Package org.zanata.apicompat.rest.dto

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


        IProjectResource projectClient =
                super.createProxy(
                        createClientProxyFactory(TRANSLATOR, TRANSLATOR_KEY),
                        IProjectResource.class, "/projects/p/sample-project");
        ClientResponse<Project> projectResponse = projectClient.get();
        Project project = projectResponse.getEntity();

        // Assert correct parsing of all properties
        assertThat(project.getId(), is("sample-project"));
        assertThat(project.getName(), is("Sample Project"));
        assertThat(project.getDescription(), is("An example Project"));
        assertThat(project.getIterations().size(), is(3));
    }
View Full Code Here


    @Test
    @RunAsClient
    public void putProjectXml() throws Exception {
        // New Project
        Project p =
                new Project("new-project", "New Project",
                        ProjectType.Podir.toString(),
                        "This is a New Sample Project");

        IProjectResource projectClient =
                super.createProxy(createClientProxyFactory(ADMIN, ADMIN_KEY),
                        IProjectResource.class, "/projects/p/new-project");
        ClientResponse putResponse = projectClient.put(p);

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

        // Modified Project
        p.setDescription("This is an updated project");
        putResponse = projectClient.put(p);

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

        // Retrieve again
        Project p2 = projectClient.get().getEntity();
        assertThat(p2.getId(), is(p.getId()));
        assertThat(p2.getName(), is(p.getName()));
        assertThat(p2.getDescription(), is(p.getDescription()));
        assertThat(p2.getIterations(), nullValue());
    }
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200)); // Ok
                assertJaxbUnmarshal(response, Projects.class);
                Projects projects = jaxbUnmarshal(response, Projects.class);
                Project sampleProject = null;

                // find sample project
                for (Project p : projects.projects) {
                    if (p.getId().equals("sample-project")) {
                        sampleProject = p;
                    }
                }

                // Assertions on individual project
                assertThat(sampleProject, notNullValue());
                assertThat(sampleProject.getId(), is("sample-project"));
                assertThat(sampleProject.getName(), is("Sample Project"));
                assertThat(sampleProject.getLinks().size(), is(1));
            }
        }.run();
    }
View Full Code Here

        new ResourceRequest(getRestEndpointUrl("/projects/p/new-project"),
                "PUT", getAuthorizedEnvironment()) {
            @Override
            protected void prepareRequest(ClientRequest request) {
                // New Project
                Project p =
                        new Project("new-project", "New Project",
                                ProjectType.Podir.toString(),
                                "This is a New Sample Project");

                request.body(MediaTypes.APPLICATION_ZANATA_PROJECT_JSON,
                        jsonMarshal(p));
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200)); // Ok
                assertJsonUnmarshal(response, Project.class);
                Project project = jsonUnmarshal(response, Project.class);

                // Assert correct parsing of all properties
                assertThat(project.getId(), is("sample-project"));
                assertThat(project.getName(), is("Sample Project"));
                assertThat(project.getDescription(), is("An example Project"));
                assertThat(project.getIterations().size(), is(3));
            }
        }.run();
    }
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200)); // Ok
                List<Project> projects = jsonParse(response);
                Project sampleProject = null;

                // find sample project
                for (Project p : projects) {
                    if (p.getId().equals("sample-project")) {
                        sampleProject = p;
                    }
                }

                // Assertions on individual project
                assertThat(sampleProject, notNullValue());
                assertThat(sampleProject.getId(), is("sample-project"));
                assertThat(sampleProject.getName(), is("Sample Project"));
                assertThat(sampleProject.getLinks().size(), is(1));
            }
        }.run();
    }
View Full Code Here

TOP

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

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.