Examples of IAccountResource


Examples of org.zanata.apicompat.rest.client.IAccountResource

                createClientProxyFactory(ADMIN, ADMIN_KEY);
        UnimplementedIAccountResource accountClient =
                super.createProxy(proxyFactory,
                        UnimplementedIAccountResource.class,
                        "/accounts/u/sampleaccount");
        IAccountResource originalAccountClient =
                super.createProxy(proxyFactory, IAccountResource.class,
                        "/accounts/u/sampleaccount");
        ClientResponse putResponse = accountClient.putJson(a);

        // Assert initial put
        assertThat(putResponse.getStatus(), is(Status.CREATED.getStatusCode()));
        putResponse.releaseConnection();

        // Modified Account
        a.setName("New Account Name");
        putResponse = accountClient.putJson(a);
        putResponse.releaseConnection();

        // Assert modification
        assertThat(putResponse.getStatus(), is(Status.OK.getStatusCode()));

        // Retrieve again
        Account a2 = originalAccountClient.get().getEntity();
        assertThat(a2.getUsername(), is(a.getUsername()));
        assertThat(a2.getApiKey(), is(a.getApiKey()));
        assertThat(a2.getEmail(), is(a.getEmail()));
        assertThat(a2.getName(), is(a.getName()));
        assertThat(a2.getPasswordHash(), is(a.getPasswordHash()));
View Full Code Here

Examples of org.zanata.apicompat.rest.client.IAccountResource

    }

    @Test
    @RunAsClient
    public void getAccountXml() throws Exception {
        IAccountResource accountClient =
                super.createProxy(createClientProxyFactory(ADMIN, ADMIN_KEY),
                        IAccountResource.class, "/accounts/u/demo");
        ClientResponse<Account> accountResponse = accountClient.get();
        Account account = accountResponse.getEntity();

        // Assert correct parsing of all properties
        assertThat(account.getUsername(), is("demo"));
        assertThat(account.getApiKey(), is("23456789012345678901234567890123"));
View Full Code Here

Examples of org.zanata.apicompat.rest.client.IAccountResource

    }

    @Test
    @RunAsClient
    public void getAccountXmlUnauthorized() throws Exception {
        IAccountResource accountClient =
                super.createProxy(
                        createClientProxyFactory(TRANSLATOR, TRANSLATOR_KEY),
                        IAccountResource.class, "/accounts/u/demo");
        ClientResponse<Account> accountResponse = accountClient.get();
        accountResponse.releaseConnection();

        // Not authorized for non-admins
        assertThat(accountResponse.getResponseStatus().getStatusCode(),
                is(Status.UNAUTHORIZED.getStatusCode()));
View Full Code Here

Examples of org.zanata.apicompat.rest.client.IAccountResource

        // New Account
        Account a =
                new Account("aacount2@localhost.com", "Sample Account",
                        "sampleaccount", "/9Se/pfHeUH8FJ4asBD6jQ==");

        IAccountResource accountClient =
                super.createProxy(createClientProxyFactory(ADMIN, ADMIN_KEY),
                        IAccountResource.class, "/accounts/u/sampleaccount");
        ClientResponse putResponse = accountClient.put(a);

        // Assert initial put
        assertThat(putResponse.getStatus(), is(Status.CREATED.getStatusCode()));
        putResponse.releaseConnection();

        // Modified Account
        a.setName("New Account Name");
        putResponse = accountClient.put(a);
        putResponse.releaseConnection();

        // Assert modification
        assertThat(putResponse.getStatus(), is(Status.OK.getStatusCode()));

        // Retrieve again
        Account a2 = accountClient.get().getEntity();
        assertThat(a2.getUsername(), is(a.getUsername()));
        assertThat(a2.getApiKey(), is(a.getApiKey()));
        assertThat(a2.getEmail(), is(a.getEmail()));
        assertThat(a2.getName(), is(a.getName()));
        assertThat(a2.getPasswordHash(), is(a.getPasswordHash()));
View Full Code Here

Examples of org.zanata.apicompat.rest.client.IAccountResource

        // New Account
        Account a =
                new Account("aacount2@localhost.com", "Sample Account",
                        "sampleaccount", "/9Se/pfHeUH8FJ4asBD6jQ==");

        IAccountResource accountClient =
                super.createProxy(createClientProxyFactory(TRANSLATOR, TRANSLATOR_KEY),
                        IAccountResource.class, "/accounts/u/sampleaccount");
        ClientResponse putResponse = accountClient.put(a);

        // Assert initial put
        assertThat(putResponse.getStatus(), is(Status.UNAUTHORIZED.getStatusCode()));
        putResponse.releaseConnection();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.