Eric Deandrea
03/01/2023, 7:42 PMGitHub
03/02/2023, 4:31 AMSyam K
03/03/2023, 1:15 PMCaused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal au.com.dius.pact.provider:maven:4.1.11:verify failed: lateinit property serviceProviders has not been initialized
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
Facu Conejero
03/06/2023, 12:21 PMGitHub
03/07/2023, 1:02 AMGitHub
03/07/2023, 1:36 AMJames Fraser
03/07/2023, 1:50 PMMessagePactBuilder
or ConsumerPactBuilder
is there any way to apply matching rules to them afterwards so this basic type match is added to the contract?
"matchingRules": {
"$.body": {
"match": "type"
}
},
Syam K
03/07/2023, 3:19 PMau.com.dius.pact.core.pactbroker.NotFoundHalResponse: No HAL document found at path '<https://xxx.pactflow.io/pacts/provider/packflow/for-verification>'
xin chen
03/08/2023, 3:36 PMItzhak Eretz Kdosha
03/09/2023, 1:57 PMPactBuilder
(V4)?Venkat Konda
03/09/2023, 3:43 PMVenkat Konda
03/09/2023, 3:44 PMsasank kumar
03/10/2023, 11:36 AMMichael Branders
03/13/2023, 12:35 PMsasank kumar
03/13/2023, 1:15 PMGitHub
03/16/2023, 6:04 AMShirley
03/16/2023, 9:03 AMShirley
03/16/2023, 9:06 AMKripa Kurian
03/16/2023, 7:31 PMPascal LIBENZI
03/17/2023, 7:00 AM<dependency>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>junit5spring</artifactId>
<version>4.5.2</version>
</dependency>
• PactBrokerConsumerVersionSelectors:
@PactBrokerConsumerVersionSelectors
public static SelectorBuilder consumerVersionSelectors() {
return new SelectorBuilder()
.branch(System.getProperty("branch"), null, System.getProperty("fallback"));
}
• Link to the project sources if needed: https://gitlab.com/pascal.libenzi/pact-jvm-provider/-/tree/feature/new-field-publication-date
My consumers have a trunk branch. If I put it as a System property “branch” the test pass. If I pass “nonexistingbranch” in branch and trunk in fallback I have:
au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException:
No Pact files were found to verify
Provider: BookStore
Source: Pact Broker <http://localhost:80> consumerVersionSelectors=[Branch(name=test, consumer=null, fallback=trunk)]
Does somebody have any idea about what I am missing?
Thanks!Simon Raess
03/17/2023, 9:24 AMsasank kumar
03/17/2023, 3:41 PMAnji
03/19/2023, 11:07 PMHi, I have a question about BiDirection Contract Testing. Steps I followed
1. I created OAS swagger.json file and published as provider contract with version 1.0.0
2. Ran can-i-deploy tool and recorded the deployment for the version 1.0.0
3. Generated the consumer contract which is compatible with provider contract
4.Published this consumer contract with version 2.0.0
5. Ran can-deploy-tool and it says consumer version 2.0.0 is compatible with provider version 1.0.0
6.Hence proceeded with deployment and recorded the deployment with consumer version 2.0.0
7.Now, I made a breaking change in provider contract (in OAS) and published to pact as version 1.0.1
8.Ran can-i-deploy and it says NO as provider contract 1.0.1 is not compatible with consumer version 2.0.0
9.I updated consumer executions to be inline with new provider change and published the consumer contract with version 2.0.1
<http://10.In|10.In> pact flow UI, I see that consumer version 2.0.1 is compatible with producer version 1.0.1 which is good
11.But when I run "can-i-deploy" it says NO as consumer version 2.0.1 is compared with producer version 1.0.0 instead 1.0.1
How can I proceed with deployment??
GitHub
03/21/2023, 7:40 AMRafał Maciak
03/22/2023, 8:07 AMSlackbot
03/24/2023, 1:39 PM郭佳佳
03/27/2023, 9:40 AM@PostMapping("/pact-test-form-data")
public SimpleResultVo<Object> pactTest(SecurityUploadHttpServletRequest request) {
List<String> result = new ArrayList<>();
CommonsMultipartFile[] mfs = request.getMultipartFiles();
try(InputStream is = mfs[0].getInputStream(); Workbook workbook = new XSSFWorkbook(is)) {
workbook.getSheetAt(0);
} catch (IOException e) {
e.printStackTrace();
}
result.add(request.getParameter("userName"));
result.add(request.getParameter("password"));
return ResultVoUtil.success(result);
}
Here is the pact I created:
@Pact(consumer = "FBB")
public RequestResponsePact formDataReqTest(PactDslWithProvider builder) throws IOException {
File file = new File("C:\\Users\\g00574640\\Desktop\\importProjectList.xlsx");
MultipartEntityBuilder entityBuilder =
MultipartEntityBuilder.create()
.addTextBody("userName", "guojiahui")
.addTextBody("password", "123456")
.addBinaryBody("file", file,
ContentType.create("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
"importProjectList.xlsx");
String expectStr =
TestingFileUtils.loadFileAsString("business/service/ResourceServiceTest/expect/formData.json");
Map<String, String> map = new HashMap<>();
map.put("Content-Type", "application/json");
return builder.uponReceiving("query a server info success.")
.path("/cloud-platform-service/v1/resource/pact-test-form-data")
.method("POST")
.body(entityBuilder)
.willRespondWith()
.status(200)
.body(expectStr)
.toPact();
}
@Test
@PactTestFor(providerName = "FormDataAPI", port = "8500", pactMethod = "formDataReqTest")
public void runTestformDataReq() throws IOException {
File file = new File("C:\\Users\\g00574640\\Desktop\\importProjectList.xlsx");
MultipartEntityBuilder entityBuilder =
MultipartEntityBuilder.create()
.addTextBody("userName", "guojiahui").addTextBody("password", "123456")
.addBinaryBody("file", file,
ContentType.create("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
"importProjectList.xlsx");
HttpEntity httpEntity = entityBuilder.build();
CloseableHttpClient httpclient = HttpClients.createDefault();
RequestBuilder request =
<http://RequestBuilder.post|RequestBuilder.post>("<http://localhost:8500/cloud-platform-service/v1/resource/pact-test-form-data>")
.setEntity(httpEntity);
HttpUriRequest httpUriRequest = request.build();
httpclient.execute(httpUriRequest);
}
But when i verified this interface and executed Workbook workbook = new XSSFWorkbook(is)
,
I received an exception like this:`java.util.zip.DataFormatException: invalid block type` .
Did I write the wrong pact? I loaded this file and found that this file is broken.
What shoud I do?❤️James Fraser
03/28/2023, 8:09 AMpactVerify
Gradle command to run for my message provider - it doesn’t seem to be able to find the methods I’ve annotated even though it should be on the test classpath
I’ve commented out the packagesToScan
section in my Gradle and it still can’t find it, it just gives me an error:
No annotated methods were found for interaction 'message.interaction.name'. You need to provide a method annotated with @PactVerifyProvider("message.interaction.name") on the classpath that returns the message contents.
I have a method annotated correctly in my test directory (the test runs and passes if I run it using JUnit):
@PactVerifyProvider("message.interaction.name")
public String verifyInteraction() {
...
}
My build.gradle currently looks like this:
pact {
broker {
pactBrokerUrl = "$System.env.PACT_BROKER_BASE_URL"
pactBrokerToken = "$System.env.PACT_BROKER_TOKEN"
}
serviceProviders {
providerName {
verificationType = 'ANNOTATED_METHOD'
// packagesToScan = ['*']
hasPactsFromPactBroker("$System.env.PACT_BROKER_BASE_URL", authentication: ['Bearer', "$System.env.PACT_BROKER_TOKEN"])
}
}
}
If you’ve any suggestions on what I could try in order to sort this I’d really appreciate it - thanks 😄GitHub
03/30/2023, 3:28 AMGitHub
03/30/2023, 4:53 AM