Page tree
Skip to end of metadata
Go to start of metadata

Downloading and Structure

The source code is available from OpenNTF Stash. Download the projects and import into Eclipse. The project structure is:

  • wws.parent: parent pom, this is the one that should be built using Maven install. Building is best done via Eclipse so runtime parameters can be defined.
    • wws-api: this project is the main code
    • wws-api-integrationtests: this project contains all unit tests run during Maven build, connecting as your WWS application
    • wws-api-assembly: this project assembles the output

The project is designed to compile against Java 1.6. However, Maven in Eclipse requires later JREs to run. We recommend Java 1.8.

Test and Run Configuration

The tests in wws-api use JUnit and do not connect to Watson Work Services and can be run without access to Watson Workspace. They can be run in Eclipse using Run As > JUnit Test. There are MockClient and MockGraphQLEndpoint classes in org.opencode4workspace.mocks in the test/java folder for loading a response into an endpoint and parsing the JSON from either the endpoint or the client.

The tests in wws-api-integrationtests use TestNg (to allow parameters to be passed from the run configurations) and do connect to Watson Work Services as an application. Before running the tests you will need to register an app and add it to at least one space. See the Watson Work Services developer site for this. When you register an app, note its app key and app secret. You will need those for the tests to run.

Create a Run Configuration in Eclipse, with the Base Directory set to wws.parent, with the goals clean install.

As will be seen from the screenshot, a number of parameters will need to be added. These are used by the various tests.

ParameterDescription
appSecretThe secret for the app you have registered
appIdThe id of the app you have registered
myDisplayNameThe displayName property for your Person object. Use the GraphiQL browser IDE to find this out
profileIdThe id for your Person object. Use the GraphiQL browser IDE to find this out
conversationIdAn id for a Conversation in a Space your app has access to
myAppNameThe displayName property for your app's Person object
messageIdAn id for a Message from the Conversation corresponding to your conversationId property
spaceId

An id for a Space your app can post a Message to

spaceNameThe name for the space corresponding to your spaceId property
space2IdAn Id for a second space your app can post a Message to
space2NameThe name for the space corresponding to your space2Id

oldestTimestamp

Long corresponding to a lower bound for the created date of a Message in the conversation corresponding to your conversationId property
mostRecentTimestampLong corresponding to a upper bound for the created date of a Message in the conversation corresponding to your conversationId property

To find timestamps, check the "created" property in a Message's annotations

If these are set correctly, you will be able to build the project using the Run button.

 

  • No labels