use of com.evolveum.midpoint.prism.impl.xnode.PrimitiveXNodeImpl in project midpoint by Evolveum.
the class TestDiffEquals method testRawValuesHashCode.
// MID-5851
@Test
public void testRawValuesHashCode() throws SchemaException {
PrismContext prismContext = PrismTestUtil.getPrismContext();
QName extensionPropertyName = new QName(NS_TEST_RI, "extensionProperty");
MutablePrismPropertyDefinition<String> extensionPropertyDef = prismContext.definitionFactory().createPropertyDefinition(extensionPropertyName, DOMUtil.XSD_STRING);
extensionPropertyDef.setRuntimeSchema(true);
PrismProperty<String> propertyParsed = extensionPropertyDef.instantiate();
PrismProperty<String> propertyRaw = extensionPropertyDef.instantiate();
propertyParsed.setRealValue("value");
propertyRaw.setValue(prismContext.itemFactory().createPropertyValue(new PrimitiveXNodeImpl<>("value")));
PrismObject<UserType> userParsed = new UserType(prismContext).name("user").asPrismObject();
userParsed.getOrCreateExtension().add(propertyParsed);
PrismObject<UserType> userRaw = new UserType(prismContext).name("user").asPrismObject();
userRaw.getOrCreateExtension().add(propertyRaw);
assertHashAndEquals(userParsed, userRaw, null);
assertHashAndEquals(userParsed, userRaw, LITERAL);
assertHashAndEquals(userParsed, userRaw, DATA);
}
use of com.evolveum.midpoint.prism.impl.xnode.PrimitiveXNodeImpl in project midpoint by Evolveum.
the class TestBeanSerialization method testPipelineItemXsdType.
@Test
public void testPipelineItemXsdType() throws SchemaException {
PipelineDataType bean = new PipelineDataType();
bean.beginItem().value("s1");
PrismContext prismContext = PrismTestUtil.getPrismContext();
RootXNode xnode = prismContext.xnodeSerializer().root(new QName("output")).serializeRealValue(bean);
MapXNode output = (MapXNode) xnode.toMapXNode().get(new QName("output"));
XNode item = ((ListXNode) output.get(PipelineDataType.F_ITEM)).get(0);
assertTrue(item instanceof MapXNode);
XNode value = ((MapXNode) item).get(PipelineItemType.F_VALUE);
assertTrue(value instanceof PrimitiveXNodeImpl);
assertTrue(value.isExplicitTypeDeclaration());
assertEquals(value.getTypeQName(), DOMUtil.XSD_STRING);
// displayValue("output in XML", prismContext.xmlSerializer().root(new QName("output")).serializeRealValue(bean));
}
Aggregations