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

svn commit: r1160560 - in /incubator/rave/trunk/rave-shindig/src: main/resources/ main/webapp/WEB-INF/ test/java/org/apache/rave/gadgets/oauth/repository/ test/java/org/apache/rave/inject/ test/java/org/apache/rave/opensocial/repository/ test/resources/

Author: jasha
Date: Tue Aug 23 06:42:09 2011
New Revision: 1160560

URL: http://svn.apache.org/viewvc?rev=1160560&view=rev
Log:
RAVE-208 split up Spring configuration to prevent duplicate datasourcePopulator. 
Rename Spring context files to prevent name clashing in overrides.

Added:
    incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml
      - copied, changed from r1160556, incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml
    incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-dataContext.xml
    incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml
      - copied, changed from r1160556, incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml
    incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-dataContext.xml
Removed:
    incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml
    incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml
Modified:
    incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml
    incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthConsumerStoreRepositoryTest.java
    incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthTokenInfoRepositoryTest.java
    incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListenerTest.java
    incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java
    incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java

Copied: incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml (from r1160556, incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml)
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml?p2=incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml&p1=incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml&r1=1160556&r2=1160560&rev=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml Tue Aug 23 06:42:09 2011
@@ -40,14 +40,6 @@
 
     <tx:annotation-driven transaction-manager="transactionManager" />
 
-    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator" >
-        <property name="executeScriptQuery" value="SELECT * FROM PERSON"/>
-        <property name="scriptLocations">
-            <list>
-                <value>classpath:initial_data.sql</value>
-            </list>
-        </property>
-    </bean>
 
     <bean id="entityManagerFactory"
           class="org.apache.rave.persistence.jpa.PopulatedLocalContainerEntityManagerFactory">

Added: incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-dataContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-dataContext.xml?rev=1160560&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-dataContext.xml (added)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-dataContext.xml Tue Aug 23 06:42:09 2011
@@ -0,0 +1,37 @@
+<!--
+  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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+
+    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator" >
+        <property name="executeScriptQuery" value="SELECT * FROM PERSON"/>
+        <property name="scriptLocations">
+            <list>
+                <value>classpath:initial_data.sql</value>
+            </list>
+        </property>
+    </bean>
+
+</beans>

Modified: incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml Tue Aug 23 06:42:09 2011
@@ -52,7 +52,8 @@
     <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>
-            classpath:spring-context.xml
+            classpath:rave-shindig-applicationContext.xml
+            classpath:rave-shindig-dataContext.xml
             classpath:modules-context.xml
         </param-value>
     </context-param>

Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthConsumerStoreRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthConsumerStoreRepositoryTest.java?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthConsumerStoreRepositoryTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthConsumerStoreRepositoryTest.java Tue Aug 23 06:42:09 2011
@@ -28,6 +28,7 @@ import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
@@ -36,8 +37,10 @@ import static junit.framework.Assert.ass
 /**
  * Test for {@link org.apache.rave.gadgets.oauth.repository.impl.JpaOAuthConsumerStoreRepository}
  */
+@Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:spring-test.xml"})
+@ContextConfiguration(locations = {"classpath:rave-shindig-test-applicationContext.xml",
+        "classpath:rave-shindig-test-dataContext.xml"})
 public class JpaOAuthConsumerStoreRepositoryTest {
     private static final String GADGET_URI = "http://localhost:8080/samplecontainer/examples/oauth.xml";
     private static final String SERVICE_NAME_GOOGLE = "Google";

Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthTokenInfoRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthTokenInfoRepositoryTest.java?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthTokenInfoRepositoryTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/gadgets/oauth/repository/JpaOAuthTokenInfoRepositoryTest.java Tue Aug 23 06:42:09 2011
@@ -28,6 +28,7 @@ import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -36,8 +37,10 @@ import static org.junit.Assert.assertNul
 /**
  * Test class for {@link org.apache.rave.gadgets.oauth.repository.impl.JpaOAuthTokenInfoRepository}
  */
+@Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:spring-test.xml"})
+@ContextConfiguration(locations = {"classpath:rave-shindig-test-applicationContext.xml",
+        "classpath:rave-shindig-test-dataContext.xml"})
 public class JpaOAuthTokenInfoRepositoryTest {
 
     private static final String INVALID_USER = "Invalid user";

Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListenerTest.java?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListenerTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListenerTest.java Tue Aug 23 06:42:09 2011
@@ -45,7 +45,8 @@ public class GuiceBindingSpringContextLo
         Injector injector = Guice.createInjector(createNiceMock(Module.class));
 
         MockServletContext mockServletContext = new MockServletContext();
-        mockServletContext.addInitParameter("contextConfigLocation", "classpath:spring-context.xml");
+        mockServletContext.addInitParameter("contextConfigLocation",
+                "classpath:rave-shindig-test-applicationContext.xml, classpath:rave-shindig-test-dataContext.xml");
         mockServletContext.setAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE, injector);
 
         GuiceBindingSpringContextLoaderListener listener = new GuiceBindingSpringContextLoaderListener();

Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java Tue Aug 23 06:42:09 2011
@@ -21,12 +21,10 @@ package org.apache.rave.inject;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import org.apache.rave.opensocial.model.Organization;
 import org.apache.rave.opensocial.service.impl.DefaultPersonService;
 import org.apache.rave.persistence.BasicEntity;
 import org.apache.rave.persistence.jpa.AbstractJpaRepository;
 import org.apache.shindig.social.opensocial.spi.PersonService;
-import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -36,12 +34,17 @@ import org.springframework.stereotype.Re
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations={"classpath:spring-context.xml"})
+@ContextConfiguration(locations={"classpath:rave-shindig-test-applicationContext.xml",
+        "classpath:rave-shindig-test-dataContext.xml"})
 public class SpringBindingModuleTest {
     private Injector injector;
 

Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java?rev=1160560&r1=1160559&r2=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java Tue Aug 23 06:42:09 2011
@@ -19,6 +19,11 @@
 
 package org.apache.rave.opensocial.repository;
 
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.opensocial.model.Person;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -26,16 +31,15 @@ import org.springframework.beans.factory
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations={"classpath:spring-test.xml"})
+@ContextConfiguration(locations={"classpath:rave-shindig-test-applicationContext.xml",
+        "classpath:rave-shindig-test-dataContext.xml"})
 public class JpaPersonRepositoryTest {
 
     private static final String VALID_USER = "canonical";

Copied: incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml (from r1160556, incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml)
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml?p2=incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml&p1=incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml&r1=1160556&r2=1160560&rev=1160560&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml Tue Aug 23 06:42:09 2011
@@ -24,15 +24,6 @@
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
 
-    <import resource="classpath:spring-context.xml"/>
-    <!-- Overrides the database populator bean defined in the runtime context and adds test data.  This is needed to run in a shared database mode-->
-    <bean primary="true" id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator">
-        <property name="executeScriptQuery" value="SELECT * FROM PERSON"/>
-        <property name="scriptLocations">
-            <list>
-                <value>classpath:initial_data.sql</value>
-                <value>classpath:test_data.sql</value>
-            </list>
-        </property>
-    </bean>
+    <import resource="classpath:rave-shindig-applicationContext.xml"/>
+    
 </beans>

Added: incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-dataContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-dataContext.xml?rev=1160560&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-dataContext.xml (added)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-dataContext.xml Tue Aug 23 06:42:09 2011
@@ -0,0 +1,37 @@
+<!--
+  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.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+    <bean primary="true" id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator">
+        <property name="executeScriptQuery" value="SELECT * FROM PERSON"/>
+        <property name="scriptLocations">
+            <list>
+                <value>classpath:initial_data.sql</value>
+                <value>classpath:test_data.sql</value>
+            </list>
+        </property>
+    </bean>
+</beans>