Skip to content

Commit

Permalink
fixed the rest of the single tests, but still the complete suite fail…
Browse files Browse the repository at this point in the history
…s, since the jetty server does not get stopped somehow
  • Loading branch information
fasseg committed Mar 21, 2013
1 parent 1227758 commit 1ec2c77
Show file tree
Hide file tree
Showing 46 changed files with 484 additions and 256 deletions.
69 changes: 53 additions & 16 deletions fcrepo-generator-dc/pom.xml
Expand Up @@ -30,6 +30,17 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.5.Final</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- test gear -->
<dependency>
Expand All @@ -42,18 +53,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand All @@ -62,6 +61,12 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<version>2.3.5.Final</version>
<scope>test</scope>
</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 All @@ -71,6 +76,11 @@
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -79,14 +89,41 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-cxf-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.0.v20130308</version>
<configuration>
<contextPath>/</contextPath>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<daemon>true</daemon>
<webAppSourceDirectory>${basedir}/src/test/resources</webAppSourceDirectory>
<useTestClasspath>true</useTestClasspath>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -9,6 +9,7 @@
import java.util.List;

import javax.annotation.Resource;
import javax.inject.Named;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
Expand All @@ -20,18 +21,24 @@

import org.fcrepo.AbstractResource;
import org.fcrepo.generator.dublincore.DCGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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



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

@Resource
List<DCGenerator> dcgenerators;

@GET
@Produces(TEXT_XML)
public Response getObjectAsDublinCore(@PathParam("pid")
final String pid) throws RepositoryException {

logger.debug("fetching dc record for pid: " + pid);
final Node obj = getObjectNode(pid);

for (DCGenerator indexer : dcgenerators) {
Expand Down
Expand Up @@ -19,7 +19,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
public abstract class AbstractResourceIT {

protected Logger logger;
Expand Down
Expand Up @@ -13,7 +13,6 @@
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;

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

@Test
Expand Down
29 changes: 29 additions & 0 deletions fcrepo-generator-dc/src/test/resources/WEB-INF/web.xml
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<display-name>Archetype Created Web Application</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-test/generator.xml classpath:spring-test/repo.xml</param-value>
</context-param>

<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<listener>
<listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>


</web-app>
19 changes: 1 addition & 18 deletions fcrepo-generator-dc/src/test/resources/spring-test/generator.xml
Expand Up @@ -2,34 +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">

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

<context:property-placeholder/>

<context:annotation-config/>

<jaxrs:server address="http://localhost:${test.port:8080}/rest">
<jaxrs:serviceBeans>
<bean class="org.fcrepo.generator.DublinCoreGenerator"/>
<bean class="org.fcrepo.api.FedoraObjects"/>
<bean class="org.fcrepo.api.FedoraDatastreams"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.fcrepo.exceptionhandlers.PathNotFoundExceptionMapper"/>
<bean class="org.fcrepo.exceptionhandlers.AccessControlExceptionMapper"/>
<bean class="org.fcrepo.exceptionhandlers.WildcardExceptionMapper">
<property name="showStackTrace" value="true"/>
</bean>
</jaxrs:providers>
</jaxrs:server>
<context:component-scan base-package="org.fcrepo.exceptionhandlers, org.fcrepo.generator, org.fcrepo.api" />

<util:list id="dcgenerators" value-type="org.fcrepo.generator.dublincore.DCGenerator">
<bean class="org.fcrepo.generator.dublincore.WellKnownDatastreamGenerator">
Expand Down
51 changes: 41 additions & 10 deletions fcrepo-generator-rdf/pom.xml
Expand Up @@ -35,16 +35,16 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<version>2.3.5.Final</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -92,6 +92,37 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.0.v20130308</version>
<configuration>
<contextPath>/</contextPath>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<daemon>true</daemon>
<webAppSourceDirectory>${basedir}/src/test/resources</webAppSourceDirectory>
<useTestClasspath>true</useTestClasspath>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Expand Up @@ -9,6 +9,7 @@
import java.util.List;

import javax.annotation.Resource;
import javax.inject.Named;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.ws.rs.GET;
Expand All @@ -23,7 +24,8 @@
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.RDFWriter;

@Path("/objects/{pid}/rdf")
@Named
@Path("/rest/objects/{pid}/rdf")
public class RdfGenerator {

@Resource
Expand Down
Expand Up @@ -19,7 +19,6 @@
import java.io.UnsupportedEncodingException;
import java.util.concurrent.TimeUnit;

@RunWith(SpringJUnit4ClassRunner.class)
public abstract class AbstractResourceIT {

protected Logger logger;
Expand Down
Expand Up @@ -13,7 +13,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

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

@Test
Expand Down
29 changes: 29 additions & 0 deletions fcrepo-generator-rdf/src/test/resources/WEB-INF/web.xml
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<display-name>Archetype Created Web Application</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-test/generator.xml classpath:spring-test/repo.xml</param-value>
</context-param>

<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<listener>
<listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>


</web-app>

0 comments on commit 1ec2c77

Please sign in to comment.