diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-02 04:22:27 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-02 04:22:27 +0000 |
commit | 60b0359c6b93e39dbfcdab2e62b3b0fb602e02c6 (patch) | |
tree | 8d0afc819dfe5d641b862b67fcd1cbcd543f0c1d /branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java | |
parent | 5e63e21cefacdeb0e5abfc71259733abe68804c8 (diff) |
Conversion to JUnit 4.5 + Cleaning up System.out
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810355 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java')
-rw-r--r-- | branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java index 4451c40faf..9c3122e134 100644 --- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java +++ b/branches/sca-java-1.5.1/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(){ + 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,11 +80,9 @@ 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()); } - - @Test public void testClientPost() throws Exception { String blogEntryTitle = "titleByGoogleCalendarTestcase"; @@ -97,17 +90,16 @@ 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()); } - @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"); + //System.out.println("testClientDelete"); //We create a new post, and then delete it Entry newEntry = new Entry(); newEntry.setTitle(new PlainTextConstruct("calendarEntryShouldNotApear")); @@ -115,15 +107,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 +140,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()); } |