summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-02 04:29:04 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-02 04:29:04 +0000
commit36ff4f08abdcf2ccf0fc816ff7bbc54eec2f11c1 (patch)
tree688c11526a0a8ce0a66a2ba73cd174b6689fece6 /branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org
parent60b0359c6b93e39dbfcdab2e62b3b0fb602e02c6 (diff)
Conversion to JUnit 4.5 + Cleaning up System.out
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810356 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org')
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java6
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java65
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java48
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java16
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java21
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java53
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java53
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java46
8 files changed, 143 insertions, 165 deletions
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
index 2517c7233a..7d723a2883 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
@@ -36,7 +36,7 @@ public class Consumer {
Feed feed = testService.clientGetFeed();
- System.out.println("#Entries(Before post): "+ testService.clientGetFeed().getEntries().size());
+ //System.out.println("#Entries(Before post): "+ testService.clientGetFeed().getEntries().size());
/*
String entryID = "tag:blogger.com,1999:blog-4520949313432095990.post-973462497533349425";
@@ -49,11 +49,11 @@ public class Consumer {
myEntry.setContent(new PlainTextConstruct("contentByConsmer2"));
testService.clientPost(myEntry);
- System.out.println("#Entries(After post): "+ testService.clientGetFeed().getEntries().size());
+ //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());
+ //System.out.println("Entry id: " + entry.getId());
}
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
index 2c15242675..be4cc657f4 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
@@ -19,60 +19,57 @@
package org.apache.tuscany.sca.binding.gdata;
-import junit.framework.TestCase;
+import junit.framework.Assert;
+
import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
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 SCADomain scaDomainProvider = null;
- private SCADomain scaDomainConsumer = null;
- private CustomerClient testService = null;
+public class ConsumerProviderTestCase {
- @Before
- @Override
- public void setUp() throws Exception {
- System.out.println("Method Test Start-----------------------------------------------------------------------");
+ private static SCADomain scaDomainProvider = null;
+ private static SCADomain scaDomainConsumer = null;
+ private static CustomerClient testService = null;
+ @BeforeClass
+ public static void setUp() throws Exception {
// Setup the local GData servlet (Service Binding test)
scaDomainProvider = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite");
- System.out.println("[Debug Info] Provider.composite ready...");
+ //System.out.println("[Debug Info] Provider.composite ready...");
// Initialize the GData client service (Reference Binding test)
scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Consumer.composite");
testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
}
- @After
- @Override
- public void tearDown() {
+ @AfterClass
+ public static void tearDown() {
+ scaDomainConsumer.close();
scaDomainProvider.close();
- 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);
+ //System.out.println(feed.getTitle().getPlainText());
+ Assert.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());
+ Assert.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());
+ //System.out.println("entryID in testcase: " + entry.getId());
+ Assert.assertEquals(entryID, entry.getId());
}
@Test
@@ -81,7 +78,7 @@ public class ConsumerProviderTestCase extends TestCase {
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());
+ Assert.assertEquals("NewEntry title by Post", postedEntry.getTitle().getPlainText());
}
@@ -90,12 +87,12 @@ public class ConsumerProviderTestCase extends TestCase {
public void testClientPut() throws Exception {
String newTitleValue = "newTitleValueByPut";
String entryID = "urn:uuid:customer-0";
- System.out.println("Before clientPut");
+ //System.out.println("Before clientPut");
testService.clientPut(entryID, newTitleValue);
- System.out.println("After clientPut");
+ //System.out.println("After clientPut");
Entry updatedEntry = testService.clientGetEntry(entryID);
- System.out.println("title: "+ updatedEntry.getTitle().getPlainText());
- assertEquals(newTitleValue, updatedEntry.getTitle().getPlainText());
+ //System.out.println("title: "+ updatedEntry.getTitle().getPlainText());
+ Assert.assertEquals(newTitleValue, updatedEntry.getTitle().getPlainText());
}
@@ -116,22 +113,22 @@ public class ConsumerProviderTestCase extends TestCase {
Feed feed00 = testService.clientGetFeed();
int entryNum00 = feed00.getEntries().size(); // The number of entries
// before deleting
- System.out.println("entryNum00:" + entryNum00);
+ //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("confirmed entry ID: " + confirmedNewEntry.getId());
+ //System.out.println("confirmed entry title: " + confirmedNewEntry.getTitle().getPlainText());
- System.out.println("Before test clientDelete");
+ //System.out.println("Before test clientDelete");
testService.clientDelete(entryID);
- System.out.println("After test clientDelete");
+ //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
+ //System.out.println("entryNum01:" + entryNum01); // The number of entries after deleting
//assertEquals(1, entryNum00 - entryNum01);
}
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
index a2b1da894d..7fb7fa9fe2 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
@@ -36,14 +36,14 @@ public class CustomerClientImpl implements CustomerClient {
// 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");
+ //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());
+ //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());
+ //System.out.print("Entry" + i + "\t");
+ //System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
i++;
}
return feed;
@@ -53,11 +53,11 @@ public class CustomerClientImpl implements CustomerClient {
// 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");
+ //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());
+ //System.out.println("\n\n!!! Entry retrieved with id=" + entry.getId()
+ // + " title="
+ // + entry.getTitle().getPlainText());
return entry;
}
@@ -65,12 +65,11 @@ public class CustomerClientImpl implements CustomerClient {
// 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");
+ //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");
+ //System.out.println("!!! New entry posted with id=" + confirmedNewEntry.getId()
+ // + " title="
+ // + confirmedNewEntry.getTitle().getPlainText());
return confirmedNewEntry;
}
@@ -78,11 +77,10 @@ public class CustomerClientImpl implements CustomerClient {
// 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");
+ //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");
+ //System.out.println("!!! entry with id" + entryID);
}
@@ -90,16 +88,16 @@ public class CustomerClientImpl implements CustomerClient {
// Call Collection.put(entry, updatedTitle)
public void clientPut(String entryID, String newTitle) throws Exception {
- System.out.println("clientPut");
+ //System.out.println("clientPut");
// Put a new entry to the provider
- System.out.println(">>> put id=" + entryID + " title=" + newTitle);
+ //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");
+ //System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle());
+ //System.out.println("\n");
}
@@ -107,14 +105,14 @@ public class CustomerClientImpl implements CustomerClient {
// 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");
+ //System.out.println(">>> query the service");
Feed feed = resourceCollection.query(query);
- System.out.println("\n\n!!! Query result feed title: " + feed.getTitle().getPlainText());
+ //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());
+ //System.out.print("Entry" + i + "\t");
+ //System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
i++;
}
return feed;
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
index 3c11fb70b9..0772bd67ee 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
@@ -69,12 +69,12 @@ public class CustomerCollectionImpl implements Collection {
// entry.addHtmlLink(""+id, "", "edit");
// entry.addHtmlLink(""+id, "", "alternate");
entries.put(id, entry);
- System.out.println(">>> id=" + id);
+ //System.out.println(">>> id=" + id);
}
}
public Entry post(Entry entry) {
- System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
+ //System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
entry.setId(id);
@@ -93,30 +93,30 @@ public class CustomerCollectionImpl implements Collection {
// "alternate");
entries.put(id, entry);
- System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
+ //System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
return entry;
}
public Entry get(String id) {
- System.out.println(">>> ResourceCollectionImpl.get id= " + 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());
+ //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);
+ //System.out.println(">>> ResourceCollectionImpl.delete id=" + id);
entries.remove(id);
}
public Feed getFeed() {
- System.out.println(">>> ResourceCollectionImpl.get collection");
+ //System.out.println(">>> ResourceCollectionImpl.get collection");
Feed feed = new Feed();
feed.setTitle(new PlainTextConstruct("Feedtitle(LocalHostServlet)"));
@@ -136,7 +136,7 @@ public class CustomerCollectionImpl implements Collection {
//FIXME: need to be modified
public Feed query(Query query) {
- System.out.println(">>> ResourceCollectionImpl.query collection ");
+ //System.out.println(">>> ResourceCollectionImpl.query collection ");
return getFeed();
}
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
index 89f48f08d0..a827677fd0 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
@@ -42,8 +42,6 @@ public class GoogleBloggerServiceTestCase {
@BeforeClass
public static void setUp() throws Exception {
- System.out.println("Method Test Start-----------------------------------------------------------------------");
-
//Initialize the GData client service (Reference Binding test)
scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite");
testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
@@ -51,14 +49,13 @@ public class GoogleBloggerServiceTestCase {
@AfterClass
public static void tearDown(){
- System.out.println("Method Test End------------------------------------------------------------------------");
- System.out.println("\n\n");
+ scaDomainConsumer.close();
}
@Test
public void testClientGetFeed() throws Exception {
Feed feed = testService.clientGetFeed();
- System.out.println("feed title: " + feed.getTitle().getPlainText());
+ //System.out.println("feed title: " + feed.getTitle().getPlainText());
Assert.assertEquals("gdata binding tuscany test", feed.getTitle().getPlainText());
}
@@ -67,9 +64,9 @@ public class GoogleBloggerServiceTestCase {
public void testClientGetEntry() throws Exception {
String entryID = "8308734583601887890";
Entry blogEntry = testService.clientGetEntry(entryID);
- System.out.println("Entry ID: " + blogEntry.getId());
+ //System.out.println("Entry ID: " + blogEntry.getId());
Assert.assertTrue(blogEntry.getId().endsWith(entryID));
- System.out.println("------------------------------------------------------------\n\n");
+ //System.out.println("------------------------------------------------------------\n\n");
}
@@ -102,7 +99,7 @@ public class GoogleBloggerServiceTestCase {
//This test case might fail
//because Google blogger service has limitation on new posts allowed everyday/every hour?
- System.out.println("testClientDelete");
+ //System.out.println("testClientDelete");
//We create a new post, and then delete it
Entry newEntry = new Entry();
newEntry.setTitle(new PlainTextConstruct("blogEntryShouldNotApear"));
@@ -111,11 +108,11 @@ public class GoogleBloggerServiceTestCase {
Thread.sleep(Constants.SLEEP_INTERVAL);
int idStartPosition = postedEntry.getId().lastIndexOf("-");
String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- System.out.println("postedEntryID: " + postedEntryID );
+ //System.out.println("postedEntryID: " + postedEntryID );
//Before deletion
Entry entry00 = testService.clientGetEntry(postedEntryID);
- System.out.println("Before Deleteion: " + entry00.getId());
+ //System.out.println("Before Deleteion: " + entry00.getId());
//Delete this entry
testService.clientDelete(postedEntryID);
@@ -135,8 +132,8 @@ public class GoogleBloggerServiceTestCase {
//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());
+ //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/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
index 4451c40faf..e426e22ec9 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
@@ -21,11 +21,11 @@ package org.apache.tuscany.sca.binding.gdata;
import java.net.URL;
-import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.gdata.client.Query;
@@ -34,37 +34,32 @@ import com.google.gdata.data.Entry;
import com.google.gdata.data.Feed;
import com.google.gdata.data.PlainTextConstruct;
-public class GoogleCalendarServiceTestCase extends TestCase{
+public class GoogleCalendarServiceTestCase {
- private SCADomain scaDomainConsumer = null;
- private CustomerClient testService = null;
+ private static SCADomain scaDomainConsumer = null;
+ private static CustomerClient testService = null;
public GoogleCalendarServiceTestCase(){
}
- @Before
- @Override
- public void setUp() throws Exception {
- System.out.println("Method Test Start-----------------------------------------------------------------------");
-
+ @BeforeClass
+ public static void setUp() throws Exception {
//Initialize the GData client service (Reference Binding test)
scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite");
testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
}
- @After
- @Override
- public void tearDown(){
- System.out.println("Method Test End------------------------------------------------------------------------");
- System.out.println("\n\n");
+ @AfterClass
+ public static void tearDown(){
+ scaDomainConsumer.close();
}
@Test
public void testClientGetFeed() throws Exception {
Feed feed = testService.clientGetFeed();
- System.out.println("feed title: " + feed.getTitle().getPlainText());
- assertEquals("gsoc gosc", feed.getTitle().getPlainText());
+ //System.out.println("feed title: " + feed.getTitle().getPlainText());
+ Assert.assertEquals("gsoc gosc", feed.getTitle().getPlainText());
}
@@ -72,9 +67,9 @@ public class GoogleCalendarServiceTestCase extends TestCase{
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");
+ //System.out.println("Entry ID: " + blogEntry.getId());
+ Assert.assertTrue(blogEntry.getId().endsWith(entryID));
+ //System.out.println("------------------------------------------------------------\n\n");
}
@@ -85,7 +80,7 @@ public class GoogleCalendarServiceTestCase extends TestCase{
testService.clientPut(entryID, newBlogEntryTitle); //update the title
Thread.sleep(Constants.SLEEP_INTERVAL);
Entry updatedEntry = testService.clientGetEntry(entryID);
- assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
}
@@ -97,7 +92,7 @@ public class GoogleCalendarServiceTestCase extends TestCase{
newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
newEntry.setContent(new PlainTextConstruct("contentByGoogleCalendarTestCase"));
Entry postedEntry = testService.clientPost(newEntry);
- assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
+ Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
}
@@ -107,7 +102,7 @@ public class GoogleCalendarServiceTestCase extends TestCase{
//This test case might fail
//because Google blogger service has limitation on new posts allowed everyday/every hour?
- System.out.println("testClientDelete");
+ //System.out.println("testClientDelete");
//We create a new post, and then delete it
Entry newEntry = new Entry();
newEntry.setTitle(new PlainTextConstruct("calendarEntryShouldNotApear"));
@@ -115,15 +110,15 @@ public class GoogleCalendarServiceTestCase extends TestCase{
Entry postedEntry = testService.clientPost(newEntry);
Thread.sleep(Constants.SLEEP_INTERVAL);
- System.out.println("ID: " + postedEntry.getId());
+ //System.out.println("ID: " + postedEntry.getId());
int idStartPosition = postedEntry.getId().lastIndexOf("/");
String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- System.out.println("postedEntryID: " + postedEntryID );
+ //System.out.println("postedEntryID: " + postedEntryID );
//Before deletion
Entry entry00 = testService.clientGetEntry(postedEntryID);
- System.out.println("Before Deleteion: " + entry00.getId());
+ //System.out.println("Before Deleteion: " + entry00.getId());
//Delete this entry
testService.clientDelete(postedEntryID);
@@ -148,8 +143,8 @@ public class GoogleCalendarServiceTestCase extends TestCase{
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());
+ //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/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
index 7ef9c29fcd..11f39d184b 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
@@ -21,11 +21,11 @@ package org.apache.tuscany.sca.binding.gdata;
import java.net.URL;
-import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.gdata.client.Query;
@@ -34,37 +34,32 @@ import com.google.gdata.data.Entry;
import com.google.gdata.data.Feed;
import com.google.gdata.data.PlainTextConstruct;
-public class GoogleContactsServiceTestCase extends TestCase {
+public class GoogleContactsServiceTestCase {
- private SCADomain scaDomainConsumer = null;
- private CustomerClient testService = null;
+ private static SCADomain scaDomainConsumer = null;
+ private static CustomerClient testService = null;
public GoogleContactsServiceTestCase(){
}
- @Before
- @Override
- public void setUp() throws Exception {
- System.out.println("Method Test Start-----------------------------------------------------------------------");
-
+ @BeforeClass
+ public static void setUp() throws Exception {
//Initialize the GData client service (Reference Binding test)
scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite");
testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
}
- @After
- @Override
- public void tearDown(){
- System.out.println("Method Test End------------------------------------------------------------------------");
- System.out.println("\n\n");
+ @AfterClass
+ public static void tearDown(){
+ scaDomainConsumer.close();
}
@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());
+ //System.out.println("feed title: " + feed.getTitle().getPlainText());
+ Assert.assertEquals("Haibo Zhao's Contacts", feed.getTitle().getPlainText());
}
@@ -72,9 +67,9 @@ public class GoogleContactsServiceTestCase extends TestCase {
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");
+ //System.out.println("Entry ID: " + contactEntry.getId());
+ Assert.assertTrue(contactEntry.getId().endsWith(entryID));
+ //System.out.println("------------------------------------------------------------\n\n");
}
@@ -85,7 +80,7 @@ public class GoogleContactsServiceTestCase extends TestCase {
testService.clientPut(entryID, newBlogEntryTitle); //update the title
Thread.sleep(Constants.SLEEP_INTERVAL);
Entry updatedEntry = testService.clientGetEntry(entryID);
- assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
}
@@ -97,7 +92,7 @@ public class GoogleContactsServiceTestCase extends TestCase {
newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
newEntry.setContent(new PlainTextConstruct("contentByGoogleContactsTestCase"));
Entry postedEntry = testService.clientPost(newEntry);
- assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
+ Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
}
@@ -107,7 +102,7 @@ public class GoogleContactsServiceTestCase extends TestCase {
//This test case might fail
//because Google blogger service has limitation on new posts allowed everyday/every hour?
- System.out.println("testClientDelete");
+ //System.out.println("testClientDelete");
//We create a new post, and then delete it
Entry newEntry = new Entry();
newEntry.setTitle(new PlainTextConstruct("contactEntryShouldNotApear"));
@@ -115,15 +110,15 @@ public class GoogleContactsServiceTestCase extends TestCase {
Entry postedEntry = testService.clientPost(newEntry);
Thread.sleep(Constants.SLEEP_INTERVAL);
- System.out.println("ID: " + postedEntry.getId());
+ //System.out.println("ID: " + postedEntry.getId());
int idStartPosition = postedEntry.getId().lastIndexOf("/");
String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- System.out.println("postedEntryID: " + postedEntryID );
+ //System.out.println("postedEntryID: " + postedEntryID );
//Before deletion
Entry entry00 = testService.clientGetEntry(postedEntryID);
- System.out.println("Before Deleteion: " + entry00.getId());
+ //System.out.println("Before Deleteion: " + entry00.getId());
//Delete this entry
testService.clientDelete(postedEntryID);
@@ -143,8 +138,8 @@ public class GoogleContactsServiceTestCase extends TestCase {
//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());
+ //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/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java
index 474d669ff0..6a657d6736 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java
@@ -21,50 +21,46 @@ package org.apache.tuscany.sca.binding.gdata;
import java.net.URL;
-import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
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 GoogleWebAlbumServiceTestCase extends TestCase{
+public class GoogleWebAlbumServiceTestCase {
- private SCADomain scaDomainConsumer = null;
- private CustomerClient testService = null;
+ private static SCADomain scaDomainConsumer = null;
+ private static CustomerClient testService = null;
public GoogleWebAlbumServiceTestCase(){
}
- @Before
- @Override
- public void setUp() throws Exception {
- System.out.println("Method Test Start-----------------------------------------------------------------------");
+ @BeforeClass
+ public static void setUp() throws Exception {
+ //System.out.println("Method Test Start-----------------------------------------------------------------------");
//Initialize the GData client service (Reference Binding test)
scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite");
testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
}
- @After
- @Override
- public void tearDown(){
- System.out.println("Method Test End------------------------------------------------------------------------");
- System.out.println("\n\n");
+ @AfterClass
+ public static void tearDown(){
+ //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 title: " + feed.getTitle().getPlainText());
- assertEquals("flowers", feed.getTitle().getPlainText());
+ //System.out.println("feed title: " + feed.getTitle().getPlainText());
+ Assert.assertEquals("flowers", feed.getTitle().getPlainText());
}
@@ -74,9 +70,9 @@ public class GoogleWebAlbumServiceTestCase extends TestCase{
public void testClientGetEntry() throws Exception {
String entryID = "photoid/5233468700029715874";
Entry contactEntry = testService.clientGetEntry(entryID);
- System.out.println("Entry ID: " + contactEntry.getId());
- assertTrue(contactEntry.getId().endsWith(entryID));
- System.out.println("------------------------------------------------------------\n\n");
+ //System.out.println("Entry ID: " + contactEntry.getId());
+ Assert.assertTrue(contactEntry.getId().endsWith(entryID));
+ //System.out.println("------------------------------------------------------------\n\n");
}
@@ -88,8 +84,8 @@ public class GoogleWebAlbumServiceTestCase extends TestCase{
myQuery.setMaxResults(100);
myQuery.setFullTextQuery("photo");
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());
+ //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());
}
@@ -102,7 +98,7 @@ public class GoogleWebAlbumServiceTestCase extends TestCase{
testService.clientPut(entryID, newBlogEntryTitle); //update the title
Thread.sleep(Constants.SLEEP_INTERVAL);
Entry updatedEntry = testService.clientGetEntry(entryID);
- assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
+ Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
}