multiple pact version support from PACT-Broker - pact

I am using JUnit for generating Pacts and Pacts maven plugin to post the pact into pact broker.
I am using below plugin Configuration
<plugin>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-provider-maven_2.11</artifactId>
<version>3.3.9</version>
<configuration>
<projectVersion>2.0</projectVersion>
<pactBrokerUrl>https:example.com</pactBrokerUrl>
<pactBrokerUsername>username1</pactBrokerUsername>
<pactBrokerPassword>password1</pactBrokerPassword>
<trimSnapshot>true</trimSnapshot> <!-- Defaults to false -->
</configuration>
</plugin>
While Consumenr pact is getting uploaded in broker, I am able to see only single entry of consumer pact of version 2.0. Eirlier I have uploaded version 1.0 eirlier, which is not present in the UI. Is there any way to see the multiple version of same provider pact in HAL browser and get different version of PACTS by Https GET request? Currently I am getting only latest consumenr pact version by http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/latest
Please provide some info regurding this and let me know if you need any informaiton.

http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/versions will show you all the versions of the pact. You can retrieve a pact using the same URL that you used to PUT it to the broker eg. http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/version/CONSUMER_VERSION.
You can explore the Pact Broker API using the embedded HAL browser, by clicking the 'HAL browser' link from the index page of the broker.

Related

Karate: Karate-summary report missing CSS format [duplicate]

After running a test case with Karate, some html reports are published with surefire plugin. In particular, I've found that there is an html report for each feature file. This is inconvenient when tests are run from an automated pipeline, like in my case, where I use htmlpublish Jenkins plugin to get a public link to access reports and spread them across slack channels or emails.
I've tried to add this snippet in my pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<aggregate>true</aggregate>
<!--also set this to link to generated source reports-->
<linkXRef>true</linkXRef>
</configuration>
</plugin>
But it had not the desired effect.
I'm trying to achieve a single index.html into the target/surefire-reports directory so i can publish and browse all test reports
Any suggestion?
Thanks
Are you using the parallel runner ? If not, please read up about it: https://github.com/intuit/karate#parallel-execution
Since we emit the cucumber-compatible JSON report in addition to the industry-standard JUnit XML format, you have the choice of any reporting solution that fits your needs. I think the maven-cucumber-reporting library should work for you - but you can decide: https://github.com/intuit/karate/tree/master/karate-demo#example-report
EDIT: For any other advanced needs, please consider writing your own report: https://stackoverflow.com/a/66773839/143475

owasp dependency-check: Show modules in aggregated report

I have a multi module pom which is checked via the owasp dependency-check. I use the aggregate goal and get a html report file where all vulnerabilities are listed. So far so good. What i like to know is if there is a possibility to show in the report for each vulnerability the module or modules in which the vulnerable dependency is used.
In HMTL-Report I have a list of the maven modules where the vulnerability is found. Is this what you meant?
The report was generated with maven in the parent module:
mvn verify dependency-check:aggregate

Spring Cloud contract jar versioning

I have established Spring cloud contract between two microservices in my project successfully. Everything was good until yesterday.
On consumer side, I am referencing the latest version of stubs like below:
#AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:+:stubs:8080"})
But this causes problem in some cases where the producer side reverted their latest version and switched back to previous version.
Or
somehow there is a situation that the jar that contains current stubs has a lower version than the latest version in maven repo.
Is there a way in Spring cloud contract to do either one of the following?
1) configure the consumer side to pick up the current project version (referring to project version in pom.xml) instead of the latest version from maven repo?
Or
2) configure the producer side to have a static version of stubs jar but keep dynamic version of other project jars. This would allow the consumer side to refer to the same static version of stubs jar
I read the documentation https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.1.1.RELEASE/single/spring-cloud-contract.html#_jar_versioning but it did not help
You can play around with the provided version. We give + to always download the latest. You can set a concrete value e.g. 2.1.1.RELEASE. You can also set ranges. All in all we're using Ivy underneath so you can check out the rules of Ivy http://ant.apache.org/ivy/history/latest-milestone/settings/version-matchers.html
1) configure the consumer side to pick up the current project version instead of the latest one?
What does current mean? Is it the latest? Latest release? If it's the latest release pick + but point to the repo that contains release versions only without snapshots.
I read the documentation https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.1.1.RELEASE/single/spring-cloud-contract.html#_jar_versioning but it did not help
What is missing in this section? You asked about static stubs, we describe it there too #AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:2.1.1:stubs:8080"}).
Following worked (for maven project).
Step1: Instead of specifying the ids in #AutoConfigureStubRunner, we can provide it inside application.properties file like below (notice #project.version#, this refers to maven project version )
stubrunner.ids=com.example:http-server-dsl:#project.version#:stubs:8080
Step2: To be able to use #project.version# in properties file, add the following in build section of pom.xml:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
And in plugins section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${mvn-resources-plugin.version}</version>
<configuration>
<delimiters>
<delimiter>#</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>

JavaFX gRPC Client Dependencies

I am working on gRPC client(JavaFX) and server(SpringBoot with gRPC starter). The two application are independent and do not share any files together. The server is complete for testing(here)
I would like to make JavaFX client independently from the gRPC server, i.e without including gRPC server as a maven dependancy in client POM.
What gRPC client specific dependencies can i add in the javafx application and how to send request to the server?
According to the official documentation (http://www.grpc.io/docs/quickstart/java.html) the examples can be used as a starting point https://github.com/grpc/grpc-java/blob/master/examples/build.gradle
The dependencies you need are
compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
where ${grpcVersion} is whatever released version of gRPC you may want to use. This notation is for the Gradle build tool, however transforming to Maven coordinates is easy, such as
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.2.0</version>
</dependency>
You'll find another working example at https://github.com/aalmiray/javatrove/tree/master/chat-02

A welcome message, that is pulled from a servlet that is configurable from the OSGi console

I am new to CQ5. I created a bundle that is configurable via the OSGi console. Now, I need the value that is configured on the console to be returned to my content page. I am not sure how to proceed with this. Looking for any tutorial or help. Thanks in advance.
Assuming the configured value is available via an OSGi service, you can access that service from java code using an #Reference SCR annotation with a suitable build setup to generate the corresponding OSGi metadata. You can also access OSGi services from scripts, in JSP that's done using sling.getService(YourService.class) in a script where you have called or its CQ equivalent.

Resources