Hello,
I’m trying to query Test Cases from Jazz based on the examples provided in:
https://github.com/OSLC/lyo-samples/blob/master/oslc4j-client-samples/src/main/java/org/eclipse/lyo/oslc4j/client/samples/ETMSample.java
I tried to use .getMembers() and .getMembersUrls() functions but they return null. Using .getRawResponse() I managed to make it work, but this solution does not support pagination and I want to cover this case as well.
My code looks like this:
String serviceProviderUrl = oslcClient.lookupServiceProviderUrl(catalogUrl, projectAreaName);
String queryCapability = oslcClient.lookupQueryCapability(
serviceProviderUrl, OSLCConstants.OSLC_QM_V2,
OSLCConstants.QM_TEST_CASE_QUERY);
OslcQueryParameters queryParams = new OslcQueryParameters();
if(conditions != null){
queryParams.setWhere(conditions);
}
if(testCaseProperties != null){
queryParams.setSelect(testCaseProperties);
}
OslcQuery query = new OslcQuery(oslcClient, queryCapability, queryParams);
OslcQueryResult result = query.submit();
testCases = processPagedQueryResult(result);
and processPagedQueryResult function:
private static List<TestCase> processPagedQueryResult(OslcQueryResult result){
List<TestCase> testCases = new ArrayList<>();
int page = 1;
do {
for (TestCase testCase : result.getMembers(TestCase.class)) {
testCases.add(testCase);
}
if (result.hasNext()) {
result = result.next();
page++;
} else {
break;
}
} while(true);
return testCases;
}
Did I miss something?
I am also experiencing something similar when I want to get the Related Change Requests (using .getRelatedChangeRequests()) from a Test Plan (it also returns a null list even though in the Jazz interface I can see the links in the Test Plan)
Thank you,
Ana