Search in sources :

Example 1 with JaxbValueContainer

use of com.evolveum.midpoint.wf.impl.util.JaxbValueContainer in project midpoint by Evolveum.

the class TestInfrastructure method test100SerializeContext.

@Test(enabled = true)
public void test100SerializeContext() throws Exception {
    final String TEST_NAME = "test100SerializeContext";
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    LensContext<UserType> context = new LensContext<UserType>(UserType.class, prismContext, provisioningService);
    PrismObject<UserType> bill = prismContext.parseObject(USER_BARBOSSA_FILE);
    CryptoUtil.encryptValues(protector, bill);
    ObjectDelta<UserType> userDelta = ObjectDelta.createAddDelta(bill);
    LensFocusContext<UserType> focusContext = context.getOrCreateFocusContext();
    focusContext.setPrimaryDelta(userDelta);
    LensContextType contextType = context.toLensContextType();
    JaxbValueContainer<LensContextType> container = new JaxbValueContainer<LensContextType>(contextType, prismContext);
    container.clearActualValue();
    System.out.println("XML value = " + container.getXmlValue());
    LensContextType contextTypeRetrieved = container.getValue();
    LensContext<UserType> contextRetrieved = LensContext.fromLensContextType(contextTypeRetrieved, prismContext, provisioningService, task, result);
    assertEquals("Context after serialization/deserialization does not match context before it (object to add is changed)", context.getFocusContext().getPrimaryDelta().getObjectToAdd(), contextRetrieved.getFocusContext().getPrimaryDelta().getObjectToAdd());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) JaxbValueContainer(com.evolveum.midpoint.wf.impl.util.JaxbValueContainer) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) LensContext(com.evolveum.midpoint.model.impl.lens.LensContext) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 2 with JaxbValueContainer

use of com.evolveum.midpoint.wf.impl.util.JaxbValueContainer in project midpoint by Evolveum.

the class TestInfrastructure method test101SerializeJaxb.

@Test(enabled = true)
public void test101SerializeJaxb() throws Exception {
    OperationResult result = new OperationResult("test101SerializeJaxb");
    ScheduleType scheduleType = new ScheduleType();
    scheduleType.setInterval(100);
    JaxbValueContainer<ScheduleType> container = new JaxbValueContainer<ScheduleType>(scheduleType, prismContext);
    container.clearActualValue();
    System.out.println("XML value = " + container.getXmlValue());
    ScheduleType scheduleTypeRetrieved = container.getValue();
    assertEquals("Object after serialization/deserialization does not match original one", scheduleType, scheduleTypeRetrieved);
}
Also used : JaxbValueContainer(com.evolveum.midpoint.wf.impl.util.JaxbValueContainer) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Aggregations

AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 JaxbValueContainer (com.evolveum.midpoint.wf.impl.util.JaxbValueContainer)2 Test (org.testng.annotations.Test)2 LensContext (com.evolveum.midpoint.model.impl.lens.LensContext)1 Task (com.evolveum.midpoint.task.api.Task)1