Skip to content

Commit

Permalink
added test container for faster integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fasseg committed May 31, 2013
1 parent 019116e commit 708c156
Show file tree
Hide file tree
Showing 27 changed files with 308 additions and 1,703 deletions.
226 changes: 102 additions & 124 deletions fcrepo-fixity-core/pom.xml
@@ -1,130 +1,108 @@
<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>
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-fixity</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>
<parent>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-fixity</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>

<artifactId>fcrepo-fixity-core</artifactId>
<packaging>bundle</packaging>
<artifactId>fcrepo-fixity-core</artifactId>
<packaging>bundle</packaging>

<name>fcrepo-fixity-core</name>
<name>fcrepo-fixity-core</name>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>2.10.1</version>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-kernel</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</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.fcrepo</groupId>
<artifactId>fcrepo-http-commons</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-api</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-servlet-webserver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<dependencies>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-client</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.10.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>3.12</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
3 changes: 0 additions & 3 deletions fcrepo-fixity-core/src/main/java/META-INF/MANIFEST.MF

This file was deleted.

@@ -0,0 +1,65 @@
/**
*
*/
package org.fcrepo.fixity.client;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.client.methods.HttpGet;
import org.apache.jena.riot.RDFDataMgr;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;


/**
* This class is responsible for interaction with the Fedora Repository
*
* @author frank asseg
*
*/
public class FedoraFixityClient {

private final static String PREDICATE_PREFIX = "info:fedora/fedora-system:def/internal";

private final static String PREDICATE_STATUS = PREDICATE_PREFIX + "#status";

private final static String PREDICATE_HASPARENT = PREDICATE_PREFIX + "#hasParent";


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

/**
* Fetch all the identifiers of objects which have a given parent
* @param parentUri The URI of the parent (e.g. http://localhost:8080/rest/objects)
* @return A {@link List} containing the URIs of the child objects
*/
public final List<String> retrieveUris(final String parentUri) throws IOException{
/* fetch a RDF Description of the parent form the repository */
final HttpGet search = new HttpGet(parentUri);
try{
/* parse the RDF N3 response using Apache Jena */
final Model model = ModelFactory.createDefaultModel();
RDFDataMgr.read(model, parentUri);

/* and iterate over all the elements which contain the predicate #hasParent in order to discover objects */
final StmtIterator stmts = model.listStatements(null,model.createProperty(PREDICATE_HASPARENT),model.createResource(parentUri));
final List<String> uris = new ArrayList<>();
while (stmts.hasNext()){
final Statement st = stmts.next();
uris.add(st.getSubject().getURI());
}

return uris;
}finally{
search.releaseConnection();
}
}

}
@@ -0,0 +1,13 @@
/**
*
*/
package org.fcrepo.fixity.model;


/**
* @author frank asseg
*
*/
public class DatastreamFixityResult {

}
@@ -0,0 +1,13 @@
/**
*
*/
package org.fcrepo.fixity.model;


/**
* @author frank asseg
*
*/
public class ObjectFixityResult {

}

This file was deleted.

0 comments on commit 708c156

Please sign in to comment.