diff options
2 files changed, 39 insertions, 10 deletions
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<Object, Object>[] 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 @@ <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace = "http://customer" - name="Provider">
+ name="ProviderNonCollection">
<service name="customer" promote="CustomerCollection">
- <tuscany:binding.atom uri = "http://localhost:8084/customer"/>
+ <tuscany:binding.atom uri = "http://localhost:8084/customer" title="Atom binding Non Collection"/>
</service>
<component name="CustomerCollection">
|