Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.RequestOptions


    @Test
    public void testUnmodifiedGetIfNoneMatch() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfNoneMatch");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-None-Match", eTag);

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 304 - Feed not provided since it matches ETag.
View Full Code Here


    @Test
    public void testUnmodifiedGetIfUnModified() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfUnModified");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date() ));

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 200 - Feed provided since feed is unmodified since.
View Full Code Here

    @Test
    public void testUnmodifiedGetIfModified() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfModified");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Modified-Since", dateFormat.format( new Date( 0 ) ));

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 200 - Feed provided since feed is changed.
View Full Code Here

        Content content = abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(customerName);
        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);
        opts.setHeader( "If-None-Match", eTag);

        res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 304 - Feed not provided since it matches ETag.
View Full Code Here

    @Test
    public void testModifiedGetIfMatch() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfMatch");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Match", eTag);

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            String thisETag = res.getHeader("ETag");
View Full Code Here

    @Test
    public void testModifiedGetIfUnModified() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfUnModified");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", dateFormat.format( previousSecond(lastModified) ));

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 412 - Feed not provided since feed is modified since.
View Full Code Here

    @Test
    public void testModifiedGetIfModified() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfModified");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Modified-Since", dateFormat.format( new Date() ));

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 304 - Feed not provided since feed is unmodified.
            Assert.assertEquals(304, res.getStatus());
        } finally {
            res.release();
        }

        // Feed request with predicates
        opts = new RequestOptions();
        opts.setContentType(contentType);
        opts.setHeader( "If-Modified-Since", dateFormat.format( previousSecond(lastModified) ));

        res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 200 - Feed provided since feed is changed.
View Full Code Here

        Content content = abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(customerName);
        entry.setContentElement(content);

        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);
View Full Code Here

    }

    @Test
    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();
View Full Code Here

    }

    @Test
    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());
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.client.RequestOptions

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.