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/08/10 02:18:19 UTC
svn commit: r1155978 [3/3] - in /incubator/rave/trunk:
rave-commons/src/main/java/org/apache/rave/util/
rave-commons/src/test/java/org/apache/rave/util/ rave-portal/ rave-shindig/
rave-shindig/src/main/java/org/apache/rave/gadgets/ rave-shindig/src/mai...
Modified: incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/persistence.xml?rev=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/META-INF/persistence.xml Wed Aug 10 00:18:18 2011
@@ -25,15 +25,49 @@
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.apache.shindig.gadgets.oauth.model.OAuthConsumerStoreDb</class>
<class>org.apache.shindig.gadgets.oauth.model.OAuthTokenInfoDb</class>
- <class>org.apache.shindig.social.opensocial.jpa.PersonDb</class>
- <properties>
- <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
- <property name="openjpa.ConnectionDriverName" value="org.h2.Driver" />
- <property name="openjpa.ConnectionURL" value="jdbc:h2:mem:portal;DB_CLOSE_DELAY=-1" />
- <property name="openjpa.ConnectionUserName" value="sa" />
- <property name="openjpa.ConnectionPassword" value="sa" />
- </properties>
+ <class>org.apache.rave.opensocial.model.Person</class>
+ <class>org.apache.rave.opensocial.model.Account</class>
+ <class>org.apache.rave.opensocial.model.Address</class>
+ <class>org.apache.rave.opensocial.model.BodyType</class>
+ <class>org.apache.rave.opensocial.model.Group</class>
+ <class>org.apache.rave.opensocial.model.Name</class>
+ <class>org.apache.rave.opensocial.model.Organization</class>
+ <class>org.apache.rave.opensocial.model.Person</class>
+ <class>org.apache.rave.opensocial.model.PersonProperty</class>
+ <class>org.apache.rave.opensocial.model.PersonAssociation</class>
+ <class>org.apache.rave.opensocial.model.Url</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ApplicationDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.OrganizationDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PersonPropertyDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ApplicationDataMapDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ListFieldDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.MessageDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ImDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.AccountDb</class>
+ <class>org.apache.shindig.gadgets.oauth.model.OAuthConsumerStoreDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ActivityTemplateParamsDb</class>
+ <class>org.apache.shindig.gadgets.oauth.model.OAuthTokenInfoDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PersonAddressDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.GroupDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ActivityDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.BodyTypeDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.FriendPropertyDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.AddressDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.MediaItemDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PersonDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.OrganizationAddressDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PhoneDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.FriendDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ApplicationPropertyDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.NameDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.EmailDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PhotoDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.GroupPropertyDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PersonOrganizationDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.PersonAccountDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.ApplicationDataMapValueDb</class>
+ <class>org.apache.shindig.social.opensocial.jpa.UrlDb</class>
+
</persistence-unit>
</persistence>
Added: incubator/rave/trunk/rave-shindig/src/main/resources/modules-context.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/modules-context.xml?rev=1155978&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/modules-context.xml (added)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/modules-context.xml Wed Aug 10 00:18:18 2011
@@ -0,0 +1,34 @@
+<!--
+ ~ 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">
+
+ <!-- Define the Default Guice Modules Here-->
+ <bean class="org.apache.rave.commoncontainer.ConfigurablePropertiesModule" />
+ <bean class="org.apache.rave.os.JPAOpenSocialModule" />
+ <bean class="org.apache.rave.os.SocialApiGuiceModule" />
+ <bean class="org.apache.shindig.gadgets.oauth.OAuthModule" />
+ <bean class="org.apache.shindig.gadgets.DefaultGuiceModule" />
+ <bean class="org.apache.shindig.common.cache.ehcache.EhCacheModule" />
+ <bean class="org.apache.shindig.sample.shiro.ShiroGuiceModule" />
+ <bean class="org.apache.shindig.sample.container.SampleContainerGuiceModule" />
+ <bean class="org.apache.shindig.extras.ShindigExtrasGuiceModule" />
+ <bean class="org.apache.shindig.sample.commoncontainer.auth.CommonContainerAuthGuiceModule" />
+</beans>
\ No newline at end of file
Modified: 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=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/spring-context.xml Wed Aug 10 00:18:18 2011
@@ -53,6 +53,7 @@
class="org.apache.rave.persistence.jpa.PopulatedLocalContainerEntityManagerFactory">
<property name="persistenceUnitName" value="raveShindigPersistenceUnit"/>
<property name="dataSource" ref="dataSource"/>
+ <property name="populator" ref="dataSourcePopulator" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="showSql" value="true" />
@@ -61,7 +62,8 @@
<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.RuntimeUnenhancedClasses" value="unsupported"/>-->
+ <entry key="openjpa.RuntimeUnenhancedClasses" value="warn"/>
<entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
</map>
</property>
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=1155978&r1=1155977&r2=1155978&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 Wed Aug 10 00:18:18 2011
@@ -25,23 +25,6 @@
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
@@ -70,6 +53,7 @@
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring-context.xml
+ classpath:modules-context.xml
</param-value>
</context-param>
@@ -169,15 +153,11 @@
<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>
Modified: 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=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/inject/GuiceBindingSprigContextLoaderListenerTest.java Wed Aug 10 00:18:18 2011
@@ -51,18 +51,4 @@ public class GuiceBindingSprigContextLoa
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);
- }
}
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=1155978&r1=1155977&r2=1155978&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 Wed Aug 10 00:18:18 2011
@@ -49,10 +49,17 @@ public class SpringBindingModuleTest {
}
@Test
- public void bindsScopedBean() {/*
+ public void bindsScopedBean() {
PersonService personService = injector.getInstance(PersonService.class);
assertThat(personService, is(notNullValue()));
- assertThat(personService, is(instanceOf(DefaultPersonService.class)));*/
+ assertThat(personService, is(instanceOf(DefaultPersonService.class)));
+ }
+
+ @Test
+ public void bindsScopedBeanSingleton() {
+ PersonService personService1 = injector.getInstance(PersonService.class);
+ PersonService personService2 = injector.getInstance(PersonService.class);
+ assertThat(personService1, is(sameInstance(personService2)));
}
@Test
Added: 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=1155978&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java (added)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/repository/JpaPersonRepositoryTest.java Wed Aug 10 00:18:18 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.opensocial.repository;
+
+import org.apache.rave.opensocial.model.Person;
+import org.apache.rave.persistence.Repository;
+import org.junit.Test;
+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 javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations={"classpath:spring-test.xml"})
+public class JpaPersonRepositoryTest {
+
+ private static final String VALID_USER = "canonical";
+ private static final String VALID_USER2 = "john.doe";
+ private static final String VALID_USER3 = "jane.doe";
+ private static final String INVALID_USERNAME = "INVALID_USERNAME";
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ @Autowired
+ private PersonRepository repository;
+
+ @Test
+ public void findByUsername_valid() {
+ Person person = repository.findByUsername(VALID_USER);
+ assertThat(person, is(not(nullValue())));
+ assertThat(person.getUsername(), is(equalTo(VALID_USER)));
+ }
+ @Test
+ public void findByUsername_null() {
+ Person person = repository.findByUsername(INVALID_USERNAME);
+ assertThat(person, is(nullValue()));
+ }
+
+ @Test
+ public void findFriends_valid() {
+ List<Person> connected = repository.findFriends(VALID_USER);
+ assertThat(connected.size(), is(equalTo(2)));
+ assertThat(connected.get(0).getUsername(), is(equalTo(VALID_USER2)));
+ assertThat(connected.get(1).getUsername(), is(equalTo(VALID_USER3)));
+ }
+
+ @Test
+ public void findFriends_invalid() {
+ List<Person> connected = repository.findFriends(INVALID_USERNAME);
+ assertThat(connected.isEmpty(), is(true));
+ }
+
+}
Modified: 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=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/rave/opensocial/service/PersonServiceTest.java Wed Aug 10 00:18:18 2011
@@ -19,10 +19,441 @@
package org.apache.rave.opensocial.service;
-/**
- */
+import com.google.common.collect.Lists;
+import org.apache.rave.opensocial.repository.PersonRepository;
+import org.apache.rave.opensocial.service.impl.DefaultPersonService;
+import org.apache.rave.opensocial.service.impl.FieldRestrictingPerson;
+import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RestfulCollection;
+import org.apache.shindig.protocol.model.FilterOperation;
+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.hamcrest.CoreMatchers;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import static org.easymock.EasyMock.*;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
public class PersonServiceTest {
+ private static final String DISPLAY_NAME = "ABCDE";
+ private static final String HAPPIEST_WHEN = "Sleeping";
+ private static final String ID_2 = "1235";
+ private static final String ID_3 = "1236";
+ private static final String ID_1 = "1234";
+ private static final String GROUP_ID = "BOO";
+ private PersonService service;
+ private PersonRepository repository;
+ private SecurityToken token;
+
+ @Before
+ public void setup() {
+ token = createNiceMock(SecurityToken.class);
+ repository = createNiceMock(PersonRepository.class);
+ service = new DefaultPersonService(repository);
+ }
+
+ @Test
+ public void getPerson_allFields() throws ExecutionException, InterruptedException {
+ UserId id = new UserId(UserId.Type.userId, ID_1);
+ Set<String> fields = new HashSet<String>();
+
+ org.apache.rave.opensocial.model.Person dbPerson = getDbPerson();
+ expect(repository.findByUsername(ID_1)).andReturn(dbPerson);
+ replay(repository);
+
+ Future<Person> personFuture = service.getPerson(id, fields, token);
+ assertThat(personFuture, is(not(nullValue())));
+ Person person = personFuture.get();
+ assertThat(person, is(not(nullValue())));
+ assertThat(person, is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(person.getId(), is(equalTo(ID_1)));
+ assertThat(person.getHappiestWhen(), is(equalTo(HAPPIEST_WHEN)));
+ assertThat(person.getDisplayName(), is(equalTo(DISPLAY_NAME)));
+ }
+
+ @Test
+ public void getPerson_restrictedFields() throws ExecutionException, InterruptedException {
+ UserId id = new UserId(UserId.Type.userId, ID_1);
+ Set<String> fields = new HashSet<String>();
+ fields.add(Person.Field.DISPLAY_NAME.toString());
+ fields.add(Person.Field.ID.toString());
+
+ org.apache.rave.opensocial.model.Person dbPerson = getDbPerson();
+ expect(repository.findByUsername(ID_1)).andReturn(dbPerson);
+ replay(repository);
+
+ Future<Person> personFuture = service.getPerson(id, fields, token);
+ assertThat(personFuture, is(not(nullValue())));
+ Person person = personFuture.get();
+ assertThat(person, is(not(nullValue())));
+ assertThat(person, is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(person.getId(), is(equalTo(ID_1)));
+ assertThat(person.getHappiestWhen(), is(nullValue()));
+ assertThat(person.getDisplayName(), is(equalTo(DISPLAY_NAME)));
+ }
+
+ @Test
+ public void getPerson_nullFields() throws ExecutionException, InterruptedException {
+ UserId id = new UserId(UserId.Type.userId, ID_1);
+
+ org.apache.rave.opensocial.model.Person dbPerson = getDbPerson();
+ expect(repository.findByUsername(ID_1)).andReturn(dbPerson);
+ replay(repository);
+
+ Future<Person> personFuture = service.getPerson(id, null, token);
+ assertThat(personFuture, is(not(nullValue())));
+ Person person = personFuture.get();
+ assertThat(person, is(not(nullValue())));
+ assertThat(person, is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(person.getId(), is(equalTo(ID_1)));
+ assertThat(person.getHappiestWhen(), is(equalTo(HAPPIEST_WHEN)));
+ assertThat(person.getDisplayName(), is(equalTo(DISPLAY_NAME)));
+ }
+
+ @Test
+ public void getPerson_viewer() throws ExecutionException, InterruptedException {
+ UserId id = new UserId(UserId.Type.viewer, ID_2);
+
+ expect(token.getViewerId()).andReturn(ID_1);
+ replay(token);
+
+ org.apache.rave.opensocial.model.Person dbPerson = getDbPerson();
+ expect(repository.findByUsername(ID_1)).andReturn(dbPerson);
+ replay(repository);
+
+ Future<Person> personFuture = service.getPerson(id, null, token);
+ assertThat(personFuture, is(not(nullValue())));
+ Person person = personFuture.get();
+ assertThat(person, is(not(nullValue())));
+ assertThat(person, is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(person.getId(), is(equalTo(ID_1)));
+ assertThat(person.getHappiestWhen(), is(equalTo(HAPPIEST_WHEN)));
+ assertThat(person.getDisplayName(), is(equalTo(DISPLAY_NAME)));
+ }
+
+ @Test(expected = ProtocolException.class)
+ public void getPerson_nullValue() throws ExecutionException, InterruptedException {
+ UserId id = new UserId(UserId.Type.userId, ID_2);
+
+ expect(repository.findByUsername(ID_1)).andReturn(null);
+ replay(repository);
+
+ service.getPerson(id, null, token);
+ }
+
+ @Test
+ public void getPeople_self() throws ExecutionException, InterruptedException {
+ String self = ID_1;
+ expect(token.getViewerId()).andReturn(self);
+ replay(token);
+
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.self, GROUP_ID);
+
+ expect(repository.findByUsername(self)).andReturn(getDbPerson());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, null, null, token);
+ assertThat(people, is(not(nullValue())));
+ assertThat(people.get().getTotalResults(), is(equalTo(1)));
+ assertThat(people.get().getEntry().get(0).getId(), is(equalTo(self)));
+ }
+
+ @Test
+ public void getPeople_all() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
+ replay(token);
+
+ expect(repository.findAllConnectedPeople(ID_2)).andReturn(getDbPersonList());
+ expect(repository.findAllConnectedPeople(ID_3)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, null, null, token);
+ assertThat(people, is(not(nullValue())));
+ assertThat(people.get().getEntry().get(0), is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(hasUniqueValues(people), is(true));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_friends() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
+ replay(token);
+
+ expect(repository.findFriends(ID_2)).andReturn(getDbPersonList());
+ expect(repository.findFriends(ID_3)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, null, null, token);
+ assertThat(people, is(not(nullValue())));
+ assertThat(people.get().getEntry().get(0), is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(hasUniqueValues(people), is(true));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_groupId() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.groupId, GROUP_ID);
+
+ expect(repository.findByGroup(GROUP_ID)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, null, null, token);
+ assertThat(people, is(not(nullValue())));
+ assertThat(people.get().getEntry().get(0), is(instanceOf(FieldRestrictingPerson.class)));
+ assertThat(hasUniqueValues(people), is(true));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_GroupFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.groupId, GROUP_ID);
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = Person.Field.ABOUT_ME.toString();
+ String value = "AAA";
+ options.setFilter(field);
+ options.setFilterOperation(FilterOperation.contains);
+ options.setFilterValue(value);
+
+ expect(repository.findByGroup(GROUP_ID, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_AllFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = Person.Field.ABOUT_ME.toString();
+ String value = "AAA";
+ options.setFilter(field);
+ options.setFilterOperation(FilterOperation.contains);
+ options.setFilterValue(value);
+
+ expect(repository.findAllConnectedPeople(ID_2, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
+ expect(repository.findAllConnectedPeople(ID_3, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_FriendsFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = Person.Field.ABOUT_ME.toString();
+ String value = "AAA";
+ options.setFilter(field);
+ options.setFilterOperation(FilterOperation.contains);
+ options.setFilterValue(value);
+
+ expect(repository.findFriends(ID_2, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
+ expect(repository.findFriends(ID_3, field, FilterOperation.contains, value)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_friendHasAppFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId).anyTimes();
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.HAS_APP_FILTER;
+ options.setFilter(field);
+
+ expect(repository.findFriends(ID_2, appId)).andReturn(getDbPersonList());
+ expect(repository.findFriends(ID_3, appId)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_allHasAppFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId).anyTimes();
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.HAS_APP_FILTER;
+ options.setFilter(field);
+
+ expect(repository.findAllConnectedPeople(ID_2, appId)).andReturn(getDbPersonList());
+ expect(repository.findAllConnectedPeople(ID_3, appId)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_groupHasAppFilterField() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.groupId, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId).anyTimes();
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.HAS_APP_FILTER;
+ options.setFilter(field);
+
+ expect(repository.findByGroup(GROUP_ID, appId)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_friendIsFriendsWith() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.friends, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId);
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.IS_WITH_FRIENDS_FILTER;
+ options.setFilter(field);
+ options.setFilterValue(ID_1);
+
+ expect(repository.findFriendsWithFriend(ID_2, ID_1)).andReturn(getDbPersonList());
+ expect(repository.findFriendsWithFriend(ID_3, ID_1)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_allIsFriendsWith() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.all, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId);
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.IS_WITH_FRIENDS_FILTER;
+ options.setFilter(field);
+ options.setFilterValue(ID_1);
+
+ expect(repository.findAllConnectedPeopleWithFriend(ID_2, ID_1)).andReturn(getDbPersonList());
+ expect(repository.findAllConnectedPeopleWithFriend(ID_3, ID_1)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test
+ public void getPeople_groupIsFriendsWith() throws ExecutionException, InterruptedException {
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.groupId, GROUP_ID);
+ String appId = "5";
+ expect(token.getAppId()).andReturn(appId).anyTimes();
+ replay(token);
+
+ CollectionOptions options = new CollectionOptions();
+ String field = PersonService.IS_WITH_FRIENDS_FILTER;
+ options.setFilter(field);
+ options.setFilterValue(ID_1);
+
+ expect(repository.findByGroupWithFriend(GROUP_ID, ID_1)).andReturn(getDbPersonList());
+ replay(repository);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, options, null, token);
+ assertThat(people, is(not(nullValue())));
+ verify(repository);
+ }
+
+ @Test(expected = ProtocolException.class)
+ public void getPeople_deleted() throws ExecutionException, InterruptedException {
+ String self = ID_1;
+ expect(token.getViewerId()).andReturn(self);
+ replay(token);
+ Set<UserId> ids = getUserIdSet();
+ GroupId groupId = new GroupId(GroupId.Type.deleted, GROUP_ID);
+
+ Future<RestfulCollection<Person>> people = service.getPeople(ids, groupId, null, null, token);
+ }
+
+ private List<org.apache.rave.opensocial.model.Person> getDbPersonList() {
+ return Lists.asList(getDbPerson(), new org.apache.rave.opensocial.model.Person[]{});
+ }
+
+ private Set<UserId> getUserIdSet() {
+ Set<UserId> ids = new HashSet<UserId>();
+ ids.add(new UserId(UserId.Type.userId, ID_2));
+ ids.add(new UserId(UserId.Type.userId, ID_3));
+ return ids;
+ }
+
+ private org.apache.rave.opensocial.model.Person getDbPerson() {
+ org.apache.rave.opensocial.model.Person dbPerson = new org.apache.rave.opensocial.model.Person();
+ dbPerson.setId(1111L);
+ dbPerson.setUsername(ID_1);
+ dbPerson.setDisplayName(DISPLAY_NAME);
+ dbPerson.setHappiestWhen(HAPPIEST_WHEN);
+ return dbPerson;
+ }
+ private static boolean hasUniqueValues(Future<RestfulCollection<Person>> people) throws ExecutionException, InterruptedException {
+ List<Person> persons = people.get().getEntry();
+ Set<String> idSet = new HashSet<String>();
+ for(Person p : persons) {
+ if(idSet.contains(p.getId())) {
+ return false;
+ }
+ idSet.add(p.getId());
+ }
+ return true;
+ }
}
Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/ConsumerStoreServiceDbImplTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/ConsumerStoreServiceDbImplTest.java?rev=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/ConsumerStoreServiceDbImplTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/ConsumerStoreServiceDbImplTest.java Wed Aug 10 00:18:18 2011
@@ -23,8 +23,9 @@ import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.shindig.gadgets.oauth.model.OAuthConsumerStoreDb;
import org.apache.shindig.gadgets.oauth.service.ConsumerStoreService;
-import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
+//import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
@@ -43,12 +44,13 @@ public class ConsumerStoreServiceDbImplT
@Before
public void setUp() throws Exception {
- Injector injector = Guice.createInjector(new OpenJPADbModule());
- service = injector.getInstance(ConsumerStoreServiceDbImpl.class);
+ /*Injector injector = Guice.createInjector(new OpenJPADbModule());
+ service = injector.getInstance(ConsumerStoreServiceDbImpl.class);*/
}
@Test
+ @Ignore //Temporarily ignoring until rave-commons JPA pattern is applied
public void testCrudOperations() throws Exception {
assertNull("Empty DB", service.findOAuthConsumerStore(GADGET_URI, SERVICE_NAME));
Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/TokenInfoServiceDbImplTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/TokenInfoServiceDbImplTest.java?rev=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/TokenInfoServiceDbImplTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/gadgets/oauth/service/impl/TokenInfoServiceDbImplTest.java Wed Aug 10 00:18:18 2011
@@ -26,8 +26,9 @@ import org.apache.shindig.gadgets.oauth.
import org.apache.shindig.gadgets.oauth.model.OAuthTokenInfoDb;
import org.apache.shindig.gadgets.oauth.service.TokenInfoService;
import org.apache.shindig.social.core.oauth.OAuthSecurityToken;
-import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
+//import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.Date;
@@ -44,12 +45,13 @@ public class TokenInfoServiceDbImplTest
@Before
public void setUp() throws Exception {
- Injector injector = Guice.createInjector(new OpenJPADbModule());
- service = injector.getInstance(TokenInfoServiceDbImpl.class);
+ /*Injector injector = Guice.createInjector(new OpenJPADbModule());
+ service = injector.getInstance(TokenInfoServiceDbImpl.class);*/
}
@Test
+ @Ignore //Temporarily ignoring until rave-commons JPA pattern is applied
public void testCrudOperations() throws Exception {
assertNull("Empty db", service.findOAuthTokenInfo("userId", "appUrl",
OAuthTokenInfoDb.MODULE_ID, "tokenName", "serviceName"));
Modified: incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDbTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDbTest.java?rev=1155978&r1=1155977&r2=1155978&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDbTest.java (original)
+++ incubator/rave/trunk/rave-shindig/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDbTest.java Wed Aug 10 00:18:18 2011
@@ -21,17 +21,12 @@ package org.apache.shindig.social.openso
import com.google.inject.Guice;
import com.google.inject.Injector;
-import org.apache.rave.os.model.RaveNameImpl;
import org.apache.shindig.auth.SecurityToken;
import org.apache.shindig.common.testing.FakeGadgetToken;
import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.model.FilterOperation;
import org.apache.shindig.protocol.model.SortOrder;
-import org.apache.shindig.social.opensocial.jpa.EnumDb;
-import org.apache.shindig.social.opensocial.jpa.PersonDb;
-import org.apache.shindig.social.opensocial.jpa.api.FilterCapability;
-import org.apache.shindig.social.opensocial.jpa.api.FilterSpecification;
-import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
+//import org.apache.shindig.social.opensocial.jpa.openjpa.OpenJPADbModule;
import org.apache.shindig.social.opensocial.model.*;
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.PersonService;
@@ -52,7 +47,7 @@ import static org.easymock.EasyMock.*;
* Test for {@link PersonServiceDb}
*/
public class PersonServiceDbTest {
- PersonServiceDb service;
+ /* PersonServiceDb service;
@Before
public void setUp() throws Exception {
@@ -95,11 +90,11 @@ public class PersonServiceDbTest {
}
}
- /**
+ *//**
* Should return 0 as position to add (or actually ignore) if the filter is invalid
*
* @throws Exception if something goes wrong
- */
+ *//*
@Test
public void testAddInvalidFilterClause() throws Exception {
final String nullString = null;
@@ -117,12 +112,12 @@ public class PersonServiceDbTest {
verify(filterable);
}
- /**
+ *//**
* Shows that a special filter will never return a String in case it's a special operation and
* returns position 0 ("do not add filter")
*
* @throws Exception if something goes wrong
- */
+ *//*
@Test
public void testAddSpecialFilterClause() throws Exception {
final String specialOperation = FilterSpecification.SPECIAL_OPERATION;
@@ -219,6 +214,6 @@ public class PersonServiceDbTest {
person.setNickname("hoosier");
person.setSmoker(new EnumDb<Smoker>(Smoker.NO));
return person;
- }
+ }*/
}
Added: 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/spring-test.xml?rev=1155978&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml (added)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/spring-test.xml Wed Aug 10 00:18:18 2011
@@ -0,0 +1,38 @@
+<!--
+ ~ 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">
+
+ <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>
+</beans>
Added: incubator/rave/trunk/rave-shindig/src/test/resources/test_data.sql
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/test_data.sql?rev=1155978&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/test_data.sql (added)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/test_data.sql Wed Aug 10 00:18:18 2011
@@ -0,0 +1,25 @@
+INSERT INTO person(id, username, display_name, gender, status, profile_url, build, eye_color, hair_color,family_name, given_name )
+VALUES (set(@person_id_1, next value for person_id_seq), 'canonical', 'Canonical User', 'male', 'I am alive', 'http://rave.rocks.org/profile', 'skinny', 'orange', 'blue', 'User', 'Canonical');
+
+INSERT INTO person(id, username, display_name)
+VALUES (set(@person_id_2, next value for person_id_seq), 'john.doe', 'John Doe');
+
+
+INSERT INTO person(id, username, display_name)
+VALUES (set(@person_id_3, next value for person_id_seq), 'jane.doe', 'Jane Doe');
+
+
+INSERT INTO person(id, username, display_name)
+VALUES (set(@person_id_4, next value for person_id_seq), 'george.doe', 'George Doe');
+
+INSERT INTO person(id, username, display_name)
+VALUES (set(@person_id_5, next value for person_id_seq), 'mario.rossi', 'Mario Rossi');
+
+INSERT INTO person_association(id, follower_id, followed_id)
+VALUES (next value for person_association_id_seq, @person_id_1, @person_id_2);
+
+INSERT INTO person_association(id, follower_id, followed_id)
+VALUES (next value for person_association_id_seq, @person_id_1, @person_id_3);
+
+INSERT INTO person_association(id, follower_id, followed_id)
+VALUES (next value for person_association_id_seq, @person_id_2, @person_id_4);