P4OAuth Development

Most of the build tasks are run using gradle, which is generally what your IDE should be able to import for doing development. This has only been imported with IDEA, which works, so YMMV if you use anything else like Eclipse.

Testing

The only tests right now are system tests developed in the functional_tests subproject. To run, you'll need:

  1. A running p4d
  2. A running p4oauth server
  3. An example "Test server" of a test client integration

The tests themselves use TestNG, but assume the above services are running.

You can use the following gradle tasks to set up your environment. These gradle commands should set up a keystore for you using the keytool command. They also set up temporary working configurations which you might find useful.

Setup p4d

This command really only needs to be run once:

 % cd functional_tests
 % ./gradlew initPerforce

From there, a p4d should be running at localhost:1666.

You can restart the p4d instance via:

 % cd functional_tests
 % ./gradlew startPerforce

In general though, the other services will do this automatically.

Start/Stop p4oauth

If you want, you can execute a p4oauth service in the background:

 % ./gradlew assemble
 % cd functional_tests
 % ./gradlew startP4Oauth

This runs P4OAuth using the p4oauth.jar that should be built in the build/libs folder of the project.

Start/Stop Test Server

A test client server is used by tests that access the local p4d and list files (to just ensure we can in fact do something with the login token). Like p4oauth, you'll have to first assemble the test server.

% cd functional_tests
% ./gradlew :test_server:assemble
% ./gradlew startTestServer

To Do List

  1. Define and document kinds of error situations when the user may have a bad set of p4d tokens