From 70c644c3827d05a5f555bcc06855f87d509208a6 Mon Sep 17 00:00:00 2001 From: mcombellack Date: Sat, 20 Jun 2009 23:00:16 +0000 Subject: Added a unit test for checking that the title can be set for an Atom feed using the title attribute of binding.atom git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@786924 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding/atom/AtomFeedNonCollectionTest.java | 45 ++++++++++++++++++---- .../binding/atom/ProviderNonCollection.composite | 4 +- 2 files changed, 39 insertions(+), 10 deletions(-) (limited to 'branches/sca-java-1.x/modules') diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java index 9623681a98..9968bc8352 100644 --- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java +++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java @@ -30,7 +30,9 @@ import org.apache.tuscany.sca.binding.atom.collection.Collection; import org.apache.tuscany.sca.data.collection.Entry; import org.apache.tuscany.sca.data.collection.Item; import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; import org.junit.AfterClass; +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -90,26 +92,36 @@ public class AtomFeedNonCollectionTest { /** * Make sure everything has been initialised correctly. */ - @Test + @Before public void testPrelim() { Assert.assertNotNull(scaProviderDomain); Assert.assertNotNull(scaConsumerDomain); Assert.assertNotNull(testService); - } - /** - * Test that we can retrieve entries from a feed that does not implement - * the Collection interface. - */ - @Test - public void testThatCanGetFeedEntriesFromNonCollectionImplementation() { // Add some entries to the Atom feed final Entry[] testEntries = new Entry[FEED_ENTRY_COUNT]; for (int i = 0; i < FEED_ENTRY_COUNT; i++) { testEntries[i] = createFeedEntry(FEED_ENTRY_TITLES[i], FEED_ENTRY_CONTENT[i], FEED_ENTRY_LINK[i]); } CustomerNonCollectionImpl.entries = testEntries; + } + /** + * Post test cleanup + */ + @After + public void testPostCleanup() + { + // Clear any old feed entries that have been added by previous tests + CustomerNonCollectionImpl.entries = null; + } + + /** + * Test that we can retrieve entries from a feed that does not implement + * the Collection interface. + */ + @Test + public void testThatCanGetFeedEntriesFromNonCollectionImplementation() { // Get the entries from the feed final Collection resourceCollection = testService.getCustomerCollection(); Assert.assertNotNull(resourceCollection); @@ -153,4 +165,21 @@ public class AtomFeedNonCollectionTest { private String nextFeedID() { return Integer.toString(ID_GEN.incrementAndGet()); } + + /** + * Tests that the title of the feed can be set by the title + * attribute on the binding.atom + */ + @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); + } } diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite index 85160fc825..f84dcaef5f 100644 --- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite +++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite @@ -20,10 +20,10 @@ + name="ProviderNonCollection"> - + -- cgit v1.2.3