use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test017GetUnauthorizedUser.
@Test
public void test017GetUnauthorizedUser() {
final String TEST_NAME = "test017GetUnauthorizedUser";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_NOBODY_USERNAME, USER_NOBODY_PASSWORD);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(1);
getDummyAuditService().assertFailedLogin(SchemaConstants.CHANNEL_REST_URI);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test135AddUserNopasswordAsDarthAdder.
@Test
public void test135AddUserNopasswordAsDarthAdder() throws Exception {
final String TEST_NAME = "test135AddUserNopasswordAsDarthAdder";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD);
client.path("/users");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(USER_NOPASSWORD_FILE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertStatus(response, 201);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(4);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
getDummyAuditService().assertHasDelta(1, ChangeType.ADD, UserType.class);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test001GetUserAdministrator.
@Test
public void test001GetUserAdministrator() {
final String TEST_NAME = "test001GetUserAdministrator";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 200);
UserType userType = response.readEntity(UserType.class);
assertNotNull("Returned entity in body must not be null.", userType);
LOGGER.info("Returned entity: {}", userType.asPrismObject().debugDump());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test140GetUserAdministratorByNopassword.
@Test
public void test140GetUserAdministratorByNopassword() {
final String TEST_NAME = "test140GetUserAdministratorByNopassword";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_NOPASSWORD_USERNAME, null);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 401);
assertNoEmptyResponse(response);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(1);
getDummyAuditService().assertFailedLogin(SchemaConstants.CHANNEL_REST_URI);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test514validateValueImplicitMultiConflict.
@Test
public void test514validateValueImplicitMultiConflict() throws Exception {
final String TEST_NAME = "test514validateValueImplicitMultiConflict";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/" + USER_DARTHADDER_OID + "/validate");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(POLICY_ITEM_DEFINITION_VALIDATE_IMPLICIT_MULTI_CONFLICT));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
traceResponse(response);
assertEquals("Expected 409 but got " + response.getStatus(), 409, response.getStatus());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
Aggregations