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

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


        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

        Assert.assertNotNull(abdera);
    }

    @Test
    public void testAtomPut() 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());

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

        //System.out.println("<<< put id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
    }

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

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

        // Generate random ID to pass as parameter in PUT() --
        String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
        try {
            // ID doesn't match with the existing IDs and NotFoundException is thrown
            resourceCollection.put(id, updateEntry(postEntry, "James Bond"));
        } catch (Exception e) {
            Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
        }
    }
View Full Code Here

     * the Collection interface.
     */
    @Test
    public void testThatCanGetFeedEntriesFromNonCollectionImplementation() {
        // Get the entries from the feed
        final Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);
        final List<org.apache.abdera.model.Entry> entries = resourceCollection.getFeed().getEntries();

        // Validate the feed entries
        Assert.assertNotNull(entries);
        Assert.assertEquals(FEED_ENTRY_COUNT, entries.size());
        for (int i = 0; i < FEED_ENTRY_COUNT; i++) {
View Full Code Here

    @Test
    public void testThatFeedTitleSet() {
        final String expectedFeedTitle = "Atom binding Non Collection";

        // Get the title of the feed
        final Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);
        final String feedTitle = resourceCollection.getFeed().getTitle();

        // Validate the title
        Assert.assertEquals(expectedFeedTitle, feedTitle);
    }
View Full Code Here

    @Test
    public void testThatFeedDescriptionSet() {
        final String expectedFeedDescription = "Feed used for unit testing";

        // Get the description of the feed
        final Collection resourceCollection = testService.getCustomerCollection();
        Assert.assertNotNull(resourceCollection);
        final String feedDescription = resourceCollection.getFeed().getSubtitle();

        // Validate the description
        Assert.assertEquals(expectedFeedDescription, feedDescription);
    }
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

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.