summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java15
-rw-r--r--branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java15
6 files changed, 57 insertions, 6 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"/>
diff --git a/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java b/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java
index 807d6a8971..f81100087c 100644
--- a/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java
+++ b/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java
@@ -39,5 +39,18 @@ public interface AtomBinding extends Binding {
* @param title
*/
void setTitle(String title);
-
+
+ /**
+ * Returns the description of the Atom collection.
+ *
+ * @return The description of the Atom collection
+ */
+ String getDescription();
+
+ /**
+ * Sets the description of the Atom collection.
+ *
+ * @param description The description of the Atom collection
+ */
+ void setDescription(String description);
}
diff --git a/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java b/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
index 1c68ab5bc1..a7c3997b22 100644
--- a/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
+++ b/branches/sca-java-1.x/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
@@ -42,6 +42,7 @@ class AtomBindingImpl implements AtomBinding, PolicySetAttachPoint {
private String name;
private String uri;
private String title;
+ private String description;
private List<Intent> requiredIntents = new ArrayList<Intent>();
private List<PolicySet> policySets = new ArrayList<PolicySet>();
private IntentAttachPointType intentAttachPointType;
@@ -71,6 +72,20 @@ class AtomBindingImpl implements AtomBinding, PolicySetAttachPoint {
this.title = title;
}
+ /**
+ * {@inheritDoc}
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
public boolean isUnresolved() {
// The binding is always resolved
return false;