use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestProtectedString method testParseProtectedStringEncrypted.
@Test
public void testParseProtectedStringEncrypted() throws Exception {
final String TEST_NAME = "testParseProtectedStringEncrypted";
displayTestTitle(TEST_NAME);
// GIVEN
Protector protector = PrismInternalTestUtil.createProtector(XMLCipher.AES_128);
ProtectedStringType protectedStringType = protector.encryptString("salalala");
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
MapXNode protectedStringTypeXNode = ((PrismContextImpl) prismContext).getBeanMarshaller().marshalProtectedDataType(protectedStringType, null);
System.out.println("Protected string type XNode: " + protectedStringTypeXNode.debugDump());
// THEN
ProtectedStringType unmarshalled = new ProtectedStringType();
XNodeProcessorUtil.parseProtectedType(unmarshalled, protectedStringTypeXNode, prismContext, ParsingContext.createDefault());
System.out.println("Unmarshalled value: " + unmarshalled);
assertEquals("Unmarshalled value differs from the original", protectedStringType, unmarshalled);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestProtectedString method testParseProtectedStringHashed.
@Test
public void testParseProtectedStringHashed() throws Exception {
final String TEST_NAME = "testParseProtectedStringHashed";
displayTestTitle(TEST_NAME);
// GIVEN
ProtectedStringType protectedStringType = new ProtectedStringType();
protectedStringType.setClearValue("blabla");
Protector protector = PrismInternalTestUtil.createProtector(XMLCipher.AES_128);
protector.hash(protectedStringType);
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
MapXNode protectedStringTypeXNode = ((PrismContextImpl) prismContext).getBeanMarshaller().marshalProtectedDataType(protectedStringType, null);
System.out.println("Protected string type XNode: " + protectedStringTypeXNode.debugDump());
// THEN
ProtectedStringType unmarshalled = new ProtectedStringType();
XNodeProcessorUtil.parseProtectedType(unmarshalled, protectedStringTypeXNode, prismContext, ParsingContext.createDefault());
System.out.println("Unmarshalled value: " + unmarshalled);
assertEquals("Unmarshalled value differs from the original", protectedStringType, unmarshalled);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestRefinedSchema method testParseFromResourceSimple.
@Test
public void testParseFromResourceSimple() throws JAXBException, SchemaException, SAXException, IOException {
System.out.println("\n===[ testParseFromResourceSimple ]===\n");
// GIVEN
PrismContext prismContext = createInitializedPrismContext();
PrismObject<ResourceType> resource = prismContext.parseObject(RESOURCE_SIMPLE_FILE);
ResourceType resourceType = resource.asObjectable();
// WHEN
RefinedResourceSchema rSchema = RefinedResourceSchemaImpl.parse(resourceType, prismContext);
// THEN
assertNotNull("Refined schema is null", rSchema);
System.out.println("Refined schema");
System.out.println(rSchema.debugDump());
assertRefinedSchema(resourceType, rSchema, null, LayerType.SCHEMA, false);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestDiffEquals method testAssignmentEquivalent.
@Test
public void testAssignmentEquivalent() throws Exception {
System.out.println("\n\n===[ testAssignmentEquivalent ]===\n");
PrismContext prismContext = PrismTestUtil.getPrismContext();
AssignmentType a1 = new AssignmentType(prismContext);
ActivationType a1a = new ActivationType(prismContext);
a1a.setValidFrom(XmlTypeConverter.createXMLGregorianCalendar(new Date()));
a1a.setEffectiveStatus(ActivationStatusType.ENABLED);
a1.setActivation(a1a);
AssignmentType a2 = new AssignmentType(prismContext);
ActivationType a2a = new ActivationType(prismContext);
a2a.setEffectiveStatus(ActivationStatusType.ENABLED);
a2.setActivation(a2a);
// WHEN
assertFalse(a1.equals(a2));
// a bit redundant
assertFalse(a1.asPrismContainerValue().equivalent(a2.asPrismContainerValue()));
assertFalse(a2.equals(a1));
// a bit redundant
assertFalse(a2.asPrismContainerValue().equivalent(a1.asPrismContainerValue()));
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class SearchPanel method searchPerformed.
void searchPerformed(AjaxRequestTarget target) {
PageBase page = (PageBase) getPage();
PrismContext ctx = page.getPrismContext();
Search search = getModelObject();
ObjectQuery query = search.createObjectQuery(ctx);
LOG.debug("Created query: {}", query);
searchPerformed(query, target);
}
Aggregations