Skip to content

Commit

Permalink
Update .gitignore and README to reflect testing strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-rowe committed Jul 12, 2015
1 parent eba3f2a commit f907bba
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ target/
# Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Avoid accidental inclusion of test key
brit-core/src/main/resources/test-matcher-key.asc
69 changes: 56 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ We have provided an [overview of BRIT](src/main/doc/Overview-of-BRIT.md) and det
the actors involved:

* [Creating Redeemer wallets](src/main/doc/Redeemer-1-Creating-Bitcoin-wallets.md)
* [Setting up a Matcher (BRIT server)](src/main/doc/Matcher-1-Setting-up.md)
* [Setting up a Matcher (BritService)](src/main/doc/Matcher-1-Setting-up.md)
* [Setting up a Payer](src/main/doc/Payer-1-Setting-up.md)

The rest of this document provides the detailed instructions for running up a BRIT server.
The rest of this document provides the detailed instructions for running up BritService.

## Branches

We follow the ["master-develop" branching strategy](http://nvie.com/posts/a-successful-git-branching-model/).
We follow the ["Git Flow" branching strategy](http://nvie.com/posts/a-successful-git-branching-model/).

This means that the latest release is on the "master" branch (the default) and the latest release candidate is on the "develop" branch.
Any issues are addressed in feature branches from "develop" and merged in as required.
Expand All @@ -50,9 +50,9 @@ build it manually. You will need to use the HEAD of the `develop` branch.

Later this will be available in a host repository (such as Maven Central) which will simplify the build process.

### BRIT server config
### BritService config

The BRIT server uses a PGP key to authenticate the requests sent to it.
The BritService uses a PGP key to authenticate the requests sent to it.

This is in a PGP secret keyring stored exactly here: `/var/brit/matcher/gpg/secring.gpg`

Expand All @@ -70,14 +70,14 @@ Import the project as a Maven project in the usual manner.
To start the project you just need to execute `BritService.main()` as a Java application. You'll need a runtime configuration
that passes in `server config.yml` as the Program Arguments.

Open a browser to [http://localhost:7070/brit/public-key](http://localhost:7070/brit/public-key) and you should see the BRIT server
Open a browser to [http://localhost:7070/brit/public-key](http://localhost:7070/brit/public-key) and you should see the BritService
public key.

At this stage you can perform most development tasks and you won't be prompted for a password.

## Running BRIT server in Production
## Running BritService in Production

To run up BRIT server for real you need to run it outside of an IDE which introduces some security issues. Security Providers such
To run up BritService for real you need to run it outside of an IDE which introduces some security issues. Security Providers such
as Bouncy Castle can only be loaded from a trusted source. In the case of a JAR this means that it must be signed with a certificate
that has in turn been signed by one of the trusted Certificate Authorities (CAs) in the `cacerts` file of the JRE.

Expand All @@ -98,14 +98,14 @@ On startup you will need to provide the passphrase for the Matcher key store. It

All commands will work on *nix without modification, use \ instead of / for Windows.

## Test the BRIT server using health checks
## Test the BritService using health checks

Open a browser to [http://localhost:7071/healthcheck](http://localhost:7070/healthcheck) and you should see the BRIT server
Open a browser to [http://localhost:7071/healthcheck](http://localhost:7070/healthcheck) and you should see the BritService
perform a self-test. Note the admin port is 7071 and is not generally exposed to the outside world.

## Test the BRIT server using a browser REST plugin
## Test the BritService using a browser REST plugin

First open a browser to [http://localhost:7070/brit/public-key](http://localhost:7070/brit/public-key) and you should see the BRIT server
First open a browser to [http://localhost:7070/brit/public-key](http://localhost:7070/brit/public-key) and you should see the BritService
public key. Note it is port 7070 not the usual 8080.

If you are running Chrome and have the excellent Advanced REST Client extension installed then you can build a POST request for the
Expand All @@ -132,7 +132,50 @@ development environment as follows:

If all goes well the response will be a `201_CREATED` with some gibberish to decrypt. The client and server are in synch.

A `400_BAD_REQUEST` indicates that the BRIT server is not able to decrypt the PayerRequest.
A `400_BAD_REQUEST` indicates that the BritService is not able to decrypt the PayerRequest.

## Test the BritService using MultiBit HD

If you need to test the correct operation of MultiBit HD against the BritService you will find it easiest to use the test
keys and to use a custom build. Do the following:

1. On the BritService `develop` branch copy `src/test/resources/matcher/gpg/matcher-key.asc` to `src/main/resources/test-matcher-key.asc`
2. This particular path must be used since it is referenced in the `.gitignore` file to provide a safety mechanism against accidental commit
3. Use the Version Control tab to create a new git Change List (green plus sign) called "Do not commit"
4. Edit the `BRITServices` as follows:

```java
/**
* The URL of the live matcher daemon
*/
// public static final String LIVE_MATCHER_URL = "https://multibit.org/brit";
public static final String LIVE_MATCHER_URL = "http://localhost:7070/brit";

/**
* The live matcher PGP public key file
*/
// public static final String LIVE_MATCHER_PUBLIC_KEY_FILE = "/multibit-org-matcher-key.asc";
public static final String LIVE_MATCHER_PUBLIC_KEY_FILE = "/test-matcher-key.asc";
```

5. In the Version Control tab move the `BRITServices.java` file into the "Do not commit" changelist
6. Perform a Maven install of the BritService so that the `brit-core-develop-SNAPSHOT` JAR is updated
7. Run up BritService so that it is listening for connections on 7070 as normal

Now switch to MultiBit HD in your IDE

1. Switch to the MultiBit HD `develop` branch (or your own development feature branch)
2. Run up MultiBit HD as normal and attempt to create a wallet
3. Verify that the traffic between MultiBit HD and BritService meets your expectations

Now switch to BritService in your IDE

1. Revert your changes to `BRITServices` and delete the `test-matcher-key.asc` file for safety
2. Verify that the live URL and key references are correct
3. Perform a Maven install of the BritService with the correct URLs

In general the MultiBit HD testing is a final "smoke test" to verify the API works within the application. The
actual protocol exchange has already been verified by unit tests and health checks.

### Where does the ASCII art come from?

Expand Down

0 comments on commit f907bba

Please sign in to comment.