summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-08-06 15:50:37 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-08-06 15:50:37 +0000
commita94f108acb136072151a2d794aaeeb9f810159f2 (patch)
treedfa01192329707dbb966bdabeb66018448386f8e /java/sca
parent90d9f44c17ff5d483fa388a5b6cf253cb78b93a4 (diff)
TUSCANY-2530 - Applying Dan's patch that provides atom feed id and last updated support for customer collection
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@683305 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/java/sca/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java b/java/sca/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
index d994e0af73..db66b00a50 100644
--- a/java/sca/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
+++ b/java/sca/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
@@ -36,16 +36,13 @@ import org.osoa.sca.annotations.Scope;
public class CustomerCollectionImpl implements Collection {
private final Abdera abdera = new Abdera();
private Map<String, Entry> entries = new HashMap<String, Entry>();
-
+ public Date lastModified = new Date();
+
/**
- * Default constructor that initializes collection with couple customer
- * entries
+ * Default constructor
*/
public CustomerCollectionImpl() {
- // Used for testing.
- // for (int i = 0; i < 4; i++) {
- // testPut( "Jane Doe_" + String.valueOf( i ));
- // }
+
}
public Entry post(Entry entry) {
@@ -58,7 +55,9 @@ public class CustomerCollectionImpl implements Collection {
entry.addLink("" + id, "edit");
entry.addLink("" + id, "alternate");
- entry.setUpdated(new Date());
+ Date now = new Date();
+ entry.setUpdated(now);
+ lastModified = now;
entries.put(id, entry);
System.out.println(">>> CustomerCollectionImpl.post return id=" + id);
@@ -80,7 +79,9 @@ public class CustomerCollectionImpl implements Collection {
public void put(String id, Entry entry) throws NotFoundException {
System.out.println(">>> CustomerCollectionImpl.put id=" + id + " entry=" + entry.getTitle());
if(entries.containsKey(id)){
- entry.setUpdated(new Date());
+ Date now = new Date();
+ entry.setUpdated(now);
+ lastModified = now;
entries.put(id, entry);
}
else {
@@ -92,20 +93,21 @@ public class CustomerCollectionImpl implements Collection {
System.out.println(">>> CustomerCollectionImpl.delete id=" + id);
if(entries.containsKey(id)){
entries.remove(id);
+ lastModified = new Date();
}
else {
throw new NotFoundException();
}
}
- @SuppressWarnings("unchecked")
public Feed getFeed() {
System.out.println(">>> CustomerCollectionImpl.getFeed");
Feed feed = this.abdera.getFactory().newFeed();
+ feed.setId("customers" + this.hashCode() ); // provide unique id for feed instance.
feed.setTitle("customers");
feed.setSubtitle("This is a sample feed");
- feed.setUpdated(new Date());
+ feed.setUpdated(lastModified);
feed.addLink("");
feed.addLink("", "self");