Package org.restlet.service

Examples of org.restlet.service.ConverterService


        if (application != null) {
            this.converterService = application.getConverterService();
        }

        if (this.converterService == null) {
            this.converterService = new ConverterService();
        }
    }
View Full Code Here


* @author Sanjay Acharya
*/
public class JaxbBasicConverterTestCase extends RestletTestCase {

    public void testObjectionToRepresentation() {
        ConverterService cs = new ConverterService();
        Representation rep = cs.toRepresentation(new Sample(), new Variant(
                MediaType.APPLICATION_XML), null);
        assertTrue(rep instanceof JaxbRepresentation<?>);
    }
View Full Code Here

                MediaType.APPLICATION_XML), null);
        assertTrue(rep instanceof JaxbRepresentation<?>);
    }

    public void testRepresentationToObject() throws IOException, JAXBException {
        ConverterService cs = new ConverterService();
        JaxbRepresentation<Sample> sampleRep = new JaxbRepresentation<Sample>(
                MediaType.APPLICATION_XML, new Sample());
        Object rep = cs.toObject(sampleRep, Sample.class, null);
        assertTrue(rep instanceof Sample);
    }
View Full Code Here

        this.services.add(new StatusService());
        this.services.add(new DecoderService());
        this.services.add(new EncoderService(false));
        this.services.add(new RangeService());
        this.services.add(new ConnectorService());
        this.services.add(new ConverterService());
        this.services.add(new MetadataService());

        this.services.add(new org.restlet.service.TaskService());
    }
View Full Code Here

import org.restlet.test.RestletTestCase;

public class ConverterTestCase extends RestletTestCase {

    public void testObjectToRepresentation() {
        ConverterService cs = new ConverterService();
        Feed feed = new Feed();
        Representation representation = cs.toRepresentation(feed);
        assertEquals(MediaType.APPLICATION_ATOM, representation.getMediaType());
    }
View Full Code Here

        Representation representation = cs.toRepresentation(feed);
        assertEquals(MediaType.APPLICATION_ATOM, representation.getMediaType());
    }

    public void testRepresentationToObject() throws IOException {
        ConverterService cs = new ConverterService();
        ClientResource cr = new ClientResource(
                "clap://class/org/restlet/test/ext/atom/entry.xml");
        Representation representation = cr.get();
        Object object = cs.toObject(representation);
        assertTrue(object instanceof Feed);
    }
View Full Code Here

TOP

Related Classes of org.restlet.service.ConverterService

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.