Search in sources :

Example 71 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class ImportTest method assertMetadata.

private <O extends ObjectType> void assertMetadata(O objectType, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) {
    MetadataType metadata = objectType.getMetadata();
    assertNotNull("No metadata in " + objectType, metadata);
    XMLGregorianCalendar createTimestamp = metadata.getCreateTimestamp();
    assertNotNull("No createTimestamp in metadata of " + objectType, createTimestamp);
    TestUtil.assertBetween("Wrong createTimestamp in metadata of " + objectType, startTime, endTime, createTimestamp);
    assertEquals("Wrong channel in metadata of " + objectType, SchemaConstants.CHANNEL_OBJECT_IMPORT_URI, metadata.getCreateChannel());
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar)

Example 72 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertEnableTimestampFocus.

protected void assertEnableTimestampFocus(PrismObject<? extends FocusType> focus, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) {
    XMLGregorianCalendar userDisableTimestamp = focus.asObjectable().getActivation().getEnableTimestamp();
    TestUtil.assertBetween("Wrong user enableTimestamp in " + focus, startTime, endTime, userDisableTimestamp);
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar)

Example 73 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertTrigger.

protected <O extends ObjectType> void assertTrigger(PrismObject<O> object, String handlerUri, XMLGregorianCalendar mid, long tolerance) throws ObjectNotFoundException, SchemaException {
    XMLGregorianCalendar start = XmlTypeConverter.addMillis(mid, -tolerance);
    XMLGregorianCalendar end = XmlTypeConverter.addMillis(mid, tolerance);
    for (TriggerType trigger : object.asObjectable().getTrigger()) {
        if (handlerUri.equals(trigger.getHandlerUri()) && MiscUtil.isBetween(trigger.getTimestamp(), start, end)) {
            return;
        }
    }
    AssertJUnit.fail("Expected that " + object + " will have a trigger but it has not");
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) TriggerType(com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType)

Example 74 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertDisableTimestampFocus.

protected void assertDisableTimestampFocus(PrismObject<? extends FocusType> focus, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) {
    XMLGregorianCalendar userDisableTimestamp = focus.asObjectable().getActivation().getDisableTimestamp();
    TestUtil.assertBetween("Wrong user disableTimestamp in " + focus, startTime, endTime, userDisableTimestamp);
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar)

Example 75 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class TestDummy method test109ModifiedAccountCleanup.

/**
	 * Clean up after caching tests so we won't break subsequent tests.
	 * MID-3481
	 */
@Test
public void test109ModifiedAccountCleanup() throws Exception {
    final String TEST_NAME = "test109ModifiedAccountCleanup";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    OperationResult result = new OperationResult(TestDummy.class.getName() + "." + TEST_NAME);
    rememberShadowFetchOperationCount();
    DummyAccount accountWill = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
    // Modify this back so won't break subsequent tests
    accountWill.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "Flying Dutchman");
    accountWill.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME);
    accountWill.setEnabled(true);
    XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
    // WHEN
    PrismObject<ShadowType> shadow = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, null, result);
    // THEN
    result.computeStatus();
    display("getObject result", result);
    TestUtil.assertSuccess(result);
    assertShadowFetchOperationCountIncrement(1);
    XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
    display("Retrieved account shadow", shadow);
    assertNotNull("No dummy account", shadow);
    checkAccountWill(shadow, result, startTs, endTs);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result);
    checkRepoAccountShadowWill(shadowRepo, startTs, endTs);
    checkConsistency(shadow);
    assertCachingMetadata(shadow, false, startTs, endTs);
    assertSteadyResource();
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Aggregations

XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)336 Test (org.testng.annotations.Test)159 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)130 Task (com.evolveum.midpoint.task.api.Task)104 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)72 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)52 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)44 Date (java.util.Date)36 TestValidityRecomputeTask (com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask)32 ArrayList (java.util.ArrayList)32 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)31 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)31 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)30 AbstractSynchronizationStoryTest (com.evolveum.midpoint.model.intest.sync.AbstractSynchronizationStoryTest)23 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)21 GregorianCalendar (java.util.GregorianCalendar)18 QName (javax.xml.namespace.QName)18 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)15 Duration (javax.xml.datatype.Duration)15 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)14