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);
}
}
}
}