Skip to content

Commit

Permalink
Correcting MS/IS config so that tests pass, also altering FedoraRepos…
Browse files Browse the repository at this point in the history
…itory resource class to include path segment /fedora
  • Loading branch information
ajs6f committed Jan 23, 2013
1 parent 6505162 commit dbc1e7a
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 51 deletions.
Expand Up @@ -103,7 +103,7 @@ private static void initializeEngine() throws RepositoryException {
String[] workspaceNames = ws.getAccessibleWorkspaceNames();

if (!Arrays.asList(workspaceNames).contains("fedora")) {
ws.createWorkspace("fedora");
ws.getSession().getWorkspace().createWorkspace("fedora");
logger.debug("Created 'fedora' workspace.\n");
}

Expand Down
Expand Up @@ -42,7 +42,7 @@ public FedoraDatastreams() throws ConfigurationException,
}

@GET
@Path("/")
@Path("")
@Produces("text/xml")
public Response getDatastreams(@PathParam("pid") final String pid)
throws RepositoryException, IOException, TemplateException {
Expand Down
Expand Up @@ -65,7 +65,7 @@ public Response retrieveObjectNamespace(@PathParam("ns") final String prefix)
}

@POST
@Path("/")
@Path("")
@Consumes("application/json")
public Response registerObjectNamespaceJSON(final InputStream message)
throws RepositoryException, JsonParseException,
Expand All @@ -84,7 +84,7 @@ public Response registerObjectNamespaceJSON(final InputStream message)
}

@GET
@Path("/")
@Path("")
@Produces("text/plain")
public Response getObjectNamespaces() throws RepositoryException {
final Session session = ws.getSession();
Expand All @@ -102,7 +102,7 @@ public Response getObjectNamespaces() throws RepositoryException {
}

@GET
@Path("/")
@Path("")
@Produces("text/xml")
public Response getObjectNamespacesInXML() throws RepositoryException,
IOException, TemplateException {
Expand Down
Expand Up @@ -31,7 +31,7 @@
* @author ajs6f
*/

@Path("/")
@Path("/fedora")
public class FedoraRepository extends AbstractResource {

private final Logger logger = Logger.getLogger(FedoraRepository.class);
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/infinispan_configuration.xml
Expand Up @@ -16,6 +16,12 @@
Defines the default behavior for all caches, including those created dynamically (e.g., when a
repository uses a cache that doesn't exist in this configuration).
-->
<clustering mode="distribution">
<sync/>
<l1 enabled="false" lifespan="0" onRehash="false"/>
<hash numOwners="1"/>
<stateTransfer fetchInMemoryState="true"/>
</clustering>
</default>

<namedCache name="FedoraRepository">
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/my_repository.json
Expand Up @@ -3,7 +3,7 @@
"jndiName" : "",
"workspaces" : {
"predefined" : ["fedora"],
"default" : "default",
"default" : "fedora",
"allowCreation" : true
},
"storage" : {
Expand Down
Expand Up @@ -33,7 +33,7 @@ public void stop() {
public void testDescribeModeshape() throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:" + SERVER_PORT
+ "/describe/modeshape");
+ "/fedora/describe/modeshape");
int status = client.executeMethod(method);
assertEquals(200, status);
}
Expand All @@ -42,7 +42,7 @@ public void testDescribeModeshape() throws Exception {
public void testDescribe() throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:" + SERVER_PORT
+ "/describe");
+ "/fedora/describe");
int status = client.executeMethod(method);
assertEquals(200, status);
}
Expand All @@ -51,7 +51,7 @@ public void testDescribe() throws Exception {
public void testGetObjects() throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:" + SERVER_PORT
+ "/objects");
+ "/fedora/objects");
int status = client.executeMethod(method);
assertEquals(200, status);
}
Expand Down
90 changes: 51 additions & 39 deletions src/test/resources/infinispan_configuration.xml
@@ -1,65 +1,77 @@
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">

<global>
<!-- Defines the global settings shared by all caches -->
</global>

<default>
<!--
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">

<global>
<!-- Defines the global settings shared by all caches -->
<transport>
<properties>
<property name="configurationFile" value="jgroups-tcp.xml"/>
</properties>
</transport>
</global>

<default>
<!--
Defines the default behavior for all caches, including those created dynamically (e.g., when a
repository uses a cache that doesn't exist in this configuration).
-->
</default>

<namedCache name="FedoraRepository">
<clustering>
<l1 enabled="false" onRehash="false"/>
</clustering>
<!--
<clustering mode="distribution">
<sync/>
<l1 enabled="false" lifespan="0" onRehash="false"/>
<hash numOwners="1"/>
<stateTransfer fetchInMemoryState="true"/>
</clustering>
</default>

<namedCache name="FedoraRepository">
<!--
Our Infinispan cache needs to be transactional. However, we'll also configure it to
use pessimistic locking, which is required whenever applications will be concurrently
updating nodes within the same process. If you're not sure, use pessimistic locking.
-->
<transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
transactionMode="TRANSACTIONAL"
lockingMode="PESSIMISTIC"/>
<!--
<clustering mode="distribution">
<sync/>
<l1 enabled="false" lifespan="0" onRehash="false"/>
<hash numOwners="1"/>
<stateTransfer fetchInMemoryState="true"/>
</clustering>
<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
transactionMode="TRANSACTIONAL" lockingMode="PESSIMISTIC"/>
<!--
Define the cache loaders (i.e., cache stores). Passivation is false because we want *all*
data to be persisted, not just what doesn't fit into memory. Shared is false because there
are no other caches sharing this file store. We set preload to false for lazy loading;
may be improved by preloading and configuring eviction.
We can have multiple cache loaders, which get chained. But we'll define just one.
-->
<loaders passivation="false" shared="false" preload="false">
<!--
<loaders passivation="false" shared="true" preload="true">

<!--
The 'fetchPersistentState' attribute applies when this cache joins the cluster; the value doesn't
really matter to us in this case. See the documentation for more options.
-->
<loader class="org.infinispan.loaders.file.FileCacheStore"
fetchPersistentState="false"
purgeOnStartup="true">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="FedoraRepository/storage"/>
</properties>
<!-- This repository isn't clustered, so we could set up the SingletonStore.
<loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="false"
purgeOnStartup="true">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="FedoraRepository/storage"/>
</properties>
<!-- This repository isn't clustered, so we could set up the SingletonStore.
singletonStore enabled="true" pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
-->
<!--
<!--
We could use "write-behind", which actually writes to the file system asynchronously,
which can improve performance as seen by the JCR client.
Plus changes are coalesced, meaning that if multiple changes are enqueued for the
same node, only the last one is written. (This is good much of the time, but not
always.)
<async enabled="true" flushLockTimeout="15000" threadPoolSize="5"/>
-->
</loader>
</loaders>
</namedCache>
</infinispan>
</loader>
</loaders>
</namedCache>
</infinispan>
15 changes: 13 additions & 2 deletions src/test/resources/my_repository.json
Expand Up @@ -2,8 +2,8 @@
"name" : "repo",
"jndiName" : "",
"workspaces" : {
"predefined" : [""],
"default" : "default",
"predefined" : ["fedora"],
"default" : "fedora",
"allowCreation" : true
},
"storage" : {
Expand All @@ -24,5 +24,16 @@
{ "classname" : "servlet" }
]
},
"sequencing" : {
"removeDerivedContentWithOriginal" : true,

"sequencers" : {
"FOXML Eater" : {
"description" : "FOXML Files loaded under 'fedora:/foxml' and extracted into 'fedora:/'",
"classname" : "org.fcrepo.ffmodeshapeprototype.foxml.FOXMLSequencer",
"pathExpressions" : ["fedora:/foxml/(.*)/jcr:content[@jcr:data] => fedora:/$1"]
}
}
},
"node-types" : ["fedora-node-types.cnd"]
}

0 comments on commit dbc1e7a

Please sign in to comment.