Package org.restlet.representation

Examples of org.restlet.representation.Representation


     */
    public void testGetRoot() throws Exception {
        final Response response = get();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        final Representation entity = response.getEntity();
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("root", entity.getText());
    }
View Full Code Here


        assertEquals("root", entity.getText());
    }

    public void testGetRepository() throws Exception {
        final Response response = get("PRJ");
        final Representation entity = response.getEntity();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("project=PRJ", entity.getText());
    }
View Full Code Here

        assertEquals("project=PRJ", entity.getText());
    }

    public void testGetProject() throws Exception {
        final Response response = get("PRJ/REPO");
        final Representation entity = response.getEntity();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("project=PRJ\nrepository=REPO", entity.getText());
    }
View Full Code Here

        assertEquals("project=PRJ\nrepository=REPO", entity.getText());
    }

    public void testGetSchemaDir() throws Exception {
        final Response response = get("PRJ/REPO/schema");
        final Representation entity = response.getEntity();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("project=PRJ\nrepository=REPO\nschema", entity
                .getText());
    }
View Full Code Here

                .getText());
    }

    public void testGetSchema() throws Exception {
        final Response response = get("PRJ/REPO/schema/SCM");
        final Representation entity = response.getEntity();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("project=PRJ\nrepository=REPO\nschema\nschema=SCM",
                entity.getText());
    }
View Full Code Here

                entity.getText());
    }
   
    public void testFooBarSimple() throws Exception {
        final Response response = get("/foo/bar/schema/simple");
        final Representation entity = response.getEntity();
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        assertEqualMediaType(MediaType.TEXT_PLAIN, entity.getMediaType());
        assertEquals("project=foo\nrepository=bar\nschema\nschema=simple",
                entity.getText());
    }
View Full Code Here

    private Response getAndExpectAlphabet(String subPath) throws IOException {
        Response response = get(subPath);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());

        Representation entity = response.getEntity();
        assertEquals(ProviderTestService.ALPHABET, entity.getText());
        return response;
    }
View Full Code Here

    /**
     * @param subPath
     * @throws IOException
     */
    private void postAndCheckXml(String subPath) throws Exception {
        final Representation send = new DomRepresentation(
                new StringRepresentation(
                        "<person><firstname>Helmut</firstname><lastname>Kohl</lastname></person>",
                        MediaType.TEXT_XML));
        final Response response = post(subPath, send);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        final Representation respEntity = response.getEntity();
        assertEquals("Helmut Kohl", respEntity.getText());
    }
View Full Code Here

     * @throws IOException
     */
    private void postAndExceptGiven(String subPath, String postEntity,
            MediaType postMediaType, MediaType responseMediaType)
            throws IOException {
        Representation entity = new StringRepresentation(postEntity,
                postMediaType);
        final Response response = post(subPath, entity);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        entity = response.getEntity();
        assertEquals(postEntity, entity.getText());
        if (responseMediaType != null) {
            assertEqualMediaType(responseMediaType, entity);
        }
    }
View Full Code Here

    public void testBufferedReaderGet() throws Exception {
        getAndExpectAlphabet("BufferedReader");
    }

    public void testBufferedReaderPost() throws Exception {
        Representation entity = new StringRepresentation("big test",
                MediaType.APPLICATION_OCTET_STREAM);
        final Response response = post("BufferedReader", entity);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        entity = response.getEntity();
        assertEquals("big test", entity.getText());
    }
View Full Code Here

TOP

Related Classes of org.restlet.representation.Representation

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.