Java Code Examples for org.apache.cxf.jaxrs.client.Client#type()

The following examples show how to use org.apache.cxf.jaxrs.client.Client#type() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReconciliationITCase.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Test
public void importCSV() {
    ReconciliationService service = adminClient.getService(ReconciliationService.class);
    Client client = WebClient.client(service);
    client.type(RESTHeaders.TEXT_CSV);

    CSVPullSpec spec = new CSVPullSpec.Builder(AnyTypeKind.USER.name(), "username").build();
    InputStream csv = getClass().getResourceAsStream("/test1.csv");

    List<ProvisioningReport> results = service.pull(spec, csv);
    assertEquals(AnyTypeKind.USER.name(), results.get(0).getAnyType());
    assertNotNull(results.get(0).getKey());
    assertEquals("donizetti", results.get(0).getName());
    assertEquals("donizetti", results.get(0).getUidValue());
    assertEquals(ResourceOperation.CREATE, results.get(0).getOperation());
    assertEquals(ProvisioningReport.Status.SUCCESS, results.get(0).getStatus());

    UserTO donizetti = userService.read(results.get(0).getKey());
    assertNotNull(donizetti);
    assertEquals("Gaetano", donizetti.getPlainAttr("firstname").get().getValues().get(0));
    assertEquals(1, donizetti.getPlainAttr("loginDate").get().getValues().size());

    UserTO cimarosa = userService.read(results.get(1).getKey());
    assertNotNull(cimarosa);
    assertEquals("Domenico Cimarosa", cimarosa.getPlainAttr("fullname").get().getValues().get(0));
    assertEquals(2, cimarosa.getPlainAttr("loginDate").get().getValues().size());
}
 
Example 2
Source File: ReconciliationRestClient.java    From syncope with Apache License 2.0 5 votes vote down vote up
public static ArrayList<ProvisioningReport> pull(final CSVPullSpec spec, final InputStream csv) {
    ReconciliationService service = getService(ReconciliationService.class);
    Client client = WebClient.client(service);
    client.type(RESTHeaders.TEXT_CSV);

    ArrayList<ProvisioningReport> result = service.pull(spec, csv).stream().
            collect(Collectors.toCollection(ArrayList::new));

    SyncopeConsoleSession.get().resetClient(ReconciliationService.class);

    return result;
}
 
Example 3
Source File: SAML2IdPsRestClient.java    From syncope with Apache License 2.0 5 votes vote down vote up
public static void importIdPs(final InputStream input) {
    SAML2IdPService service = getService(SAML2IdPService.class);
    Client client = WebClient.client(service);
    client.type(MediaType.APPLICATION_XML);

    service.importFromMetadata(input);

    SyncopeConsoleSession.get().resetClient(SAML2IdPService.class);
}
 
Example 4
Source File: BpmnProcessRestClient.java    From syncope with Apache License 2.0 4 votes vote down vote up
private static BpmnProcessService getService(final MediaType mediaType) {
    BpmnProcessService service = getService(BpmnProcessService.class);
    Client client = WebClient.client(service);
    client.type(mediaType);
    return service;
}