Search in sources :

Example 51 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestActivationComputer method testGetDraftAdministrativeEnabled.

@Test
public void testGetDraftAdministrativeEnabled() throws Exception {
    System.out.println("\n===[ testGetDraftAdministrativeEnabled ]===\n");
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.DISABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_DRAFT, activationType);
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.DISABLED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) Test(org.testng.annotations.Test)

Example 52 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestActivationComputer method testGetAdministrativeArchived.

@Test
public void testGetAdministrativeArchived() throws Exception {
    System.out.println("\n===[ testGetAdministrativeArchived ]===\n");
    // GIVEN
    Clock clock = createClock(SUMMER_SOLSTICE);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.ARCHIVED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(null, activationType);
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.ARCHIVED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) Test(org.testng.annotations.Test)

Example 53 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestActivationComputer method testGetProposedAdministrativeEnabled.

@Test
public void testGetProposedAdministrativeEnabled() throws Exception {
    System.out.println("\n===[ testGetProposedAdministrativeEnabled ]===\n");
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.DISABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_PROPOSED, activationType);
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.DISABLED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) Test(org.testng.annotations.Test)

Example 54 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestDiffEquals method testAssignmentEquals.

@Test
public void testAssignmentEquals() throws Exception {
    System.out.println("\n\n===[ testAssignmentEquals ]===\n");
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    AssignmentType a1a = new AssignmentType();
    prismContext.adopt(a1a);
    a1a.setDescription("descr1");
    AssignmentType a2 = new AssignmentType();
    prismContext.adopt(a2);
    a2.setDescription("descr2");
    AssignmentType a1b = new AssignmentType();
    prismContext.adopt(a1b);
    a1b.setDescription("descr1");
    AssignmentType a1m = new AssignmentType();
    prismContext.adopt(a1m);
    a1m.setDescription("descr1");
    MetadataType metadata1m = new MetadataType();
    metadata1m.setCreateTimestamp(XmlTypeConverter.createXMLGregorianCalendar(System.currentTimeMillis()));
    a1m.setMetadata(metadata1m);
    AssignmentType a1e = new AssignmentType();
    prismContext.adopt(a1e);
    a1e.setDescription("descr1");
    ActivationType activation1e = new ActivationType();
    activation1e.setEffectiveStatus(ActivationStatusType.ENABLED);
    a1e.setActivation(activation1e);
    // WHEN
    assertFalse(a1a.equals(a2));
    assertFalse(a1b.equals(a2));
    assertFalse(a1m.equals(a2));
    assertFalse(a1e.equals(a2));
    assertFalse(a2.equals(a1a));
    assertFalse(a2.equals(a1b));
    assertFalse(a2.equals(a1m));
    assertFalse(a2.equals(a1e));
    assertTrue(a1a.equals(a1a));
    assertTrue(a1b.equals(a1b));
    assertTrue(a1m.equals(a1m));
    assertTrue(a1e.equals(a1e));
    assertTrue(a2.equals(a2));
    assertTrue(a1a.equals(a1b));
    assertTrue(a1b.equals(a1a));
    assertTrue(a1a.equals(a1m));
    assertTrue(a1b.equals(a1m));
    assertTrue(a1m.equals(a1a));
    assertTrue(a1m.equals(a1b));
    assertTrue(a1m.equals(a1e));
    assertTrue(a1a.equals(a1e));
    assertTrue(a1b.equals(a1e));
    assertTrue(a1e.equals(a1a));
    assertTrue(a1e.equals(a1b));
    assertTrue(a1e.equals(a1m));
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) Test(org.testng.annotations.Test)

Example 55 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class TestDiffEquals method testAssignmentHashcode.

@Test
public void testAssignmentHashcode() throws Exception {
    LOGGER.info("\n\n===[ testAssignmentHashcode ]===\n");
    System.out.println("\n\n===[ testAssignmentHashcode ]===\n");
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    AssignmentType a1a = new AssignmentType();
    prismContext.adopt(a1a);
    a1a.setDescription("descr1");
    AssignmentType a2 = new AssignmentType();
    prismContext.adopt(a2);
    a2.setDescription("descr2");
    AssignmentType a1b = new AssignmentType();
    prismContext.adopt(a1b);
    a1b.setDescription("descr1");
    AssignmentType a1m = new AssignmentType();
    prismContext.adopt(a1m);
    a1m.setDescription("descr1");
    MetadataType metadata1m = new MetadataType();
    metadata1m.setCreateTimestamp(XmlTypeConverter.createXMLGregorianCalendar(System.currentTimeMillis()));
    a1m.setMetadata(metadata1m);
    AssignmentType a1e = new AssignmentType();
    prismContext.adopt(a1e);
    a1e.setDescription("descr1");
    ActivationType activation1e = new ActivationType();
    activation1e.setEffectiveStatus(ActivationStatusType.ENABLED);
    a1e.setActivation(activation1e);
    // WHEN
    assertFalse(a1a.hashCode() == a2.hashCode());
    assertFalse(a1b.hashCode() == a2.hashCode());
    assertFalse(a1m.hashCode() == a2.hashCode());
    assertFalse(a1e.hashCode() == a2.hashCode());
    assertFalse(a2.hashCode() == a1a.hashCode());
    assertFalse(a2.hashCode() == a1b.hashCode());
    assertFalse(a2.hashCode() == a1m.hashCode());
    assertFalse(a2.hashCode() == a1e.hashCode());
    assertTrue(a1a.hashCode() == a1a.hashCode());
    assertTrue(a1b.hashCode() == a1b.hashCode());
    assertTrue(a1m.hashCode() == a1m.hashCode());
    assertTrue(a1e.hashCode() == a1e.hashCode());
    assertTrue(a2.hashCode() == a2.hashCode());
    assertTrue(a1a.hashCode() == a1b.hashCode());
    assertTrue(a1b.hashCode() == a1a.hashCode());
    assertTrue(a1a.hashCode() == a1m.hashCode());
    assertTrue(a1b.hashCode() == a1m.hashCode());
    assertTrue(a1m.hashCode() == a1a.hashCode());
    assertTrue(a1m.hashCode() == a1b.hashCode());
    assertTrue(a1m.hashCode() == a1e.hashCode());
    assertTrue(a1a.hashCode() == a1e.hashCode());
    assertTrue(a1b.hashCode() == a1e.hashCode());
    assertTrue(a1e.hashCode() == a1a.hashCode());
    assertTrue(a1e.hashCode() == a1b.hashCode());
    assertTrue(a1e.hashCode() == a1m.hashCode());
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) Test(org.testng.annotations.Test)

Aggregations

ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)59 Test (org.testng.annotations.Test)34 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)22 Task (com.evolveum.midpoint.task.api.Task)13 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)13 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)13 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)12 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)10 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)9 ObjectWrapperFactory (com.evolveum.midpoint.web.component.prism.ObjectWrapperFactory)5 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)5 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)4 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)4 QName (javax.xml.namespace.QName)4 TestValidityRecomputeTask (com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)3 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)3 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)3 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)3