Skip to content
Permalink
Browse files

Merge pull request #606 from fcrepo4/80959252

  • Loading branch information...
awoods committed Oct 30, 2014
2 parents d7d94ea + 2e3e927 commit d62c1fc30ba3e3c2def2ea8cbe32267a6f094269
Showing with 332 additions and 267 deletions.
  1. +3 −0 .gitignore
  2. +2 −2 fcrepo-auth-common/src/test/java/org/fcrepo/auth/integration/ModeShapeHonorsFADResponseIT.java
  3. +5 −5 ...file/src/test/java/org/fcrepo/integration/connector/file/AbstractFedoraFileSystemConnectorIT.java
  4. +2 −2 ...rc/test/java/org/fcrepo/integration/connector/file/BasicReadWriteFedoraFileSystemConnectorIT.java
  5. +1 −1 .../org/fcrepo/integration/connector/file/ReadOnlyExternalPropertiesFedoraFileSystemConnectorIT.java
  6. +3 −4 fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraLdp.java
  7. +8 −0 fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryBackup.java
  8. +7 −0 fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryRestore.java
  9. +9 −9 fcrepo-http-api/src/test/java/org/fcrepo/http/api/FedoraLdpTest.java
  10. +4 −4 fcrepo-http-api/src/test/java/org/fcrepo/http/api/FedoraNodesTest.java
  11. +1 −1 fcrepo-http-api/src/test/java/org/fcrepo/http/api/FedoraVersioningTest.java
  12. +0 −2 fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/FedoraLdpIT.java
  13. +1 −7 fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/AbstractResource.java
  14. +2 −42 fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/RDFMediaType.java
  15. +1 −1 fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/RdfStreamProvider.java
  16. +3 −1 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/identifiers/UUIDPidMinter.java
  17. +23 −2 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/AbstractService.java
  18. +22 −4 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/BinaryServiceImpl.java
  19. +19 −1 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/NodeServiceImpl.java
  20. +28 −1 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/ObjectServiceImpl.java
  21. +0 −18 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/ServiceHelpers.java
  22. +40 −0 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/functions/GetClusterExecutor.java
  23. +3 −2 fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/utils/impl/InfinispanCacheStoreEntry.java
  24. +26 −26 fcrepo-kernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/FedoraBinaryImplIT.java
  25. +6 −6 fcrepo-kernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/FedoraObjectImplIT.java
  26. +47 −47 fcrepo-kernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/FedoraResourceImplIT.java
  27. +5 −5 ...po-kernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/services/BinaryServiceImplIT.java
  28. +3 −3 ...ernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/services/RepositoryServiceImplIT.java
  29. +3 −3 ...rnel-impl/src/test/java/org/fcrepo/integration/kernel/impl/services/TransactionServiceImplIT.java
  30. +5 −5 ...o-kernel-impl/src/test/java/org/fcrepo/integration/kernel/impl/services/VersionServiceImplIT.java
  31. +3 −3 fcrepo-kernel-impl/src/test/java/org/fcrepo/kernel/impl/services/BinaryServiceImplTest.java
  32. +5 −5 fcrepo-kernel-impl/src/test/java/org/fcrepo/kernel/impl/services/ObjectServiceImplTest.java
  33. +1 −19 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/BinaryService.java
  34. +1 −19 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/NodeService.java
  35. +1 −10 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/ObjectService.java
  36. +1 −1 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/RepositoryService.java
  37. +34 −2 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/Service.java
  38. +1 −1 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/TransactionService.java
  39. +1 −1 fcrepo-kernel/src/main/java/org/fcrepo/kernel/services/VersionService.java
  40. +1 −1 fcrepo-transform/src/test/java/org/fcrepo/integration/LDPathServiceIT.java
  41. +1 −1 fcrepo-transform/src/test/java/org/fcrepo/integration/SparqlQueryTransformIT.java
@@ -13,4 +13,7 @@ ObjectStore/
*~
fcrepo4-data/
*.iml
.checkstyle
fcrepo-integration-ldp/report-*
fcrepo-integration-ldp/report
fcrepo-integration-ldp/test-output
@@ -102,7 +102,7 @@ public void testPermissiveFAD() throws RepositoryException {
logger.debug("got priv: " + p.getName());
}
final ObjectService os = new ObjectServiceImpl();
os.findOrCreateObject(session, "/myobject");
os.findOrCreate(session, "/myobject");
verify(fad, times(4)).hasPermission(any(Session.class), any(Path.class), any(String[].class));
}

@@ -124,7 +124,7 @@ public void testRestrictiveFAD() throws Throwable {
final Session session = repo.login(credentials);
final ObjectService os = new ObjectServiceImpl();
try {
os.findOrCreateObject(session, "/myobject");
os.findOrCreate(session, "/myobject");
} catch (final RepositoryRuntimeException e) {
throw e.getCause();
}
@@ -195,7 +195,7 @@ protected static void cleanUpJsonFilesFiles(final File directory) {
public void testGetFederatedObject() throws RepositoryException {
final Session session = repo.login();

final FedoraObject object = objectService.findOrCreateObject(session, testDirPath());
final FedoraObject object = objectService.findOrCreate(session, testDirPath());
assertNotNull(object);

final Node node = object.getNode();
@@ -213,7 +213,7 @@ public void testGetFederatedObject() throws RepositoryException {
public void testGetFederatedDatastream() throws RepositoryException {
final Session session = repo.login();

final Datastream datastream = binaryService.findOrCreateBinary(session, testFilePath()).getDescription();
final Datastream datastream = binaryService.findOrCreate(session, testFilePath()).getDescription();
assertNotNull(datastream);

final Node node = datastream.getNode();
@@ -231,7 +231,7 @@ public void testGetFederatedDatastream() throws RepositoryException {
public void testGetFederatedContent() throws RepositoryException {
final Session session = repo.login();

final Node node = nodeService.getObject(session, testFilePath() + "/jcr:content").getNode();
final Node node = nodeService.find(session, testFilePath() + "/jcr:content").getNode();
assertNotNull(node);

final NodeType[] mixins = node.getMixinNodeTypes();
@@ -253,7 +253,7 @@ public void testGetFederatedContent() throws RepositoryException {
public void testFixity() throws RepositoryException, IOException, NoSuchAlgorithmException {
final Session session = repo.login();

checkFixity(binaryService.findOrCreateBinary(session, testFilePath()));
checkFixity(binaryService.findOrCreate(session, testFilePath()));

session.save();
session.logout();
@@ -263,7 +263,7 @@ public void testFixity() throws RepositoryException, IOException, NoSuchAlgorith
public void testChangedFileFixity() throws RepositoryException, IOException, NoSuchAlgorithmException {
final Session session = repo.login();

final FedoraBinary binary = binaryService.findOrCreateBinary(session, testFilePath());
final FedoraBinary binary = binaryService.findOrCreate(session, testFilePath());

final String originalFixity = checkFixity(binary);

@@ -59,7 +59,7 @@ protected String getFederationRoot() {
public void testWriteProperty() throws RepositoryException {
final Session session = repo.login();

final FedoraResource object = nodeService.getObject(session, testFilePath());
final FedoraResource object = nodeService.find(session, testFilePath());
assertNotNull(object);

final String sparql = "PREFIX fedora: <http://fedora.info/definitions/v4/rest-api#> " +
@@ -85,7 +85,7 @@ public void testWriteProperty() throws RepositoryException {
public void testRemoveProperty() throws RepositoryException {
final Session session = repo.login();

final FedoraResource object = nodeService.getObject(session, testFilePath());
final FedoraResource object = nodeService.find(session, testFilePath());
assertNotNull(object);

final String sparql = "PREFIX fedora: <http://fedora.info/definitions/v4/rest-api#> " +
@@ -54,7 +54,7 @@ protected String testFilePath() {
@Test
public void verifyThatPropertiesAreExternal() throws RepositoryException {
final Session session = repo.login();
final FedoraResource object = nodeService.getObject(session, testFilePath());
final FedoraResource object = nodeService.find(session, testFilePath());
assertEquals("There should be exactly as many visible nodes as actual files (ie, no hidden sidecar files).",
fileForNode(null).getParentFile().list().length,
getChildCount(object.getNode().getParent()));
@@ -79,7 +79,6 @@
import static org.apache.jena.riot.WebContent.contentTypeSPARQLUpdate;
import static org.fcrepo.http.commons.domain.RDFMediaType.JSON_LD;
import static org.fcrepo.http.commons.domain.RDFMediaType.N3;
import static org.fcrepo.http.commons.domain.RDFMediaType.N3_ALT1;
import static org.fcrepo.http.commons.domain.RDFMediaType.N3_ALT2;
import static org.fcrepo.http.commons.domain.RDFMediaType.NTRIPLES;
import static org.fcrepo.http.commons.domain.RDFMediaType.RDF_XML;
@@ -479,7 +478,7 @@ private void addOptionsHttpHeaders() {
options = "MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS";
servletResponse.addHeader("Accept-Patch", contentTypeSPARQLUpdate);

final String rdfTypes = TURTLE + "," + N3 + "," + N3_ALT1 + ","
final String rdfTypes = TURTLE + "," + N3 + ","
+ N3_ALT2 + "," + RDF_XML + "," + NTRIPLES;
servletResponse.addHeader("Accept-Post", rdfTypes + "," + MediaType.MULTIPART_FORM_DATA
+ "," + contentTypeSPARQLUpdate);
@@ -546,10 +545,10 @@ private FedoraResource createFedoraResource(final String requestMixin,

switch (objectType) {
case FEDORA_OBJECT:
result = objectService.findOrCreateObject(session, path);
result = objectService.findOrCreate(session, path);
break;
case FEDORA_DATASTREAM:
result = binaryService.findOrCreateBinary(session, path);
result = binaryService.findOrCreate(session, path);
break;
default:
throw new ClientErrorException("Unknown object type " + objectType, BAD_REQUEST);
@@ -28,8 +28,10 @@
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.WebApplicationException;

import org.apache.commons.io.IOUtils;
import org.fcrepo.http.commons.AbstractResource;
import org.fcrepo.kernel.services.RepositoryService;
import org.modeshape.jcr.api.Problem;
import org.modeshape.jcr.api.Problems;
import org.slf4j.Logger;
@@ -49,6 +51,12 @@
@Inject
protected Session session;

/**
* The fcrepo repository service
*/
@Inject
protected RepositoryService repositoryService;

/**
* This method runs a repository backup.
*
@@ -34,6 +34,7 @@

import org.apache.commons.io.IOUtils;
import org.fcrepo.http.commons.AbstractResource;
import org.fcrepo.kernel.services.RepositoryService;
import org.modeshape.jcr.api.Problem;
import org.modeshape.jcr.api.Problems;
import org.slf4j.Logger;
@@ -53,6 +54,12 @@
@Inject
protected Session session;

/**
* The fcrepo repository service
*/
@Inject
protected RepositoryService repositoryService;

/**
* This method runs a repository restore.
*
@@ -596,7 +596,7 @@ public void testPutNewObject() throws Exception {
when(mockObject.isNew()).thenReturn(true);

when(mockNodeService.exists(mockSession, "/some/path")).thenReturn(false);
when(mockObjectService.findOrCreateObject(mockSession, "/some/path")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/some/path")).thenReturn(mockObject);

final Response actual = testObj.createOrReplaceObjectRdf(null, null, null, null, null);

@@ -610,7 +610,7 @@ public void testPutNewObjectWithRdf() throws Exception {
when(mockObject.isNew()).thenReturn(true);

when(mockNodeService.exists(mockSession, "/some/path")).thenReturn(false);
when(mockObjectService.findOrCreateObject(mockSession, "/some/path")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/some/path")).thenReturn(mockObject);

final Response actual = testObj.createOrReplaceObjectRdf(NTRIPLES_TYPE,
toInputStream("_:a <info:x> _:c ."), null, null, null);
@@ -625,7 +625,7 @@ public void testPutNewBinary() throws Exception {
when(mockBinary.isNew()).thenReturn(true);

when(mockNodeService.exists(mockSession, "/some/path")).thenReturn(false);
when(mockBinaryService.findOrCreateBinary(mockSession, "/some/path")).thenReturn(mockBinary);
when(mockBinaryService.findOrCreate(mockSession, "/some/path")).thenReturn(mockBinary);

final Response actual = testObj.createOrReplaceObjectRdf(TEXT_PLAIN_TYPE,
toInputStream("xyz"), null, null, null);
@@ -642,7 +642,7 @@ public void testPutReplaceRdfObject() throws Exception {
when(mockObject.isNew()).thenReturn(false);

when(mockNodeService.exists(mockSession, "/some/path")).thenReturn(true);
when(mockObjectService.findOrCreateObject(mockSession, "/some/path")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/some/path")).thenReturn(mockObject);

final Response actual = testObj.createOrReplaceObjectRdf(NTRIPLES_TYPE,
toInputStream("_:a <info:x> _:c ."), null, null, null);
@@ -660,7 +660,7 @@ public void testPutWithStrictIfMatchHandling() throws Exception {
when(mockObject.isNew()).thenReturn(false);

when(mockNodeService.exists(mockSession, "/some/path")).thenReturn(true);
when(mockObjectService.findOrCreateObject(mockSession, "/some/path")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/some/path")).thenReturn(mockObject);

testObj.createOrReplaceObjectRdf(NTRIPLES_TYPE,
toInputStream("_:a <info:x> _:c ."), null, null, null);
@@ -713,7 +713,7 @@ public void testCreateNewObject() throws Exception {

setResource(FedoraObject.class);

when(mockObjectService.findOrCreateObject(mockSession, "/b")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/b")).thenReturn(mockObject);

final Response actual = testObj.createObject(null, null, null, null, "b", null);

@@ -725,7 +725,7 @@ public void testCreateNewObjectWithSparql() throws Exception {

setResource(FedoraObject.class);

when(mockObjectService.findOrCreateObject(mockSession, "/b")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/b")).thenReturn(mockObject);

final Response actual = testObj.createObject(null, null, null,
MediaType.valueOf(contentTypeSPARQLUpdate), "b", toInputStream("x"));
@@ -739,7 +739,7 @@ public void testCreateNewObjectWithRdf() throws Exception {

setResource(FedoraObject.class);

when(mockObjectService.findOrCreateObject(mockSession, "/b")).thenReturn(mockObject);
when(mockObjectService.findOrCreate(mockSession, "/b")).thenReturn(mockObject);

final Response actual = testObj.createObject(null, null, null, NTRIPLES_TYPE, "b",
toInputStream("_:a <info:b> _:c ."));
@@ -754,7 +754,7 @@ public void testCreateNewBinary() throws Exception {

setResource(FedoraObject.class);

when(mockBinaryService.findOrCreateBinary(mockSession, "/b")).thenReturn(mockBinary);
when(mockBinaryService.findOrCreate(mockSession, "/b")).thenReturn(mockBinary);

try (final InputStream content = toInputStream("x")) {
final Response actual = testObj.createObject(null, null, null, APPLICATION_OCTET_STREAM_TYPE, "b",
@@ -205,7 +205,7 @@ public void testCopyObjectToExistingDestination() throws RepositoryException, UR
@Test
public void testMoveObject() throws RepositoryException, URISyntaxException {
final ValueFactory mockVF = mock(ValueFactory.class);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
when(mockNodes.find(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
when(mockObject.getEtagValue()).thenReturn("");
when(mockObject.getPath()).thenReturn(path);
@@ -222,7 +222,7 @@ public void testMoveMissingObject() throws RepositoryException, URISyntaxExcepti
final ValueFactory mockVF = mock(ValueFactory.class);
when(mockSession.getValueFactory()).thenReturn(mockVF);
when(mockNodes.exists(mockSession, path)).thenReturn(false);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
when(mockNodes.find(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
when(mockObject.getEtagValue()).thenReturn("");

@@ -234,7 +234,7 @@ public void testMoveObjectToExistingDestination() throws RepositoryException, UR
final ValueFactory mockVF = mock(ValueFactory.class);
when(mockSession.getValueFactory()).thenReturn(mockVF);
when(mockNodes.exists(mockSession, path)).thenReturn(true);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
when(mockNodes.find(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
when(mockObject.getEtagValue()).thenReturn("");
doThrow(new RepositoryRuntimeException(new ItemExistsException()))
@@ -249,7 +249,7 @@ public void testMoveObjectToExistingDestination() throws RepositoryException, UR
public void testMoveObjectWithBadDestination() throws RepositoryException, URISyntaxException {
final ValueFactory mockVF = mock(ValueFactory.class);
when(mockSession.getValueFactory()).thenReturn(mockVF);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
when(mockNodes.find(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
when(mockNodes.exists(mockSession, path)).thenReturn(true);
when(mockObject.getEtagValue()).thenReturn("");
@@ -112,7 +112,7 @@ public void setUp() throws Exception {
public void testGetVersionList() {
when(mockRequest.selectVariant(POSSIBLE_RDF_VARIANTS)).thenReturn(
mockVariant);
when(mockNodes.getObject(any(Session.class), anyString())).thenReturn(
when(mockNodes.find(any(Session.class), anyString())).thenReturn(
mockResource);
when(mockResource.getTriples(any(IdentifierConverter.class), eq(VersionsRdfContext.class)))
.thenReturn(mockRdfStream);
@@ -41,7 +41,6 @@
import static org.apache.http.impl.client.cache.CacheConfig.DEFAULT;
import static org.apache.jena.riot.RDFLanguages.contentTypeToLang;
import static org.apache.jena.riot.WebContent.contentTypeN3;
import static org.apache.jena.riot.WebContent.contentTypeN3Alt1;
import static org.apache.jena.riot.WebContent.contentTypeN3Alt2;
import static org.apache.jena.riot.WebContent.contentTypeNTriples;
import static org.apache.jena.riot.WebContent.contentTypeRDFXML;
@@ -340,7 +339,6 @@ private static void assertContainerOptionsHeaders(final HttpResponse httpRespons
assertTrue("POST should support application/sparql-update", postTypes.contains(contentTypeSPARQLUpdate));
assertTrue("POST should support text/turtle", postTypes.contains(contentTypeTurtle));
assertTrue("POST should support text/rdf+n3", postTypes.contains(contentTypeN3));
assertTrue("POST should support application/n3", postTypes.contains(contentTypeN3Alt1));
assertTrue("POST should support text/n3", postTypes.contains(contentTypeN3Alt2));
assertTrue("POST should support application/rdf+xml", postTypes.contains(contentTypeRDFXML));
assertTrue("POST should support application/n-triples", postTypes.contains(contentTypeNTriples));
@@ -28,7 +28,7 @@
import org.fcrepo.kernel.services.BinaryService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ObjectService;
import org.fcrepo.kernel.services.RepositoryService;
//import org.fcrepo.kernel.services.RepositoryService;
import org.fcrepo.kernel.services.VersionService;
import org.jvnet.hk2.annotations.Optional;
import org.slf4j.bridge.SLF4JBridgeHandler;
@@ -84,12 +84,6 @@
@Autowired
protected VersionService versionService;

/**
* The fcrepo repository service
*/
@Autowired
protected RepositoryService repositoryService;

@Inject
@Optional
protected EventBus eventBus;
Oops, something went wrong.

0 comments on commit d62c1fc

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