-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs site tweaks and updated all md files to refer to the website.
- Loading branch information
Dave Smith
committed
Oct 25, 2016
1 parent
b7a5b8b
commit 75edff7
Showing
9 changed files
with
75 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
|
||
## 1.0.2 - 2016-10-04 | ||
- Remove logging implementation dependencies ([agustafson]) | ||
- Added example projects ([davesmith00000]) | ||
- ScalaPactContractWriter creates directories 'target' and 'pacts' if they don't exist ([raoulk]) | ||
- Add preflight request operation (OPTIONS) ([itsDanOades]) | ||
- Codified testing process in a shell script. ([davesmith00000]) | ||
|
||
## 1.0.1 - 2016-07-19 | ||
- Verifier does not post data if body is empty ([davesmith00000]) | ||
- Added the ability to specify a pact version when verifying ([itsDanOades]) | ||
|
||
## 1.0.0 - 2016-05-26 | ||
- Initial public release following a number of in house only dev and milestone versions. ([davesmith00000], [Iulian-Antohe], [smithleej], [blake-boesinger]) | ||
|
||
[davesmith00000]: https://github.com/davesmith00000 | ||
[itsDanOades]: https://github.com/itsDanOades | ||
[smithleej]: https://github.com/smithleej | ||
[Iulian-Antohe]: https://github.com/iulian-antohe | ||
[blake-boesinger]: https://github.com/blake-boesinger | ||
[agustafson]: https://github.com/agustafson | ||
[raoulk]: https://github.com/raoulk | ||
Please refer to the [change log page](http://io.itv.com/scala-pact/change-log.html) in the Scala-Pact documentation site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,3 @@ | ||
# How to contribute | ||
|
||
All efforts to contribute to this project are welcome and encouraged. Scala-Pact can only be better with more eyes looking for problems and more minds trying to solve them. | ||
|
||
If you would like to contribute, there are principally two ways you can help. | ||
|
||
### Raising issues | ||
If we don't know there is a problem, we can't help fix it. | ||
|
||
Please feel free to raise issues if you can't get something to work, find a bug, or you have any ideas for improvements. | ||
|
||
Try and be as specific as possible, ideally you should include steps to re-produce your issue if it's a bug, or some sort of rationale for new features. | ||
|
||
### Code | ||
We will always try to accept code submissions. If you'd like to discuss a change before you make it, please raise an issue and describe the work you're planning to do. | ||
|
||
If you would like to improve the project by contributing code, please fork the repo, make your change and submit a pull request. | ||
|
||
#### When your PR is accepted, please rebase rather than merge | ||
Special note to people who have direct access to the main project repo. Please do not use github's magic merge button on your pull requests. Please rebase your work, for example (assuming you're on your branch): | ||
``` | ||
git fetch -p | ||
git pull --rebase origin master | ||
git push origin HEAD:master | ||
``` | ||
|
||
This should help us keep a linear history. | ||
|
||
#### Testing Scala-Pact | ||
Before submitting your pull request, you should do your best to check it all works! | ||
|
||
The process has been codified into the `local-build-test.sh` shell script in the project root. This script builds, tests, and publishes everything to your local .ivy2 repo. Run from the project root directory using (takes about 5 minutes to complete): | ||
`bash scripts/local-build-test.sh` | ||
|
||
Here is the current testing procedure (in order): | ||
|
||
##### All Projects | ||
1. Make sure all the projects have a new SNAPSHOT version, that it is the same everywhere, and that they all use each other's new version i.e. Bump the core, bump the plugin and update the plugin to use the new core, bump the test project and update it to use the new core and the new plugin version. | ||
2. Make sure you don't have that version in your `~/.ivy2/local` or `~/.ivy2/cache` folders. | ||
|
||
##### Core Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt "+ publish-local"` to cross compile and publish to your local cache. | ||
|
||
##### Plugin Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt publish-local` to publish to your local cache. | ||
|
||
##### Test Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt pact-test` | ||
1. Run `sbt pact-stubber` | ||
1. In a new terminal (again from the test project directory), run `sbt pact-verify --source target/pacts` | ||
|
||
##### Standalone stubber | ||
No testing required at present. | ||
|
||
**If everything is green, you're ready to submit your pull request!** | ||
All contributions are very welcome, please see our [contributing guide](http://io.itv.com/scala-pact/contributing.html) for details of how to get involved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,5 @@ | ||
#Scala-Pact Example Projects | ||
|
||
This is a simple demonstration of Pact CDC testing in action. There are two SBT projects, one for the consumer and another for the provider. Both contain the bare minimum to demonstrate how pact testing works. | ||
This is a simple demonstration of Pact CDC testing in action. | ||
|
||
The examples don't go into great depth, for more information you should refer to the main [README](https://github.com/ITV/scala-pact/blob/master/README.md) file. | ||
|
||
There is an assumption that you will be running this on linux or mac and have Scala + SBT setup. | ||
|
||
##Consumer | ||
The consumer project owns and generates the Pact contract file. | ||
|
||
The Pact contract file is the result of an [integration test](https://github.com/ITV/scala-pact/blob/example-projects/example/consumer/src/test/scala/com/example/consumer/ProviderClientSpec.scala) that tests a [real, albeit crude piece of client code](https://github.com/ITV/scala-pact/blob/example-projects/example/consumer/src/main/scala/com/example/consumer/ProviderClient.scala) against a mock. | ||
|
||
To run the pact-tests, do the following (assuming you've checked out the project and are in the example directory): | ||
|
||
``` | ||
cd consumer | ||
sbt pact-test | ||
``` | ||
|
||
You should now be able to see a file in the `consumer/target/pacts/` directory called `Consumer_Provider.json`. This is your Pact file that describes the behaviour you expect fro the Provider service. | ||
|
||
##Stubbing | ||
If you wanted to, you could now run a stub version of the Provider service, again from the `consumer` directory, by simply entering `sbt pact-stubber` on the command line and the service would start on port `1234`. | ||
|
||
Try it, you should be able to go hit [the results end point in your browser](http://localhost:1234/results). | ||
|
||
You could also use the [standalone stubber](https://github.com/ITV/scala-pact/tree/master/scalapact-standalone-stubber). If you plan to use this in a CI pipeline you should consider assembling it into a JAR by running `sbt assembly`. | ||
|
||
##Delivering the pact file | ||
In a real scenario, you would probably use Pact Broker to send the newly created Pact contract to the Provider ahead of verification. | ||
|
||
In our demo, we're going to skip that on the assumption that you don't have a [Pact Broker](https://github.com/bethesque/pact_broker) handy, but full details of how to integrate with [Pact Broker](https://github.com/bethesque/pact_broker) can be found in the main [README](https://github.com/ITV/scala-pact/blob/master/README.md) file. | ||
|
||
Instead we're going to use a script to do the delivery. Navigate back to the main example directory on the terminal and run: | ||
``` | ||
bash deliver.sh | ||
``` | ||
|
||
This script simply copies the `Consumer_Provider.json` file into the `provider/delivered_pacts` directory. | ||
|
||
##Provider | ||
Now to see if it works! | ||
|
||
You will need two terminal windows, both of which are open in the `provider` directory. | ||
|
||
In the first terminal window, run `sbt run` to start the service. | ||
|
||
In the second terminal window, run: | ||
``` | ||
sbt "pact-verify --source delivered_pacts/ --host localhost --port 8080" | ||
``` | ||
*Note: the `--source delivered_pacts/` bit that tells the verifier you want to use local pact files in the directory specified.* | ||
|
||
This will replay the request(s) in the Pact contract file against the service and check that the responses match. | ||
|
||
###Additionally... | ||
This example setup contains one extra thing, which is an example of how to use provider states. The test suite declares a `given("...")` requirement and it is fulfilled during verification by the function in the `pact.sbt` at the root of the provider project. | ||
|
||
##Things to note | ||
1. The consumer and provider scala projects both use different case classes to represent the data. This does not matter, only the Pact file matters. | ||
1. The consumer and provider scala projects both use different json libraries to read/write the json. This does not matter either, the contract is in no way less solid for the difference in library or marshalling logic. | ||
Please refer to the [example projects page](http://io.itv.com/scala-pact/example.html) in the Scala-Pact documentation site for a full guide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# How to contribute | ||
|
||
All efforts to contribute to this project are welcome and encouraged. Scala-Pact can only be better with more eyes looking for problems and more minds trying to solve them. | ||
|
||
If you would like to contribute, there are principally two ways you can help. | ||
|
||
### Raising issues | ||
If we don't know there is a problem, we can't help fix it. | ||
|
||
Please feel free to raise issues if you can't get something to work, find a bug, or you have any ideas for improvements. | ||
|
||
Try and be as specific as possible, ideally you should include steps to re-produce your issue if it's a bug, or some sort of rationale for new features. | ||
|
||
### Code | ||
We will always try to accept code submissions. If you'd like to discuss a change before you make it, please raise an issue and describe the work you're planning to do. | ||
|
||
If you would like to improve the project by contributing code, please fork the repo, make your change and submit a pull request. | ||
|
||
#### When your PR is accepted, please rebase rather than merge | ||
Special note to people who have direct access to the main project repo. Please do not use github's magic merge button on your pull requests. Please rebase your work, for example (assuming you're on your branch): | ||
``` | ||
git fetch -p | ||
git pull --rebase origin master | ||
git push origin HEAD:master | ||
``` | ||
|
||
This should help us keep a linear history. | ||
|
||
#### Testing Scala-Pact | ||
Before submitting your pull request, you should do your best to check it all works! | ||
|
||
The process has been codified into the `local-build-test.sh` shell script in the project root. This script builds, tests, and publishes everything to your local .ivy2 repo. Run from the project root directory using (takes about 5 minutes to complete): | ||
`bash scripts/local-build-test.sh` | ||
|
||
Here is the current testing procedure (in order): | ||
|
||
##### All Projects | ||
1. Make sure all the projects have a new SNAPSHOT version, that it is the same everywhere, and that they all use each other's new version i.e. Bump the core, bump the plugin and update the plugin to use the new core, bump the test project and update it to use the new core and the new plugin version. | ||
2. Make sure you don't have that version in your `~/.ivy2/local` or `~/.ivy2/cache` folders. | ||
|
||
##### Core Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt "+ publish-local"` to cross compile and publish to your local cache. | ||
|
||
##### Plugin Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt publish-local` to publish to your local cache. | ||
|
||
##### Test Project | ||
1. Run `sbt clean update compile` | ||
1. Run `sbt test` | ||
1. Run `sbt pact-test` | ||
1. Run `sbt pact-stubber` | ||
1. In a new terminal (again from the test project directory), run `sbt pact-verify --source target/pacts` | ||
|
||
##### Standalone stubber | ||
No testing required at present. | ||
|
||
**If everything is green, you're ready to submit your pull request!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# ScalaPact SBT Plugin | ||
|
||
Please refer to the main project readme for setup and usage instructions. | ||
Please refer to the [Scala-Pact documentation site](http://io.itv.com/scala-pact/) for setup and usage information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# ScalaPact ScalaTest Library | ||
|
||
Please refer to the main project readme for setup and usage instructions. | ||
Please refer to the [Scala-Pact documentation site](http://io.itv.com/scala-pact/) for setup and usage information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ScalaPact ScalaTest Library | ||
|
||
Please refer to the [Scala-Pact documentation site](http://io.itv.com/scala-pact/) for setup and usage information. |