use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test512validateValueImplicitSingle.
@Test
public void test512validateValueImplicitSingle() throws Exception {
final String TEST_NAME = "test512validateValueImplicitSingle";
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_SINGLE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertEquals("Expected 200 but got " + response.getStatus(), 200, response.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 test005GetAuthBadUsernameEmptyPassword.
@Test
public void test005GetAuthBadUsernameEmptyPassword() {
final String TEST_NAME = "test005GetAuthBadUsernameEmptyPassword";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient("NoSUCHuser", "");
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 test200searchAllUsers.
@Test
public void test200searchAllUsers() {
final String TEST_NAME = "test200searchAllUsers";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/search");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(new QueryType());
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertStatus(response, 200);
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 test504checkGeneratedValue.
@Test
public void test504checkGeneratedValue() throws Exception {
final String TEST_NAME = "test503generateValueExecute";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/" + USER_DARTHADDER_OID);
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertEquals("Expected 200 but got " + response.getStatus(), 200, response.getStatus());
UserType user = response.readEntity(UserType.class);
assertNotNull("EmployeeNumber must not be null", user.getEmployeeNumber());
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestAbstractRestService method test003GetNoAuthHeaders.
@Test
public void test003GetNoAuthHeaders() {
final String TEST_NAME = "test003GetNoAuthHeaders";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(null, 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);
IntegrationTestTools.display("Audit", getDummyAuditService());
// No records. There are no auth headers so this is not considered to be a login attempt
getDummyAuditService().assertRecords(0);
}
Aggregations