How to retrieve TestCaseQuery URI via OSLC API
I would like to update a test case via the OSLC API I’m able to retrieve the designated Service Provider (Project Area) (I’m following example 4 in Lab 3 in the oslc document)
https://myJazzServer:9443/jazz/oslc_qm/contexts/<ID>/services.xml But how do I get the right queryCapability, the one for test cases? When I use the HttpRequester add-on for FireFox I can se that the URI I’m trying to get should look like this: https:// my JazzServer:9443/jazz/oslc_qm/contexts/<ID>/resourcescom.ibm.rqm.planning.VersionedTestCase I’ve tried to write this XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); String simpleQueryXPath = "//oslc:QueryCapability/oslc:queryBase/@rdf:resource"; xpath.setNamespaceContext( new NamespaceContextMap(new String[] {"oslc", "http://open-services.net/ns/qm#", "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"})); // Parse the response body to retrieve the Change Management Simple Query URL InputSource source = new InputSource(response.getEntity().getContent()); Node simpleQueryURLNode = (Node)(xpath.evaluate(simpleQueryXPath, source, XPathConstants.NODE)); |
3 answers
Hi Helene,
You would be looking for: <oslc:queryCapability> <oslc:QueryCapability> <dcterms:title>Default query capability for TestCase</dcterms:title> <oslc:queryBase rdf:resource="https://localhost:9443/jazz/oslc_qm/contexts/_stJVgGfqEd24KMoDcFLfcQ/resources/com.ibm.rqm.planning.VersionedTestCase"/> <oslc:resourceShape rdf:resource="https://localhost:9443/jazz/oslc_qm/contexts/_stJVgGfqEd24KMoDcFLfcQ/shape/query/com.ibm.rqm.planning.VersionedTestCase"/> <oslc:resourceType rdf:resource="http://open-services.net/ns/qm#TestCaseQuery"/> </oslc:QueryCapability> </oslc:queryCapability> For more information, see http://open-services.net/bin/view/Main/OslcCoreSpecification#Resource_Service_Provider. Comments
helene højrup
commented May 16 '13, 10:12 a.m.
Hi Paul
|
Hi Helene,
could you try this : String simpleQueryXPath ="//oslc:QueryCapability[oslc:resourceType/@rdf:resource='http://open-services.net/ns/qm#TestCaseQuery']/oslc:queryBase";Any better ? Regards Stéphane Comments
helene højrup
commented May 16 '13, 10:12 a.m.
No unfortunately it didn't work.
Interesting...
|
OK after looking a bit more into Xpath and the notation I found out that this should be written String simpleQueryXPath = "//oslc:QueryCapability[dcterms:title='Default query capability for TestCase']/oslc:queryBase/@rdf:resource";
and my oslc namespace was wrong.... it should be xpath.setNamespaceContext( new NamespaceContextMap(new String[] //{"oslc", "http://open-services.net/ns/core#", {"oslc", "http://open-services.net/ns/core#", "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "dcterms","http://purl.org/dc/terms/"})); |
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.