Skip to content

Commit

Permalink
Fixing wstests (MID-4035)
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jun 29, 2017
1 parent 9b3e6c3 commit a078228
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
Expand Up @@ -152,12 +152,18 @@ public abstract class AbstractWebserviceTest {
public static final String USER_NOPASSWORD_USERNAME = "nopassword";

public static final File ROLE_WS_FILE = new File(COMMON_DIR, "role-ws.xml");

public static final File ROLE_READER_FILE = new File(COMMON_DIR, "role-reader.xml");
public static final String ROLE_READER_OID = "eb243068-d48d-11e4-a83a-001e8c717e5b";

public static final File ROLE_ADDER_FILE = new File(COMMON_DIR, "role-adder.xml");

public static final File ROLE_MODIFIER_FILE = new File(COMMON_DIR, "role-modifier.xml");
public static final String ROLE_MODIFIER_OID = "82005ae4-d90b-11e4-bdcc-001e8c717e5b";

public static final File ROLE_WHATEVER_FILE = new File(COMMON_DIR, "role-whatever.xml");
public static final String ROLE_WHATEVER_OID = "7385820e-5cb3-11e7-96a3-1ba6f1dc6281";

public static final File RESOURCE_OPENDJ_FILE = new File(COMMON_DIR, "resource-opendj.xml");
public static final String RESOURCE_OPENDJ_OID = "ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff";

Expand Down Expand Up @@ -480,6 +486,14 @@ protected void displayFault(FaultMessage fault) {
protected void displayTestTitle(String testName) {
TestUtil.displayTestTile(testName);
}

protected void displayWhen(String testName) {
TestUtil.displayWhen(testName);
}

protected void displayThen(String testName) {
TestUtil.displayThen(testName);
}

protected void display(String msg) {
System.out.println(msg);
Expand Down
Expand Up @@ -505,6 +505,9 @@ public void test130AddRolesAndUsersAsAdministrator() throws Exception {

role = ModelClientUtil.unmarshallFile(ROLE_ADDER_FILE);
addObject(role);

role = ModelClientUtil.unmarshallFile(ROLE_WHATEVER_FILE);
addObject(role);

UserType user = ModelClientUtil.unmarshallFile(USER_CYCLOPS_FILE);
String userCyclopsOid = addObject(user);
Expand All @@ -523,7 +526,7 @@ public void test130AddRolesAndUsersAsAdministrator() throws Exception {
assertUser(userAfter, userCyclopsOid, USER_CYCLOPS_USERNAME);

assertObjectCount(UserType.class, 6);
assertObjectCount(RoleType.class, 5);
assertObjectCount(RoleType.class, 6);
}

@Test
Expand Down Expand Up @@ -688,7 +691,7 @@ public void test136AddRoleAsDarthAdder() throws Exception {
tailer.assertAudit(4);

assertObjectCount(UserType.class, 6);
assertObjectCount(RoleType.class, 6);
assertObjectCount(RoleType.class, 7);
}

@Test
Expand All @@ -699,15 +702,17 @@ public void test135AssignRoleAsDarthAdder() throws Exception {
LogfileTestTailer tailer = createLogTailer();

ObjectDeltaListType deltaList = ModelClientUtil.createAssignDeltaList(UserType.class, USER_DARTHADDER_OID,
RoleType.class, ROLE_MODIFIER_OID);
RoleType.class, ROLE_WHATEVER_OID);

try {
// WHEN
displayWhen(TEST_NAME);
modelPort.executeChanges(deltaList, null);

AssertJUnit.fail("Unexpected success");

} catch (SOAPFaultException e) {
displayThen(TEST_NAME);
assertSoapFault(e, "FailedAuthentication", "could not be authenticated or authorized");
}

Expand Down Expand Up @@ -1037,15 +1042,15 @@ public void test162ChangeDarthAdderPasswordViolatesPolicy() throws Exception {
AssertJUnit.fail("Unexpected success");

} catch (FaultMessage e) {
assertFaultMessage(e, PolicyViolationFaultType.class, "password does not satisfy password policies");
assertFaultMessage(e, PolicyViolationFaultType.class, "password does not satisfy");
}

// THEN
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "password does not satisfy password policies");
assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "password does not satisfy");
tailer.assertAudit(4);

UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
Expand Down
22 changes: 22 additions & 0 deletions testing/wstest/src/test/resources/common/role-whatever.xml
@@ -0,0 +1,22 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<role oid="7385820e-5cb3-11e7-96a3-1ba6f1dc6281"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3">
<name>Whatever</name>

</role>

0 comments on commit a078228

Please sign in to comment.