Search in sources :

Example 56 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class TestPreviewChanges method modifyUserAddAccountImplicitExplicitSameReverse.

private void modifyUserAddAccountImplicitExplicitSameReverse(String bundleName, ObjectSource<PrismObject<ShadowType>> accountSource, ObjectChecker<ModelContext<UserType>> checker) throws Exception {
    final String TEST_NAME = bundleName + "ImplicitExplicitSameReverse";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestPreviewChanges.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<ShadowType> account = accountSource.get();
    ObjectDelta<UserType> userDelta = ObjectDelta.createEmptyModifyDelta(UserType.class, USER_JACK_OID, prismContext);
    PrismReferenceValue accountRefVal = new PrismReferenceValue();
    accountRefVal.setObject(account);
    ReferenceDelta accountRefDelta = ReferenceDelta.createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
    userDelta.addModification(accountRefDelta);
    ObjectDelta<ShadowType> accountDelta = account.createAddDelta();
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(accountDelta, userDelta);
    doPreview(deltas, checker, task, result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 57 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class TestWSSanity method test112CheckJackAccountShadowRaw.

@Test
public void test112CheckJackAccountShadowRaw() throws Exception {
    final String TEST_NAME = "test112CheckJackAccountShadowRaw";
    displayTestTitle(TEST_NAME);
    Holder<ObjectType> objectHolder = new Holder<>();
    Holder<OperationResultType> resultHolder = new Holder<>();
    // WHEN
    modelPort.getObject(ModelClientUtil.getTypeQName(ShadowType.class), accountJackOid, ModelClientUtil.createRootGetOptions(ModelClientUtil.createRawGetOption()), objectHolder, resultHolder);
    // THEN
    assertSuccess(resultHolder);
    ShadowType shadow = (ShadowType) objectHolder.value;
    display(shadow);
    assertAttribute(shadow, ATTR_ICF_NAME_NAME, "uid=" + USER_JACK_USERNAME + "," + openDJController.getSuffixPeople());
    assertNoAttribute(shadow, "uid");
    assertNoAttribute(shadow, "givenName");
    assertNoAttribute(shadow, "sn");
    assertNoAttribute(shadow, "cn");
    assertNoAttribute(shadow, "displayName");
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) Holder(javax.xml.ws.Holder) Test(org.testng.annotations.Test)

Example 58 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class TestWSSanity method test111CheckJackAccountShadow.

@Test
public void test111CheckJackAccountShadow() throws Exception {
    final String TEST_NAME = "test111CheckJackAccountShadow";
    displayTestTitle(TEST_NAME);
    Holder<ObjectType> objectHolder = new Holder<>();
    Holder<OperationResultType> resultHolder = new Holder<>();
    // WHEN
    modelPort.getObject(ModelClientUtil.getTypeQName(ShadowType.class), accountJackOid, null, objectHolder, resultHolder);
    // THEN
    assertSuccess(resultHolder);
    ShadowType shadow = (ShadowType) objectHolder.value;
    display(shadow);
    assertAttribute(shadow, ATTR_ICF_NAME_NAME, "uid=" + USER_JACK_USERNAME + "," + openDJController.getSuffixPeople());
    assertAttribute(shadow, "uid", "jack");
    assertAttribute(shadow, "givenName", "Jack");
    assertAttribute(shadow, "sn", "Sparrow");
    assertAttribute(shadow, "cn", "Jack Sparrow");
    assertAttribute(shadow, "displayName", "Jack Sparrow");
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) Holder(javax.xml.ws.Holder) Test(org.testng.annotations.Test)

Example 59 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType 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 60 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType 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)

Aggregations

ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)243 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)126 Test (org.testng.annotations.Test)97 Task (com.evolveum.midpoint.task.api.Task)82 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)79 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)78 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)68 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)55 ArrayList (java.util.ArrayList)51 Holder (javax.xml.ws.Holder)48 QName (javax.xml.namespace.QName)32 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)30 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)29 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)28 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)26 PrismObject (com.evolveum.midpoint.prism.PrismObject)25 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)25 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)24 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)22