Package org.apache.abdera.i18n.iri

Examples of org.apache.abdera.i18n.iri.IRI


        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        // AtomTestCaseUtils.printRequestHeaders( "Post request headers", "   ", opts );
        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        ClientResponse res = client.post(colUri.toString(), entry, opts);

        // Assert response status code is 201-OK.
        // Assert response header Content-Type: application/atom+xml; charset=UTF-8
        Assert.assertEquals(201, res.getStatus());
        String returnedContentType = res.getContentType().toString().trim();
View Full Code Here


    public void testXMLEntryGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testXMLEntryGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/atom+xml" );

        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
        Assert.assertEquals(200, res.getStatus());
        String returnedContentType = res.getContentType().toString().trim();
        // Assert.assertEquals(contentType, returnedContentType );
        res.release();
    }
View Full Code Here

    public void testJSONEntryGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testJSONEntryGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/json" );

        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
        try {
            Assert.assertEquals(200, res.getStatus());
            // Abdera 0.4 throws exception on getContentType with application/json.
            // System.out.println( "ContentNegotiationTest.testJSONEntryGet contentType=" + res.getContentType());
            String contentType = res.getHeader( "Content-Type");
View Full Code Here

        entry.setContentElement(content);

        RequestOptions opts = new RequestOptions();
        String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.post(colUri.toString(), entry, opts);

        // Feed request with predicates
        opts = new RequestOptions();
        contentType = "application/atom+xml";
        opts.setContentType(contentType);
View Full Code Here

            Document<Entry> document = abderaParser.parse(response.getEntity().getContent());
            Entry entry = document.getRoot();
            String title = entry.getTitle();
            // System.out.println( "mediaPost entry.title=" + title );
            Assert.assertNotNull(title);
            IRI id = entry.getId();
            // System.out.println( "mediaPost entry.id=" + id );
            Assert.assertNotNull(id);
            mediaId = id.toString();
            Assert.assertNotNull(mediaId); // Save for put/update request
            Date updated = entry.getUpdated();
            // System.out.println( "mediaPost entry.updated=" + updated);
            Assert.assertNotNull(updated);
            String summary = entry.getSummary();
            // System.out.println( "mediaPost entry.summary=" + summary);
            Assert.assertNotNull(summary);
            IRI contentSrc = entry.getContentSrc();
            // System.out.println( "mediaPost entry.content.src=" + contentSrc + ", type=" + entry.getContentType());
            Assert.assertNotNull(contentSrc);
            Link editLink = entry.getEditLink();
            // System.out.println( "mediaPost entry.editLink" + " rel=" + editLink.getRel() + ", href=" +  editLink.getHref() );
            Assert.assertNotNull(editLink);
View Full Code Here

        // Build entry for media link.
        entry.setUpdated( new Date() );
        entry.setId( id );
        // Convention. Return header properties as key values.
        entry.setSummary( "Content-Type=" + contentType + ",Content-Length=" + mediaLength  );
        entry.setContent( new IRI( hostURL + normalTitle + "." + extension ), contentType );
        entry.addLink( reposLocation + ".atom", "edit" );
        entry.addLink( reposLocation + "." + extension, "edit-media" );
        return entry;   
    }
View Full Code Here

        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        // AtomTestCaseUtils.printRequestHeaders( "Post request headers", "   ", opts );
        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        ClientResponse res = client.post(colUri.toString(), entry, opts);

        // Assert response status code is 201-OK.
        // Assert response header Content-Type: application/atom+xml; charset=UTF-8
        // Assert response header Location: http://example.org/edit/first-post.atom
        // Assert response header Content-Location: http://example.org/edit/first-post.atom
View Full Code Here

        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-None-Match", eTag);

        // AtomTestCaseUtils.printRequestHeaders( "Put request headers", "   ", opts );
        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        id = eTag.substring( 1, eTag.length()-1);
        // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
        // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
        ClientResponse res = client.put(colUri.toString() + "/" + id, new BaseRequestEntity( entry ), opts);
        // Expected Atom server response (item was edited by another user)
        // >      HTTP/1.1 412 Precondition Failed
        //       Date: Sat, 24 Feb 2007 16:34:11 GMT

        // If-Match Assert response status code is 412. Precondition failed.
View Full Code Here

        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-None-Match", "123456");
        opts.setHeader( "Pragma", "no-cache"); // turn off client caching

        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        String id = eTag.substring( 1, eTag.length()-1);
        // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
        // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
        ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
        // Expected Atom server response (item was edited by another user)
        // >      HTTP/1.1 412 Precondition Failed
        //       Date: Sat, 24 Feb 2007 16:34:11 GMT

        // Atom server response (item was up to date)
View Full Code Here

        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-None-Match", eTag);
        opts.setHeader( "Pragma", "no-cache"); // turn off client caching

        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        String id = eTag.substring( 1, eTag.length()-1);
        // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
        // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
        ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
        // Atom server response (item was up to date)
        // >      HTTP/1.1 304 Not Modified
        //       Date: Sat, 24 Feb 2007 13:17:11 GMT

        // Assert response status code is 304 Not Modified.
View Full Code Here

TOP

Related Classes of org.apache.abdera.i18n.iri.IRI

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.