Skip to content
Permalink
Browse files

Remove deprecated methods from GraphSubjects

  • Loading branch information...
ajs6f committed Apr 2, 2014
1 parent ecc93b8 commit 7f7a3f5556d1cbbb483d9d9eab681ad5eba5a401
Showing with 31 additions and 77 deletions.
  1. +5 −5 ...nnector-file/src/test/java/org/fcrepo/integration/connector/file/FedoraFileSystemConnectorIT.java
  2. +0 −6 fcrepo-http-api/src/main/java/org/fcrepo/http/api/versioning/VersionAwareHttpGraphSubjects.java
  3. +5 −14 fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpGraphSubjects.java
  4. +1 −19 fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/rdf/GraphSubjects.java
  5. +1 −1 fcrepo-kernel/src/main/java/org/fcrepo/kernel/rdf/JcrRdfTools.java
  6. +3 −15 fcrepo-kernel/src/main/java/org/fcrepo/kernel/rdf/impl/DefaultGraphSubjects.java
  7. +2 −2 fcrepo-kernel/src/test/java/org/fcrepo/integration/kernel/FedoraObjectIT.java
  8. +2 −2 fcrepo-kernel/src/test/java/org/fcrepo/integration/kernel/FedoraResourceImplIT.java
  9. +1 −1 fcrepo-kernel/src/test/java/org/fcrepo/kernel/FedoraResourceImplTest.java
  10. +1 −1 fcrepo-kernel/src/test/java/org/fcrepo/kernel/rdf/impl/DefaultGraphSubjectsTest.java
  11. +1 −1 fcrepo-kernel/src/test/java/org/fcrepo/kernel/rdf/impl/WorkspaceRdfContextTest.java
  12. +1 −1 fcrepo-kernel/src/test/java/org/fcrepo/kernel/utils/JcrRdfToolsTest.java
  13. +2 −2 fcrepo-rss/src/test/java/org/fcrepo/syndication/RssResourcesTest.java
  14. +1 −1 fcrepo-transform/src/test/java/org/fcrepo/integration/JQLConverterIT.java
  15. +1 −1 fcrepo-transform/src/test/java/org/fcrepo/integration/LDPathServiceIT.java
  16. +1 −1 fcrepo-transform/src/test/java/org/fcrepo/integration/SparqlQueryTransformIT.java
  17. +2 −2 fcrepo-transform/src/test/java/org/fcrepo/transform/http/TransformResourcesTest.java
  18. +1 −2 fcrepo-webhooks/src/test/java/org/fcrepo/webhooks/WebhooksResourcesTest.java
@@ -164,7 +164,7 @@ public void testWriteProperty() throws RepositoryException {
"'some-test-name' }";

// Write the properties
object.updatePropertiesDataset(new DefaultGraphSubjects(session),
object.updatePropertiesDataset(new DefaultGraphSubjects(),
sparql);

// Verify
@@ -178,7 +178,7 @@ public void testWriteProperty() throws RepositoryException {

@Test
public void testRemoveProperty() throws RepositoryException {
Session session = repo.login();
final Session session = repo.login();

final FedoraResource object = nodeService.getObject(session, testFile);
assertNotNull(object);
@@ -190,7 +190,7 @@ public void testRemoveProperty() throws RepositoryException {
"'some-property-to-remove' }";

// Write the properties
final GraphSubjects graphSubjects = new DefaultGraphSubjects(session);
final GraphSubjects graphSubjects = new DefaultGraphSubjects();
object.updatePropertiesDataset(graphSubjects, sparql);

// Verify property exists
@@ -206,7 +206,7 @@ public void testRemoveProperty() throws RepositoryException {
"}";

// Remove the properties
final GraphSubjects graphSubjectsRemove = new DefaultGraphSubjects(session);
final GraphSubjects graphSubjectsRemove = new DefaultGraphSubjects();
object.updatePropertiesDataset(graphSubjectsRemove, sparqlRemove);

// Persist the object (although the propery will be removed from memory without this.)
@@ -216,7 +216,7 @@ public void testRemoveProperty() throws RepositoryException {
boolean thrown = false;
try{
object.getNode().getProperty("fedora:remove");
} catch (PathNotFoundException e){
} catch (final PathNotFoundException e){
thrown = true;
}
assertTrue("Exception expected - property should be missing", thrown);
@@ -109,12 +109,6 @@ public Resource getGraphSubject(final String absPath) throws RepositoryException
return super.getGraphSubject(absPath);
}

@Override
@Deprecated
public Resource getGraphSubject(final Node node) throws RepositoryException {
throw new UnsupportedOperationException("Deprecated method!");
}

/**
* For frozen nodes (which represent version snapshots) we translate the
* paths from their frozen storage URI to
@@ -18,14 +18,17 @@

import com.google.common.base.Function;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.commons.lang.StringUtils;

import org.fcrepo.kernel.exception.RepositoryRuntimeException;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.services.functions.GetDefaultWorkspace;
import org.slf4j.Logger;

import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static java.util.Collections.singletonMap;
import static javax.jcr.PropertyType.PATH;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.apache.commons.lang.StringUtils.replaceOnce;
import static org.fcrepo.jcr.FedoraJcrTypes.FCR_CONTENT;
import static org.fcrepo.kernel.services.TransactionServiceImpl.getCurrentTransactionId;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
@@ -111,18 +114,6 @@ public Resource getContext() {
return createResource(context.toString());
}

@Override
@Deprecated
public Resource getGraphSubject(final Node node) throws RepositoryException {
throw new UnsupportedOperationException("Deprecated method!");
}

@Override
@Deprecated
public Node getNodeFromGraphSubject(final Resource subject) throws RepositoryException {
throw new UnsupportedOperationException("Deprecated method!");
}

private static String getResourceURI(final Resource subject) {
if (!subject.isURIResource()) {
LOGGER.debug("RDF resource {} was not a URI resource: returning null.",
@@ -208,7 +199,7 @@ private boolean isValidJcrPath(final String absPath) {
if (txId != null) {
final String txIdWithSlash = "/" + TX_PREFIX + txId;
/* replace the first occurrence of tx within the path */
pathToValidate = StringUtils.replaceOnce(absPath, txIdWithSlash, StringUtils.EMPTY);
pathToValidate = replaceOnce(absPath, txIdWithSlash, EMPTY);
LOGGER.debug("removed {} from URI {}. Path for JCR validation is now: {}",
txIdWithSlash, absPath, pathToValidate);
}
@@ -15,7 +15,6 @@
*/
package org.fcrepo.kernel.rdf;

import javax.jcr.Node;
import javax.jcr.RepositoryException;

import com.hp.hpl.jena.rdf.model.Resource;
@@ -24,27 +23,10 @@
* Translate internal JCR node identifiers to external Fedora identifiers
* (and vice versa)
* @author barmintor
* @author ajs6f
* @date May 15, 2013
*/
public interface GraphSubjects {
/**
* Translate a JCR node into an RDF Resource
* @param node
* @return an RDF URI resource
* @throws RepositoryException
*/
@Deprecated
Resource getGraphSubject(final Node node) throws RepositoryException;

/**
* Translate an RDF resource into a JCR node
* @param subject an RDF URI resource
* @return a JCR node, or null if one couldn't be found
* @throws RepositoryException
*/
@Deprecated
Node getNodeFromGraphSubject(final Resource subject)
throws RepositoryException;

/**
* Translate an RDF resource into a JCR path
@@ -159,7 +159,7 @@ public static JcrRdfTools withContext(final GraphSubjects graphSubjects) {
public static JcrRdfTools withContext(final GraphSubjects graphSubjects,
final Session session) {
if (graphSubjects == null) {
return new JcrRdfTools(new DefaultGraphSubjects(session), session);
return new JcrRdfTools(new DefaultGraphSubjects(), session);
}
return new JcrRdfTools(graphSubjects, session);
}
@@ -20,11 +20,11 @@
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static org.fcrepo.jcr.FedoraJcrTypes.FCR_CONTENT;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
import javax.jcr.Node;

import javax.jcr.RepositoryException;
import javax.jcr.Session;

import org.fcrepo.kernel.rdf.GraphSubjects;

import com.hp.hpl.jena.rdf.model.Resource;

/**
@@ -46,7 +46,7 @@
/**
* Construct the graph with a placeholder context resource
*/
public DefaultGraphSubjects(final Session session) {
public DefaultGraphSubjects() {
this.context = createResource();
}

@@ -63,18 +63,6 @@ public Resource getContext() {
return context;
}

@Override
@Deprecated
public Resource getGraphSubject(final Node node) {
throw new UnsupportedOperationException("Deprecated method!");
}

@Override
@Deprecated
public Node getNodeFromGraphSubject(final Resource subject) {
throw new UnsupportedOperationException("Deprecated method!");
}

@Override
public String getPathFromGraphSubject(final Resource subject) throws RepositoryException {
if (!isFedoraGraphSubject(subject)) {
@@ -81,7 +81,7 @@ public void testObjectGraph() throws Exception {
final Session session = repo.login();
final FedoraObject object =
objectService.createObject(session, "/graphObject");
final GraphSubjects subjects = new DefaultGraphSubjects(session);
final GraphSubjects subjects = new DefaultGraphSubjects();
final Dataset graphStore = object.getPropertiesDataset(subjects);

final String graphSubject = subjects.getGraphSubject("/graphObject").getURI();
@@ -161,7 +161,7 @@ public void testObjectGraphWithUriProperty() throws RepositoryException {
final Session session = repo.login();
final FedoraObject object =
objectService.createObject(session, "/graphObject");
final GraphSubjects subjects = new DefaultGraphSubjects(session);
final GraphSubjects subjects = new DefaultGraphSubjects();
final String graphSubject = subjects.getGraphSubject("/graphObject").getURI();
final Dataset graphStore = object.getPropertiesDataset(subjects);

@@ -98,7 +98,7 @@
@Before
public void setUp() throws RepositoryException {
session = repo.login();
subjects = new DefaultGraphSubjects(session);
subjects = new DefaultGraphSubjects();
}

@After
@@ -124,7 +124,7 @@ public void testRandomNodeGraph() throws RepositoryException {
nodeService.findOrCreateObject(session, "/testNodeGraph");

logger.warn(object.getPropertiesDataset(
new DefaultGraphSubjects(session)).toString());
new DefaultGraphSubjects()).toString());
final Node s = createGraphSubjectNode("/testNodeGraph");
final Node p = createURI(REPOSITORY_NAMESPACE + "primaryType");
final Node o = createLiteral("nt:unstructured");
@@ -356,7 +356,7 @@ public void testIsNotNew() {
public void testReplacePropertiesDataset() throws Exception {

mockStatic(JcrRdfTools.class);
final DefaultGraphSubjects defaultGraphSubjects = new DefaultGraphSubjects(mockSession);
final DefaultGraphSubjects defaultGraphSubjects = new DefaultGraphSubjects();
when(JcrRdfTools.withContext(defaultGraphSubjects, mockSession)).thenReturn(mockJcrRdfTools);

when(mockNode.getPath()).thenReturn("/xyz");
@@ -52,7 +52,7 @@
@Before
public void setUp() {
initMocks(this);
testObj = new DefaultGraphSubjects(mockSession);
testObj = new DefaultGraphSubjects();
}

@Test
@@ -50,7 +50,7 @@
@Before
public void setUp() {
initMocks(this);
subjects = new DefaultGraphSubjects(session);
subjects = new DefaultGraphSubjects();
when(session.getRepository()).thenReturn(repository);
when(session.getWorkspace()).thenReturn(mockWorkspace);
}
@@ -143,7 +143,7 @@
@Before
public final void setUp() throws RepositoryException {
initMocks(this);
testSubjects = new DefaultGraphSubjects(mockSession);
testSubjects = new DefaultGraphSubjects();
testObj = new JcrRdfTools(testSubjects, mockSession);
buildMockNodeAndSurroundings();
}
@@ -17,6 +17,7 @@

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;

import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.impl.DefaultGraphSubjects;
@@ -27,7 +28,6 @@

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.ws.rs.core.UriInfo;

@@ -50,7 +50,7 @@ public void setUp() {
mockResource = new FedoraResourceImpl(mockNode);

uriInfo = TestHelpers.getUriInfoImpl();
mockSubjects = new DefaultGraphSubjects(mock(Session.class));
mockSubjects = new DefaultGraphSubjects();
}

@Test
@@ -48,7 +48,7 @@
@Before
public void setUp() throws Exception {
session = repo.login();
subjects = new DefaultGraphSubjects(session);
subjects = new DefaultGraphSubjects();
}

@Test
@@ -75,7 +75,7 @@ public void shouldDoStuff() throws RepositoryException {

testObj = new LDPathTransform(stringReader);

final DefaultGraphSubjects subjects = new DefaultGraphSubjects(session);
final DefaultGraphSubjects subjects = new DefaultGraphSubjects();
final Map<String, Collection<Object>> stuff = testObj.apply(object.getPropertiesDataset(subjects));

assertNotNull("Failed to retrieve results!", stuff);
@@ -68,7 +68,7 @@ public void shouldDoStuff() throws RepositoryException {

testObj = new SparqlQueryTransform(stringReader);

final QueryExecution qexec = testObj.apply(object.getPropertiesDataset(new DefaultGraphSubjects(session)));
final QueryExecution qexec = testObj.apply(object.getPropertiesDataset(new DefaultGraphSubjects()));

assert(qexec != null);

@@ -17,6 +17,7 @@

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;

import org.fcrepo.http.commons.test.util.TestHelpers;
import org.fcrepo.jcr.FedoraJcrTypes;
import org.fcrepo.kernel.FedoraResourceImpl;
@@ -27,7 +28,6 @@

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.ws.rs.core.UriInfo;

@@ -58,7 +58,7 @@ public void setUp() {
mockResource = new FedoraResourceImpl(mockNode);

uriInfo = TestHelpers.getUriInfoImpl();
mockSubjects = new DefaultGraphSubjects(mock(Session.class));
mockSubjects = new DefaultGraphSubjects();
}

@Test
@@ -24,7 +24,6 @@

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.ws.rs.core.UriInfo;

@@ -57,7 +56,7 @@ public void setUp() {
mockResource = new FedoraResourceImpl(mockNode);

uriInfo = TestHelpers.getUriInfoImpl();
mockSubjects = new DefaultGraphSubjects(mock(Session.class));
mockSubjects = new DefaultGraphSubjects();
}

@Test

0 comments on commit 7f7a3f5

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