TestCase querying issue
Hi,
Based on the
ETMSample from Lyo's OSLC-client
lyo-samples/ETMSample.java at master · OSLC/lyo-samples (github.com), I wrote a query that should retrieve all the test cases of a given project area.
The result of this query is always an empty array, although there is actually 3 test cases in this project area.
Did I missed something ?
String catalogUrl = new RootServicesHelper(
<My QM URL>, OSLCConstants.OSLC_QM_V2, client).getCatalogUrl();
String serviceProviderUrl = client.lookupServiceProviderUrl(catalogUrl,<My QM project area>);
String queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2, OSLCConstants.QM_TEST_CASE_QUERY);
OslcQueryParameters queryParams = new OslcQueryParameters();
queryParams.setPrefix("rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
queryParams.setWhere("rdf:type=<http://open-services.net/ns/qm#TestCase>");
OslcQuery query = new OslcQuery(client, queryCapability, -1, queryParams);
OslcQueryResult result = query.submit();
Assertions.assertNotNull(result);
Assertions.assertEquals(3, result.getMembersUrls().length);
5 answers
Hi
Comments
Hi, thanks for answering.
You will definitely require authentication, Jad. I think the Lyo samples perform the authentication in the beginning. You need to authenticate to find the project areas and to access any protected resource other than the rootservices.
When working with Postman see https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/ for the authentication options.
I trust authentication is working, since the call client.lookupServiceProviderUrl() is working as expected.
I see <oslc:totalCount>0</oslc:totalCount>. So the question is why is the server returning 0 entries. We can (for now) conclude that it is not a problem with your client/Lyo. It's either on the server side, or in your query.
Hi Joao
result.setMemberProperty(OSLCConstants.OSLC_QM_V2 + "testCase");
Comments
Strangely, I have (almost) the same code to retrieve all requirements from a "RM" project area and, in this case, I didn't have to set this "memberProperty"...
That must affect something about the query GET if it changes what ETM returns, perhaps it adds a needed header like OSLC-Core-Version: 2.0 - can you compare with/without it?
I'm not sure about that : the "memberProperty" is applied on the result after the query has been submitted
Comments
Joao Barata
Sep 22 '21, 3:44 a.m.The corresponding request that is actually generated is :