Skip to content

Commit

Permalink
Add integration test rigging
Browse files Browse the repository at this point in the history
Resolves https://www.pivotaltracker.com/story/show/56135376
- Unify integration tests with other code in a single module
  • Loading branch information
Michael Durbin authored and Andrew Woods committed Sep 7, 2013
1 parent ef50b84 commit 3f773e2
Show file tree
Hide file tree
Showing 178 changed files with 28,159 additions and 24 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -3,6 +3,21 @@
This fedoration connector allows exposure of fedora 3 content in a running fedora 3 repository
to appear within a fedora 4 repository. To use this code, you'd need to have access to a fedora 3 repository.

## Organization

This module has 2 sub-modules.

### local-legacy-fedora3

A sub module that builds jar file of a build of fedora 3 for use in
cargo to support integration testing.

### fcrepo-fedora3-federation-connector

A federation connector with unit and integration tests rigging to expose
fedora 3 conent in a fedora 4 repository.


[Design Documentation](https://wiki.duraspace.org/display/FF/Design+-+Fedora+3+to+4+Upgrade)

## Fetching the source code
Expand Down
269 changes: 269 additions & 0 deletions fcrepo-fedora3-federation-connector/pom.xml
@@ -0,0 +1,269 @@
<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-fedora3-federation</artifactId>
<version>4.0.0-alpha-2-SNAPSHOT</version>
</parent>
<artifactId>fcrepo-fedora3-federation-connector</artifactId>
<name>${project.artifactId}</name>
<description>
A package of federation connectors that can be used to project
over fedora 3 content.
</description>
<properties>
<modeshape.version>3.4.0.Final</modeshape.version>
<fedora.home>${project.build.directory}/fedora-home</fedora.home>
<foxml.dir>${project.build.directory}/foxml</foxml.dir>
<datastreams.dir>${project.build.directory}/datastreams</datastreams.dir>
</properties>
<packaging>war</packaging>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>local-legacy-fedora3</artifactId>
<version>${fedora3.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.yourmediashelf.fedora.client</groupId>
<artifactId>fedora-client-core</artifactId>
<version>0.7</version>
<classifier>with-dependencies</classifier>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-kernel</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-fedora3-federation-connector</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly2</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>

<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${basedir}/src/test/resources/fedora-home</directory>
<targetPath>${fedora.home}</targetPath>
<filtering>true</filtering>
</testResource>
<testResource>
<directory>${basedir}/src/test/resources/config</directory>
<targetPath>${build.testOutputDirectory}/config</targetPath>
<filtering>true</filtering>
</testResource>
<testResource>
<directory>${basedir}/src/test/resources/foxml</directory>
<targetPath>${foxml.dir}</targetPath>
</testResource>
<testResource>
<directory>${basedir}/src/test/resources/datastreams</directory>
<targetPath>${datastreams.dir}</targetPath>
</testResource>
</testResources>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.2</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<configuration>
<!-- reserve a port under the property ${servlet.port} for integration
tests -->
<portNames>
<portName>servlet.port</portName>
</portNames>
</configuration>
<executions>
<execution>
<id>reserve-port</id>
<phase>pre-integration-test</phase>
<goals>
<goal>reserve-network-port</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<servlet.port>${servlet.port}</servlet.port>
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<configuration>
<properties>
<cargo.servlet.port>${servlet.port}</cargo.servlet.port>
<cargo.servlet.uriencoding>UTF-8</cargo.servlet.uriencoding>
<cargo.jvmargs>-XX:MaxPermSize=512m -Xmx1024m</cargo.jvmargs>
<cargo.logging>low</cargo.logging>
</properties>
</configuration>
<container>
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.41/bin/apache-tomcat-7.0.41.zip</url>
</zipUrlInstaller>
<systemProperties>
<fedora.home>${fedora.home}</fedora.home>
<servlet.port>${servlet.port}</servlet.port>
</systemProperties>
<log>${project.build.directory}/tomcat.log</log>
<timeout>360000</timeout>
</container>
<deployables>
<deployable>
<groupId>org.fcrepo</groupId>
<artifactId>local-legacy-fedora3</artifactId>
<type>war</type>
<properties>
<context>fedora</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<id>start-cargo</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-cargo</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>

</project>
@@ -0,0 +1,75 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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.fcrepo.federation.fedora3.itests;

import static java.lang.System.getProperty;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.List;

import javax.jcr.LoginException;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import org.apache.commons.io.IOUtils;
import org.fcrepo.kernel.services.ObjectService;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import com.yourmediashelf.fedora.client.FedoraClient;
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.IngestResponse;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* This placeholder integration test exists only to show that the
* test rigging is complete.
*
* @author Michael Durbin
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/spring-test/repo.xml", "/spring-test/eventing.xml", "/spring-test/test-container.xml"})
public class FedoraFedrationIT {

@Autowired
Repository repo;

@Autowired
ObjectService objectService;

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

@Test
public void testFederationObject() throws LoginException, RepositoryException {
final Session session = repo.login();
objectService.getObjectNode(session, "/f3");
session.save();
session.logout();
}
}

0 comments on commit 3f773e2

Please sign in to comment.