Jump to: navigation, search

Difference between revisions of "Lyo/BuildClient"

< Lyo
(DoorsOauthSample)
(8 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
*[http://eclipse.org/downloads Eclipse 3.6 or higher IDE]  
 
*[http://eclipse.org/downloads Eclipse 3.6 or higher IDE]  
 
*[http://eclipse.org/egit/download/ EGit] team provider for git (recommended) or [http://git-scm.com/download git command line package].  
 
*[http://eclipse.org/egit/download/ EGit] team provider for git (recommended) or [http://git-scm.com/download git command line package].  
*[http://www.eclipse.org/m2e/download/ m2eclipse] for Maven support in the Eclipse IDE  
+
*[http://www.eclipse.org/m2e/download/ m2e] for Maven support in the Eclipse IDE  
 
*Lyo client requires a Java 1.6 compiler and Java 1.6 runtime. The Eclipse project settings have been set appropriately. If you are building outside of Eclipse, please use Java 1.6.
 
*Lyo client requires a Java 1.6 compiler and Java 1.6 runtime. The Eclipse project settings have been set appropriately. If you are building outside of Eclipse, please use Java 1.6.
  
Line 29: Line 29:
 
*Select the Import Existing Projects wizard and click Next  
 
*Select the Import Existing Projects wizard and click Next  
 
*Import the following projects:  
 
*Import the following projects:  
**OSLC4J
+
**org.eclipse.lyo.oslc4j.core
**OSLC4JJenaProvider
+
**org.eclipse.lyo.oslc4j.provider.jena
**OSLC4JJson4JProvider
+
**org.eclipse.lyo.oslc4j.provider.json4j
  
 
You may import the other projects if you like, but they are not required for building the client.
 
You may import the other projects if you like, but they are not required for building the client.
 
[[Image:Lyo_core_import_projects.png]]
 
  
 
*[Optional] Add the projects to a new working set.
 
*[Optional] Add the projects to a new working set.
  
 
== Build all projects ==
 
== Build all projects ==
* Expand the OSLC4J project
+
* Expand org.eclipse.lyo.oslc4j.core
 
* Right click pom.xml -> Run As -> Maven clean
 
* Right click pom.xml -> Run As -> Maven clean
 
* Right click pom.xml -> Run As -> Maven install
 
* Right click pom.xml -> Run As -> Maven install
* Repeat these steps for the OSLC4JJenaProvider and OSLC4JJson4JProvider projects
+
* Repeat these steps for the org.eclipse.lyo.oslc4j.provider.jena and org.eclipse.lyo.oslc4j.provider.json4j projects
  
 
== Clone the Lyo Client git repository  ==
 
== Clone the Lyo Client git repository  ==
Line 89: Line 87:
 
* update an existing ChangeRequest
 
* update an existing ChangeRequest
  
To run the sample you first need to follow the instructions to build and run the [[Lyo/BuildRIO | Change Management Reference Implementation]]. Then you can create a launch configuration in eclipse to run GenericCMSample as a java application, passing in values for the command line arguments as shown below:
+
To run the sample you first need to follow the instructions to build and run the [[Lyo/BuildingOSLC4J| Change Management Reference Implementation]]. Then you can create a launch configuration in eclipse to run GenericCMSample as a java application, passing in values for the command line arguments as shown below:
  
 
[[Image:RunGenericCMSample.png]]
 
[[Image:RunGenericCMSample.png]]
Line 116: Line 114:
  
 
[[Image:RunRTCFormSample.png]]
 
[[Image:RunRTCFormSample.png]]
 +
 +
== DoorsOauthSample ==
 +
 +
This sample demonstrates how to use the Lyo client to interact with IBM Rational DOORS in the following ways:
 +
 +
* Connects to IBM Rational DOORS using OAuth
 +
* Creates a requirement in DOORS
 +
 +
It then attempts to update that requirement but there is an outstanding issue with dates leading to errors.
 +
 +
It requires DOORS Web Access 9.5.0 or later.  Ideally 9.5.1.2+.
 +
 +
In DOORS go to File-OSLC-Local Keys (or Database Properties-Local Keys in 9.5.0.x). 
 +
Add a new OAuth Consumer by giving a name, key and secret.  Note the key and secret used.
 +
 +
[[File:DOORSRegisterConsumer.PNG]]
 +
 +
Edit the DoorsOauthSample.java.  Locate this section and replace the consumer key and secret with what was registed with DOORS:
 +
 +
//STEP 2: Create a new OSLC OAuth capable client, the parameter of following call should be provided
 +
// by the system administrator of the DOORs Web Access server
 +
e.g
 +
 +
OslcOAuthClient client = helper.initOAuthClient("lyo", "lyo");
 +
 +
Right click and select Run As - Run Configuration.  Under Arguments add the connection details for your DOORS Web Access and a module name.  e.g.
 +
 +
-url https://example.com:9443/dwa -user <user> -password <password> -project "my DOORS Module"
 +
 +
[[File:DOORSRunConfiguration2.PNG]]
 +
 +
Run it by right click Run As - Java Application.
  
 
== RQMAutomationSample ==
 
== RQMAutomationSample ==

Revision as of 11:48, 31 October 2013

The Lyo Client provides helpful APIs and sample code that can be used to interact with OSLC Service Providers. It provides an additional layer of functionality on top of Apache HttpClient, Apache Wink, and OSLC4J that can give you a head start on some of the common use cases such as form login, OAuth handling, service discovery, sending queries, and processing query results. It also provides sample code that demonstrates how to use the Lyo client in interesting ways, such as acting as a remote agent for an OSLC Automation service provider.

Building the Lyo Client in Eclipse

Prerequisites

  • Eclipse 3.6 or higher IDE
  • EGit team provider for git (recommended) or git command line package.
  • m2e for Maven support in the Eclipse IDE
  • Lyo client requires a Java 1.6 compiler and Java 1.6 runtime. The Eclipse project settings have been set appropriately. If you are building outside of Eclipse, please use Java 1.6.

Clone the Lyo Core git repository

This example assumes EGit is being used.

Lyo client core git.png

  • On the Branch Selection page, select the master branch
  • On the Local Destination page, specify a location or accept the default and click Finish

The repository should now show up in your Git Repositories view.

Import Eclipse projects from the git repository

  • In the Git Repositories view, right click org.eclipse.lyo.core and select Import Projects
  • Select the Import Existing Projects wizard and click Next
  • Import the following projects:
    • org.eclipse.lyo.oslc4j.core
    • org.eclipse.lyo.oslc4j.provider.jena
    • org.eclipse.lyo.oslc4j.provider.json4j

You may import the other projects if you like, but they are not required for building the client.

  • [Optional] Add the projects to a new working set.

Build all projects

  • Expand org.eclipse.lyo.oslc4j.core
  • Right click pom.xml -> Run As -> Maven clean
  • Right click pom.xml -> Run As -> Maven install
  • Repeat these steps for the org.eclipse.lyo.oslc4j.provider.jena and org.eclipse.lyo.oslc4j.provider.json4j projects

Clone the Lyo Client git repository

This example assumes EGit is being used.

Lyo client clone git.png

  • On the Branch Selection page, select the master branch
  • On the Local Destination page, specify a location or accept the default and click Finish

The repository should now show up in your Git Repositories view.

Import Eclipse projects from the git repository

  • In the Git Repositories view, right click org.eclipse.lyo.client and select Import Projects
  • Select the Import Existing Projects wizard and click Next
  • Import the following projects:
    • org.eclipse.lyo.client.java
    • org.eclipse.lyo.samples.clients

Lyo client import projects.png

  • [Optional] Add the projects to a new working set.

Build all projects

  • Expand the org.eclipse.lyo.clients.java project
  • Right click pom.xml -> Run As -> Maven clean
  • Right click pom.xml -> Run As -> Maven install
  • Repeat these steps for the org.eclipse.lyo.samples.client project

Running the Lyo Client samples in Eclipse

The org.eclipse.lyo.samples.clients project contains sample code that uses the Lyo client to interact with OSLC Service Providers in various ways.

GenericCMSample

This sample demonstrates how to use the Lyo client to interact with a Change Management (CM) Service Provider in the following ways:

  • run an OLSC ChangeRequest query and retrieve OSLC ChangeRequests and de-serialize them as Java objects
  • retrieve an OSLC ChangeRequest and print it as XML
  • create a new ChangeRequest
  • update an existing ChangeRequest

To run the sample you first need to follow the instructions to build and run the Change Management Reference Implementation. Then you can create a launch configuration in eclipse to run GenericCMSample as a java application, passing in values for the command line arguments as shown below:

RunGenericCMSample.png

RQMFormSample

This sample demonstrates how to use the Lyo client to interact with a Quality Management (QM) Service Provider in the following ways:

  • run an OLSC TestResult query and retrieve OSLC TestResults and de-serialize them as Java objects
  • retrieve an OSLC TestResult and print it as XML
  • create a new TestCase
  • update an existing TestCase

To run this sample you can install and configure a Quality Management V2 service provider such as Rational Quality Manager. Then create a launch configuration in eclipse to run RQMFormSample as a java application, passing in values for the command line arguments as shown below:

RunRQMFormSample.png

RTCFormSample

This sample demonstrates how to use the Lyo client to interact with a Change Management (CM) Service Provider in the following ways:

  • run an OLSC ChangeRequest query and retrieve OSLC ChangeRequests and de-serialize them as Java objects
  • retrieve an OSLC ChangeRequest and print it as XML
  • create a new ChangeRequest
  • update an existing ChangeRequest

To run this sample you can install and configure a Change Management V2 service provider such as Rational Team Concert. Then create a launch configuration in eclipse to run RTCFormSample as a java application, passing in values for the command line arguments as shown below:

RunRTCFormSample.png

DoorsOauthSample

This sample demonstrates how to use the Lyo client to interact with IBM Rational DOORS in the following ways:

  • Connects to IBM Rational DOORS using OAuth
  • Creates a requirement in DOORS

It then attempts to update that requirement but there is an outstanding issue with dates leading to errors.

It requires DOORS Web Access 9.5.0 or later. Ideally 9.5.1.2+.

In DOORS go to File-OSLC-Local Keys (or Database Properties-Local Keys in 9.5.0.x). Add a new OAuth Consumer by giving a name, key and secret. Note the key and secret used.

DOORSRegisterConsumer.PNG

Edit the DoorsOauthSample.java. Locate this section and replace the consumer key and secret with what was registed with DOORS:

//STEP 2: Create a new OSLC OAuth capable client, the parameter of following call should be provided // by the system administrator of the DOORs Web Access server e.g

OslcOAuthClient client = helper.initOAuthClient("lyo", "lyo");

Right click and select Run As - Run Configuration. Under Arguments add the connection details for your DOORS Web Access and a module name. e.g.

-url https://example.com:9443/dwa -user <user> -password <password> -project "my DOORS Module"

DOORSRunConfiguration2.PNG

Run it by right click Run As - Java Application.

RQMAutomationSample

This sample demonstrates how to use the Lyo client to interact with an Automation Service Provider. It provides an Automation Adapter resource which can be used to communicate with the Automation Provider for activities such as polling for Automation Requests. It also provides a sample application that demonstrates how to initialize the Automation Adapter and register it with the Automation Provider.

When an Automation Request becomes available the Automation Adapter takes ownership of the request and gives control back to the sample application for execution of a test script. While the test automation is underway the sample application uses the Automation Adapter to send progress updates to the Automation Service Provider. When the test automation has completed the sample application uses the Automation Adapter to upload an attachment to the Service Provider and send an Automation Result back to the Automation Provider.

RQMAutomationSample.png

To run this sample you can install and configure a Automation Service Provider such as Rational Quality Manager. Then update the adapter.properties file with the information about your Adapter client and the Automation Provider.

AutomationAdapterProperties.png

Finally, to run the Sample application right click RQMAutomationSample.java in your Explorer view and select Run As->Java Application.