Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added integration test infrastrucutre and switched fcrepo-legacy-api …
…to a jersey impl
- Loading branch information
Showing
17 changed files
with
312 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,116 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.fcrepo</groupId> | ||
<artifactId>fcrepo</artifactId> | ||
<version>4.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>fcrepo-http-commons</artifactId> | ||
<name>Fedora HTTP Commons</name> | ||
<description>HTTP (JAX-RS) resources and helpers.</description> | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.fcrepo</groupId> | ||
<artifactId>fcrepo</artifactId> | ||
<version>4.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>fcrepo-http-commons</artifactId> | ||
<name>Fedora HTTP Commons</name> | ||
<description>HTTP (JAX-RS) resources and helpers.</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.fcrepo</groupId> | ||
<artifactId>fcrepo-kernel</artifactId> | ||
<version>${project.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.jboss.jbossts</groupId> | ||
<artifactId>jbossjta</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-jcr</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-jcr-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.fcrepo</groupId> | ||
<artifactId>fcrepo-kernel</artifactId> | ||
<version>${project.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.jboss.jbossts</groupId> | ||
<artifactId>jbossjta</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-jcr</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-jcr-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.sun.grizzly</groupId> | ||
<artifactId>grizzly-servlet-webserver</artifactId> | ||
<version>1.9.57</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.sun.jersey</groupId> | ||
<artifactId>jersey-grizzly</artifactId> | ||
<version>1.17.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
</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> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
fcrepo-http-commons/src/test/java/org/fcrepo/test/util/ContainerWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.fcrepo.test.util; | ||
|
||
import java.net.URI; | ||
import java.util.List; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
|
||
import com.sun.grizzly.http.SelectorThread; | ||
import com.sun.grizzly.http.servlet.ServletAdapter; | ||
import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory; | ||
import com.sun.jersey.spi.spring.container.servlet.SpringServlet; | ||
|
||
public class ContainerWrapper { | ||
private static final Logger logger = LoggerFactory.getLogger(ContainerWrapper.class); | ||
|
||
private String contextConfigLocations; | ||
private int port; | ||
private ConfigurableApplicationContext context; | ||
private SelectorThread server; | ||
private String packagesToScan; | ||
|
||
public void setPackagesToScan(String packagesToScan) { | ||
this.packagesToScan = packagesToScan; | ||
} | ||
|
||
public void setContextConfigLocations(String contextConfigLocations) { | ||
this.contextConfigLocations = contextConfigLocations; | ||
} | ||
|
||
public void setPort(int port) { | ||
this.port = port; | ||
} | ||
|
||
public void start() throws Exception { | ||
URI uri = URI.create("http://localhost:" + port + "/"); | ||
ServletAdapter adapter = new ServletAdapter(); | ||
adapter.addInitParameter("com.sun.jersey.config.property.packages", packagesToScan); | ||
adapter.addInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true"); | ||
adapter.addContextParameter("contextConfigLocation", contextConfigLocations); | ||
adapter.addServletListener("org.springframework.web.context.ContextLoaderListener"); | ||
adapter.setServletInstance(new SpringServlet()); | ||
adapter.setContextPath(uri.getPath()); | ||
adapter.setProperty("load-on-startup", 1); | ||
this.server = GrizzlyServerFactory.create(uri, adapter); | ||
logger.debug("started grizzly webserver endpoint at " + this.server.getPort()); | ||
} | ||
|
||
public void stop() throws Exception { | ||
server.stopEndpoint(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.