summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-06-20 23:00:16 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-06-20 23:00:16 +0000
commit70c644c3827d05a5f555bcc06855f87d509208a6 (patch)
tree292ca933b7520753c42fab29d4c7501c978bbcf2 /branches/sca-java-1.x/modules
parent396e33f60cb55e0c36588a9378209ee35ac4289d (diff)
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
Diffstat (limited to 'branches/sca-java-1.x/modules')
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java45
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite4
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">