use of com.evolveum.midpoint.prism.xnode.MapXNode in project midpoint by Evolveum.
the class ImportTest method assertDummyResource.
private void assertDummyResource(PrismObject<ResourceType> resource, boolean fromRepo) {
PrismContainer<Containerable> configurationPropertiesContainer = assertResource(resource, "Dummy Resource", RESOURCE_DUMMY_NAMESPACE, dummyConnector.getOid(), fromRepo);
PrismProperty<ProtectedStringType> guardedProperty = configurationPropertiesContainer.findProperty(new QName(CONNECTOR_DUMMY_NAMESPACE, "uselessGuardedString"));
// The resource was pulled from the repository. Therefore it does not have the right schema here. We should proceed with caution
// and inspect the DOM elements there
assertNotNull("No uselessGuardedString property in configuration properties", guardedProperty);
PrismPropertyValue<ProtectedStringType> guardedPVal = guardedProperty.getValue();
if (fromRepo) {
Object passwordRawElement = guardedPVal.getRawElement();
if (!(passwordRawElement instanceof MapXNode)) {
AssertJUnit.fail("Expected password value of type " + MapXNode.class + " but got " + passwordRawElement.getClass());
}
MapXNode passwordXNode = (MapXNode) passwordRawElement;
assertTrue("uselessGuardedString was not encrypted (clearValue)", passwordXNode.get(new QName("clearValue")) == null);
assertTrue("uselessGuardedString was not encrypted (no encryptedData)", passwordXNode.get(new QName("encryptedData")) != null);
} else {
ProtectedStringType psType = guardedPVal.getValue();
assertNull("uselessGuardedString was not encrypted (clearValue)", psType.getClearValue());
assertNotNull("uselessGuardedString was not encrypted (no EncryptedData)", psType.getEncryptedDataType());
}
}
use of com.evolveum.midpoint.prism.xnode.MapXNode in project midpoint by Evolveum.
the class QueryJaxbConvertor method createQueryType.
public static QueryType createQueryType(ObjectQuery query, PrismContext prismContext) throws SchemaException {
ObjectFilter filter = query.getFilter();
QueryType queryType = new QueryType();
if (filter != null) {
SearchFilterType filterType = new SearchFilterType();
MapXNode filterXNode = QueryConvertor.serializeFilter(filter, prismContext);
filterType.setFilterClauseXNode(filterXNode);
queryType.setFilter(filterType);
}
queryType.setPaging(PagingConvertor.createPagingType(query.getPaging()));
return queryType;
}
use of com.evolveum.midpoint.prism.xnode.MapXNode in project midpoint by Evolveum.
the class SearchFilterType method setFilterClauseXNode.
public void setFilterClauseXNode(RootXNode filterClauseNode) {
if (filterClauseNode == null) {
this.filterClauseXNode = null;
} else {
this.filterClauseXNode = new MapXNode();
this.filterClauseXNode.put(filterClauseNode.getRootElementName(), filterClauseNode.getSubnode());
}
}
use of com.evolveum.midpoint.prism.xnode.MapXNode in project midpoint by Evolveum.
the class SearchFilterType method serializeToXNode.
public MapXNode serializeToXNode() throws SchemaException {
MapXNode xmap = getFilterClauseXNode();
if (description == null) {
return xmap;
} else {
// we have to serialize the map in correct order (see MID-1847): description first, filter clause next
MapXNode newXMap = new MapXNode();
newXMap.put(SearchFilterType.F_DESCRIPTION, new PrimitiveXNode<>(description));
if (xmap != null && !xmap.isEmpty()) {
newXMap.put(xmap.getSingleSubEntry("search filter"));
}
return newXMap;
}
}
use of com.evolveum.midpoint.prism.xnode.MapXNode in project midpoint by Evolveum.
the class TestFundamentals method testRawTypeClone.
@Test
public void testRawTypeClone() throws Exception {
System.out.println("\n\n===[ testRawTypeClone ]===\n");
// GIVEN
QName typeQName = new QName("abcdef");
MapXNode mapXNode = new MapXNode();
mapXNode.setTypeQName(typeQName);
RawType rawType = new RawType(mapXNode, PrismTestUtil.getPrismContext());
// WHEN
RawType rawTypeClone = rawType.clone();
// THEN
assertEquals("Wrong or missing type QName", typeQName, rawTypeClone.getXnode().getTypeQName());
}
Aggregations