Skip to content

Commit

Permalink
test: add new price field
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Oct 7, 2024
1 parent 0a10f90 commit 9dc79bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ can_i_deploy: .env
--pacticipant ${PACTICIPANT} \
--version ${GIT_COMMIT} \
--to-environment production \
--retry-while-unknown 0 \
--retry-interval 10
--retry-while-unknown 5 \
--retry-interval 15

deploy_app:
@echo "Deploying to prod"
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/pactflow/example/kafka/LoadDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class LoadDatabase {
@Bean
CommandLineRunner initDatabase(ProductRepository repository) {
return args -> {
log.info("Preloading " + repository.save(new Product("1", "Burger", "Aussie with avocade, egg, bacon and beetroot", "v2", "CREATED")));
log.info("Preloading " + repository.save(new Product("2" , "Chips", "Sweet potato fries", "v1", "UPDATED")));
log.info("Preloading " + repository.save(new Product("1", "Burger", "Aussie with avocade, egg, bacon and beetroot", "v2", "CREATED", 11.99)));
log.info("Preloading " + repository.save(new Product("2" , "Chips", "Sweet potato fries", "v1", "UPDATED", 12.99)));
};
}
}
4 changes: 3 additions & 1 deletion src/main/java/io/pactflow/example/kafka/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ class Product {
private String type;
private String version;
private String event;
private double price;

Product() {}
Product(String id, String name, String type, String version, String event) {
Product(String id, String name, String type, String version, String event, double price) {
this.id = id;
this.name = name;
this.type = type;
this.version = version;
this.event = event;
this.price = price;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ MessagePact createPact(MessagePactBuilder builder) {
body.stringType("name", "product name");
body.stringType("type", "product series");
body.stringType("id", "5cc989d0-d800-434c-b4bb-b1268499e850");
body.decimalType("price", 11.99);
body.stringMatcher("version", "v[a-zA-z0-9]+", "v1");
body.stringMatcher("event", "^(CREATED|UPDATED|DELETED)$", "CREATED");

Expand Down

0 comments on commit 9dc79bc

Please sign in to comment.