Skip to content
Permalink
Browse files

Enabling read-write operations on federated filesystem, depends on fi…

  • Loading branch information...
escowles committed Jul 8, 2014
1 parent 2e1e058 commit 2de88d6b635242dfb515275ccb43b9fcecd9248d
@@ -80,10 +80,6 @@ public void initialize(final NamespaceRegistry registry,
final NodeTypeManager nodeTypeManager) throws RepositoryException, IOException {
super.initialize(registry, nodeTypeManager);

if (!isReadonly()) {
throw new RepositoryException("The " + getClass().getName() + " must have \"readonly\" set to true!");
}

if (propertiesDirectoryPath != null) {
propertiesDirectory = new File(propertiesDirectoryPath);
if (!propertiesDirectory.exists() || !propertiesDirectory.isDirectory()) {
@@ -34,7 +34,6 @@
import org.slf4j.Logger;

import javax.jcr.NamespaceRegistry;
import javax.jcr.RepositoryException;

import java.io.File;
import java.io.FileOutputStream;
@@ -138,17 +137,6 @@ public void setUp() throws Exception {
mockContext.getNamespaceRegistry().register("premis", "http://www.loc.gov/premis/rdf/v1#");
}

@Test(expected = RepositoryException.class)
public void testThatReadOnlyIsRequired() throws IOException, RepositoryException {
final FedoraFileSystemConnector c = new FedoraFileSystemConnector();
setField(c, "directoryPath", directoryPath.toString());
setField(c, "translator", mockTranslator);
setField(c, "context", mockContext);
setField(c, "extraPropertiesStore", mockExtraPropertiesStore);
setField(mockTranslator, "names", mockNameFactory);
c.initialize(mockRegistry, mockNodeTypeManager);
}

@Test
public void testGetDocumentByIdNull() throws Exception {
final Document doc = connector.getDocumentById(null);
@@ -15,12 +15,14 @@
*/
package org.fcrepo.integration.connector.file;

import org.fcrepo.kernel.FedoraObject;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.impl.rdf.impl.DefaultIdentifierTranslator;
import org.junit.Ignore;
import org.junit.Test;

import java.util.UUID;

import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
@@ -32,20 +34,7 @@

/**
* @author Mike Durbin
*
* This class is ignored until non-'readonly' federations are supported. At that time,
* include the following in the repository.json and remove the 'ignore' annotation.
*
* "federated-directory" : {
* "classname" : "org.fcrepo.connector.file.FedoraFileSystemConnector",
* "directoryPath" : "${fcrepo.test.dir1:must-be-provided}",
* "projections" : [ "default:/federated => /" ],
* "contentBasedSha1" : "false",
* "readonly" : false,
* "extraPropertiesStorage" : "json"
* },
*/
@Ignore
public class BasicReadWriteFedoraFileSystemConnectorIT extends AbstractFedoraFileSystemConnectorIT {

@Override
@@ -136,4 +125,17 @@ public void testRemoveProperty() throws RepositoryException {

session.logout();
}

@Test
public void testCreateObject() throws RepositoryException {
final String id = UUID.randomUUID().toString();
Session session = repo.login();
objectService.createObject(session, "/" + federationName() + "/" + id);
session.save();
session.logout();

session = repo.login();
final FedoraObject obj = objectService.getObject(session, "/" + federationName() + "/" + id);
assertNotNull("Couldn't find object!", obj);
}
}
@@ -7,6 +7,14 @@
"allowCreation" : true
},
"externalSources" : {
"federated-directory" : {
"classname" : "org.fcrepo.connector.file.FedoraFileSystemConnector",
"directoryPath" : "${fcrepo.test.dir1:must-be-provided}",
"projections" : [ "default:/federated => /" ],
"contentBasedSha1" : "false",
"readonly" : false,
"extraPropertiesStorage" : "json"
},
"federated-directory-read-only" : {
"classname" : "org.fcrepo.connector.file.FedoraFileSystemConnector",
"directoryPath" : "${fcrepo.test.dir2:must-be-provided}",
@@ -30,4 +38,4 @@
}
},
"node-types" : ["fedora-node-types.cnd"]
}
}
@@ -33,7 +33,7 @@
<jersey.version>1.17.1</jersey.version>
<jgroups.version>3.4.0.Final</jgroups.version>
<logback.version>1.0.13</logback.version>
<modeshape.version>3.8.0.Final</modeshape.version>
<modeshape.version>3.8-SNAPSHOT</modeshape.version>
<metrics.version>3.0.2</metrics.version>
<sesame.version>2.7.7</sesame.version>
<slf4j.version>1.7.7</slf4j.version>

0 comments on commit 2de88d6

Please sign in to comment.
You can’t perform that action at this time.