Package javax.ws.rs.core

Examples of javax.ws.rs.core.Response


        // set connector capabilities
        connectorTO.addCapability(ConnectorCapability.TWO_PHASES_CREATE);
        connectorTO.addCapability(ConnectorCapability.ONE_PHASE_CREATE);
        connectorTO.addCapability(ConnectorCapability.TWO_PHASES_UPDATE);

        Response response = connectorService.create(connectorTO);
        if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
            throw (RuntimeException) clientExceptionMapper.fromResponse(response);
        }

        ConnInstanceTO actual = getObject(response, ConnInstanceTO.class, connectorService);
View Full Code Here


        // ----------------------------------

        // ----------------------------------
        // Create a new connector instance.
        // ----------------------------------
        Response response = connectorService.create(connInstanceTO);
        if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
            throw (RuntimeException) clientExceptionMapper.fromResponse(response);
        }

        connInstanceTO = getObject(response, ConnInstanceTO.class, connectorService);
View Full Code Here

        connectorTO.setConfiguration(conf);

        try {
            assertFalse(connectorService.check(connectorTO));

            Response response = connectorService.create(connectorTO);
            if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
                throw (RuntimeException) clientExceptionMapper.fromResponse(response);
            }

            connectorTO = getObject(response, ConnInstanceTO.class, configurationService);
            assertNotNull(connectorTO);
View Full Code Here

        // 1. set create request not allowed
        ConfigurationTO configurationTO = new ConfigurationTO();
        configurationTO.setKey("createRequest.allowed");
        configurationTO.setValue("false");

        Response response = configurationService.create(configurationTO);
        assertNotNull(response);
        assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
        configurationTO = getObject(response, ConfigurationTO.class, configurationService);
        assertNotNull(configurationTO);

        UserTO userTO = UserTestITCase.getUniqueSampleTO("selfcreate@syncope.apache.org");

        // 2. get unauthorized when trying to request user create
        try {
            createUserRequest(userRequestService, new UserRequestTO(userTO));
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            assertNotNull(e.getException(SyncopeClientExceptionType.UnauthorizedRole));
        }

        // 3. set create request allowed
        configurationTO.setValue("true");

        response = configurationService.create(configurationTO);
        assertNotNull(response);
        assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
        configurationTO = getObject(response, ConfigurationTO.class, configurationService);
        assertNotNull(configurationTO);

        // 4. as anonymous, request user create works
        UserRequestService userRequestService2 = setupCredentials(userRequestService, UserRequestService.class, null, null);
View Full Code Here

            assertEquals(HttpStatus.NOT_FOUND, e.getStatusCode());
        }
    }

    private Response createUserRequest(UserRequestService service, final UserRequestTO userRequestTO) {
        Response response = service.create(userRequestTO);
        if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
            throw (RuntimeException) clientExceptionMapper.fromResponse(response);
        }
        return response;
    }
View Full Code Here

    public void create() {
        DerivedSchemaTO schema = new DerivedSchemaTO();
        schema.setName("derived");
        schema.setExpression("derived_sx + '_' + derived_dx");

        Response response = createSchema(AttributableType.USER, SchemaType.DERIVED, schema);
        DerivedSchemaTO actual = getObject(response, DerivedSchemaTO.class, schemaService);
        assertNotNull(actual);

        actual = schemaService.read(AttributableType.USER, SchemaType.DERIVED, actual.getName());
        assertNotNull(actual);
View Full Code Here

        } catch (SyncopeClientCompositeErrorException e) {
            t = e;
            assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));
        } finally {
            // Recreate schema to make test re-runnable
            Response response = createSchema(AttributableType.ROLE, SchemaType.DERIVED, schema);
            assertNotNull(response);
            assertEquals(HttpStatus.CREATED.value(), response.getStatus());
        }
        assertNotNull(t);
    }
View Full Code Here

    @Test
    public void create() {
        SyncPolicyTO policy = buildSyncPolicyTO();

        Response response = createPolicy(policyService, PolicyType.SYNC, policy);
        SyncPolicyTO policyTO = getObject(response, SyncPolicyTO.class, policyService);

        assertNotNull(policyTO);
        assertEquals(PolicyType.SYNC, policyTO.getType());
        assertEquals(TestSyncRule.class.getName(), ((SyncPolicySpec) policyTO.getSpecification()).getUserJavaRule());
View Full Code Here

        PasswordPolicyTO policy = new PasswordPolicyTO();
        policy.setDescription("A simple password policy");
        policy.setSpecification(globalPolicy.getSpecification());

        // create a new password policy using global password as a template
        Response response = createPolicy(policyService, PolicyType.PASSWORD, policy);
        policy = getObject(response, PasswordPolicyTO.class, policyService);

        // read new password policy
        policy = policyService.read(PolicyType.PASSWORD, policy.getId());
View Full Code Here

    }

    @Test
    public void delete() {
        SyncPolicyTO policy = buildSyncPolicyTO();
        Response response = createPolicy(policyService, PolicyType.SYNC, policy);
        SyncPolicyTO policyTO = getObject(response, SyncPolicyTO.class, policyService);
        assertNotNull(policyTO);

        policyService.delete(PolicyType.SYNC, policyTO.getId());
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.