Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RQM: how to read Test case category attributes values from extended properties through OSLC

Hi All,
I am trying to read the category value of Test case through OSLC but after looping through to extended values for category i am getting An array of the URI. Can anyone help me to get the attributes values from URI. I have tried using AnyResource but it can not cast to URI.
public void getExtendedProperties(TestCase testCase)

{
Map<String,String> testCaseAttributes = new HashMap<String, String>();
for (Entry<QName, Object> extendedProperty : testCase.getExtendedProperties().entrySet()) {
if("category".equalsIgnoreCase(extendedProperty.getKey().getLocalPart())) { 
//System.out.println("Key :" +extendedProperty.getKey()  + " Value : " + extendedProperty.getValue());
Object value = extendedProperty.getValue();
if(value instanceof ArrayList<?>){
ArrayList<?> extendedProp = (ArrayList<?>) value;
//System.out.println("we are getting category value : " );
for(int i = 0; i< extendedProp. size(); i++){
AnyResource resources = (AnyResource) extendedProp.get(i); // Getting URI and can not Cast to AnyResource.
String categoryName = "";
String categoryValue = "";
for (Entry<QName, Object> resource : resources.getExtendedProperties().entrySet()) {
if("title".equalsIgnoreCase(resource.getKey().getLocalPart())){
categoryName = resource.getValue().toString();
}else if("subject".equalsIgnoreCase(resource.getKey().getLocalPart())){
categoryValue =  resource.getValue().toString();
}
}
testCaseAttributes.put(categoryName, categoryValue);
}
}
}
}

0 votes



One answer

Permanent link

The category in a test case looks like this in the XML output.

<ns2:category term="Test Phase" value="Integration Test"/>
What do you mean that you get "an array of the URI"?

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Apr 05 '17, 7:13 a.m.

Question was seen: 2,491 times

Last updated: Apr 12 '17, 9:58 a.m.

Confirmation Cancel Confirm