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

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


        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

        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

        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

  }

  @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

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.