How to set priority in RQM while creating test case using Eclipse Lyo
Hello,
I am trying to create a test case using eclipse lyo. I am not able to set the priority using QName.
Please help
private static final String QM_NAMESPACE = "http://jazz.net/xmlns/prod/jazz/rqm/process/1.0/";
private static final String PRIORITY = "priority";
TestCase tc = new TestCase();
tc.setTitle(rqmAdapterInput.getTestCaseDTO().getTitle()); tc.setDescription(rqmAdapterInput.getTestCaseDTO().getDescription());
QName priority = new QName(QM_NAMESPACE, PRIORITY,PRIORITY);
Map<QName, Object> priorityMap = new HashMap<QName, Object>();
priorityMap.put(priority, "literal.priority.130");
tc.setExtendedProperties(priorityMap);
String testcaseCreation = client.lookupCreationFactory(serviceProviderUrl,OSLCConstants.OSLC_QM_V2, tc.getRdfTypes()[0].toString());
System.out.println(testcaseCreation);
ClientResponse creationResponse = client.createResource(testcaseCreation, tc,OslcMediaType.APPLICATION_RDF_XML);
if (creationResponse.getStatusCode() != HttpServletResponse.SC_CREATED) { System.err.println("ERROR: Could not create the test case (status "creationResponse.getStatusCode()+ ")\n"); System.err.println(creationResponse.getEntity(String.class));
}
creationResponse.consumeContent();
String testcaseLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION); System.out.println("Test Case created a location " + testcaseLocation);
2 answers
Thanks Paul for your reply.
My observation
While creating , it is no setting the priority. But if i update by modifying the existing QName and set the value to LOW, MEDIUM, HIGH is working.
private static final String QM_NAMESPACE = "http://jazz.net/xmlns/prod/jazz/rqm/process/1.0/"; private static final String PRIORITY = "hasPriority";
private static final String PREFIX = "rqm_process";
To be precise, while creating priority value is not getting set but for updating it works. I dont know whether this is a bug in eclipse lyo API implementation or from RQM test creation using OSLC.
Comments
The qm_process:hasPriority property support create/update/read operation. This information is in the test case resource shape.
As mentioned, when testing your code, try the same request using a HTTP client to eliminate any issues with your code or Eclipse Lyo.