rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r1158647 - in /incubator/rave/trunk: rave-commons/src/test/resources/ rave-portal/ rave-portal/src/test/java/org/apache/rave/portal/repository/ rave-portal/src/test/java/org/apache/rave/portal/web/renderer/ rave-portal/src/test/java/org/apa...
Date Wed, 17 Aug 2011 11:59:01 GMT
Author: jasha
Date: Wed Aug 17 11:59:00 2011
New Revision: 1158647

URL: http://svn.apache.org/viewvc?rev=1158647&view=rev
Log:
RAVE-197 read Spring config from the test classpath instead of relative filesystem location
to be able to run junit tests from an IDE.
Allow runtime enhancement of the Beans.

Added:
    incubator/rave/trunk/rave-portal/src/test/resources/portal-test-applicationContext.xml
    incubator/rave/trunk/rave-portal/src/test/resources/portal-test-dataContext.xml
Modified:
    incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml
    incubator/rave/trunk/rave-portal/pom.xml
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/AbstractJpaRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionWidgetRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaUserRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaWidgetRepositoryTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/renderer/RenderServiceIntegrationTest.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/provider/opensocial/repository/ShindigGadgetMetadataRepositoryTest.java

Modified: incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml (original)
+++ incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml Wed Aug
17 11:59:00 2011
@@ -22,7 +22,7 @@
 
     <bean id="portalPropertyPlaceholder" class="org.apache.rave.util.OverridablePropertyPlaceholderConfigurer">
         <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
-        <property name="location" value="classpath:portal.properties"/>
+        <property name="location" value="classpath:portal-test.properties"/>
     </bean>
 
     <!-- make the the portal.properties props available to autowire injectors -->

Modified: incubator/rave/trunk/rave-portal/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/pom.xml?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/pom.xml (original)
+++ incubator/rave/trunk/rave-portal/pom.xml Wed Aug 17 11:59:00 2011
@@ -201,41 +201,41 @@
     <build>
         <defaultGoal>install</defaultGoal>
         <plugins>
-			 <plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-jar-plugin</artifactId>
-				<executions>
-				  <execution>
-					 <id>make-the-jar</id>
-					 <phase>compile</phase>
-					 <goals>
-						<goal>jar</goal>
-					 </goals>
-				  </execution>
-				</executions>
-			 </plugin>
-			 <plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-install-plugin</artifactId>
-				<executions>
-				  <execution>
-					 <id>install-the-jar</id>
-					 <phase>install</phase>
-					 <goals>
-						<goal>install-file</goal>
-					 </goals>
-					 <configuration>
-						<packaging>jar</packaging>
-						<artifactId>${project.artifactId}</artifactId>
-						<groupId>${project.groupId}</groupId>
-						<version>${project.version}</version>
-						<file>
-						  ${project.build.directory}/${project.artifactId}-${project.version}.jar
-						</file>
-				  </configuration>
-				  </execution>
-				</executions>
-			 </plugin>
+             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                  <execution>
+                     <id>make-the-jar</id>
+                     <phase>compile</phase>
+                     <goals>
+                        <goal>jar</goal>
+                     </goals>
+                  </execution>
+                </executions>
+             </plugin>
+             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-install-plugin</artifactId>
+                <executions>
+                  <execution>
+                     <id>install-the-jar</id>
+                     <phase>install</phase>
+                     <goals>
+                        <goal>install-file</goal>
+                     </goals>
+                     <configuration>
+                        <packaging>jar</packaging>
+                        <artifactId>${project.artifactId}</artifactId>
+                        <groupId>${project.groupId}</groupId>
+                        <version>${project.version}</version>
+                        <file>
+                          ${project.build.directory}/${project.artifactId}-${project.version}.jar
+                        </file>
+                  </configuration>
+                  </execution>
+                </executions>
+             </plugin>
             <plugin>
                 <groupId>com.googlecode.mavenfilesync</groupId>
                 <artifactId>maven-filesync-plugin</artifactId>

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/AbstractJpaRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/AbstractJpaRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/AbstractJpaRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/AbstractJpaRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -19,6 +19,11 @@
 
 package org.apache.rave.portal.repository;
 
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.persistence.BasicEntity;
 import org.apache.rave.persistence.Repository;
 import org.junit.Test;
@@ -29,11 +34,12 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-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.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
 /**
@@ -41,7 +47,7 @@ import static org.junit.Assert.assertTha
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 @SuppressWarnings("unchecked")
 //By iterating over all repositories in the context, we can be sure that basic repository
functionality isn't broken by any overriding methods
 public class AbstractJpaRepositoryTest {

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -18,6 +18,11 @@
  */
 package org.apache.rave.portal.repository;
 
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.portal.model.Page;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -26,16 +31,15 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-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.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 public class JpaPageRepositoryTest {
 
     private static final Long USER_ID = 1L;

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -19,6 +19,11 @@
 
 package org.apache.rave.portal.repository;
 
+import java.util.ArrayList;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.portal.model.Region;
 import org.apache.rave.portal.model.RegionWidget;
 import org.junit.Test;
@@ -29,16 +34,17 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.util.ArrayList;
-
-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.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 public class JpaRegionRepositoryTest {
 
     @PersistenceContext

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionWidgetRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionWidgetRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionWidgetRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaRegionWidgetRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -19,6 +19,11 @@
 
 package org.apache.rave.portal.repository;
 
+import java.util.ArrayList;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.portal.model.RegionWidget;
 import org.apache.rave.portal.model.RegionWidgetPreference;
 import org.junit.Test;
@@ -29,16 +34,17 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.util.ArrayList;
-
-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.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 public class JpaRegionWidgetRepositoryTest {
     @PersistenceContext
     private EntityManager manager;

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaUserRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaUserRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaUserRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaUserRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -19,6 +19,9 @@
 
 package org.apache.rave.portal.repository;
 
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.portal.model.User;
 import org.hamcrest.CoreMatchers;
 import org.junit.Test;
@@ -28,15 +31,14 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 public class JpaUserRepositoryTest {
 
     @PersistenceContext
@@ -44,9 +46,9 @@ public class JpaUserRepositoryTest {
 
     private static final Long USER_ID = 1L;
     private static final String USER_NAME = "canonical";
-	 //The password value depends on the hash algorithm and salt used, so this
-	 //may need updating in the future.
-	 private static final String HASHED_SALTED_PASSWORD="b97fd0fa25ba8a504309be2b6651ac6dee167ded";
+    //The password value depends on the hash algorithm and salt used, so this
+    //may need updating in the future.
+    private static final String HASHED_SALTED_PASSWORD="b97fd0fa25ba8a504309be2b6651ac6dee167ded";
     private static final Long INVALID_USER = -2L;
 
     @Autowired
@@ -57,7 +59,7 @@ public class JpaUserRepositoryTest {
         User user = repository.get(USER_ID);
         assertThat(user, CoreMatchers.notNullValue());
         assertThat(user.getUsername(), is(equalTo(USER_NAME)));
-		  assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
+        assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
         assertThat(user.isAccountNonExpired(), is(true));
     }
     @Test
@@ -70,7 +72,7 @@ public class JpaUserRepositoryTest {
         User user = repository.getByUsername(USER_NAME);
         assertThat(user, CoreMatchers.notNullValue());
         assertThat(user.getId(), is(equalTo(USER_ID)));
-		  assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
+        assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
         assertThat(user.isAccountNonExpired(), is(true));
     }
     @Test

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaWidgetRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaWidgetRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaWidgetRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaWidgetRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -19,6 +19,11 @@
 
 package org.apache.rave.portal.repository;
 
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
 import org.apache.rave.portal.model.Widget;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -27,16 +32,15 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-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.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 @Transactional
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
 public class JpaWidgetRepositoryTest {
 
     @PersistenceContext

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/renderer/RenderServiceIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/renderer/RenderServiceIntegrationTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/renderer/RenderServiceIntegrationTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/renderer/RenderServiceIntegrationTest.java
Wed Aug 17 11:59:00 2011
@@ -20,7 +20,13 @@
 package org.apache.rave.portal.web.renderer;
 
 
-import org.apache.rave.portal.model.*;
+import java.util.Arrays;
+
+import org.apache.rave.portal.model.Page;
+import org.apache.rave.portal.model.Region;
+import org.apache.rave.portal.model.RegionWidget;
+import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.model.Widget;
 import org.apache.rave.provider.opensocial.repository.impl.ShindigGadgetMetadataRepository;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,14 +41,18 @@ import org.springframework.test.context.
 import org.springframework.test.util.ReflectionTestUtils;
 import org.springframework.web.client.RestOperations;
 
-import java.util.Arrays;
-
-import static org.easymock.EasyMock.*;
-import static org.hamcrest.CoreMatchers.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.junit.Assert.assertThat;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations = {"classpath:portal-test-dataContext.xml", "classpath:portal-test-applicationContext.xml"})
+//@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
 public class RenderServiceIntegrationTest {
 
     @Autowired

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/provider/opensocial/repository/ShindigGadgetMetadataRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/provider/opensocial/repository/ShindigGadgetMetadataRepositoryTest.java?rev=1158647&r1=1158646&r2=1158647&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/provider/opensocial/repository/ShindigGadgetMetadataRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/provider/opensocial/repository/ShindigGadgetMetadataRepositoryTest.java
Wed Aug 17 11:59:00 2011
@@ -26,7 +26,10 @@ import org.springframework.beans.factory
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.client.RestOperations;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 

Added: incubator/rave/trunk/rave-portal/src/test/resources/portal-test-applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/resources/portal-test-applicationContext.xml?rev=1158647&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/resources/portal-test-applicationContext.xml
(added)
+++ incubator/rave/trunk/rave-portal/src/test/resources/portal-test-applicationContext.xml
Wed Aug 17 11:59:00 2011
@@ -0,0 +1,122 @@
+<!--
+  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:mvc="http://www.springframework.org/schema/mvc"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:oxm="http://www.springframework.org/schema/oxm"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:util="http://www.springframework.org/schema/util"
+       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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+        http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
+        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
+
+        <!-- make the the portal.properties props available to autowire injectors, location
of the properties can
+     be overridden by setting a system property "portal.override.properties" -->
+    <bean id="portalPropertyPlaceholder" class="org.apache.rave.util.OverridablePropertyPlaceholderConfigurer">
+        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
+        <property name="location" value="classpath:portal.properties"/>
+    </bean>
+
+    <!-- base-package scan on org.apache.rave lets junit tests fail from the IDE -->
+    <context:component-scan base-package="org.apache.rave.portal"/>
+    <context:component-scan base-package="org.apache.rave.provider"/>
+    
+    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+        <property name="entityManagerFactory" ref="entityManagerFactory"/>
+    </bean>
+
+    <tx:annotation-driven transaction-manager="transactionManager"/>
+
+    <!-- Bean that executes the given set of resources (SQL scripts) in order
+         To remove runtime initialization of initial data, remove this bean and change teh
entity manager factory to the default
+         Spring implementation
+    -->
+    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator">
+        <property name="executeScriptQuery" value="SELECT * FROM WIDGETS"/>
+        <property name="scriptLocations">
+            <list>
+                <value>classpath:initial_data.sql</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean id="entityManagerFactory"
+          class="org.apache.rave.persistence.jpa.PopulatedLocalContainerEntityManagerFactory">
+        <property name="populator" ref="dataSourcePopulator"/>
+        <property name="persistenceUnitName" value="ravePersistenceUnit"/>
+        <property name="dataSource" ref="dataSource"/>
+        <property name="jpaVendorAdapter">
+            <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+                <property name="showSql" value="true"/>
+            </bean>
+        </property>
+        <property name="jpaPropertyMap">
+            <map>
+                <entry key="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO,
SQL=TRACE"/>
+                <!-- Allow to enhance classes at runtime -->
+                <entry key="openjpa.RuntimeUnenhancedClasses" value="supported"/>
+                <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            </map>
+        </property>
+    </bean>
+
+    <!-- A RestTemplate instance that can be used to call a web service which expects
Content-Type and Accept headers of
+    application/json with a pre-built string of JSON data. -->
+    <bean id="jsonStringCompatibleRestTemplate" class="org.springframework.web.client.RestTemplate">
+        <property name="messageConverters">
+            <list>
+                <bean class="org.springframework.http.converter.StringHttpMessageConverter">
+                    <property name="supportedMediaTypes">
+                        <list>
+                            <util:constant static-field="org.springframework.http.MediaType.APPLICATION_JSON"/>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+    </bean>
+
+    <!-- Environment variables for opensocial calls from the portal -->
+    <bean id="openSocialEnvironment" class="org.apache.rave.provider.opensocial.config.OpenSocialEnvironment">
+        <property name="engineProtocol" value="${portal.opensocial_engine.protocol}"/>
+        <property name="engineRoot" value="${portal.opensocial_engine.root}"/>
+        <property name="engineGadgetPath" value="${portal.opensocial_engine.gadget_path}"/>
+    </bean>
+
+    <!-- Validators -->
+    <bean id="newAccountValidator" class="org.apache.rave.portal.web.validator.NewAccountValidator"/>
+    <bean id="userProfileValidator" class="org.apache.rave.portal.web.validator.UserProfileValidator"/>
+
+    <!-- Configuring messages.properties file -->
+    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"
+          p:basename="messages"/>
+
+    <!-- Password encoding and salting-->
+    <bean class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"
id="passwordEncoder"/>
+    <bean class="org.springframework.security.authentication.dao.ReflectionSaltSource"
id="saltSource">
+        <property name="userPropertyToUse" value="username"/>
+    </bean>
+
+</beans>
\ No newline at end of file

Added: incubator/rave/trunk/rave-portal/src/test/resources/portal-test-dataContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/resources/portal-test-dataContext.xml?rev=1158647&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/resources/portal-test-dataContext.xml (added)
+++ incubator/rave/trunk/rave-portal/src/test/resources/portal-test-dataContext.xml Wed Aug
17 11:59:00 2011
@@ -0,0 +1,30 @@
+<!--
+  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"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
+
+    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+        <property name="url" value="jdbc:h2:mem:portal;DB_CLOSE_DELAY=-1"/>
+        <property name="driverClassName" value="org.h2.Driver"/>
+        <property name="username" value="sa"/>
+        <property name="password" value="local"/>
+    </bean>
+</beans>
\ No newline at end of file



Mime
View raw message