You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2011/10/27 23:12:12 UTC

svn commit: r1190037 - in /shindig/trunk/java: samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/ samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/ server/src/test/java/org/apache/shindig/server/endtoend/

Author: lindner
Date: Thu Oct 27 21:12:12 2011
New Revision: 1190037

URL: http://svn.apache.org/viewvc?rev=1190037&view=rev
Log:
Fix OAuth2 tests for samples

Modified:
    shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/SpiDatabaseBootstrap.java
    shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaRestfulJsonDataTest.java
    shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java
    shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndServer.java

Modified: shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/SpiDatabaseBootstrap.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/SpiDatabaseBootstrap.java?rev=1190037&r1=1190036&r2=1190037&view=diff
==============================================================================
--- shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/SpiDatabaseBootstrap.java (original)
+++ shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/SpiDatabaseBootstrap.java Thu Oct 27 21:12:12 2011
@@ -48,6 +48,7 @@ import org.apache.shindig.social.opensoc
 import org.apache.shindig.social.opensocial.model.Smoker;
 import org.apache.shindig.social.opensocial.model.Url;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -81,14 +82,14 @@ public class SpiDatabaseBootstrap {
   /*
    * Init database bootstrap
    */
-  public void init() throws Exception {
+  public void init() throws ParseException {
     this.bootstrapDatabase();    
   }
   
   /*
    * Bootstrap database with some dummy test data
    */
-  protected void bootstrapDatabase() throws Exception {
+  protected void bootstrapDatabase() throws ParseException {
     // Start transaction
     if (!entityManager.getTransaction().isActive()) {
       entityManager.getTransaction().begin();
@@ -325,7 +326,7 @@ public class SpiDatabaseBootstrap {
   }
 
   private Person buildPerson(String id, String displayName, Person.Gender gender, boolean hasApp,
-      String familyName, String givenName, String formatted) throws Exception {
+      String familyName, String givenName, String formatted) throws ParseException {
     Person person = buildPersonTemplate(id);
     person.setDisplayName(displayName);
     person.setGender(gender);
@@ -340,7 +341,7 @@ public class SpiDatabaseBootstrap {
     return person;
   }
   
-  private Person buildCanonicalPerson() throws Exception {
+  private Person buildCanonicalPerson() throws ParseException {
     Person person = buildPersonTemplate("canonical");
     person.setAboutMe("I have an example of every piece of data");    
     person.setActivities(asList("Coding Shindig"));    
@@ -665,7 +666,7 @@ public class SpiDatabaseBootstrap {
     return person;
   }
   
-  private Date buildDate(String dateAsString) throws Exception {    
+  private Date buildDate(String dateAsString) throws ParseException {
     return DATE_FORMATTER.parse(dateAsString);
   }
   

Modified: shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaRestfulJsonDataTest.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaRestfulJsonDataTest.java?rev=1190037&r1=1190036&r2=1190037&view=diff
==============================================================================
--- shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaRestfulJsonDataTest.java (original)
+++ shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaRestfulJsonDataTest.java Thu Oct 27 21:12:12 2011
@@ -42,14 +42,19 @@ public class JpaRestfulJsonDataTest exte
    * @throws Exception the exception
    */
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     // Init config
-    Injector injector = JpaRestfulTestConfigHelper.init();
-    this.setServlet(JpaRestfulTestConfigHelper.getDataServiceServlet(injector));
-    
-    // Bootstrap hibernate and associated test db, and setup db with test data
-    this.bootstrap = injector.getInstance(SpiDatabaseBootstrap.class);
-    this.bootstrap.init();
+    try {
+      Injector injector = JpaRestfulTestConfigHelper.init();
+      this.setServlet(JpaRestfulTestConfigHelper.getDataServiceServlet(injector));
+
+      // Bootstrap hibernate and associated test db, and setup db with test data
+      this.bootstrap = injector.getInstance(SpiDatabaseBootstrap.class);
+      this.bootstrap.init();
+    } catch (Exception e) {
+      System.out.println(e);
+      fail();
+    }
   }
   
   @After

Modified: shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java?rev=1190037&r1=1190036&r2=1190037&view=diff
==============================================================================
--- shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java (original)
+++ shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java Thu Oct 27 21:12:12 2011
@@ -27,7 +27,15 @@ import org.apache.shindig.common.Propert
 import org.apache.shindig.gadgets.DefaultGuiceModule;
 import org.apache.shindig.gadgets.admin.GadgetAdminModule;
 import org.apache.shindig.gadgets.oauth.OAuthModule;
+import org.apache.shindig.gadgets.oauth2.OAuth2MessageModule;
+import org.apache.shindig.gadgets.oauth2.OAuth2Module;
+import org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerModule;
+import org.apache.shindig.gadgets.oauth2.persistence.sample.OAuth2PersistenceModule;
 import org.apache.shindig.social.core.config.SocialApiGuiceModule;
+import org.apache.shindig.social.core.oauth2.OAuth2DataService;
+import org.apache.shindig.social.core.oauth2.OAuth2DataServiceImpl;
+import org.apache.shindig.social.core.oauth2.OAuth2Service;
+import org.apache.shindig.social.core.oauth2.OAuth2ServiceImpl;
 import org.apache.shindig.social.opensocial.jpa.AccountDb;
 import org.apache.shindig.social.opensocial.jpa.ActivityDb;
 import org.apache.shindig.social.opensocial.jpa.AddressDb;
@@ -80,10 +88,16 @@ public class JpaTestGuiceModule extends 
     install(new DefaultGuiceModule());
     install(new SocialApiGuiceModule());
     install(new OAuthModule());
+    install(new OAuth2Module());
+    install(new OAuth2PersistenceModule());
+    install(new OAuth2MessageModule());
+    install(new OAuth2HandlerModule());
+
     install(new JPASocialModule(entityManager));
 
     this.bind(OAuthDataStore.class).toInstance(new NullOAuthDataStore());
-
+    bind(OAuth2Service.class).to(OAuth2ServiceImpl.class);
+    bind(OAuth2DataService.class).to(OAuth2DataServiceImpl.class);
     // Entities
     this.bind(Activity.class).to(ActivityDb.class);
     this.bind(Account.class).to(AccountDb.class);

Modified: shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndServer.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndServer.java?rev=1190037&r1=1190036&r2=1190037&view=diff
==============================================================================
--- shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndServer.java (original)
+++ shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndServer.java Thu Oct 27 21:12:12 2011
@@ -132,7 +132,6 @@ public class EndToEndServer {
               DefaultGuiceModule.class.getName(),
               PropertiesModule.class.getName(), 
               OAuthModule.class.getName(),
-              OAuthModule.class.getName(),
               OAuth2Module.class.getName(),
               OAuth2PersistenceModule.class.getName(), 
               OAuth2MessageModule.class.getName(),