Skip to content

Commit

Permalink
chore: make links to exammples absolute for docosaurus site #1189
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Aug 22, 2020
1 parent 979a7db commit 7a4bd3b
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You want to look at: [groovy](consumer/groovy) or [junit](consumer/junit)
### (Use Clojure I)

Clojure can call out to Java, so have a look at [junit](consumer/junit). For an example
look at [example_clojure_consumer_pact_test.clj](consumer/junit/src/test/clojure/au/com/dius/pact/consumer/junit/example_clojure_consumer_pact_test.clj).
look at [example_clojure_consumer_pact_test.clj](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/clojure/au/com/dius/pact/consumer/junit/example_clojure_consumer_pact_test.clj).

### I Use some other jvm language or test framework

Expand All @@ -86,7 +86,7 @@ You want to look at: [Consumer](consumer)
### My Consumer interacts with a Message Queue

As part of the V3 pact specification, we have defined a new pact file for interactions with message queues. For an
implementation of a Groovy consumer test with a message pact, have a look at [PactMessageBuilderSpec.groovy](consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilderSpec.groovy).
implementation of a Groovy consumer test with a message pact, have a look at [PactMessageBuilderSpec.groovy](https://github.com/DiUS/pact-jvm/blob/master/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilderSpec.groovy).

## Service Providers

Expand Down
2 changes: 1 addition & 1 deletion consumer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ DslPart body = new PactDslJsonBody()

```

For an example, have a look at [WildcardKeysTest](/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/WildcardKeysTest.java).
For an example, have a look at [WildcardKeysTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/WildcardKeysTest.java).

**NOTE:** The `eachKeyLike` method adds a `*` to the matching path, so the matching definition will be applied to all keys
of the map if there is not a more specific matcher defined for a particular key. Having more than one `eachKeyLike` condition
Expand Down
4 changes: 2 additions & 2 deletions consumer/groovy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ withBody {
}
```

For an example, have a look at [WildcardPactSpec](/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/WildcardPactSpec.groovy).
For an example, have a look at [WildcardPactSpec](https://github.com/DiUS/pact-jvm/blob/master/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/WildcardPactSpec.groovy).

**NOTE:** The `keyLike` method adds a `*` to the matching path, so the matching definition will be applied to all keys
of the map if there is not a more specific matcher defined for a particular key. Having more than one `keyLike` condition
Expand Down Expand Up @@ -539,7 +539,7 @@ overwritten, set the Java system property `pact.writer.overwrite` to `true`.

# Publishing your pact files to a pact broker

If you use Gradle, you can use the [pact Gradle plugin](../../provider/gradle#publishing-pact-files-to-a-pact-broker) to publish your pact files.
If you use Gradle, you can use the [pact Gradle plugin](https://github.com/DiUS/pact-jvm/tree/master/provider/gradle#publishing-pact-files-to-a-pact-broker) to publish your pact files.

# Pact Specification V3

Expand Down
20 changes: 10 additions & 10 deletions consumer/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ You can leave the provider name out. It will then use the provider name of the f
}
```

For an example, have a look at [ExampleJavaConsumerPactRuleTest](src/test/java/au/com/dius/pact/consumer/examples/ExampleJavaConsumerPactRuleTest.java)
For an example, have a look at [ExampleJavaConsumerPactRuleTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/examples/ExampleJavaConsumerPactRuleTest.java)

### Requiring a test with multiple providers

The Pact Rule can be used to test with multiple providers. Just add a rule to the test class for each provider, and
then include all the providers required in the `@PactVerification` annotation. For an example, look at
[PactMultiProviderTest](src/test/java/au/com/dius/pact/consumer/pactproviderrule/PactMultiProviderTest.java).
[PactMultiProviderTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/pactproviderrule/PactMultiProviderTest.java).

Note that if more than one provider fails verification for the same test, you will only receive a failure for one of them.
Also, to have multiple tests in the same test class, the providers must be setup with random ports (i.e. don't specify
Expand All @@ -192,12 +192,12 @@ E.g.:
PactSpecVersion.V2, this); // ^^^^
```

For an example test doing this, see [PactProviderHttpsTest](src/test/java/au/com/dius/pact/consumer/pactproviderrule/PactProviderHttpsTest.java).
For an example test doing this, see [PactProviderHttpsTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/pactproviderrule/PactProviderHttpsTest.java).

**NOTE:** The provider will start handling HTTPS requests using a self-signed certificate. Most HTTP clients will not accept
connections to a self-signed server as the certificate is untrusted. You may need to enable insecure HTTPS with your client
for this test to work. For an example of how to enable insecure HTTPS client connections with Apache Http Client, have a
look at [InsecureHttpsRequest](src/test/java/org/apache/http/client/fluent/InsecureHttpsRequest.java).
look at [InsecureHttpsRequest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/org/apache/http/client/fluent/InsecureHttpsRequest.java).

### Requiring the mock server to run with HTTPS with a keystore

Expand All @@ -212,7 +212,7 @@ E.g.:
"/path/to/your/keystore.jks", "your-keystore-password", PactSpecVersion.V2, this);
```

For an example test doing this, see [PactProviderHttpsKeystoreTest](src/test/java/au/com/dius/pact/consumer/pactproviderrule/PactProviderHttpsKeystoreTest.java).
For an example test doing this, see [PactProviderHttpsKeystoreTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/pactproviderrule/PactProviderHttpsKeystoreTest.java).

### Setting default expected request and response values

Expand All @@ -239,7 +239,7 @@ For example:
}
```

For an example test that uses these, have a look at [PactProviderWithMultipleFragmentsTest](src/test/java/au/com/dius/pact/consumer/pactproviderrule/PactProviderWithMultipleFragmentsTest.java)
For an example test that uses these, have a look at [PactProviderWithMultipleFragmentsTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/pactproviderrule/PactProviderWithMultipleFragmentsTest.java)

### Note on HTTP clients and persistent connections

Expand Down Expand Up @@ -347,7 +347,7 @@ is verified. It is only recorded in the consumer tests and used by the provider

### Building JSON bodies with PactDslJsonBody DSL

**NOTE:** If you are using Java 8, there is [an updated DSL for consumer tests](../java8).
**NOTE:** If you are using Java 8, there is [an updated DSL for consumer tests](https://github.com/DiUS/pact-jvm/tree/master/consumer/java8).

The body method of the ConsumerPactBuilder can accept a PactDslJsonBody, which can construct a JSON body as well as
define regex and type matchers.
Expand Down Expand Up @@ -520,7 +520,7 @@ DslPart body = new PactDslJsonBody()

```

For an example, have a look at [WildcardKeysTest](src/test/java/au/com/dius/pact/consumer/WildcardKeysTest.java).
For an example, have a look at [WildcardKeysTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/WildcardKeysTest.java).

**NOTE:** The `eachKeyLike` method adds a `*` to the matching path, so the matching definition will be applied to all keys
of the map if there is not a more specific matcher defined for a particular key. Having more than one `eachKeyLike` condition
Expand Down Expand Up @@ -677,7 +677,7 @@ overwritten, set the Java system property `pact.writer.overwrite` to `true`.

# Publishing your pact files to a pact broker

If you use Gradle, you can use the [pact Gradle plugin](../../provider/gradle#publishing-pact-files-to-a-pact-broker) to publish your pact files.
If you use Gradle, you can use the [pact Gradle plugin](https://github.com/DiUS/pact-jvm/tree/master/provider/gradle#publishing-pact-files-to-a-pact-broker) to publish your pact files.

# Pact Specification V3

Expand Down Expand Up @@ -712,7 +712,7 @@ If you are using the `PactProviderRule`, you can pass the version into the const
For testing a consumer of messages from a message queue, the `MessagePactProviderRule` rule class works in much the
same way as the `PactProviderRule` class for Request-Response interactions, but will generate a V3 format message pact file.

For an example, look at [ExampleMessageConsumerTest](src/test/java/au/com/dius/pact/consumer/junit/v3/ExampleMessageConsumerTest.java)
For an example, look at [ExampleMessageConsumerTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit/src/test/java/au/com/dius/pact/consumer/junit/v3/ExampleMessageConsumerTest.java)

# Having values injected from provider state callbacks (3.6.11+)

Expand Down
8 changes: 4 additions & 4 deletions consumer/junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ interactions for the test.

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).
[ArticlesTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit5/src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) and
[MultiTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit5/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
Expand All @@ -72,13 +72,13 @@ public class ExampleJavaConsumerPactTest {
#### 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
same provider name will be used. See [ArticlesTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit5/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.
needs a `@Pact` annotation). See [MultiTest](https://github.com/DiUS/pact-jvm/blob/master/consumer/junit5/src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy) for an example.

### Injecting the mock server into the test

Expand Down
12 changes: 8 additions & 4 deletions provider/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ no parameters or a single Map parameter.

### Example of Message test that verifies metadata

To have the message metadata - such as the topic - also verified you need to return a `MessageAndMetadata` from the invoked method that contains the payload and metadata to be validation. For example, to verify the metadata of an integration using the Spring [Message](https://docs.spring.io/spring-integration/reference/html/message.html) interface, you can do something like the following:
To have the message metadata - such as the topic - also verified you need to return a `MessageAndMetadata` from
the invoked method that contains the payload and metadata to be validation. For example, to verify the metadata of an
integration using the Spring [Message](https://docs.spring.io/spring-integration/reference/html/message.html) interface,
you can do something like the following:

```java
...
Expand Down Expand Up @@ -187,13 +190,14 @@ two ways you can do this:

#### Use interfaces

You can put the state change methods on interfaces and then have your test class implement those interfaces. See [StateAnnotationsOnInterfaceTest](src/test/java/au/com/dius/pact/provider/junit/StateAnnotationsOnInterfaceTest.java)
You can put the state change methods on interfaces and then have your test class implement those interfaces.
See [StateAnnotationsOnInterfaceTest](https://github.com/DiUS/pact-jvm/blob/master/provider/junit/src/test/java/au/com/dius/pact/provider/junit/StateAnnotationsOnInterfaceTest.java)
for an example.

#### Specify the additional classes on the test target

You can provide the additional classes to the test target with the `withStateHandler` or `setStateHandlers` methods. See
[BooksPactProviderTest](../spring/src/test/java/au/com/dius/pact/provider/spring/BooksPactProviderTest.java) for an example.
[BooksPactProviderTest](https://github.com/DiUS/pact-jvm/blob/master/provider/spring/src/test/java/au/com/dius/pact/provider/spring/BooksPactProviderTest.java) for an example.

## Pact source

Expand Down Expand Up @@ -464,7 +468,7 @@ For example, configure it by adding the following to your POM:

#### Modifying the requests before they are sent

**NOTE: `@TargetRequestFilter` is only for JUnit 4. For JUnit 5 see [JUnit 5 docs](../junit5#modifying-the-requests-before-they-are-sent).**
**NOTE: `@TargetRequestFilter` is only for JUnit 4. For JUnit 5 see [JUnit 5 docs](https://github.com/DiUS/pact-jvm/tree/master/provider/junit5#modifying-the-requests-before-they-are-sent).**

Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would
be authentication tokens, which have a small life span. The HttpTarget supports request filters by annotating methods
Expand Down
6 changes: 3 additions & 3 deletions provider/junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ContractVerificationTest {
}
```

For details on the provider and pact source annotations, refer to the [Pact junit runner](../junit/) docs.
For details on the provider and pact source annotations, refer to the [Pact junit runner](https://github.com/DiUS/pact-jvm/tree/master/provider/junit) docs.

## Test target

Expand Down Expand Up @@ -63,13 +63,13 @@ For example, configure it by adding the following to your POM:

## Provider State Methods

Provider State Methods work in the same way as with JUnit 4 tests, refer to the [Pact junit runner](../junit/) docs.
Provider State Methods work in the same way as with JUnit 4 tests, refer to the [Pact junit runner](https://github.com/DiUS/pact-jvm/tree/master/provider/junit) docs.

### Using multiple classes for the state change methods

If you have a large number of state change methods, you can split things up by moving them to other classes. You will
need to specify the additional classes on the test context in a `Before` method. Do this with the `withStateHandler`
or `setStateHandlers` methods. See [StateAnnotationsOnAdditionalClassTest](src/test/java/au/com/dius/pact/provider/junit5/StateAnnotationsOnAdditionalClassTest.java) for an example.
or `setStateHandlers` methods. See [StateAnnotationsOnAdditionalClassTest](https://github.com/DiUS/pact-jvm/blob/master/provider/junit5/src/test/java/au/com/dius/pact/provider/junit5/StateAnnotationsOnAdditionalClassTest.java) for an example.

## Modifying the requests before they are sent

Expand Down
2 changes: 1 addition & 1 deletion provider/junit5spring/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pact Spring/JUnit5 Support

This module extends the base [Pact JUnit5 module](../junit5). See that for more details.
This module extends the base [Pact JUnit5 module](https://github.com/DiUS/pact-jvm/tree/master/provider/junit5). See that for more details.

For writing Spring Pact verification tests with JUnit 5, there is an JUnit 5 Invocation Context Provider that you can use with
the `@TestTemplate` annotation. This will generate a test for each interaction found for the pact files for the provider.
Expand Down
2 changes: 1 addition & 1 deletion provider/spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview
Library provides ability to play contract tests against a provider using Spring & JUnit.
This library is based on and references the JUnit package, so see the [Pact JUnit 4](../junit) or [Pact JUnit 5](../junit5) providers for more details regarding configuration using JUnit.
This library is based on and references the JUnit package, so see the [Pact JUnit 4](https://github.com/DiUS/pact-jvm/tree/master/provider/junit) or [Pact JUnit 5](https://github.com/DiUS/pact-jvm/tree/master/provider/junit5) providers for more details regarding configuration using JUnit.

Supports:

Expand Down

0 comments on commit 7a4bd3b

Please sign in to comment.