Search in sources :

Example 11 with WebClient

use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.

the class TestAbstractRestService method test502generateValueBadPath.

@Test
public void test502generateValueBadPath() throws Exception {
    final String TEST_NAME = "test502generateValueBadPath";
    displayTestTile(this, TEST_NAME);
    WebClient client = prepareClient();
    client.path("/users/" + USER_DARTHADDER_OID + "/generate");
    getDummyAuditService().clear();
    TestUtil.displayWhen(TEST_NAME);
    Response response = client.post(getRepoFile(POLICY_ITEM_DEFINITION_GENERATE_BAD_PATH));
    TestUtil.displayThen(TEST_NAME);
    displayResponse(response);
    assertEquals("Expected 400 but got " + response.getStatus(), 400, response.getStatus());
    IntegrationTestTools.display("Audit", getDummyAuditService());
    getDummyAuditService().assertRecords(2);
    getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
Also used : Response(javax.ws.rs.core.Response) WebClient(org.apache.cxf.jaxrs.client.WebClient) Test(org.testng.annotations.Test)

Example 12 with WebClient

use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.

the class TestAbstractRestService method test505generatePasswordExecute.

@Test
public void test505generatePasswordExecute() throws Exception {
    final String TEST_NAME = "test505generatePasswordExecute";
    displayTestTile(this, TEST_NAME);
    WebClient client = prepareClient();
    client.path("/users/" + USER_DARTHADDER_OID + "/generate");
    getDummyAuditService().clear();
    TestUtil.displayWhen(TEST_NAME);
    Response response = client.post(getRepoFile(POLICY_ITEM_DEFINITION_GENERATE_PASSWORD_EXECUTE));
    TestUtil.displayThen(TEST_NAME);
    displayResponse(response);
    assertEquals("Expected 200 but got " + response.getStatus(), 200, response.getStatus());
    IntegrationTestTools.display("Audit", getDummyAuditService());
    getDummyAuditService().assertRecords(4);
    getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
    getDummyAuditService().assertHasDelta(1, ChangeType.MODIFY, UserType.class);
//UserType user = loadObject(UserType.class, USER_DARTHADDER_OID);
//TODO assert changed items
}
Also used : Response(javax.ws.rs.core.Response) WebClient(org.apache.cxf.jaxrs.client.WebClient) Test(org.testng.annotations.Test)

Example 13 with WebClient

use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.

the class TestAbstractRestService method test121AddUserDarthAdder.

@Test
public void test121AddUserDarthAdder() throws Exception {
    final String TEST_NAME = "test121AddUserDarthAdder";
    displayTestTile(this, TEST_NAME);
    WebClient client = prepareClient();
    client.path("/users");
    getDummyAuditService().clear();
    TestUtil.displayWhen(TEST_NAME);
    Response response = client.post(getRepoFile(USER_DARTHADDER_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);
}
Also used : Response(javax.ws.rs.core.Response) WebClient(org.apache.cxf.jaxrs.client.WebClient) Test(org.testng.annotations.Test)

Example 14 with WebClient

use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.

the class TestAbstractRestService method test513validateValueImplicitMulti.

@Test
public void test513validateValueImplicitMulti() throws Exception {
    final String TEST_NAME = "test513validateValueImplicitMulti";
    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));
    TestUtil.displayThen(TEST_NAME);
    displayResponse(response);
    traceResponse(response);
    assertEquals("Expected 200 but got " + response.getStatus(), 200, response.getStatus());
    IntegrationTestTools.display("Audit", getDummyAuditService());
    getDummyAuditService().assertRecords(2);
    getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
Also used : Response(javax.ws.rs.core.Response) WebClient(org.apache.cxf.jaxrs.client.WebClient) Test(org.testng.annotations.Test)

Example 15 with WebClient

use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.

the class TestAbstractRestService method test132DarthAdderEnableByAdministrator.

@Test
public void test132DarthAdderEnableByAdministrator() throws Exception {
    final String TEST_NAME = "test132DarthAdderEnableByAdministrator";
    displayTestTile(this, TEST_NAME);
    WebClient client = prepareClient();
    client.path("/users/" + USER_DARTHADDER_OID);
    getDummyAuditService().clear();
    TestUtil.displayWhen(TEST_NAME);
    Response response = client.post(MiscUtil.readFile(getRequestFile(MODIFICATION_ENABLE)));
    TestUtil.displayThen(TEST_NAME);
    displayResponse(response);
    assertStatus(response, 204);
    IntegrationTestTools.display("Audit", getDummyAuditService());
    getDummyAuditService().assertRecords(4);
    getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
    getDummyAuditService().assertHasDelta(1, ChangeType.MODIFY, UserType.class);
    OperationResult result = new OperationResult("test");
    PrismObject<UserType> user = getRepositoryService().getObject(UserType.class, USER_DARTHADDER_OID, null, result);
    assertEquals("Wrong administrativeStatus", ActivationStatusType.ENABLED, user.asObjectable().getActivation().getAdministrativeStatus());
}
Also used : Response(javax.ws.rs.core.Response) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WebClient(org.apache.cxf.jaxrs.client.WebClient) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

WebClient (org.apache.cxf.jaxrs.client.WebClient)107 Response (javax.ws.rs.core.Response)82 Test (org.testng.annotations.Test)46 Test (org.junit.Test)35 SourceResponse (ddf.catalog.operation.SourceResponse)16 Matchers.containsString (org.hamcrest.Matchers.containsString)14 ResourceResponse (ddf.catalog.operation.ResourceResponse)12 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)11 SecureCxfClientFactory (org.codice.ddf.cxf.SecureCxfClientFactory)11 QueryImpl (ddf.catalog.operation.impl.QueryImpl)10 Filter (org.opengis.filter.Filter)10 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)9 Metacard (ddf.catalog.data.Metacard)8 Subject (ddf.security.Subject)8 InputStream (java.io.InputStream)7 Result (ddf.catalog.data.Result)5 IOException (java.io.IOException)5 MalformedURLException (java.net.MalformedURLException)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)4