summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-atom-abdera/src
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-06-20 23:41:05 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-06-20 23:41:05 +0000
commitf6935c5980c68e02be6886edd2a463484a1327d5 (patch)
tree0d2d259b9663ee287919bc0ae8a78f538c162552 /branches/sca-java-1.x/modules/binding-atom-abdera/src
parent70c644c3827d05a5f555bcc06855f87d509208a6 (diff)
TUSCANY-3310 - Updated the atom binding so that the description can be set using the description attribute. This is similar to the way that we set the title of the feed using the title attribute
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@786928 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-atom-abdera/src')
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java7
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java2
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java17
-rw-r--r--branches/sca-java-1.x/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite7
4 files changed, 28 insertions, 5 deletions
diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
index f41284624e..5eebc6dff7 100644
--- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
+++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
@@ -95,6 +95,7 @@ class AtomBindingListenerServlet extends HttpServlet {
private Invoker deleteInvoker;
private MessageFactory messageFactory;
private String title;
+ private String description;
private Mediator mediator;
private DataType<?> itemClassType;
private DataType<?> itemXMLType;
@@ -107,11 +108,12 @@ class AtomBindingListenerServlet extends HttpServlet {
* @param messageFactory
* @param feedType
*/
- AtomBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title) {
+ AtomBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title, String description) {
this.wire = wire;
this.messageFactory = messageFactory;
this.mediator = mediator;
this.title = title;
+ this.description = description;
// Get the invokers for the supported operations
Operation getOperation = null;
@@ -515,6 +517,9 @@ class AtomBindingListenerServlet extends HttpServlet {
} else {
feed.setTitle("Feed");
}
+ if (description != null) {
+ feed.setSubtitle(description);
+ }
// All feeds must provide Id and updated elements.
// However, some do not, so provide some program protection.
feed.setId( "Feed" + feed.hashCode());
diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java
index 9e08b5b92e..0a5a90204e 100644
--- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java
+++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java
@@ -71,7 +71,7 @@ class AtomServiceBindingProvider implements ServiceBindingProvider {
RuntimeWire wire = componentService.getRuntimeWire(binding);
AtomBindingListenerServlet servlet =
- new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle());
+ new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle(), binding.getDescription());
servletMapping = binding.getURI();
if (!servletMapping.endsWith("/")) {
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 9968bc8352..4f91ff492a 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
@@ -182,4 +182,21 @@ public class AtomFeedNonCollectionTest {
// Validate the title
Assert.assertEquals(expectedFeedTitle, feedTitle);
}
+
+ /**
+ * Tests that the description of the feed can be set by the description
+ * attribute on the binding.atom
+ */
+ @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);
+ }
}
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 f84dcaef5f..ddb660cada 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
@@ -22,9 +22,10 @@
targetNamespace = "http://customer"
name="ProviderNonCollection">
- <service name="customer" promote="CustomerCollection">
- <tuscany:binding.atom uri = "http://localhost:8084/customer" title="Atom binding Non Collection"/>
- </service>
+ <service name="customer" promote="CustomerCollection">
+ <tuscany:binding.atom uri = "http://localhost:8084/customer"
+ title="Atom binding Non Collection" description="Feed used for unit testing"/>
+ </service>
<component name="CustomerCollection">
<implementation.java class="org.apache.tuscany.sca.binding.atom.CustomerNonCollectionImpl"/>