Skip to content

Commit

Permalink
switched RSSPublisher to Jersey impl and changed integration test to …
Browse files Browse the repository at this point in the history
…use grizzly
  • Loading branch information
fasseg committed Apr 17, 2013
1 parent ece5bdd commit a8e45f3
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 61 deletions.
6 changes: 5 additions & 1 deletion fcrepo-generator-dc/pom.xml
Expand Up @@ -30,7 +30,11 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>

<!-- test gear -->
<dependency>
<groupId>org.fcrepo</groupId>
Expand Down
Expand Up @@ -21,8 +21,10 @@
import org.fcrepo.generator.dublincore.DCGenerator;
import org.fcrepo.services.ObjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Path("/objects/{pid}/oai_dc")
@Component
@Path("/rest/objects/{pid}/oai_dc")
public class DublinCoreGenerator extends AbstractResource {

@Resource
Expand Down
Expand Up @@ -2,20 +2,16 @@
<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:jaxrs="http://cxf.apache.org/jaxrs"
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://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<context:annotation-config />

<context:component-scan base-package="org.fcrepo.generator,org.fcrepo.exceptionhandlers"/>
<context:component-scan base-package="org.fcrepo.generator, org.fcrepo.api, org.fcrepo.exceptionhandlers"/>

<bean class="org.fcrepo.session.SessionFactory" />

<bean class="org.fcrepo.session.SessionFactory" />

<!-- Mints PIDs-->
Expand Down
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
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">

<context:property-placeholder/>

<!-- show stack traces for easier debugging -->
<bean id="wildcardExceptionmapper" class="org.fcrepo.exceptionhandlers.WildcardExceptionMapper" >
<property name="showStackTrace" value="true" />
</bean>

<bean id="containerWrapper" class="org.fcrepo.test.util.ContainerWrapper" init-method="start" destroy-method="stop" >
<property name="port" value="${test.port:8080}"/>
<property name="contextConfigLocations" value="classpath:spring-test/generator.xml,classpath:spring-test/repo.xml" />
<property name="packagesToScan" value="org.fcrepo.api, org.fcrepo.generator, org.fcrepo.exceptionhandlers" />
</bean>

</beans>
50 changes: 39 additions & 11 deletions fcrepo-generator-rdf/pom.xml
Expand Up @@ -22,7 +22,11 @@
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>

<!-- test gear -->
<dependency>
<groupId>org.fcrepo</groupId>
Expand All @@ -35,25 +39,49 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-servlet-webserver</artifactId>
<version>1.9.57</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly</artifactId>
<version>1.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.17.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>xerces</groupId>
Expand Down
Expand Up @@ -11,6 +11,7 @@
import javax.inject.Inject;
import javax.jcr.NamespaceRegistry;
import javax.jcr.RepositoryException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
Expand All @@ -32,7 +33,9 @@
import org.openrdf.sail.memory.model.MemValueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
@Path("/objects/{pid}/datastreams/{dsid}/rdf")
@Produces({TEXT_XML, "text/turtle", TEXT_PLAIN})
public class DatastreamRdfGenerator extends AbstractResource {
Expand Down
Expand Up @@ -12,7 +12,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@ContextConfiguration({"/spring-test/generator.xml", "/spring-test/repo.xml"})
@ContextConfiguration({"/spring-test/test-container.xml"})
public class RdfGeneratorIT extends AbstractResourceIT {

@Test
Expand Down
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
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">

<context:property-placeholder/>

<!-- show stack traces for easier debugging -->
<bean id="wildcardExceptionmapper" class="org.fcrepo.exceptionhandlers.WildcardExceptionMapper" >
<property name="showStackTrace" value="true" />
</bean>

<bean id="containerWrapper" class="org.fcrepo.test.util.ContainerWrapper" init-method="start" destroy-method="stop" >
<property name="port" value="${test.port:8080}"/>
<property name="contextConfigLocations" value="classpath:spring-test/generator.xml,classpath:spring-test/repo.xml" />
<property name="packagesToScan" value="org.fcrepo.api, org.fcrepo.generator, org.fcrepo.exceptionhandlers" />
</bean>

</beans>
1 change: 0 additions & 1 deletion fcrepo-http-api/src/test/resources/spring-test/repo.xml
Expand Up @@ -17,7 +17,6 @@

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>


<bean class="org.fcrepo.services.ObjectService"/>
<bean class="org.fcrepo.services.LowLevelStorageService"/>
<bean class="org.fcrepo.services.DatastreamService"/>
Expand Down
59 changes: 47 additions & 12 deletions fcrepo-rss/pom.xml
Expand Up @@ -22,32 +22,67 @@
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>

<!-- test gear -->
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-servlet-webserver</artifactId>
<version>1.9.57</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly</artifactId>
<version>1.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.17.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- This dependency is for compile-time: it keeps this module independent of
any given choice of JAX-RS implementation. It must be _after_ the test
Expand Down
Expand Up @@ -21,6 +21,8 @@
import org.fcrepo.AbstractResource;
import org.joda.time.DateTime;
import org.modeshape.common.SystemFailureException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.common.base.Function;
import com.google.common.eventbus.EventBus;
Expand All @@ -34,6 +36,7 @@
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedOutput;

@Component
@Path("/rss")
public class RSSPublisher extends AbstractResource {

Expand All @@ -45,7 +48,7 @@ public class RSSPublisher extends AbstractResource {

private static final String FEED_DESCRIPTION = FEED_TITLE;

@Inject
@Autowired
EventBus eventBus;

private BlockingQueue<Event> feedQueue = new ArrayBlockingQueue<Event>(
Expand Down
Expand Up @@ -8,7 +8,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import javax.inject.Inject;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
Expand All @@ -20,15 +19,15 @@
import org.modeshape.jcr.api.JcrTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

@ContextConfiguration({"/spring-test/repo.xml", "/spring-test/rest.xml",
"/spring-test/eventing.xml"})
@ContextConfiguration({"/spring-test/repo.xml", "/spring-test/test-container.xml"})
public class RSSIT extends AbstractResourceIT {

final private Logger logger = LoggerFactory.getLogger(RSSIT.class);

@Inject
@Autowired
Repository repo;

JcrTools jcrTools = new JcrTools(true);
Expand Down
5 changes: 3 additions & 2 deletions fcrepo-rss/src/test/resources/spring-test/repo.xml
Expand Up @@ -10,14 +10,15 @@

<context:annotation-config/>


<bean name="modeshapeRepofactory"
class="org.fcrepo.spring.ModeShapeRepositoryFactoryBean">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:test_repository.json}"/>
</bean>

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>

<bean class="org.fcrepo.services.ObjectService" />
<bean class="org.fcrepo.services.ObjectService"/>
<bean class="org.fcrepo.services.LowLevelStorageService"/>
<bean class="org.fcrepo.services.DatastreamService"/>

</beans>
28 changes: 6 additions & 22 deletions fcrepo-rss/src/test/resources/spring-test/rest.xml
Expand Up @@ -2,33 +2,17 @@
<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:jaxrs="http://cxf.apache.org/jaxrs"
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://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml"/>

<context:property-placeholder/>

<!-- Context that houses JAX-RS Resources that compose the API
as well as some utility gear. -->

<context:annotation-config/>
<context:annotation-config />

<context:component-scan base-package="org.fcrepo.syndication, org.fcrepo.exceptionhandlers"/>

<bean class="org.fcrepo.session.SessionFactory" />

<jaxrs:server address="http://localhost:${test.port:8080}">
<jaxrs:serviceBeans>
<bean class="org.fcrepo.syndication.RSSPublisher"/>
</jaxrs:serviceBeans>
</jaxrs:server>


<!-- Mints PIDs-->
<bean class="org.fcrepo.identifiers.UUIDPidMinter"/>



</beans>

0 comments on commit a8e45f3

Please sign in to comment.