Package org.zanata.rest.client

Examples of org.zanata.rest.client.IProjectResource


        }
    }

    public void createProjectAndVersion(String projectSlug,
            String iterationSlug, String projectType) {
        IProjectResource projectResource =
                zanataProxyFactory.getProject(projectSlug);
        Project project = new Project();
        project.setDefaultType(projectType);
        project.setId(projectSlug);
        project.setName(projectSlug);

        ClientResponse response = projectResource.put(project);
        checkStatusAndReleaseConnection(response);

        ProjectIteration iteration = new ProjectIteration();
        iteration.setId(iterationSlug);
        IProjectIterationResource projectIteration =
View Full Code Here


        resources.add(projectService);
    }

    @Test
    public void retrieveNonExistingProject() {
        IProjectResource projectService =
                getClientRequestFactory()
                        .createProxy(
                                IProjectResource.class,
                                createBaseURI(RESOURCE_PATH).resolve(
                                        "invalid-project"));

        ClientResponse<Project> response = projectService.get();
        assertThat(response.getStatus(), is(404));
    }
View Full Code Here

        assertThat(response.getStatus(), is(404));
    }

    @Test
    public void retrieveExistingProject() {
        IProjectResource projectService =
                getClientRequestFactory().createProxy(IProjectResource.class,
                        createBaseURI(RESOURCE_PATH).resolve("sample-project"));
        ClientResponse<Project> response = projectService.get();
        assertThat(response.getStatus(), lessThan(400));
    }
View Full Code Here

        assertThat(response.getStatus(), lessThan(400));
    }

    @Test
    public void retrieveObsoleteProject() {
        IProjectResource projectService =
                getClientRequestFactory().createProxy(
                        IProjectResource.class,
                        createBaseURI(RESOURCE_PATH)
                                .resolve("obsolete-project"));
        ClientResponse<Project> response = projectService.get();
        assertThat(response.getStatus(), is(Status.NOT_FOUND.getStatusCode())); // Obsolete
                                                                                // projects
                                                                                // are
                                                                                // not
                                                                                // found
View Full Code Here

                                                                                // found
    }

    @Test
    public void retrieveRetiredProject() {
        IProjectResource projectService =
                getClientRequestFactory()
                        .createProxy(
                                IProjectResource.class,
                                createBaseURI(RESOURCE_PATH).resolve(
                                        "retired-project"));
        ClientResponse<Project> response = projectService.get();
        assertThat(response.getStatus(), is(Status.OK.getStatusCode())); // Retired
                                                                         // projects
                                                                         // can
                                                                         // be
                                                                         // read
View Full Code Here

                                                                         // read
    }

    @Test
    public void headExistingProject() {
        IProjectResource projectService =
                getClientRequestFactory().createProxy(IProjectResource.class,
                        createBaseURI(RESOURCE_PATH).resolve("sample-project"));
        ClientResponse response = projectService.head();
        assertThat(response.getStatus(), lessThan(400));
    }
View Full Code Here

        assertThat(response.getStatus(), lessThan(400));
    }

    @Test
    public void headObsoleteProject() {
        IProjectResource projectService =
                getClientRequestFactory().createProxy(
                        IProjectResource.class,
                        createBaseURI(RESOURCE_PATH)
                                .resolve("obsolete-project"));
        ClientResponse response = projectService.head();
        assertThat(response.getStatus(), is(Status.NOT_FOUND.getStatusCode())); // Obsolete
                                                                                // projects
                                                                                // are
                                                                                // not
                                                                                // found
View Full Code Here

                                                                                // found
    }

    @Test
    public void headRetiredProject() {
        IProjectResource projectService =
                getClientRequestFactory()
                        .createProxy(
                                IProjectResource.class,
                                createBaseURI(RESOURCE_PATH).resolve(
                                        "retired-project"));
        ClientResponse response = projectService.head();
        assertThat(response.getStatus(), is(Status.OK.getStatusCode())); // Retired
                                                                         // projects
                                                                         // can
                                                                         // be
                                                                         // read
View Full Code Here

        Project project =
                new Project(PROJECT_SLUG, PROJECT_NAME,
                        ProjectType.Gettext.toString(), PROJECT_DESC);

        IProjectResource projectService =
                getClientRequestFactory().createProxy(IProjectResource.class,
                        createBaseURI(RESOURCE_PATH).resolve(PROJECT_SLUG));

        Response response = projectService.put(project);

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

        String location = (String) response.getMetadata().getFirst("Location");

        assertThat(location, endsWith("/projects/p/" + PROJECT_SLUG));

        projectService =
                getClientRequestFactory().createProxy(IProjectResource.class,
                        createBaseURI(RESOURCE_PATH).resolve(PROJECT_SLUG));

        ClientResponse<Project> response1 = projectService.get();
        assertThat(response1.getStatus(), is(Status.OK.getStatusCode()));

        Project projectRes = response1.getEntity();

        assertThat(projectRes, notNullValue());
View Full Code Here

            "My test ProjectMy test ProjectMy test ProjectMy test ProjectMy test ProjectMy test Project";
    final String PROJECT_DESC = "Another test project";

    @Test
    public void createProjectWithInvalidSlug() {
        IProjectResource projectService =
                getClientRequestFactory().createProxy(
                        IProjectResource.class,
                        createBaseURI(RESOURCE_PATH).resolve(
                                PROJECT_SLUG_INVALID));

        Project project =
                new Project(PROJECT_SLUG_INVALID, PROJECT_NAME,
                        ProjectType.Gettext.toString(), PROJECT_DESC);
        Response response = projectService.put(project);

        assertThat(response.getStatus(), is(Status.NOT_FOUND.getStatusCode()));
    }
View Full Code Here

TOP

Related Classes of org.zanata.rest.client.IProjectResource

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.