Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
changed webapp, generators-rdf and webhooks to jersey impl and switch…
…ed integration tests to use grizzly
  • Loading branch information
fasseg committed Apr 18, 2013
1 parent a8e45f3 commit be4d127
Show file tree
Hide file tree
Showing 31 changed files with 189 additions and 386 deletions.
Expand Up @@ -24,7 +24,7 @@
import org.springframework.stereotype.Component;

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

@Resource
Expand Down
Expand Up @@ -37,6 +37,9 @@ public void setLogger() {
protected static final String serverAddress = "http://" + HOSTNAME + ":" +
SERVER_PORT + "/rest/";

protected static final String serverOAIAddress = "http://" + HOSTNAME + ":" +
SERVER_PORT + "/oai/";

protected final PoolingClientConnectionManager connectionManager =
new PoolingClientConnectionManager();

Expand Down
Expand Up @@ -21,7 +21,7 @@ public void testJcrPropertiesBasedOaiDc() throws Exception {
int status = getStatus(postObjMethod("DublinCoreTest1"));
assertEquals(201, status);
HttpGet getWorstCaseOaiMethod =
new HttpGet(serverAddress + "objects/DublinCoreTest1/oai_dc");
new HttpGet(serverOAIAddress + "objects/DublinCoreTest1/oai_dc");
getWorstCaseOaiMethod.setHeader("Accept", TEXT_XML);
HttpResponse response = client.execute(getWorstCaseOaiMethod);
assertEquals(200, response.getStatusLine().getStatusCode());
Expand All @@ -43,7 +43,7 @@ public void testWellKnownPathOaiDc() throws Exception {
assertEquals(201, response.getStatusLine().getStatusCode());

HttpGet getWorstCaseOaiMethod =
new HttpGet(serverAddress + "objects/DublinCoreTest2/oai_dc");
new HttpGet(serverOAIAddress + "objects/DublinCoreTest2/oai_dc");
getWorstCaseOaiMethod.setHeader("Accept", TEXT_XML);
response = client.execute(getWorstCaseOaiMethod);
assertEquals(200, response.getStatusLine().getStatusCode());
Expand Down
7 changes: 7 additions & 0 deletions fcrepo-generator-rdf/pom.xml
Expand Up @@ -34,6 +34,13 @@
<version>${project.version}</version>
<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>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Expand Up @@ -33,10 +33,12 @@
import org.openrdf.sail.memory.model.MemValueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
@Path("/objects/{pid}/datastreams/{dsid}/rdf")
@Path("/rest/objects/{pid}/datastreams/{dsid}/rdf")
@Produces({TEXT_XML, "text/turtle", TEXT_PLAIN})
public class DatastreamRdfGenerator extends AbstractResource {

Expand All @@ -47,7 +49,7 @@ public class DatastreamRdfGenerator extends AbstractResource {
final private Logger logger = LoggerFactory
.getLogger(DatastreamRdfGenerator.class);

@Inject
@Autowired
DatastreamService datastreamService;

@GET
Expand Down
Expand Up @@ -30,8 +30,12 @@
import org.openrdf.sail.memory.model.MemValueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Path("/objects/{pid}/rdf")
@Component
@Path("/rest/objects/{pid}/rdf")
@Produces({TEXT_XML, "text/turtle", TEXT_PLAIN})
public class ObjectRdfGenerator 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/test-container.xml"})
@ContextConfiguration({"/spring-test/generator.xml","/spring-test/repo.xml","/spring-test/test-container.xml"})
public class RdfGeneratorIT extends AbstractResourceIT {

@Test
Expand Down
80 changes: 34 additions & 46 deletions fcrepo-generator-rdf/src/test/resources/spring-test/generator.xml
@@ -1,52 +1,40 @@
<?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"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
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/>

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

<jaxrs:server address="http://localhost:${test.port:8080}/rest">
<jaxrs:serviceBeans>
<bean class="org.fcrepo.generator.ObjectRdfGenerator">
<property name="objectGenerators">
<list>
<bean class="org.fcrepo.generator.rdf.DefaultFedoraObjectGenerator"/>
</list>
</property>
</bean>
<bean class="org.fcrepo.generator.DatastreamRdfGenerator">
<property name="dsGenerators">
<list>
<bean class="org.fcrepo.generator.rdf.DefaultDatastreamGenerator"/>
</list>
</property>
</bean>
<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>

<!-- Mints PIDs-->
<bean class="org.fcrepo.identifiers.UUIDPidMinter"/>
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<context:property-placeholder />

<context:annotation-config />

<bean class="org.fcrepo.generator.ObjectRdfGenerator">
<property name="objectGenerators">
<list value-type="org.fcrepo.generator.rdf.TripleSource">
<bean id="objectRdf" class="org.fcrepo.generator.rdf.DefaultFedoraObjectGenerator" />
</list>
</property>
</bean>

<bean class="org.fcrepo.generator.DatastreamRdfGenerator">
<property name="dsGenerators">
<list>
<bean id="datastreamRdf" class="org.fcrepo.generator.rdf.DefaultDatastreamGenerator" />
</list>
</property>
</bean>



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

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


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

</beans>
Expand Up @@ -15,6 +15,7 @@
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:my_repository.json}"/>
</bean>


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

<bean class="org.fcrepo.services.ObjectService"/>
Expand Down
Expand Up @@ -2,11 +2,13 @@
<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: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://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-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" />
Expand Down
60 changes: 7 additions & 53 deletions fcrepo-http-api/src/main/resources/META-INF/spring/rest.xml
Expand Up @@ -2,64 +2,18 @@
<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 that houses JAX-RS Resources that compose the API
as well as some utility gear. -->

<context:annotation-config/>

<jaxrs:server address="/rest">
<jaxrs:serviceBeans>
<bean class="org.fcrepo.api.legacy.FedoraRepository"/>
<bean class="org.fcrepo.api.legacy.FedoraDatastreams"/>
<bean class="org.fcrepo.api.legacy.FedoraIdentifiers"/>
<bean class="org.fcrepo.api.legacy.FedoraNamespaces"/>
<bean class="org.fcrepo.api.legacy.FedoraObjects"/>
<bean class="org.fcrepo.api.FedoraSitemap"/>
<bean class="org.fcrepo.foxml.FedoraOXML"/>
</jaxrs:serviceBeans>
<jaxrs:extensionMappings>
<entry key="json" value="application/json"/>
<entry key="xml" value="application/xml"/>
</jaxrs:extensionMappings>
<jaxrs:providers>
<bean class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<property name="marshallerProperties">
<util:map>
<entry key="jaxb.formatted.output">
<value type="java.lang.Boolean">true</value>
</entry>
</util:map>
</property>
</bean>
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="ignoreNamespaces" value="true"/>
</bean>
</jaxrs:providers>
</jaxrs:server>

<jaxrs:server address="/rest/modeshape">
<jaxrs:serviceBeans>
<bean class="org.modeshape.web.jcr.rest.ModeShapeRestService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.modeshape.web.jcr.rest.output.HtmlBodyWriter"/>
<bean class="org.modeshape.web.jcr.rest.output.JSONBodyWriter"/>
<bean class="org.modeshape.web.jcr.rest.output.TextBodyWriter"/>
</jaxrs:providers>
</jaxrs:server>
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

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

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

<context:annotation-config />

<context:component-scan base-package="org.modeshape.web.jcr.rest, org.fcrepo.api, org.fcrepo.exceptionhandlers"/>

</beans>

Expand Up @@ -65,7 +65,7 @@
import com.sun.jersey.multipart.MultiPart;

@Path("/v3/objects/{pid}/datastreams")
@Component
@Component("fedoraLegacyDatastreams")
public class FedoraDatastreams extends AbstractResource {

final private Logger logger = LoggerFactory
Expand Down
Expand Up @@ -27,7 +27,7 @@
*
*/
@Path("/v3/nextPID")
@Component
@Component("fedoraLegacyIdentifiers")
public class FedoraIdentifiers extends AbstractResource {

/**
Expand Down
Expand Up @@ -39,7 +39,7 @@
*
*/
@Path("/v3/namespaces")
@Component
@Component("fedoraLegacyNamespaces")
public class FedoraNamespaces extends AbstractResource {

/**
Expand Down
Expand Up @@ -43,7 +43,7 @@
import org.springframework.stereotype.Component;

@Path("/v3/objects")
@Component
@Component("fedoraLegacyObjects")
public class FedoraObjects extends AbstractResource {

private static final Logger logger = LoggerFactory
Expand Down
Expand Up @@ -41,7 +41,7 @@
*/

@Path("/v3")
@Component
@Component("fedoraLegacyRepository")
public class FedoraRepository extends AbstractResource {

private static final Logger logger = LoggerFactory
Expand Down
52 changes: 5 additions & 47 deletions fcrepo-legacy-api/src/main/resources/META-INF/spring/rest.xml
Expand Up @@ -10,55 +10,13 @@
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 that houses JAX-RS Resources that compose the API
as well as some utility gear. -->

<context:annotation-config/>

<jaxrs:server address="/rest">
<jaxrs:serviceBeans>
<bean class="org.fcrepo.api.legacy.FedoraRepository"/>
<bean class="org.fcrepo.api.legacy.FedoraDatastreams"/>
<bean class="org.fcrepo.api.legacy.FedoraIdentifiers"/>
<bean class="org.fcrepo.api.legacy.FedoraNamespaces"/>
<bean class="org.fcrepo.api.legacy.FedoraObjects"/>
<bean class="org.fcrepo.foxml.FedoraOXML"/>
</jaxrs:serviceBeans>
<jaxrs:extensionMappings>
<entry key="json" value="application/json"/>
<entry key="xml" value="application/xml"/>
</jaxrs:extensionMappings>
<jaxrs:providers>
<bean class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<property name="marshallerProperties">
<util:map>
<entry key="jaxb.formatted.output">
<value type="java.lang.Boolean">true</value>
</entry>
</util:map>
</property>
</bean>
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="ignoreNamespaces" value="true"/>
</bean>
</jaxrs:providers>
</jaxrs:server>

<jaxrs:server address="/rest/modeshape">
<jaxrs:serviceBeans>
<bean class="org.modeshape.web.jcr.rest.ModeShapeRestService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.modeshape.web.jcr.rest.output.HtmlBodyWriter"/>
<bean class="org.modeshape.web.jcr.rest.output.JSONBodyWriter"/>
<bean class="org.modeshape.web.jcr.rest.output.TextBodyWriter"/>
</jaxrs:providers>
</jaxrs:server>

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

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

<context:annotation-config />

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

</beans>

0 comments on commit be4d127

Please sign in to comment.