You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2011/07/26 21:16:59 UTC
svn commit: r1151215 - in /incubator/rave/trunk: ./
rave-commons/src/main/java/org/apache/rave/orm/ rave-shindig/
rave-shindig/src/main/java/org/apache/rave/inject/
rave-shindig/src/main/java/org/apache/rave/opensocial/
rave-shindig/src/main/java/org/a...
Author: mfranklin
Date: Tue Jul 26 19:16:56 2011
New Revision: 1151215
URL: http://svn.apache.org/viewvc?rev=1151215&view=rev
Log:
Added Spring integration into rave-shindig (Fixes RAVE-121)
Added:
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListener.java
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/SpringBindingModule.java
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/model/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/PersonRepository.java
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/
incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/DefaultPersonService.java
incubator/rave/trunk/rave-shindig/src/main/resources/initial_data.sql
incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties
incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.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/
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/model/
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/
incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java
Removed:
incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/orm/
Modified:
incubator/rave/trunk/pom.xml
incubator/rave/trunk/rave-shindig/pom.xml
incubator/rave/trunk/rave-shindig/src/main/webapp/WEB-INF/web.xml
Modified: incubator/rave/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/pom.xml?rev=1151215&r1=1151214&r2=1151215&view=diff
==============================================================================
--- incubator/rave/trunk/pom.xml (original)
+++ incubator/rave/trunk/pom.xml Tue Jul 26 19:16:56 2011
@@ -129,6 +129,11 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${org.springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
Modified: incubator/rave/trunk/rave-shindig/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/pom.xml?rev=1151215&r1=1151214&r2=1151215&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/pom.xml (original)
+++ incubator/rave/trunk/rave-shindig/pom.xml Tue Jul 26 19:16:56 2011
@@ -67,6 +67,16 @@
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-persist</artifactId>
</dependency>
@@ -110,6 +120,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListener.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListener.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListener.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/GuiceBindingSpringContextLoaderListener.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.inject;
+
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.apache.shindig.common.servlet.GuiceServletContextListener;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.ContextLoaderListener;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import java.util.Collection;
+
+/**
+ * Context Load listener that initializes the Spring application context and binds beans to the pre-existing Guice injector
+ */
+public class GuiceBindingSpringContextLoaderListener extends ContextLoaderListener{
+
+ @Override
+ public void contextInitialized(ServletContextEvent event) {
+ //Initialize the application context
+ super.contextInitialized(event);
+ ServletContext servletContext = event.getServletContext();
+ //Get a list of Guice module Spring beans from the application context
+ Collection<Module> modules = getModulesFromApplicationContext();
+ //Get the current injector from the servlet context
+ Injector injector = getInjector(servletContext);
+ //Override the current injector with the new child injector that includes all Spring managed Guice modules
+ overrideInjector(injector.createChildInjector(modules), servletContext);
+ }
+
+ private static Injector getInjector(ServletContext servletContext) {
+ Injector injector = (Injector) servletContext.getAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE);
+ if(injector == null) {
+ throw new IllegalStateException("No Guice Injector found in Servlet Context. Ensure that this listener is loaded AFTER Guice has been initialized");
+ }
+ return injector;
+ }
+
+ private static void overrideInjector(Injector injector, ServletContext context) {
+ context.setAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE, injector);
+ }
+
+ private static Collection<Module> getModulesFromApplicationContext() {
+ ApplicationContext context = getCurrentWebApplicationContext();
+ return context.getBeansOfType(Module.class).values();
+ }
+}
Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/SpringBindingModule.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/SpringBindingModule.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/SpringBindingModule.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/inject/SpringBindingModule.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.inject;
+
+import com.google.inject.AbstractModule;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.lang.reflect.Proxy;
+import java.util.regex.Pattern;
+
+/**
+ * Initializes a Spring application context and binds the beans from the context to Guice
+ */
+@Component
+public class SpringBindingModule extends AbstractModule implements ApplicationContextAware {
+
+ public static final String BASE_PACKAGE = "${shindig.spring.base-package}";
+
+ private ApplicationContext applicationContext;
+ private String basePackage;
+
+ @Override
+ protected void configure() {
+ bindFromApplicationContext();
+ }
+
+ private void bindFromApplicationContext() {
+ for (String beanName : applicationContext.getBeanDefinitionNames()) {
+ Object bean = applicationContext.getBean(beanName);
+ bindInterfaces(bean);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void bindInterfaces(Object bean) {
+ String fullClassName = Proxy.isProxyClass(bean.getClass()) ? bean.toString() : bean.getClass().getName();
+ if (fullClassName.matches(basePackage + ".*")) {
+ for (Class clazz : bean.getClass().getInterfaces()) {
+ bind(clazz).toInstance(bean);
+ }
+ }
+ }
+
+ /**
+ * Sets the package name to restrict bean binding to Guice
+ * @param value the base package to bind all beans in sub-packages to Guice
+ */
+ @Value(BASE_PACKAGE)
+ public void setBasePackage(String value) {
+ this.basePackage = value.replace(".", "\\.");
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+}
Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/PersonRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/PersonRepository.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/PersonRepository.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/repository/PersonRepository.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.opensocial.repository;
+
+import org.apache.rave.persistence.Repository;
+
+
+public interface PersonRepository extends Repository {
+}
Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/DefaultPersonService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/DefaultPersonService.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/DefaultPersonService.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/rave/opensocial/service/impl/DefaultPersonService.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.opensocial.service.impl;
+
+import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RestfulCollection;
+import org.apache.shindig.social.opensocial.model.Person;
+import org.apache.shindig.social.opensocial.spi.CollectionOptions;
+import org.apache.shindig.social.opensocial.spi.GroupId;
+import org.apache.shindig.social.opensocial.spi.PersonService;
+import org.apache.shindig.social.opensocial.spi.UserId;
+import org.springframework.stereotype.Service;
+
+import java.util.Set;
+import java.util.concurrent.Future;
+
+/**
+ * Implementation of the {@link PersonService} SPI
+ */
+public class DefaultPersonService implements PersonService {
+ @Override
+ public Future<RestfulCollection<Person>> getPeople(Set<UserId> userIds, GroupId groupId, CollectionOptions collectionOptions, Set<String> fields, SecurityToken token) throws ProtocolException {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token) throws ProtocolException {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: incubator/rave/trunk/rave-shindig/src/main/resources/initial_data.sql
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/initial_data.sql?rev=1151215&view=auto
==============================================================================
(empty)
Added: incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties (added)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties Tue Jul 26 19:16:56 2011
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+shindig.spring.base-package=org.apache.rave
+
Added: 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/spring-context.xml?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml (added)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml Tue Jul 26 19:16:56 2011
@@ -0,0 +1,69 @@
+<!--
+ ~ 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">
+
+ <context:property-placeholder location="classpath:rave.shindig.properties" />
+ <context:component-scan base-package="org.apache.rave" annotation-config="true" />
+
+ <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>
+
+ <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory"/>
+ </bean>
+
+ <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">
+ <property name="persistenceUnitName" value="raveShindigPersistenceUnit"/>
+ <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"/>
+ <entry key="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
+ <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </map>
+ </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=1151215&r1=1151214&r2=1151215&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 Jul 26 19:16:56 2011
@@ -23,61 +23,69 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="Shindig"
version="2.5">
- <display-name>Shindig</display-name>
- <!-- configuration -->
- <!-- If you have your own Guice module(s), put them here as a colon-separated list. -->
- <!-- Note that any extras modules are optional -->
- <context-param>
- <param-name>guice-modules</param-name>
- <param-value>
- org.apache.rave.commoncontainer.ConfigurablePropertiesModule:
- org.apache.shindig.gadgets.DefaultGuiceModule:
- org.apache.shindig.social.core.config.SocialApiGuiceModule:
- org.apache.rave.os.JPAOpenSocialModule:
- org.apache.shindig.gadgets.oauth.OAuthModuleDb:
- org.apache.shindig.common.cache.ehcache.EhCacheModule:
- org.apache.shindig.sample.shiro.ShiroGuiceModule:
- org.apache.shindig.sample.container.SampleContainerGuiceModule:
- org.apache.shindig.extras.ShindigExtrasGuiceModule:
- org.apache.shindig.sample.commoncontainer.auth.CommonContainerAuthGuiceModule
- </param-value>
- </context-param>
-
- <!--
- Syntax: <key>=<value> separated by a newline
-
- system.properties specifies the environmental variables that will be set to the JVM System Properties at server startup time.
- Alternatively, you may add these values in your app server (ex: Tomcat) as
- VM arguments like this: -Dshindig.host="my.production.shindig.server.com".
-
- Here are a few properties that can be set for Shindig:
- shindig.host: the server name that Shindig is deployed and running on
- shindig.port: the port number of shindig.host server
-
- Make sure you escape all HTML values for the web.xml to be parsed correctly.
- -->
- <context-param>
- <param-name>system.properties</param-name>
- <param-value>
- shindig.host=
- shindig.port=
- aKey=/shindig/gadgets/proxy?container=default&url=
- </param-value>
- </context-param>
-
- <filter>
- <filter-name>hostFilter</filter-name>
- <filter-class>org.apache.shindig.common.servlet.HostFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>hostFilter</filter-name>
- <url-pattern>/gadgets/ifr</url-pattern>
- <url-pattern>/gadgets/js/*</url-pattern>
- <url-pattern>/gadgets/proxy/*</url-pattern>
- <url-pattern>/gadgets/concat</url-pattern>
- <url-pattern>/rpc/*</url-pattern>
- <url-pattern>/rest/*</url-pattern>
- </filter-mapping>
+ <display-name>Shindig</display-name>
+ <!-- configuration -->
+ <!-- If you have your own Guice module(s), put them here as a colon-separated list. -->
+ <!-- Note that any extras modules are optional -->
+ <context-param>
+ <param-name>guice-modules</param-name>
+ <param-value>
+ org.apache.rave.commoncontainer.ConfigurablePropertiesModule:
+ org.apache.shindig.gadgets.DefaultGuiceModule:
+ org.apache.shindig.social.core.config.SocialApiGuiceModule:
+ org.apache.rave.os.JPAOpenSocialModule:
+ org.apache.shindig.gadgets.oauth.OAuthModuleDb:
+ org.apache.shindig.common.cache.ehcache.EhCacheModule:
+ org.apache.shindig.sample.shiro.ShiroGuiceModule:
+ org.apache.shindig.sample.container.SampleContainerGuiceModule:
+ org.apache.shindig.extras.ShindigExtrasGuiceModule:
+ org.apache.shindig.sample.commoncontainer.auth.CommonContainerAuthGuiceModule
+ </param-value>
+ </context-param>
+
+ <!--
+ Syntax: <key>=<value> separated by a newline
+
+ system.properties specifies the environmental variables that will be set to the JVM System Properties at server startup time.
+ Alternatively, you may add these values in your app server (ex: Tomcat) as
+ VM arguments like this: -Dshindig.host="my.production.shindig.server.com".
+
+ Here are a few properties that can be set for Shindig:
+ shindig.host: the server name that Shindig is deployed and running on
+ shindig.port: the port number of shindig.host server
+
+ Make sure you escape all HTML values for the web.xml to be parsed correctly.
+ -->
+ <context-param>
+ <param-name>system.properties</param-name>
+ <param-value>
+ shindig.host=
+ shindig.port=
+ aKey=/shindig/gadgets/proxy?container=default&url=
+ </param-value>
+ </context-param>
+
+ <!-- Spring context configuration -->
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath:spring-context.xml
+ </param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>hostFilter</filter-name>
+ <filter-class>org.apache.shindig.common.servlet.HostFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>hostFilter</filter-name>
+ <url-pattern>/gadgets/ifr</url-pattern>
+ <url-pattern>/gadgets/js/*</url-pattern>
+ <url-pattern>/gadgets/proxy/*</url-pattern>
+ <url-pattern>/gadgets/concat</url-pattern>
+ <url-pattern>/rpc/*</url-pattern>
+ <url-pattern>/rest/*</url-pattern>
+ </filter-mapping>
<filter>
<filter-name>ShiroFilter</filter-name>
@@ -107,245 +115,250 @@
</init-param>
</filter>
- <filter>
- <filter-name>authFilter</filter-name>
- <filter-class>org.apache.shindig.auth.AuthenticationServletFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>etagFilter</filter-name>
- <filter-class>org.apache.shindig.gadgets.servlet.ETagFilter</filter-class>
- </filter>
-
-
- <filter-mapping>
- <filter-name>ShiroFilter</filter-name>
- <url-pattern>/oauth/authorize</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>ShiroFilter</filter-name>
- <url-pattern>*.jsp</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>authFilter</filter-name>
- <url-pattern>/social/*</url-pattern>
- <url-pattern>/gadgets/ifr</url-pattern>
- <url-pattern>/gadgets/makeRequest</url-pattern>
- <url-pattern>/gadgets/api/rpc/*</url-pattern>
- <url-pattern>/gadgets/api/rest/*</url-pattern>
- <url-pattern>/rpc/*</url-pattern>
- <url-pattern>/rest/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>etagFilter</filter-name>
- <url-pattern>*</url-pattern>
- </filter-mapping>
-
- <context-param>
- <param-name>db.url</param-name>
- <param-value>jdbc:h2:mem:portal</param-value>
- </context-param>
- <context-param>
- <param-name>db.user</param-name>
- <param-value>sa</param-value>
- </context-param>
- <context-param>
- <param-name>db.password</param-name>
- <param-value>sa</param-value>
- </context-param>
- <context-param>
- <param-name>db.tcpServer</param-name>
- <param-value>-tcpAllowOthers</param-value>
- </context-param>
-
- <listener>
- <listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.apache.rave.os.DatabasePopulateContextListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.h2.server.web.DbStarter</listener-class>
- </listener>
-
- <!-- Render a Gadget -->
- <servlet>
- <servlet-name>xml-to-html</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.GadgetRenderingServlet
- </servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>accel</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.HtmlAccelServlet
- </servlet-class>
- </servlet>
-
- <!-- Proxy -->
- <servlet>
- <servlet-name>proxy</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.ProxyServlet
- </servlet-class>
- </servlet>
-
- <!-- makeRequest -->
- <servlet>
- <servlet-name>makeRequest</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.MakeRequestServlet
- </servlet-class>
- </servlet>
-
- <!-- Concat -->
- <servlet>
- <servlet-name>concat</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.ConcatProxyServlet
- </servlet-class>
- </servlet>
-
- <!-- OAuth callback -->
- <servlet>
- <servlet-name>oauthCallback</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.OAuthCallbackServlet
- </servlet-class>
- </servlet>
-
- <!-- Metadata RPC -->
- <servlet>
- <servlet-name>metadata</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.RpcServlet
- </servlet-class>
- </servlet>
-
- <!-- javascript serving -->
- <servlet>
- <servlet-name>js</servlet-name>
- <servlet-class>org.apache.shindig.gadgets.servlet.JsServlet</servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>restapiServlet</servlet-name>
- <servlet-class>
- org.apache.shindig.protocol.DataServiceServlet
- </servlet-class>
- <init-param>
- <param-name>handlers</param-name>
- <param-value>org.apache.shindig.handlers</param-value>
- </init-param>
- </servlet>
-
- <!-- Serve social RPC api -->
- <servlet>
- <servlet-name>jsonRpcServlet</servlet-name>
- <servlet-class>
- org.apache.shindig.protocol.JsonRpcServlet
- </servlet-class>
- <init-param>
- <param-name>handlers</param-name>
- <param-value>org.apache.shindig.handlers</param-value>
- </init-param>
- </servlet>
-
- <!-- Serve sample OAuth apis -->
- <servlet>
- <servlet-name>sampleOAuth</servlet-name>
- <servlet-class>
- org.apache.shindig.social.sample.oauth.SampleOAuthServlet
- </servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>rpcSwf</servlet-name>
- <servlet-class>
- org.apache.shindig.gadgets.servlet.RpcSwfServlet
- </servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>js</servlet-name>
- <url-pattern>/gadgets/js/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>proxy</servlet-name>
- <url-pattern>/gadgets/proxy/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>makeRequest</servlet-name>
- <url-pattern>/gadgets/makeRequest</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>jsonRpcServlet</servlet-name>
- <url-pattern>/rpc/*</url-pattern>
- <url-pattern>/gadgets/api/rpc/*</url-pattern>
- <url-pattern>/social/rpc/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>restapiServlet</servlet-name>
- <url-pattern>/rest/*</url-pattern>
- <url-pattern>/gadgets/api/rest/*</url-pattern>
- <url-pattern>/social/rest/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>concat</servlet-name>
- <url-pattern>/gadgets/concat</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>oauthCallback</servlet-name>
- <url-pattern>/gadgets/oauthcallback</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>xml-to-html</servlet-name>
- <url-pattern>/gadgets/ifr</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>accel</servlet-name>
- <url-pattern>/gadgets/accel</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>metadata</servlet-name>
- <url-pattern>/gadgets/metadata</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>sampleOAuth</servlet-name>
- <url-pattern>/oauth/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>rpcSwf</servlet-name>
- <url-pattern>/xpc*</url-pattern>
- </servlet-mapping>
-
-
- <servlet>
- <servlet-name>H2Console</servlet-name>
- <servlet-class>org.h2.server.web.WebServlet</servlet-class>
- <!-- <init-param> <param-name>webAllowOthers</param-name> <param-value></param-value>
- </init-param> <init-param> <param-name>trace</param-name> <param-value></param-value>
- </init-param> -->
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>H2Console</servlet-name>
- <url-pattern>/console/*</url-pattern>
- </servlet-mapping>
-
+ <filter>
+ <filter-name>authFilter</filter-name>
+ <filter-class>org.apache.shindig.auth.AuthenticationServletFilter</filter-class>
+ </filter>
+
+ <filter>
+ <filter-name>etagFilter</filter-name>
+ <filter-class>org.apache.shindig.gadgets.servlet.ETagFilter</filter-class>
+ </filter>
+
+
+ <filter-mapping>
+ <filter-name>ShiroFilter</filter-name>
+ <url-pattern>/oauth/authorize</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>ShiroFilter</filter-name>
+ <url-pattern>*.jsp</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>authFilter</filter-name>
+ <url-pattern>/social/*</url-pattern>
+ <url-pattern>/gadgets/ifr</url-pattern>
+ <url-pattern>/gadgets/makeRequest</url-pattern>
+ <url-pattern>/gadgets/api/rpc/*</url-pattern>
+ <url-pattern>/gadgets/api/rest/*</url-pattern>
+ <url-pattern>/rpc/*</url-pattern>
+ <url-pattern>/rest/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>etagFilter</filter-name>
+ <url-pattern>*</url-pattern>
+ </filter-mapping>
+
+ <context-param>
+ <param-name>db.url</param-name>
+ <param-value>jdbc:h2:mem:portal</param-value>
+ </context-param>
+ <context-param>
+ <param-name>db.user</param-name>
+ <param-value>sa</param-value>
+ </context-param>
+ <context-param>
+ <param-name>db.password</param-name>
+ <param-value>sa</param-value>
+ </context-param>
+ <context-param>
+ <param-name>db.tcpServer</param-name>
+ <param-value>-tcpAllowOthers</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>org.apache.rave.os.DatabasePopulateContextListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>org.h2.server.web.DbStarter</listener-class>
+ </listener>
+
+ <!-- Initialize Spring LAST -->
+ <listener>
+ <listener-class>org.apache.rave.inject.GuiceBindingSpringContextLoaderListener</listener-class>
+ </listener>
+
+ <!-- Render a Gadget -->
+ <servlet>
+ <servlet-name>xml-to-html</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.GadgetRenderingServlet
+ </servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>accel</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.HtmlAccelServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- Proxy -->
+ <servlet>
+ <servlet-name>proxy</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.ProxyServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- makeRequest -->
+ <servlet>
+ <servlet-name>makeRequest</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.MakeRequestServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- Concat -->
+ <servlet>
+ <servlet-name>concat</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.ConcatProxyServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- OAuth callback -->
+ <servlet>
+ <servlet-name>oauthCallback</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.OAuthCallbackServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- Metadata RPC -->
+ <servlet>
+ <servlet-name>metadata</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.RpcServlet
+ </servlet-class>
+ </servlet>
+
+ <!-- javascript serving -->
+ <servlet>
+ <servlet-name>js</servlet-name>
+ <servlet-class>org.apache.shindig.gadgets.servlet.JsServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>restapiServlet</servlet-name>
+ <servlet-class>
+ org.apache.shindig.protocol.DataServiceServlet
+ </servlet-class>
+ <init-param>
+ <param-name>handlers</param-name>
+ <param-value>org.apache.shindig.handlers</param-value>
+ </init-param>
+ </servlet>
+
+ <!-- Serve social RPC api -->
+ <servlet>
+ <servlet-name>jsonRpcServlet</servlet-name>
+ <servlet-class>
+ org.apache.shindig.protocol.JsonRpcServlet
+ </servlet-class>
+ <init-param>
+ <param-name>handlers</param-name>
+ <param-value>org.apache.shindig.handlers</param-value>
+ </init-param>
+ </servlet>
+
+ <!-- Serve sample OAuth apis -->
+ <servlet>
+ <servlet-name>sampleOAuth</servlet-name>
+ <servlet-class>
+ org.apache.shindig.social.sample.oauth.SampleOAuthServlet
+ </servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>rpcSwf</servlet-name>
+ <servlet-class>
+ org.apache.shindig.gadgets.servlet.RpcSwfServlet
+ </servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>js</servlet-name>
+ <url-pattern>/gadgets/js/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>proxy</servlet-name>
+ <url-pattern>/gadgets/proxy/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>makeRequest</servlet-name>
+ <url-pattern>/gadgets/makeRequest</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>jsonRpcServlet</servlet-name>
+ <url-pattern>/rpc/*</url-pattern>
+ <url-pattern>/gadgets/api/rpc/*</url-pattern>
+ <url-pattern>/social/rpc/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>restapiServlet</servlet-name>
+ <url-pattern>/rest/*</url-pattern>
+ <url-pattern>/gadgets/api/rest/*</url-pattern>
+ <url-pattern>/social/rest/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>concat</servlet-name>
+ <url-pattern>/gadgets/concat</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>oauthCallback</servlet-name>
+ <url-pattern>/gadgets/oauthcallback</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>xml-to-html</servlet-name>
+ <url-pattern>/gadgets/ifr</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>accel</servlet-name>
+ <url-pattern>/gadgets/accel</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>metadata</servlet-name>
+ <url-pattern>/gadgets/metadata</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>sampleOAuth</servlet-name>
+ <url-pattern>/oauth/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>rpcSwf</servlet-name>
+ <url-pattern>/xpc*</url-pattern>
+ </servlet-mapping>
+
+
+ <servlet>
+ <servlet-name>H2Console</servlet-name>
+ <servlet-class>org.h2.server.web.WebServlet</servlet-class>
+ <!-- <init-param> <param-name>webAllowOthers</param-name> <param-value></param-value>
+ </init-param> <init-param> <param-name>trace</param-name> <param-value></param-value>
+ </init-param> -->
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>H2Console</servlet-name>
+ <url-pattern>/console/*</url-pattern>
+ </servlet-mapping>
+
</web-app>
Added: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java (added)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.inject;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.apache.shindig.common.servlet.GuiceServletContextListener;
+import org.junit.Test;
+import org.springframework.mock.web.MockServletContext;
+import javax.servlet.ServletContextEvent;
+
+import static org.easymock.EasyMock.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertThat;
+
+public class GuiceBindingSprigContextLoaderListenerTest {
+ @Test
+ public void initialize_test() {
+ Injector injector = Guice.createInjector(createNiceMock(Module.class));
+
+ MockServletContext mockServletContext = new MockServletContext();
+ mockServletContext.addInitParameter("contextConfigLocation", "classpath:spring-context.xml");
+ mockServletContext.setAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE, injector);
+
+ GuiceBindingSpringContextLoaderListener listener = new GuiceBindingSpringContextLoaderListener();
+ ServletContextEvent event = createNiceMock(ServletContextEvent.class);
+ expect(event.getServletContext()).andReturn(mockServletContext).anyTimes();
+ replay(event);
+
+ listener.contextInitialized(event);
+ assertThat((Injector)mockServletContext.getAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE), is(not(sameInstance(injector))));
+
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void noGuice() {
+ GuiceBindingSpringContextLoaderListener listener = new GuiceBindingSpringContextLoaderListener();
+
+ MockServletContext mockServletContext = new MockServletContext();
+ mockServletContext.addInitParameter("contextConfigLocation", "classpath:spring-context.xml");
+
+ ServletContextEvent event = createNiceMock(ServletContextEvent.class);
+ expect(event.getServletContext()).andReturn(mockServletContext).anyTimes();
+ replay(event);
+
+ listener.contextInitialized(event);
+ }
+}
Added: 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=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java (added)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/SpringBindingModuleTest.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.inject;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import org.apache.rave.opensocial.service.impl.DefaultPersonService;
+import org.apache.shindig.social.opensocial.spi.PersonService;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.orm.jpa.LocalEntityManagerFactoryBean;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations={"classpath:spring-context.xml"})
+public class SpringBindingModuleTest {
+ private Injector injector;
+
+ @Autowired
+ private SpringBindingModule module;
+
+ @Before
+ public void setup(){
+ injector = Guice.createInjector(module);
+ }
+
+ @Test
+ public void bindsScopedBean() {/*
+ PersonService personService = injector.getInstance(PersonService.class);
+ assertThat(personService, is(notNullValue()));
+ assertThat(personService, is(instanceOf(DefaultPersonService.class)));*/
+ }
+
+ @Test
+ public void bindsProxiedBean() {
+ LocalEntityManagerFactoryBean factory = injector.getInstance(LocalEntityManagerFactoryBean.class);
+ assertThat(factory, is(not(nullValue())));
+ }
+}
Added: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java?rev=1151215&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java (added)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java Tue Jul 26 19:16:56 2011
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package org.apache.rave.opensocial.service;
+
+/**
+ */
+public class PersonServiceTest {
+
+
+
+}