summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test')
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java66
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java153
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java40
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java123
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java143
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java156
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java164
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java160
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java48
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java48
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/log4j.properties25
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite32
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite32
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite32
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite32
-rw-r--r--sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite33
16 files changed, 1287 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
new file mode 100644
index 0000000000..50a3ec3886
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.PlainTextConstruct;
+
+public class Consumer {
+
+ public static void main(String[] args) throws Exception {
+
+ //Initialize the GData client service (Reference Binding test)
+ String contribution = ContributionLocationHelper.getContributionLocation(Consumer.class);
+ Node node = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite", new Contribution("consumer", contribution));
+ node.start();
+ CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient");
+
+
+ Feed feed = testService.clientGetFeed();
+
+ System.out.println("#Entries(Before post): "+ testService.clientGetFeed().getEntries().size());
+
+ /*
+ String entryID = "tag:blogger.com,1999:blog-4520949313432095990.post-973462497533349425";
+ Entry entry = testService.clientGetEntry(entryID);
+ System.out.println("Entry id: " + entry.getId());
+ */
+
+ Entry myEntry = new Entry();
+ myEntry.setTitle(new PlainTextConstruct("titleByConsumer2"));
+ myEntry.setContent(new PlainTextConstruct("contentByConsmer2"));
+ testService.clientPost(myEntry);
+
+ System.out.println("#Entries(After post): "+ testService.clientGetFeed().getEntries().size());
+
+ String entryID = "tag:blogger.com,1999:blog-4520949313432095990.post-973462497533349425";
+ Entry entry = testService.clientGetEntry(entryID);
+ System.out.println("Entry id: " + entry.getId());
+
+
+ }
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
new file mode 100644
index 0000000000..e4d502357d
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.PlainTextConstruct;
+
+public class ConsumerProviderTestCase extends TestCase {
+
+ private Node providerNode = null;
+ private Node consumerNode = null;
+ private CustomerClient testService = null;
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ System.out.println("Method Test Start-----------------------------------------------------------------------");
+
+ // Setup the local GData servlet (Service Binding test)
+ String contribution = ContributionLocationHelper.getContributionLocation(ConsumerProviderTestCase.class);
+ providerNode = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/Provider.composite", new Contribution("provider", contribution));
+ providerNode.start();
+ System.out.println("[Debug Info] Provider.composite ready...");
+
+ // Initialize the GData client service (Reference Binding test)
+ consumerNode = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/Consumer.composite", new Contribution("consumer", contribution));
+ consumerNode.start();
+ testService = consumerNode.getService(CustomerClient.class, "CustomerClient");
+ }
+
+ @After
+ @Override
+ public void tearDown() {
+ providerNode.stop();
+ providerNode.destroy();
+ consumerNode.stop();
+ consumerNode.destroy();
+ System.out.println("Method Test End------------------------------------------------------------------------");
+ System.out.println("\n\n");
+ }
+
+
+ @Test
+ public void testClientGetFeed() throws Exception {
+ Feed feed = testService.clientGetFeed();
+ System.out.println(feed.getTitle().getPlainText());
+ assertNotNull(feed);
+ // Given we are testing on the localhost providing feed, we know the
+ // feed title is "Feedtitle(LocalHostServlet)"
+ assertEquals("Feedtitle(LocalHostServlet)", feed.getTitle().getPlainText());
+ }
+
+ @Test
+ public void testClientGetEntry() throws Exception {
+ String entryID = "urn:uuid:customer-0";
+ Entry entry = testService.clientGetEntry(entryID);
+ System.out.println("entryID in testcase: " + entry.getId());
+ assertEquals(entryID, entry.getId());
+ }
+
+ @Test
+ public void testClientPost() throws Exception {
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct("NewEntry title by Post"));
+ newEntry.setContent(new PlainTextConstruct("NewEntry Content by Post"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ assertEquals("NewEntry title by Post", postedEntry.getTitle().getPlainText());
+ }
+
+
+
+ @Test
+ public void testClientPut() throws Exception {
+ String newTitleValue = "newTitleValueByPut";
+ String entryID = "urn:uuid:customer-0";
+ System.out.println("Before clientPut");
+ testService.clientPut(entryID, newTitleValue);
+ System.out.println("After clientPut");
+ Entry updatedEntry = testService.clientGetEntry(entryID);
+ System.out.println("title: "+ updatedEntry.getTitle().getPlainText());
+ assertEquals(newTitleValue, updatedEntry.getTitle().getPlainText());
+ }
+
+
+
+ @Test
+ public void testClientDelete() throws Exception {
+
+ // We first create a new entry, then delete it
+
+ // Post a new entry
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct("NewEntry title to be deleted"));
+ newEntry.setContent(new PlainTextConstruct("NewEntry Content to be delted"));
+ Entry confirmedNewEntry = testService.clientPost(newEntry);
+
+ Thread.sleep(300);
+
+ Feed feed00 = testService.clientGetFeed();
+ int entryNum00 = feed00.getEntries().size(); // The number of entries
+ // before deleting
+ System.out.println("entryNum00:" + entryNum00);
+
+ // Delete this newly created entry
+ String entryID = confirmedNewEntry.getId();
+ Thread.sleep(300);
+
+ System.out.println("confirmed entry ID: " + confirmedNewEntry.getId());
+ System.out.println("confirmed entry title: " + confirmedNewEntry.getTitle().getPlainText());
+
+ System.out.println("Before test clientDelete");
+ testService.clientDelete(entryID);
+ System.out.println("After test clientDelete");
+
+ Feed feed01 = testService.clientGetFeed();
+ int entryNum01 = feed01.getEntries().size();
+ System.out.println("entryNum01:" + entryNum01); // The number of entries after deleting
+
+ //assertEquals(1, entryNum00 - entryNum01);
+ }
+
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java
new file mode 100644
index 0000000000..7aa0a8961c
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+
+public interface CustomerClient {
+
+ Feed clientGetFeed() throws Exception;
+
+ Entry clientGetEntry(String entryID) throws Exception;
+
+ Entry clientPost(Entry entry) throws Exception;
+
+ void clientDelete(String entryID) throws Exception;
+
+ void clientPut(String entryID, String newTitle) throws Exception;
+
+ Feed clientQuery(Query query) throws Exception;
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
new file mode 100644
index 0000000000..a2b1da894d
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.PlainTextConstruct;
+
+import org.apache.tuscany.sca.binding.gdata.collection.Collection;
+import org.apache.tuscany.sca.binding.gdata.collection.NotFoundException;
+import org.osoa.sca.annotations.Reference;
+
+public class CustomerClientImpl implements CustomerClient {
+
+ @Reference
+ public Collection resourceCollection;
+
+ // Call Collection.getFeed()
+ public Feed clientGetFeed() throws Exception {
+ // Get all the entries from the provider, return in a single feed
+ System.out.println(">>> get the feed from the provider service");
+ Feed feed = resourceCollection.getFeed();
+ System.out.println("\n\n!!! Fetched feed title: " + feed.getTitle().getPlainText());
+ int i = 0;
+ for (Object o : feed.getEntries()) {
+ com.google.gdata.data.Entry e = (com.google.gdata.data.Entry)o;
+ System.out.print("Entry" + i + "\t");
+ System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
+ i++;
+ }
+ return feed;
+ }
+
+
+ // Call Collection.get(entryID)
+ public Entry clientGetEntry(String entryID) throws Exception {
+ // Get an existing entry based on its id
+ System.out.println(">>> get an existing entry from the provider service");
+ Entry entry = resourceCollection.get(entryID);
+ System.out.println("\n\n!!! Entry retrieved with id=" + entry.getId()
+ + " title="
+ + entry.getTitle().getPlainText());
+ return entry;
+ }
+
+
+ // Call Collection.post(newEntry)
+ public Entry clientPost(Entry newEntry) throws Exception {
+ // Put a new entry to the provider
+ System.out.println(">>> post a new entry to the provider service");
+ Entry confirmedNewEntry = resourceCollection.post(newEntry);
+ System.out.println("!!! New entry posted with id=" + confirmedNewEntry.getId()
+ + " title="
+ + confirmedNewEntry.getTitle().getPlainText());
+ System.out.println("\n");
+ return confirmedNewEntry;
+ }
+
+
+ // Call Collection.delete(newEntry)
+ public void clientDelete(String entryID) throws Exception {
+ // Put a new entry to the provider
+ System.out.println(">>> delete an existing entry from the provider service");
+ System.out.println(">>> delete id=" + "urn:uuid:customer-1");
+ resourceCollection.delete(entryID);
+ System.out.println("!!! entry with id" + entryID);
+ System.out.println("\n");
+ }
+
+
+
+ // Call Collection.put(entry, updatedTitle)
+ public void clientPut(String entryID, String newTitle) throws Exception {
+
+ System.out.println("clientPut");
+ // Put a new entry to the provider
+ System.out.println(">>> put id=" + entryID + " title=" + newTitle);
+ Entry entry = resourceCollection.get(entryID);
+
+ //change the title of this entry
+ entry.setTitle(new PlainTextConstruct(newTitle));
+ resourceCollection.put(entryID, entry);
+ System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle());
+ System.out.println("\n");
+ }
+
+
+
+ // Call Collection.getFeed()
+ public Feed clientQuery(Query query) throws Exception {
+ // Get all the entries from the provider, return in a single feed
+ System.out.println(">>> query the service");
+ Feed feed = resourceCollection.query(query);
+ System.out.println("\n\n!!! Query result feed title: " + feed.getTitle().getPlainText());
+ int i = 0;
+ for (Object o : feed.getEntries()) {
+ com.google.gdata.data.Entry e = (com.google.gdata.data.Entry)o;
+ System.out.print("Entry" + i + "\t");
+ System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
+ i++;
+ }
+ return feed;
+ }
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
new file mode 100644
index 0000000000..3c11fb70b9
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.Link;
+import com.google.gdata.data.PlainTextConstruct;
+
+import org.apache.tuscany.sca.binding.gdata.collection.Collection;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class CustomerCollectionImpl implements Collection {
+
+
+ private Map<String, Entry> entries = new HashMap<String, Entry>();
+
+ /**
+ * Default constructor that initializes collection with couple customer
+ * entries
+ */
+ public CustomerCollectionImpl() {
+
+ for (int i = 0; i < 4; i++) {
+ // id is supposed to be generated in a random way, but for the
+ // purpose of testing, we just make them as static ids
+
+ // String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+
+ String id = "urn:uuid:customer-" + String.valueOf(i);
+ Entry entry = new Entry();
+ entry.setId(id);
+ entry.setTitle(new PlainTextConstruct("EntryTitle_" + i));
+ entry.setContent(new PlainTextConstruct("content_" + i));
+ entry.setUpdated(DateTime.now());
+ // FIXME: The following three lines of code need to be fixed to add
+ // HTML links.
+ Link link = new Link();
+ link.setType(Link.Type.ATOM);
+ link.setRel(Link.Rel.ENTRY_EDIT);
+ link.setHref("http://localhost:8084/customer" + "/" + id);
+ entry.getLinks().add(link);
+
+ // entry.addHtmlLink(""+id, "", "edit");
+ // entry.addHtmlLink(""+id, "", "alternate");
+ entries.put(id, entry);
+ System.out.println(">>> id=" + id);
+ }
+ }
+
+ public Entry post(Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
+
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+ entry.setId(id);
+
+ Link link = new Link();
+ link.setType(Link.Type.ATOM);
+ link.setRel(Link.Rel.ENTRY_EDIT);
+ link.setHref("http://localhost:8084/customer" + "/" + id);
+ entry.getLinks().add(link);
+
+ //entry.addLink("" + id, "edit"); entry.addLink("" + id, "alternate");
+ entry.setUpdated(DateTime.now());
+
+ // entry.addHtmlLink("http://www.google.com", "languageType", "edit");
+ // entry.addHtmlLink("http://www.google.com", "languageType",
+ // "alternate");
+
+ entries.put(id, entry);
+ System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
+ return entry;
+ }
+
+ public Entry get(String id) {
+ System.out.println(">>> ResourceCollectionImpl.get id= " + id);
+ return entries.get(id);
+ }
+
+ public void put(String id, Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.put id=" + id + " entry=" + entry.getTitle().getPlainText());
+ entry.setUpdated(DateTime.now());
+ entries.put(id, entry);
+ }
+
+
+ public void delete(String id) {
+ System.out.println(">>> ResourceCollectionImpl.delete id=" + id);
+ entries.remove(id);
+ }
+
+
+ public Feed getFeed() {
+ System.out.println(">>> ResourceCollectionImpl.get collection");
+
+ Feed feed = new Feed();
+ feed.setTitle(new PlainTextConstruct("Feedtitle(LocalHostServlet)"));
+ feed.setSubtitle(new PlainTextConstruct("Subtitle: This is a sample feed"));
+ feed.setUpdated(DateTime.now());
+ // FIXME: The following two lines of code need to be fixed
+ // feed.addHtmlLink("", "", "");
+ // feed.addHtmlLink("", "languageType", "self");
+ ArrayList<Entry> entryList = new ArrayList<Entry>();
+ for (Entry entry : entries.values()) {
+ entryList.add(entry);
+ }
+ feed.setEntries(entryList);
+
+ return feed;
+ }
+
+ //FIXME: need to be modified
+ public Feed query(Query query) {
+ System.out.println(">>> ResourceCollectionImpl.query collection ");
+ return getFeed();
+ }
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
new file mode 100644
index 0000000000..902d251200
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.PlainTextConstruct;
+
+public class GoogleBloggerServiceTestCase extends TestCase{
+
+ private Node consumerNode = null;
+ private CustomerClient testService = null;
+
+ public GoogleBloggerServiceTestCase(){
+ }
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ System.out.println("Method Test Start-----------------------------------------------------------------------");
+
+ //Initialize the GData client service (Reference Binding test)
+ String contribution = ContributionLocationHelper.getContributionLocation(GoogleBloggerServiceTestCase.class);
+ consumerNode = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite", new Contribution("consumer", contribution));
+ consumerNode.start();
+ testService = consumerNode.getService(CustomerClient.class, "CustomerClient");
+ }
+
+ @After
+ @Override
+ public void tearDown(){
+ System.out.println("Method Test End------------------------------------------------------------------------");
+ System.out.println("\n\n");
+ consumerNode.stop();
+ consumerNode.destroy();
+ }
+
+ @Test
+ public void testClientGetFeed() throws Exception {
+ Feed feed = testService.clientGetFeed();
+ System.out.println("feed title: " + feed.getTitle().getPlainText());
+ assertEquals("gdata binding tuscany test", feed.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientGetEntry() throws Exception {
+ String entryID = "8308734583601887890";
+ Entry blogEntry = testService.clientGetEntry(entryID);
+ System.out.println("Entry ID: " + blogEntry.getId());
+ assertTrue(blogEntry.getId().endsWith(entryID));
+ System.out.println("------------------------------------------------------------\n\n");
+ }
+
+
+ @Test
+ public void testClientPut() throws Exception {
+ String entryID = "2889832689497686762";
+ String newBlogEntryTitle = "updatedTitleByTestCase2";
+ testService.clientPut(entryID, newBlogEntryTitle); //update the title
+ Thread.sleep(300);
+ Entry updatedEntry = testService.clientGetEntry(entryID);
+ assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ }
+
+
+
+ @Test
+ public void testClientPost() throws Exception {
+ String blogEntryTitle = "titleByBloogerTestcase000";
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
+ newEntry.setContent(new PlainTextConstruct("contentByBloggerTestCase000"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientDelete() throws Exception {
+
+ //This test case might fail
+ //because Google blogger service has limitation on new posts allowed everyday/every hour?
+
+ System.out.println("testClientDelete");
+ //We create a new post, and then delete it
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct("blogEntryShouldNotApear"));
+ newEntry.setContent(new PlainTextConstruct("contentByBloggerShouldNotAppear"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ Thread.sleep(300);
+ int idStartPosition = postedEntry.getId().lastIndexOf("-");
+ String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
+ System.out.println("postedEntryID: " + postedEntryID );
+
+ //Before deletion
+ Entry entry00 = testService.clientGetEntry(postedEntryID);
+ System.out.println("Before Deleteion: " + entry00.getId());
+
+ //Delete this entry
+ testService.clientDelete(postedEntryID);
+
+ //Worked: this newly posted entry did not appear in the blogspot website,
+ //But we need a Junit assertion here
+ //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
+ //FIXME: Need an assertion here
+ //Assert(....);
+ }
+
+
+ @Test
+ public void testClientQuery() throws Exception {
+ Query myQuery = new Query(new URL("http://haibotuscany.blogspot.com/feeds/posts/default"));
+ myQuery.setMaxResults(100);
+ //myQuery.setUpdatedMin(startTime);
+ myQuery.setUpdatedMax(DateTime.now());
+ Feed resultFeed = testService.clientQuery(myQuery);
+ System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
+ System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
+ //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
+ }
+
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
new file mode 100644
index 0000000000..749dd41710
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.PlainTextConstruct;
+
+public class GoogleCalendarServiceTestCase extends TestCase{
+
+ private Node consumerNode = null;
+ private CustomerClient testService = null;
+
+ public GoogleCalendarServiceTestCase(){
+ }
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ System.out.println("Method Test Start-----------------------------------------------------------------------");
+
+ //Initialize the GData client service (Reference Binding test)
+ String contribution = ContributionLocationHelper.getContributionLocation(GoogleCalendarServiceTestCase.class);
+ consumerNode = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite", new Contribution("consumer", contribution));
+ consumerNode.start();
+ testService = consumerNode.getService(CustomerClient.class, "CustomerClient");
+ }
+
+ @After
+ @Override
+ public void tearDown(){
+ System.out.println("Method Test End------------------------------------------------------------------------");
+ System.out.println("\n\n");
+ consumerNode.stop();
+ consumerNode.destroy();
+ }
+
+ @Test
+ public void testClientGetFeed() throws Exception {
+ Feed feed = testService.clientGetFeed();
+ System.out.println("feed title: " + feed.getTitle().getPlainText());
+ assertEquals("gsoc gosc", feed.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientGetEntry() throws Exception {
+ String entryID = "1c76lcl70jg9r0fm18rcbneea8";
+ Entry blogEntry = testService.clientGetEntry(entryID);
+ System.out.println("Entry ID: " + blogEntry.getId());
+ assertTrue(blogEntry.getId().endsWith(entryID));
+ System.out.println("------------------------------------------------------------\n\n");
+ }
+
+
+ @Test
+ public void testClientPut() throws Exception {
+ String entryID = "1c76lcl70jg9r0fm18rcbneea8";
+ String newBlogEntryTitle = "updatedTitleByGoogleContactsConsumerTestCase";
+ testService.clientPut(entryID, newBlogEntryTitle); //update the title
+ Thread.sleep(300);
+ Entry updatedEntry = testService.clientGetEntry(entryID);
+ assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ }
+
+
+
+ @Test
+ public void testClientPost() throws Exception {
+ String blogEntryTitle = "titleByGoogleCalendarTestcase";
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
+ newEntry.setContent(new PlainTextConstruct("contentByGoogleCalendarTestCase"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientDelete() throws Exception {
+
+ //This test case might fail
+ //because Google blogger service has limitation on new posts allowed everyday/every hour?
+
+ System.out.println("testClientDelete");
+ //We create a new post, and then delete it
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct("calendarEntryShouldNotApear"));
+ newEntry.setContent(new PlainTextConstruct("calendarByBloggerShouldNotAppear"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ Thread.sleep(300);
+
+ System.out.println("ID: " + postedEntry.getId());
+
+ int idStartPosition = postedEntry.getId().lastIndexOf("/");
+ String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
+ System.out.println("postedEntryID: " + postedEntryID );
+
+ //Before deletion
+ Entry entry00 = testService.clientGetEntry(postedEntryID);
+ System.out.println("Before Deleteion: " + entry00.getId());
+
+ //Delete this entry
+ testService.clientDelete(postedEntryID);
+
+ //Worked: this newly posted entry did not appear in the contact list
+ //But we need a Junit assertion here
+ //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
+ //FIXME: Need an assertion here
+ //Assert(....);
+ }
+
+
+ @Test
+ public void testClientQuery() throws Exception {
+ Query myQuery = new Query(new URL("http://www.google.com/calendar/feeds/haibotuscany@gmail.com/private/full"));
+ myQuery.setMaxResults(100);
+ //myQuery.setUpdatedMin(startTime);
+ myQuery.setUpdatedMax(DateTime.now());
+
+ //Google Calendar service supports full-text search
+ String queryString = "event0";
+ myQuery.setFullTextQuery(queryString);
+
+ Feed resultFeed = testService.clientQuery(myQuery);
+ System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
+ System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
+ //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
+ }
+
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
new file mode 100644
index 0000000000..cab7196a69
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gdata.client.Query;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.PlainTextConstruct;
+
+public class GoogleContactsServiceTestCase extends TestCase{
+
+ private Node consumerNode = null;
+ private CustomerClient testService = null;
+
+ public GoogleContactsServiceTestCase(){
+
+ }
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ System.out.println("Method Test Start-----------------------------------------------------------------------");
+
+ //Initialize the GData client service (Reference Binding test)
+ String contribution = ContributionLocationHelper.getContributionLocation(GoogleContactsServiceTestCase.class);
+ consumerNode = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite", new Contribution("consumer", contribution));
+ consumerNode.start();
+ testService = consumerNode.getService(CustomerClient.class, "CustomerClient");
+ }
+
+ @After
+ @Override
+ public void tearDown(){
+ System.out.println("Method Test End------------------------------------------------------------------------");
+ System.out.println("\n\n");
+ consumerNode.stop();
+ consumerNode.destroy();
+ }
+
+ @Test
+ public void testClientGetFeed() throws Exception {
+ Feed feed = testService.clientGetFeed();
+ System.out.println("feed title: " + feed.getTitle().getPlainText());
+ assertEquals("Haibo Zhao's Contacts", feed.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientGetEntry() throws Exception {
+ String entryID = "12feeeb38ab87365";
+ Entry contactEntry = testService.clientGetEntry(entryID);
+ System.out.println("Entry ID: " + contactEntry.getId());
+ assertTrue(contactEntry.getId().endsWith(entryID));
+ System.out.println("------------------------------------------------------------\n\n");
+ }
+
+
+ @Test
+ public void testClientPut() throws Exception {
+ String entryID = "12feeeb38ab87365";
+ String newBlogEntryTitle = "updatedTitleByGoogleContactsConsumerTestCase";
+ testService.clientPut(entryID, newBlogEntryTitle); //update the title
+ Thread.sleep(300);
+ Entry updatedEntry = testService.clientGetEntry(entryID);
+ assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ }
+
+
+
+ @Test
+ public void testClientPost() throws Exception {
+ String blogEntryTitle = "titleByGoogleContactsTestcase";
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
+ newEntry.setContent(new PlainTextConstruct("contentByGoogleContactsTestCase"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
+ }
+
+
+ @Test
+ public void testClientDelete() throws Exception {
+
+ //This test case might fail
+ //because Google blogger service has limitation on new posts allowed everyday/every hour?
+
+ System.out.println("testClientDelete");
+ //We create a new post, and then delete it
+ Entry newEntry = new Entry();
+ newEntry.setTitle(new PlainTextConstruct("contactEntryShouldNotApear"));
+ newEntry.setContent(new PlainTextConstruct("contactByBloggerShouldNotAppear"));
+ Entry postedEntry = testService.clientPost(newEntry);
+ Thread.sleep(300);
+
+ System.out.println("ID: " + postedEntry.getId());
+
+ int idStartPosition = postedEntry.getId().lastIndexOf("/");
+ String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
+ System.out.println("postedEntryID: " + postedEntryID );
+
+ //Before deletion
+ Entry entry00 = testService.clientGetEntry(postedEntryID);
+ System.out.println("Before Deleteion: " + entry00.getId());
+
+ //Delete this entry
+ testService.clientDelete(postedEntryID);
+
+ //Worked: this newly posted entry did not appear in the contact list
+ //But we need a Junit assertion here
+ //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
+ //FIXME: Need an assertion here
+ //Assert(....);
+ }
+
+
+ @Test
+ public void testClientQuery() throws Exception {
+ Query myQuery = new Query(new URL("http://www.google.com/m8/feeds/contacts/default/base"));
+ myQuery.setMaxResults(100);
+ //myQuery.setUpdatedMin(startTime);
+ myQuery.setUpdatedMax(DateTime.now());
+ Feed resultFeed = testService.clientQuery(myQuery);
+ System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
+ System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
+ //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
+ }
+
+
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java
new file mode 100644
index 0000000000..a9b12c3d32
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+public class Provider {
+
+ public static void main(String[] args) {
+
+ String contribution = ContributionLocationHelper.getContributionLocation(Provider.class);
+ Node node = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/Provider.composite", new Contribution("provider", contribution));
+ node.start();
+ System.out.println("Provider.composite ready...");
+
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ node.stop();
+ node.destroy();
+ }
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java
new file mode 100644
index 0000000000..141f641575
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.gdata;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+public class StartLocalhostServlet {
+
+ public static void main(String[] args) {
+
+ String contribution = ContributionLocationHelper.getContributionLocation(Provider.class);
+ Node node = NodeFactory.newInstance().createNode(
+ "org/apache/tuscany/sca/binding/gdata/Provider.composite", new Contribution("provider", contribution));
+ node.start();
+ System.out.println("Provider.composite ready...");
+
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ node.stop();
+ node.destroy();
+ }
+}
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/log4j.properties b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..33eaf11c1f
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/log4j.properties
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=INFO, CONSOLE
+
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %x - %m\n
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite
new file mode 100644
index 0000000000..a7941a2056
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.gdata uri="http://localhost:8084/customer" serviceType="localServiceBinding" username="admin" password="admin"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite
new file mode 100644
index 0000000000..078873c44f
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.gdata uri="http://haibotuscany.blogspot.com/feeds/posts/default" serviceType="blogger" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite
new file mode 100644
index 0000000000..7e0c925482
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.gdata uri="http://www.google.com/calendar/feeds/haibotuscany@gmail.com/private/full" serviceType="cl" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite
new file mode 100644
index 0000000000..bc1ea7a8a9
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.gdata uri="http://www.google.com/m8/feeds/contacts/default/base" serviceType="cp" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite
new file mode 100644
index 0000000000..a4cf00dc84
--- /dev/null
+++ b/sca-java-2.x/branches/sca-equinox/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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">
+
+ <service name="customer" promote="CustomerCollection">
+ <tuscany:binding.gdata uri = "http://localhost:8084/customer"/>
+ </service>
+
+ <component name="CustomerCollection">
+ <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerCollectionImpl"/>
+ </component>
+
+</composite>