use of org.sblim.wbem.cim.CIMValue in project opennms by OpenNMS.
the class VmwareViJavaAccessTest method testGetPropertyOfCimObject.
@Test
public void testGetPropertyOfCimObject() throws Exception {
CIMObject obj1 = new CIMInstance();
CIMProperty cimProperty1 = new CIMProperty();
cimProperty1.setName("theKey");
cimProperty1.setValue(new CIMValue("theValue", CIMDataType.getPredefinedType(CIMDataType.STRING)));
obj1.addProperty(cimProperty1);
CIMObject obj2 = new CIMInstance();
CIMProperty cimProperty2 = new CIMProperty();
cimProperty2.setName("theKey");
cimProperty2.setValue(new CIMValue(null, CIMDataType.getPredefinedType(CIMDataType.STRING)));
obj2.addProperty(cimProperty2);
CIMObject obj3 = new CIMInstance();
CIMProperty cimProperty3 = new CIMProperty();
obj3.addProperty(cimProperty3);
Assert.assertEquals(vmwareViJavaAccess.getPropertyOfCimObject(obj1, "theKey"), "theValue");
Assert.assertNull(vmwareViJavaAccess.getPropertyOfCimObject(obj2, "theKey"));
Assert.assertNull(vmwareViJavaAccess.getPropertyOfCimObject(obj3, "theKey"));
}
Aggregations