Search in sources :

Example 6 with LogfileTestTailer

use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.

the class TestWSSecurity method test136AddRoleAsDarthAdder.

@Test
public void test136AddRoleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test136AddRoleAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    RoleType role = ModelClientUtil.unmarshallFile(ROLE_MODIFIER_FILE);
    /// WHEN
    addObject(role);
    // THEN
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "ADD_OBJECT");
    tailer.assertAudit(4);
    assertObjectCount(UserType.class, 6);
    assertObjectCount(RoleType.class, 6);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) Test(org.testng.annotations.Test)

Example 7 with LogfileTestTailer

use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.

the class TestWSSecurity method test123GetConfigAsNobodyGoodPasswordDigest.

@Test
public void test123GetConfigAsNobodyGoodPasswordDigest() throws Exception {
    final String TEST_NAME = "test123GetConfigAsNobodyGoodPasswordDigest";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOBODY_USERNAME, USER_NOBODY_PASSWORD, WSConstants.PW_DIGEST);
    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
        AssertJUnit.fail("Unexpected success");
    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");
    }
    tailer.tail();
    assertAuditLoginFailed(tailer, "no authorizations");
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.testng.annotations.Test)

Example 8 with LogfileTestTailer

use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.

the class TestWSSecurity method test134GetConfigAsDarthAdderGoodPasswordDigest.

@Test
public void test134GetConfigAsDarthAdderGoodPasswordDigest() throws Exception {
    final String TEST_NAME = "test134GetConfigAsDarthAdderGoodPasswordDigest";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);
    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    /// WHEN
    modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
    // THEN
    assertSuccess(resultHolder);
    tailer.tail();
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    tailer.assertAudit(2);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) Test(org.testng.annotations.Test)

Example 9 with LogfileTestTailer

use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.

the class TestWSSecurity method test160ChangeDarthAdderPasswordSatisfiesPolicyShortcut.

@Test
public void test160ChangeDarthAdderPasswordSatisfiesPolicyShortcut() throws Exception {
    final String TEST_NAME = "test160ChangeDarthAdderPasswordSatisfiesPolicyShortcut";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);
    ProtectedStringType protectedString = new ProtectedStringType();
    protectedString.getContent().add(USER_DARTHADDER_PASSWORD_NEW1);
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "credentials/password/value", ModificationTypeType.REPLACE, protectedString);
    XMLGregorianCalendar startTs = TestUtil.currentTime();
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    // THEN
    assertSuccess(deltaOpList);
    XMLGregorianCalendar endTs = TestUtil.currentTime();
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT");
    tailer.assertAudit(4);
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD_NEW1, WSConstants.PW_DIGEST);
    UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
    display(user);
    assertPasswordModifyMetadata(user, USER_DARTHADDER_OID, startTs, endTs);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 10 with LogfileTestTailer

use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.

the class TestWSSanity method test020AddResourceOpenDj.

@Test
public void test020AddResourceOpenDj() throws Exception {
    final String TEST_NAME = "test020AddResourceOpenDj";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    ResourceType resource = ModelClientUtil.unmarshallFile(RESOURCE_OPENDJ_FILE);
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setObjectType(getTypeQName(ResourceType.class));
    delta.setChangeType(ChangeTypeType.ADD);
    delta.setObjectToAdd(resource);
    deltaList.getDelta().add(delta);
    ModelExecuteOptionsType options = new ModelExecuteOptionsType();
    options.setIsImport(Boolean.TRUE);
    XMLGregorianCalendar startTs = TestUtil.currentTime();
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, options);
    // THEN
    assertSuccess(deltaOpList);
    String oid = deltaOpList.getDeltaOperation().get(0).getObjectDelta().getOid();
    XMLGregorianCalendar endTs = TestUtil.currentTime();
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "ADD_OBJECT");
    tailer.assertAudit(4);
    assertEquals("Wrong OID", RESOURCE_OPENDJ_OID, oid);
    ResourceType resourceAfter = getObject(ResourceType.class, RESOURCE_OPENDJ_OID);
    display(resourceAfter);
    assertEquals("Wrong connector OID", connectorLdapOid, resourceAfter.getConnectorRef().getOid());
    assertCreateMetadata(resourceAfter, USER_ADMINISTRATOR_OID, startTs, endTs);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) Test(org.testng.annotations.Test)

Aggregations

LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)48 Test (org.testng.annotations.Test)48 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)28 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)26 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)21 Holder (javax.xml.ws.Holder)21 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)21 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)13 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)11 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)9 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)8 Task (com.evolveum.midpoint.task.api.Task)8 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)5 LoggingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)5 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)5 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)3 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)3 ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)2 SubSystemLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)2 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)2