Retrieve Test Case data with OSCL
I am trying to get work items and their linked test cases in order to store that data in a database. I can access work items thanks to JAVA API and I list the linked test cases as urls:
For instance in the Project Area "ZZZ" there is one work item named "YYY" that has the following test case: https://localhost:9443/qm/oslc_qm/contexts/_ueOOYKgQEeaPaoGRbbL1BA/resources/com.ibm.rqm.planning.VersionedTestCase/_LsP4sKqLEeaPaoGRbbL1BA Now I want to retrieve information of this test case. I was pointed in another question that I should use OSCL request since RQM doesn't have a JAVA API like RTC does. So I am digging into OSCL options and I have also download the OSCL-Workshop and their examples. I can connect to the server and authentificate to my https://localhost:9443/qm server but how could I retrieve the test case info based on the aforementioned test case url? This is the login test based on the OSCL-Workshop example: public static void main(String[] args) { //============== Code to adapt to your own configuration =============// String server = "https://localhost:9443/qm"; // Set the Public URI of your RTC server String login = "login"; // Set the user login String password = "password"; // Set the associated password System.out.println(">> Example02: Print out the content of the Service Providers catalog"); System.out.println(" - Login: "+login); System.out.println(" - Password: "+password); JazzFormAuthClient client = null; try { //Initialize a Jazz rootservices helper and indicate we're looking for the ChangeManagement catalog //RTC contains a service provider for CM and SCM, so we need to indicate our interest in CM JazzRootServicesHelper helper = new JazzRootServicesHelper(server, OSLCConstants.OSLC_QM_V2); //Create a new Form Auth client with the supplied user/password client = helper.initFormClient(login, password); //Try to login if (client.formLogin() != HttpStatus.SC_OK) { System.out.print(">> login failed."); return; } //Fetch the catalog of service providers. ClientResponse response = client.getResource(helper.getCatalogUrl(), OSLCConstants.CT_RDF); ServiceProviderCatalog catalog = response.getEntity(ServiceProviderCatalog.class); if (catalog != null) { for (ServiceProvider sp : catalog.getServiceProviders()) { System.out.println(">> \t - "+ sp.getTitle()); } } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (RootServicesException e) { e.printStackTrace(); } catch (OAuthException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } catch (JazzAuthFailedException e) { e.printStackTrace(); } catch (JazzAuthErrorException e) { e.printStackTrace(); } finally { // Shutdown the HTTP connection if (client != null) { client.getHttpClient().getConnectionManager().shutdown(); } } } |
Accepted answer
Paul Slauenwhite (8.4k●1●2)
| answered Nov 17 '16, 7:08 a.m.
FORUM MODERATOR / JAZZ DEVELOPER edited Nov 17 '16, 7:24 a.m.
You can use the RQM OSLC API or RQM Reportable REST API to CRUD/query test artifacts. To use the OSLC API, you'll need specific headers (see https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api#Headers). I would suggest using your favorite browser plugin to issue HTTP requests (e.g. Poster/HttpRequester) to learn how to use the API before using a code example.
Antonio Dionisio selected this answer as the correct answer
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.