Package org.zanata.apicompat.rest.dto

Examples of org.zanata.apicompat.rest.dto.ProjectIteration


            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(Status.OK.getStatusCode())); // 200
                assertJsonUnmarshal(response, ProjectIteration.class);

                ProjectIteration it =
                        jsonUnmarshal(response, ProjectIteration.class);
                assertThat(it.getId(), is("1.0"));
            }

        }.run();
    }
View Full Code Here


    }

    @Test
    @RunAsClient
    public void putJsonProjectIteration() throws Exception {
        final ProjectIteration newIteration =
                new ProjectIteration("new-iteration");

        new ResourceRequest(
                getRestEndpointUrl("/projects/p/sample-project/iterations/i/"
                        + newIteration.getId()), "PUT",
                getAuthorizedEnvironment()) {
            @Override
            protected void prepareRequest(ClientRequest request) {
                request.body(
                        MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON,
                        jsonMarshal(newIteration));
            };

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(),
                        is(Status.CREATED.getStatusCode())); // 201
            }

        }.run();

        // Retreive it again
        IProjectIterationResource iterationClient =
                super.createProxy(
                        createClientProxyFactory(TRANSLATOR, TRANSLATOR_KEY),
                        IProjectIterationResource.class,
                        "/projects/p/sample-project/iterations/i/"
                                + newIteration.getId());

        ClientResponse<ProjectIteration> getResponse = iterationClient.get();

        assertThat(getResponse.getStatus(), is(Status.OK.getStatusCode())); // 200

        ProjectIteration it = getResponse.getEntity();
        assertThat(it.getId(), is("new-iteration"));
    }
View Full Code Here

                        "/projects/p/sample-project/iterations/i/1.0");
        ClientResponse<ProjectIteration> response = iterationClient.get();

        assertThat(response.getStatus(), is(Status.OK.getStatusCode())); // 200

        ProjectIteration it = response.getEntity();
        assertThat(it.getId(), is("1.0"));
    }
View Full Code Here

    }

    @Test
    @RunAsClient
    public void putXmlProjectIteration() throws Exception {
        ProjectIteration newIteration = new ProjectIteration("new-iteration");

        IProjectIterationResource iterationClient =
                super.createProxy(createClientProxyFactory(ADMIN, ADMIN_KEY),
                        IProjectIterationResource.class,
                        "/projects/p/sample-project/iterations/i/"
                                + newIteration.getId());
        ClientResponse response = iterationClient.put(newIteration);

        assertThat(response.getStatus(), is(Status.CREATED.getStatusCode())); // 201
        response.releaseConnection();

        // Retreive it again
        ClientResponse<ProjectIteration> getResponse = iterationClient.get();

        assertThat(getResponse.getStatus(), is(Status.OK.getStatusCode())); // 200

        ProjectIteration it = getResponse.getEntity();
        assertThat(it.getId(), is("new-iteration"));
    }
View Full Code Here

TOP

Related Classes of org.zanata.apicompat.rest.dto.ProjectIteration

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.