use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test141GetUserAdministratorByNopasswordBadPassword.
@Test
public void test141GetUserAdministratorByNopasswordBadPassword() {
final String TEST_NAME = "test140GetUserAdministratorByNopassword";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_NOPASSWORD_USERNAME, "bad");
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
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 test401AddUserTemplateOverwrite.
@Test
public void test401AddUserTemplateOverwrite() throws Exception {
final String TEST_NAME = "test401AddUserTemplateOverwrite";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/objectTemplates");
client.query("options", "overwrite");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(USER_TEMPLATE_FILE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertEquals("Expected 201 but got " + response.getStatus(), 201, response.getStatus());
String location = response.getHeaderString("Location");
String expected = ENDPOINT_ADDRESS + "/objectTemplates/" + USER_TEMPLATE_OID;
assertEquals("Unexpected location, expected: " + expected + " but was " + location, expected, location);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(4);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
getDummyAuditService().assertHasDelta(1, ChangeType.ADD, ObjectTemplateType.class);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test002GetNonExistingUser.
@Test
public void test002GetNonExistingUser() {
final String TEST_NAME = "test002GetNonExistingUser";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/12345");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 404);
OperationResultType result = response.readEntity(OperationResultType.class);
assertNotNull("Error response must contain operation result", result);
LOGGER.info("Returned result: {}", result);
assertEquals("Unexpected operation result status", OperationResultStatusType.FATAL_ERROR, result.getStatus());
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 test016GetAuthBadPassword.
@Test
public void test016GetAuthBadPassword() {
final String TEST_NAME = "test016GetAuthBadPassword";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_ADMINISTRATOR_USERNAME, "forgot");
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 401);
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 test103AddUserBadTargetCollection.
@Test
public void test103AddUserBadTargetCollection() throws Exception {
final String TEST_NAME = "test103AddUserBadTargetCollection";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/objectTemplates");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(USER_DARTHADDER_FILE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertStatus(response, 400);
OperationResultType result = response.readEntity(OperationResultType.class);
assertNotNull("Error response must contain operation result", result);
LOGGER.info("Returned result: {}", result);
assertEquals("Unexpected operation result status", OperationResultStatusType.FATAL_ERROR, result.getStatus());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
Aggregations