Package org.zanata.rest.dto

Examples of org.zanata.rest.dto.Account


        HAccount hAccount = accountDAO.getByUsername(username);
        if (hAccount == null) {
            return Response.status(Status.NOT_FOUND)
                    .entity("Username not found").build();
        }
        Account result = new Account();
        transfer(hAccount, result);

        log.debug("HTTP GET result :\n" + result);
        return Response.ok(result).build();
    }
View Full Code Here


            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200));
                assertJaxbUnmarshal(response, Account.class);

                Account account = jaxbUnmarshal(response, Account.class);
                assertThat(account.getUsername(), is("admin"));
                assertThat(account.getPasswordHash(),
                        is("Eyox7xbNQ09MkIfRyH+rjg=="));
                assertThat(account.getEmail(), is("root@localhost"));
                assertThat(account.getApiKey(),
                        is("b6d7044e9ee3b2447c28fb7c50d86d98"));
                assertThat(account.getRoles().size(), is(1)); // 1 roles
            }
        }.run();
    }
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200));
                assertJsonUnmarshal(response, Account.class);

                Account account = jsonUnmarshal(response, Account.class);
                assertThat(account.getUsername(), is("admin"));
                assertThat(account.getPasswordHash(),
                        is("Eyox7xbNQ09MkIfRyH+rjg=="));
                assertThat(account.getEmail(), is("root@localhost"));
                assertThat(account.getApiKey(),
                        is("b6d7044e9ee3b2447c28fb7c50d86d98"));
                assertThat(account.getRoles().size(), is(1)); // 1 role
            }
        }.run();
    }
View Full Code Here

    }

    @Test
    @RunAsClient
    public void xmlPut() throws Exception {
        final Account account =
                new Account("test@testing.com", "Test Account", "testuser",
                        "Eyox7xbNQ09MkIfRyH+rjg==");
        account.setEnabled(false);

        new ResourceRequest(getRestEndpointUrl("/accounts/u/testuser"), "PUT",
                getAuthorizedEnvironment()) {
            @Override
            protected void prepareRequest(ClientRequest request) {
View Full Code Here

    }

    @Test
    @RunAsClient
    public void jsonPut() throws Exception {
        final Account account =
                new Account("test@testing.com", "Test Account", "testuser",
                        "Eyox7xbNQ09MkIfRyH+rjg==");
        account.setEnabled(false);

        new ResourceRequest(getRestEndpointUrl("/accounts/u/testuser"), "PUT",
                getAuthorizedEnvironment()) {
            @Override
            protected void prepareRequest(ClientRequest request) {
View Full Code Here

    }

    @Test
    @RunAsClient
    public void unauthorizedPut() throws Exception {
        final Account account =
                new Account("test@testing.com", "Test Account", "testuser",
                        "Eyox7xbNQ09MkIfRyH+rjg==");
        account.setEnabled(false);

        new ResourceRequest(getRestEndpointUrl("/accounts/u/testuser"), "PUT") {
            @Override
            protected void prepareRequest(ClientRequest request) {
                request.body(MediaTypes.APPLICATION_ZANATA_ACCOUNT_JSON,
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.Account

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.