Package org.apache.tuscany.sca.binding.atom.collection

Examples of org.apache.tuscany.sca.binding.atom.collection.Collection


        Assert.assertNotNull(abdera);
    }

    @Test
    public void testAtomPost() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        System.out.println(">>> post entry= " + postEntry.getTitle());

        Entry newEntry = resourceCollection.post(postEntry);

        Assert.assertEquals(postEntry.getTitle(), newEntry.getTitle());

        System.out.println("<<< new entry= " + newEntry.getTitle());
View Full Code Here


    }

    @Test
    public void testAtomPostException() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Exception_Test");

        try {
            resourceCollection.post(postEntry);
        } catch (Exception e) {
            Assert.assertEquals("HTTP status code: 500", e.getMessage());
        }
    }
View Full Code Here

        Assert.assertNotNull(abdera);
    }

    @Test
    public void testAtomDelete() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        System.out.println(">>> post entry= " + postEntry.getTitle());

        Entry newEntry = resourceCollection.post(postEntry);
        System.out.println("<<< Entry posted for " + newEntry.getTitle());

        System.out.println(">>> get id=" + newEntry.getId());

        resourceCollection.delete(newEntry.getId().toString());

    }
View Full Code Here

    }

    @Test
    public void testAtomDeleteException() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        try {
            // Generates custom ID
            String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
            resourceCollection.delete(id);
        } catch (Exception e) {
            // ID doesn't match with the existing IDs and NotFoundException is
            // thrown
            Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
        }
View Full Code Here

    }
  }   

    @Test
    public void testServiceDocumentGet() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        Entry newEntry = resourceCollection.post(postEntry);
        postEntry = postEntry("Austin Powers");
        newEntry = resourceCollection.post(postEntry);
        postEntry = postEntry("Count Dracula");
        newEntry = resourceCollection.post(postEntry);

    // Service document
    ClientResponse res = client.get(providerURI + "/atomsvc");
    Assert.assertNotNull(res);
    try {
View Full Code Here

        Assert.assertNotNull(abdera);
    }

    @Test
    public void testAtomGet() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        System.out.println(">>> post entry= " + postEntry.getTitle());

        Entry newEntry = resourceCollection.post(postEntry);
        System.out.println("<<< Entry posted for " + newEntry.getTitle());

        System.out.println(">>> get id=" + newEntry.getId());

        Entry getEntry = resourceCollection.get(newEntry.getId().toString());

        Assert.assertEquals(newEntry.getTitle(), getEntry.getTitle());
        System.out.println("<<< get id=" + getEntry.getId() + " entry=" + getEntry.getTitle());
    }
View Full Code Here

        System.out.println("<<< get id=" + getEntry.getId() + " entry=" + getEntry.getTitle());
    }

    @Test
    public void testAtomGetException() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        System.out.println(">>> post entry= " + postEntry.getTitle());

        Entry newEntry = resourceCollection.post(postEntry);
        System.out.println("<<< Entry posted for " + newEntry.getTitle());
        System.out.println(newEntry.getId());

        // Delete the entry to force the Collection to throw NotFoundException
        resourceCollection.delete(newEntry.getId().toString());

        try {
            resourceCollection.get(newEntry.getId().toString());
        } catch (Exception e) {
            Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
        }
    }
View Full Code Here

    }

    @Test
    public void testCustomerCollection() throws Exception {
        System.out.println(getClass().getName()  + ".testCustomerCollection entry");
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry newEntry = newEntry("Sponge Bob");
        //System.out.println(">>> post entry=" + newEntry.getTitle());
        newEntry = resourceCollection.post(newEntry);
        //System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());

        newEntry = newEntry("Jane Bond");
        //System.out.println(">>> post entry=" + newEntry.getTitle());
        newEntry = resourceCollection.post(newEntry);
        //System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());

        //System.out.println(">>> get id=" + newEntry.getId());
        Entry entry = resourceCollection.get(newEntry.getId().toString());
        //System.out.println("<<< get id=" + entry.getId() + " entry=" + entry.getTitle());

        //System.out.println(">>> put id=" + newEntry.getId() + " entry=" + entry.getTitle());
        resourceCollection.put(entry.getId().toString(), updateEntry(entry, "James Bond"));
        //System.out.println("<<< put id=" + entry.getId() + " entry=" + entry.getTitle());

        //System.out.println(">>> delete id=" + entry.getId());
        resourceCollection.delete(entry.getId().toString());
        //System.out.println("<<< delete id=" + entry.getId());

        //System.out.println(">>> get collection");
        Feed feed = resourceCollection.getFeed();
        //System.out.println("<<< get collection");
        for (Object o : feed.getEntries()) {
            Entry e = (Entry)o;
            //System.out.println("id = " + e.getId() + " entry = " + e.getTitle());
        }
View Full Code Here

        Assert.assertNotNull(abdera);
    }

    @Test
    public void testAtomPost() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Sponge Bob");
        //System.out.println(">>> post entry= " + postEntry.getTitle());

        Entry newEntry = resourceCollection.post(postEntry);

        Assert.assertEquals(postEntry.getTitle(), newEntry.getTitle());

        //System.out.println("<<< new entry= " + newEntry.getTitle());
View Full Code Here

    }

    @Test
    public void testAtomPostException() throws Exception {
        Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);

        Entry postEntry = postEntry("Exception_Test");

        try {
            resourceCollection.post(postEntry);
        } catch (Exception e) {
            Assert.assertEquals("HTTP status code: 500", e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.atom.collection.Collection

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.