Download JAR files tagged by interactions with all dependencies
com.ibm.batch-cdi-integration from group com.ibm.batch (version 1.0-b04)
Group: com.ibm.batch Artifact: com.ibm.batch-cdi-integration
Show all versions Show documentation Show source
Show all versions Show documentation Show source
0 downloads
Artifact com.ibm.batch-cdi-integration
Group com.ibm.batch
Version 1.0-b04
Last update 31. January 2013
Organization not specified
URL Not specified
License not specified
Dependencies amount 3
Dependencies com.ibm.batch-runtime, javax.batch-annotation, javax.batch-api,
There are maybe transitive dependencies!
Group com.ibm.batch
Version 1.0-b04
Last update 31. January 2013
Organization not specified
URL Not specified
License not specified
Dependencies amount 3
Dependencies com.ibm.batch-runtime, javax.batch-annotation, javax.batch-api,
There are maybe transitive dependencies!
com.ibm.batch-annotation-processors from group com.ibm.batch (version 1.0-b03)
Group: com.ibm.batch Artifact: com.ibm.batch-annotation-processors
Show all versions Show documentation Show source
Show all versions Show documentation Show source
0 downloads
Artifact com.ibm.batch-annotation-processors
Group com.ibm.batch
Version 1.0-b03
Last update 11. January 2013
Organization not specified
URL Not specified
License not specified
Dependencies amount 1
Dependencies javax.batch-annotation,
There are maybe transitive dependencies!
Group com.ibm.batch
Version 1.0-b03
Last update 11. January 2013
Organization not specified
URL Not specified
License not specified
Dependencies amount 1
Dependencies javax.batch-annotation,
There are maybe transitive dependencies!
InfoScope from group io.github.petrostick (version 1.1.0)
InfoScope Library: Simplifying Privacy Policy Display with WebView
The InfoScope Library is a versatile tool designed to enhance the seamless presentation of privacy policies through WebView integration. Privacy policies play a crucial role in maintaining transparency and trust between users and applications, and the InfoScope Library streamlines this process by offering a range of convenient features.
At its core, the library provides the SimpleAutoWebView, a WebView component equipped with fundamental settings for optimal privacy policy display. This WebView component is tailored to effortlessly load and present privacy policy content to users, ensuring a smooth and user-friendly experience.
To further enhance the functionality and customization options, the InfoScope Library includes two essential components: SimpleAutoWebViewClient and SimpleAutoWebChromeClient. These components enable developers to quickly establish and configure the basic WebView behavior and appearance.
The SimpleAutoWebViewClient is designed to facilitate the interaction between the WebView and the application. It streamlines the process of handling various events, such as page loading, error handling, and navigation. With this component, developers can swiftly create a WebViewClient that aligns with their application's requirements, promoting a consistent and intuitive user journey.
Complementing the WebView functionality, the SimpleAutoWebChromeClient focuses on managing the visual aspects of WebView content, including alert dialogs, JavaScript dialogs, and UI interactions. This component empowers developers to define the behavior and appearance of these elements, ensuring a polished and integrated presentation of the privacy policy content.
In summary, the InfoScope Library offers a comprehensive toolkit for developers to seamlessly integrate privacy policy display using WebView. By providing the SimpleAutoWebView, SimpleAutoWebViewClient, and SimpleAutoWebChromeClient components, the library enables swift development and easy customization, fostering transparency and trust between users and applications. Embrace the power of the InfoScope Library to elevate your privacy policy presentation and enhance your user experience.
Group: io.github.petrostick Artifact: InfoScope
Show all versions
Show all versions
There is no JAR file uploaded. A download is not possible! Please choose another version.
0 downloads
Artifact InfoScope
Group io.github.petrostick
Version 1.1.0
Last update 18. August 2023
Organization not specified
URL https://github.com/PetroStick/InfoScope
License MIT License
Dependencies amount 1
Dependencies kotlin-stdlib-jdk8,
There are maybe transitive dependencies!
Group io.github.petrostick
Version 1.1.0
Last update 18. August 2023
Organization not specified
URL https://github.com/PetroStick/InfoScope
License MIT License
Dependencies amount 1
Dependencies kotlin-stdlib-jdk8,
There are maybe transitive dependencies!
pact-jvm-consumer-junit5_2.11 from group au.com.dius (version 3.5.24)
pact-jvm-consumer-junit5
========================
JUnit 5 support for Pact consumer tests
## Dependency
The library is available on maven central using:
* group-id = `au.com.dius`
* artifact-id = `pact-jvm-consumer-junit5_2.12`
* version-id = `3.5.x`
## Usage
### 1. Add the Pact consumer test extension to the test class.
To write Pact consumer tests with JUnit 5, you need to add `@ExtendWith(PactConsumerTestExt)` to your test class. This
replaces the `PactRunner` used for JUnit 4 tests. The rest of the test follows a similar pattern as for JUnit 4 tests.
```java
@ExtendWith(PactConsumerTestExt.class)
class ExampleJavaConsumerPactTest {
```
### 2. create a method annotated with `@Pact` that returns the interactions for the test
For each test (as with JUnit 4), you need to define a method annotated with the `@Pact` annotation that returns the
interactions for the test.
```java
@Pact(provider="test_provider", consumer="test_consumer")
public RequestResponsePact createPact(PactDslWithProvider builder) {
return builder
.given("test state")
.uponReceiving("ExampleJavaConsumerPactTest test interaction")
.path("/")
.method("GET")
.willRespondWith()
.status(200)
.body("{\"responsetest\": true}")
.toPact();
}
```
### 3. Link the mock server with the interactions for the test with `@PactTestFor`
Then the final step is to use the `@PactTestFor` annotation to tell the Pact extension how to setup the Pact test. You
can either put this annotation on the test class, or on the test method. For examples see
[ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) and
[MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy).
The `@PactTestFor` annotation allows you to control the mock server in the same way as the JUnit 4 `PactProviderRule`. It
allows you to set the hostname to bind to (default is `localhost`) and the port (default is to use a random port). You
can also set the Pact specification version to use (default is V3).
```java
@ExtendWith(PactConsumerTestExt.class)
@PactTestFor(providerName = "ArticlesProvider", port = "1234")
public class ExampleJavaConsumerPactTest {
```
**NOTE on the hostname**: The mock server runs in the same JVM as the test, so the only valid values for hostname are:
| hostname | result |
| -------- | ------ |
| `localhost` | binds to the address that localhost points to (normally the loopback adapter) |
| `127.0.0.1` or `::1` | binds to the loopback adapter |
| host name | binds to the default interface that the host machines DNS name resolves to |
| `0.0.0.0` or `::` | binds to the all interfaces on the host machine |
#### Matching the interactions by provider name
If you set the `providerName` on the `@PactTestFor` annotation, then the first method with a `@Pact` annotation with the
same provider name will be used. See [ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) for
an example.
#### Matching the interactions by method name
If you set the `pactMethod` on the `@PactTestFor` annotation, then the method with the provided name will be used (it still
needs a `@Pact` annotation). See [MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy) for an example.
### Injecting the mock server into the test
You can get the mock server injected into the test method by adding a `MockServer` parameter to the test method.
```java
@Test
void test(MockServer mockServer) {
HttpResponse httpResponse = Request.Get(mockServer.getUrl() + "/articles.json").execute().returnResponse();
assertThat(httpResponse.getStatusLine().getStatusCode(), is(equalTo(200)));
}
```
This helps with getting the base URL of the mock server, especially when a random port is used.
## Unsupported
The current implementation does not support tests with multiple providers. This will be added in a later release.
Group: au.com.dius Artifact: pact-jvm-consumer-junit5_2.11
Show all versions Show documentation Show source
Show all versions Show documentation Show source
1 downloads
Artifact pact-jvm-consumer-junit5_2.11
Group au.com.dius
Version 3.5.24
Last update 04. November 2018
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies kotlin-stdlib-jdk8, kotlin-reflect, slf4j-api, groovy-all, kotlin-logging, scala-library, scala-logging_2.11, pact-jvm-consumer_2.11, junit-jupiter-api,
There are maybe transitive dependencies!
Group au.com.dius
Version 3.5.24
Last update 04. November 2018
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies kotlin-stdlib-jdk8, kotlin-reflect, slf4j-api, groovy-all, kotlin-logging, scala-library, scala-logging_2.11, pact-jvm-consumer_2.11, junit-jupiter-api,
There are maybe transitive dependencies!
pact-jvm-consumer-groovy-v3_2.10 from group au.com.dius (version 2.2.15)
pact-jvm-consumer-groovy-v3
===========================
Groovy DSL for Pact JVM implementing V3 specification changes.
##Dependency
The library is available on maven central using:
* group-id = `au.com.dius`
* artifact-id = `pact-jvm-consumer-groovy-v3_2.11`
* version-id = `2.2.x` or `3.0.x`
##Usage
Add the `pact-jvm-consumer-groovy-v3` library to your test class path. This provides a `PactMessageBuilder` class for you to use
to define your pacts.
If you are using gradle for your build, add it to your `build.gradle`:
dependencies {
testCompile 'au.com.dius:pact-jvm-consumer-groovy-v3_2.11:2.2.12'
}
## Consumer test for a message consumer
The `PactMessageBuilder` class provides a DSL for defining your message expectations. It works in much the same way as
the `PactBuilder` class for Request-Response interactions.
### Step 1 - define the message expectations
Create a test that uses the `PactMessageBuilder` to define a message expectation, and then call `run`. This will invoke
the given closure with a message for each one defined in the pact.
```groovy
def eventStream = new PactMessageBuilder().call {
serviceConsumer 'messageConsumer'
hasPactWith 'messageProducer'
given 'order with id 10000004 exists'
expectsToReceive 'an order confirmation message'
withMetaData(type: 'OrderConfirmed') // Can define any key-value pairs here
withContent(contentType: 'application/json') {
type 'OrderConfirmed'
audit {
userCode 'messageService'
}
origin 'message-service'
referenceId '10000004-2'
timeSent: '2015-07-22T10:14:28+00:00'
value {
orderId '10000004'
value '10.000000'
fee '10.00'
gst '15.00'
}
}
}
```
### Step 2 - call your message handler with the generated messages
This example tests a message handler that gets messages from a Kafka topic. In this case the Pact message is wrapped
as a Kafka `MessageAndMetadata`.
```groovy
eventStream.run { Message message ->
messageHandler.handleMessage(new MessageAndMetadata('topic', 1,
new kafka.message.Message(message.contentsAsBytes()), 0, null, valueDecoder))
}
```
### Step 3 - validate that the message was handled correctly
```groovy
def order = orderRepository.getOrder('10000004')
assert order.status == 'confirmed'
assert order.value == 10.0
```
### Step 4 - Publish the pact file
If the test was successful, a pact file would have been produced with the message from step 1.
Group: au.com.dius Artifact: pact-jvm-consumer-groovy-v3_2.10
Show all versions Show documentation Show source
Show all versions Show documentation Show source
0 downloads
Artifact pact-jvm-consumer-groovy-v3_2.10
Group au.com.dius
Version 2.2.15
Last update 17. September 2015
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 7
Dependencies pact-jvm-consumer-groovy_2.10, scala-library, groovy-all, json4s-native_2.10, pact-jvm-model-v3_2.10, slf4j-api, json4s-jackson_2.10,
There are maybe transitive dependencies!
Group au.com.dius
Version 2.2.15
Last update 17. September 2015
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 7
Dependencies pact-jvm-consumer-groovy_2.10, scala-library, groovy-all, json4s-native_2.10, pact-jvm-model-v3_2.10, slf4j-api, json4s-jackson_2.10,
There are maybe transitive dependencies!
pact-jvm-consumer-groovy-v3_2.11 from group au.com.dius (version 3.0.4)
pact-jvm-consumer-groovy-v3
===========================
Groovy DSL for Pact JVM implementing V3 specification changes.
##Dependency
The library is available on maven central using:
* group-id = `au.com.dius`
* artifact-id = `pact-jvm-consumer-groovy-v3_2.11`
* version-id = `2.2.x` or `3.0.x`
##Usage
Add the `pact-jvm-consumer-groovy-v3` library to your test class path. This provides a `PactMessageBuilder` class for you to use
to define your pacts.
If you are using gradle for your build, add it to your `build.gradle`:
dependencies {
testCompile 'au.com.dius:pact-jvm-consumer-groovy-v3_2.11:2.2.12'
}
## Consumer test for a message consumer
The `PactMessageBuilder` class provides a DSL for defining your message expectations. It works in much the same way as
the `PactBuilder` class for Request-Response interactions.
### Step 1 - define the message expectations
Create a test that uses the `PactMessageBuilder` to define a message expectation, and then call `run`. This will invoke
the given closure with a message for each one defined in the pact.
```groovy
def eventStream = new PactMessageBuilder().call {
serviceConsumer 'messageConsumer'
hasPactWith 'messageProducer'
given 'order with id 10000004 exists'
expectsToReceive 'an order confirmation message'
withMetaData(type: 'OrderConfirmed') // Can define any key-value pairs here
withContent(contentType: 'application/json') {
type 'OrderConfirmed'
audit {
userCode 'messageService'
}
origin 'message-service'
referenceId '10000004-2'
timeSent: '2015-07-22T10:14:28+00:00'
value {
orderId '10000004'
value '10.000000'
fee '10.00'
gst '15.00'
}
}
}
```
### Step 2 - call your message handler with the generated messages
This example tests a message handler that gets messages from a Kafka topic. In this case the Pact message is wrapped
as a Kafka `MessageAndMetadata`.
```groovy
eventStream.run { Message message ->
messageHandler.handleMessage(new MessageAndMetadata('topic', 1,
new kafka.message.Message(message.contentsAsBytes()), 0, null, valueDecoder))
}
```
### Step 3 - validate that the message was handled correctly
```groovy
def order = orderRepository.getOrder('10000004')
assert order.status == 'confirmed'
assert order.value == 10.0
```
### Step 4 - Publish the pact file
If the test was successful, a pact file would have been produced with the message from step 1.
Group: au.com.dius Artifact: pact-jvm-consumer-groovy-v3_2.11
Show all versions Show documentation Show source
Show all versions Show documentation Show source
0 downloads
Artifact pact-jvm-consumer-groovy-v3_2.11
Group au.com.dius
Version 3.0.4
Last update 17. September 2015
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies scala-logging_2.11, pact-jvm-consumer-groovy_2.11, groovy-all, json4s-native_2.11, pact-jvm-model-v3_2.11, slf4j-api, scala-xml_2.11, scala-library, json4s-jackson_2.11,
There are maybe transitive dependencies!
Group au.com.dius
Version 3.0.4
Last update 17. September 2015
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies scala-logging_2.11, pact-jvm-consumer-groovy_2.11, groovy-all, json4s-native_2.11, pact-jvm-model-v3_2.11, slf4j-api, scala-xml_2.11, scala-library, json4s-jackson_2.11,
There are maybe transitive dependencies!
osgi-tests from group org.apache.axis2 (version 1.6.3)
Artifact osgi-tests
Group org.apache.axis2
Version 1.6.3
Last update 27. June 2015
Organization not specified
URL http://axis.apache.org/axis2/java/core/
License not specified
Dependencies amount 1
Dependencies axis2-testutils,
There are maybe transitive dependencies!
Group org.apache.axis2
Version 1.6.3
Last update 27. June 2015
Organization not specified
URL http://axis.apache.org/axis2/java/core/
License not specified
Dependencies amount 1
Dependencies axis2-testutils,
There are maybe transitive dependencies!
axis2-parent from group org.apache.axis2 (version 1.6.3)
Axis2 is an effort to re-design and totally re-implement both Axis/Java and
(eventually) Axis/C++ on a new architecture. Evolving from the now standard "handler chain"
model which Axis1 pioneered, Axis2 is developing a more flexible pipeline architecture which
can yet be managed and packaged in a more organized manner. This new design acknowledges the
maturing of the Web services space in terms of new protocols such as WS-ReliableMessaging,
WS-Security and WS-Addressing that are built on top of the base SOAP system. At the time
Axis1 was designed, while it was fully expected that other protocols such as
WS-ReliableMessaging would be built on top of it, there was not a proper extension
architecture defined to enable clean composition of such layers. Thus, one of the key
motivations for Axis2 is to provide a clean and simple environment for like Apache Sandesha
and Apache WSS4J to layer on top of the base SOAP system. Another driving force for Axis2 as
well as the move away from RPC oriented Web services towards more document-oriented, message
style asynchronous service interactions. The Axis2 project is centered on a new
representation for SOAP messages called AXIOM (AXIs Object Model). AXIOM consists of two
parts: a complete XML Infoset representation and a SOAP Infoset representation on top of
that. The XML Infoset representation provides a JDOM-like simple API but is built on a
deferred model via a StAX-based (Streaming API for XML) pull parsing API. A key feature of
AXIOM is that it allows one to stop building the XML tree and just access the pull stream
directly; thus enabling both maximum flexibility and maximum performance. This approach
allows us to support multiple levels of abstraction for consuming and offering Web services:
using plain AXIOM, using generated code and statically data-bound data types and so on. At
the time of Axis1's design, RPC-style, synchronous, request-response interactions were the
order of the day for Web services. Today service interactions are much more message
-oriented and exploit many different message exchange patterns. The Axis2 engine
architecture is careful to not build in any assumptions of request-response patterns to
ensure that it can be used easily to support arbitrary message exchange
patterns.
Group: org.apache.axis2 Artifact: axis2-parent
Show all versions
Show all versions
There is no JAR file uploaded. A download is not possible! Please choose another version.
0 downloads
Artifact axis2-parent
Group org.apache.axis2
Version 1.6.3
Last update 27. June 2015
Organization not specified
URL http://axis.apache.org/axis2/java/core/
License not specified
Dependencies amount 0
Dependencies No dependencies
There are maybe transitive dependencies!
Group org.apache.axis2
Version 1.6.3
Last update 27. June 2015
Organization not specified
URL http://axis.apache.org/axis2/java/core/
License not specified
Dependencies amount 0
Dependencies No dependencies
There are maybe transitive dependencies!
pact-jvm-server_2.12 from group au.com.dius (version 3.6.15)
Pact server
===========
The pact server is a stand-alone interactions recorder and verifier, aimed at clients that are non-JVM or non-Ruby based.
The pact client for that platform will need to be implemented, but it only be responsible for generating the `JSON`
interactions, running the tests and communicating with the server.
The server implements a `JSON` `REST` Admin API with the following endpoints.
/ -> For diagnostics, currently returns a list of ports of the running mock servers.
/create -> For initialising a test server and submitting the JSON interactions. It returns a port
/complete -> For finalising and verifying the interactions with the server. It writes the `JSON` pact file to disk.
## Running the server
### Versions 2.2.6+
Pact server takes the following parameters:
```
Usage: pact-jvm-server [options] [port]
port
port to run on (defaults to 29999)
--help
prints this usage text
-h <value> | --host <value>
host to bind to (defaults to localhost)
-l <value> | --mock-port-lower <value>
lower bound to allocate mock ports (defaults to 20000)
-u <value> | --mock-port-upper <value>
upper bound to allocate mock ports (defaults to 40000)
-d | --daemon
run as a daemon process
-v <value> | --pact-version <value>
pact version to generate for (2 or 3)
-k <value> | --keystore-path <value>
Path to keystore
-p <value> | --keystore-password <value>
Keystore password
-s <value> | --ssl-port <value>
Ssl port the mock server should run on. lower and upper bounds are ignored
--debug
run with debug logging
```
### Using trust store 3.4.0+
Trust store can be used. However, it is limited to a single port for the time being.
### Prior to version 2.2.6
Pact server takes one optional parameter, the port number to listen on. If not provided, it will listen on 29999.
It requires an active console to run.
### Using a distribution archive
You can download a [distribution from maven central](http://search.maven.org/remotecontent?filepath=au/com/dius/pact-jvm-server_2.11/2.2.4/).
There is both a ZIP and TAR archive. Unpack it to a directory of choice and then run the script in the bin directory.
### Building a distribution bundle
You can build an application bundle with gradle by running (for 2.11 version):
$ ./gradlew :pact-jvm-server_2.11:installdist
This will create an app bundle in `build/2.11/install/pact-jvm-server_2.11`. You can then execute it with:
$ java -jar pact-jvm-server/build/2.10/install/pact-jvm-server_2.11/lib/pact-jvm-server_2.11-3.2.11.jar
or with the generated bundle script file:
$ pact-jvm-server/build/2.11/install/pact-jvm-server_2.11/bin/pact-jvm-server_2.11
By default will run on port `29999` but a port number can be optionally supplied.
### Running it with docker
You can use a docker image to execute the mock server as a docker container.
$ docker run -d -p 8080:8080 -p 20000-20010:20000-20010 uglyog/pact-jvm-server
This will run the main server on port 8080, and each created mock server on ports 20000-20010. You can map the ports to
any you require.
## Life cycle
The following actions are expected to occur
* The client calls `/create` to initialise a server with the expected `JSON` interactions and state
* The admin server will start a mock server on a random port and return the port number in the response
* The client will execute its interaction tests against the mock server with the supplied port
* Once finished, the client will call `/complete' on the Admin API, posting the port number
* The pact server will verify the interactions and write the `JSON` `pact` file to disk under `/target`
* The mock server running on the supplied port will be shutdown.
## Endpoints
### /create
The client will need `POST` to `/create` the generated `JSON` interactions, also providing a state as a query parameter
and a path.
For example:
POST http://localhost:29999/create?state=NoUsers&path=/sub/ref/path '{ "provider": { "name": "Animal_Service"}, ... }'
This will create a new running mock service provider on a randomly generated port. The port will be returned in the
`201` response:
{ "port" : 34423 }
But you can also reference the path from `/sub/ref/path` using the server port. The service will not strip
the prefix path, but instead will use it as a differentiator. If your services do not have differences
in the prefix of their path, then you will have to use the port method.
### /complete
Once the client has finished running its tests against the mock server on the supplied port (in this example port
`34423`) the client will need to `POST` to `/complete` the port number of the mock server that was used.
For example:
POST http://localhost:29999/complete '{ "port" : 34423 }'
This will cause the Pact server to verify the interactions, shutdown the mock server running on that port and writing
the pact `JSON` file to disk under the `target` directory.
### /
The `/` endpoint is for diagnostics and to check that the pact server is running. It will return all the currently
running mock servers port numbers.
For example:
GET http://localhost:29999/
'{ "ports": [23443,43232] }'
2 downloads
Artifact pact-jvm-server_2.12
Group au.com.dius
Version 3.6.15
Last update 29. April 2020
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 4
Dependencies pact-jvm-consumer_2.12, logback-core, logback-classic, scopt_2.12,
There are maybe transitive dependencies!
Group au.com.dius
Version 3.6.15
Last update 29. April 2020
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 4
Dependencies pact-jvm-consumer_2.12, logback-core, logback-classic, scopt_2.12,
There are maybe transitive dependencies!
pact-jvm-provider_2.12 from group au.com.dius (version 3.6.15)
Pact provider
=============
sub project of https://github.com/DiUS/pact-jvm
The pact provider is responsible for verifying that an API provider adheres to a number of pacts authored by its clients
This library provides the basic tools required to automate the process, and should be usable on its own in many instances.
Framework and build tool specific bindings will be provided in separate libraries that build on top of this core functionality.
### Provider State
Before each interaction is executed, the provider under test will have the opportunity to enter a state.
Generally the state maps to a set of fixture data for mocking out services that the provider is a consumer of (they will have their own pacts)
The pact framework will instruct the test server to enter that state by sending:
POST "${config.stateChangeUrl.url}/setup" { "state" : "${interaction.stateName}" }
### An example of running provider verification with junit
This example uses Groovy, JUnit 4 and Hamcrest matchers to run the provider verification.
As the provider service is a DropWizard application, it uses the DropwizardAppRule to startup the service before running any test.
**Warning:** It only grabs the first interaction from the pact file with the consumer, where there could be many. (This could possibly be solved with a parameterized test)
```groovy
class ReadmeExamplePactJVMProviderJUnitTest {
@ClassRule
public static TestRule startServiceRule = new DropwizardAppRule<DropwizardConfiguration>(
TestDropwizardApplication.class, ResourceHelpers.resourceFilePath("dropwizard/test-config.yaml"))
private static ProviderInfo serviceProvider
private static Pact<RequestResponseInteraction> testConsumerPact
private static ConsumerInfo consumer
@BeforeClass
static void setupProvider() {
serviceProvider = new ProviderInfo("Dropwizard App")
serviceProvider.setProtocol("http")
serviceProvider.setHost("localhost")
serviceProvider.setPort(8080)
serviceProvider.setPath("/")
consumer = new ConsumerInfo()
consumer.setName("test_consumer")
consumer.setPactSource(new UrlSource(
ReadmeExamplePactJVMProviderJUnitTest.getResource("/pacts/zoo_app-animal_service.json").toString()))
testConsumerPact = PactReader.loadPact(consumer.getPactSource()) as Pact<RequestResponseInteraction>
}
@Test
void runConsumerPacts() {
// grab the first interaction from the pact with consumer
Interaction interaction = testConsumerPact.interactions.get(0)
// setup the verifier
ProviderVerifier verifier = setupVerifier(interaction, serviceProvider, consumer)
// setup any provider state
// setup the client and interaction to fire against the provider
ProviderClient client = new ProviderClient(serviceProvider, new HttpClientFactory())
Map<String, Object> failures = new HashMap<>()
verifier.verifyResponseFromProvider(serviceProvider, interaction, interaction.getDescription(), failures, client)
if (!failures.isEmpty()) {
verifier.displayFailures(failures)
}
// Assert all good
assertThat(failures, is(empty()))
}
private ProviderVerifier setupVerifier(Interaction interaction, ProviderInfo provider, ConsumerInfo consumer) {
ProviderVerifier verifier = new ProviderVerifier()
verifier.initialiseReporters(provider)
verifier.reportVerificationForConsumer(consumer, provider)
if (!interaction.getProviderStates().isEmpty()) {
for (ProviderState providerState: interaction.getProviderStates()) {
verifier.reportStateForInteraction(providerState.getName(), provider, consumer, true)
}
}
verifier.reportInteractionDescription(interaction)
return verifier
}
}
```
### An example of running provider verification with spock
This example uses groovy and spock to run the provider verification.
Again the provider service is a DropWizard application, and is using the DropwizardAppRule to startup the service.
This example runs all interactions using spocks Unroll feature
```groovy
class ReadmeExamplePactJVMProviderSpockSpec extends Specification {
@ClassRule @Shared
TestRule startServiceRule = new DropwizardAppRule<DropwizardConfiguration>(TestDropwizardApplication,
ResourceHelpers.resourceFilePath('dropwizard/test-config.yaml'))
@Shared
ProviderInfo serviceProvider
ProviderVerifier verifier
def setupSpec() {
serviceProvider = new ProviderInfo('Dropwizard App')
serviceProvider.protocol = 'http'
serviceProvider.host = 'localhost'
serviceProvider.port = 8080
serviceProvider.path = '/'
serviceProvider.hasPactWith('zoo_app') {
pactSource = new FileSource(new File(ResourceHelpers.resourceFilePath('pacts/zoo_app-animal_service.json')))
}
}
def setup() {
verifier = new ProviderVerifier()
}
def cleanup() {
// cleanup provider state
// ie. db.truncateAllTables()
}
def cleanupSpec() {
// cleanup provider
}
@Unroll
def "Provider Pact - With Consumer #consumer"() {
expect:
verifyConsumerPact(consumer).empty
where:
consumer << serviceProvider.consumers
}
private Map verifyConsumerPact(ConsumerInfo consumer) {
Map failures = [:]
verifier.initialiseReporters(serviceProvider)
verifier.runVerificationForConsumer(failures, serviceProvider, consumer)
if (!failures.empty) {
verifier.displayFailures(failures)
}
failures
}
}
```
3 downloads
Artifact pact-jvm-provider_2.12
Group au.com.dius
Version 3.6.15
Last update 29. April 2020
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies pact-jvm-model, pact-jvm-pact-broker, pact-jvm-matchers_2.12, commons-io, jansi, httpclient, reflections, pact-jvm-support, scala-java8-compat_2.12,
There are maybe transitive dependencies!
Group au.com.dius
Version 3.6.15
Last update 29. April 2020
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 9
Dependencies pact-jvm-model, pact-jvm-pact-broker, pact-jvm-matchers_2.12, commons-io, jansi, httpclient, reflections, pact-jvm-support, scala-java8-compat_2.12,
There are maybe transitive dependencies!
Page 19 from 3 (items total 229)