Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tightening PathService and its tests
  • Loading branch information
ajs6f committed Feb 28, 2013
1 parent 583d21a commit 8bb67b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -5,13 +5,15 @@
import org.slf4j.LoggerFactory;

/**
* Conveience class for constructing Fedora-related paths in the JCR repository.
* Convenience class for constructing Fedora-related paths in the JCR repository.
*
* @author cbeer
*
*/
public class PathService {

public final static String objectPath = "/objects";

private static final Logger logger = LoggerFactory
.getLogger(DatastreamService.class);

Expand All @@ -21,7 +23,7 @@ public class PathService {
*/
public static String getObjectJcrNodePath(String pid) {
logger.trace("Executing getObjectJcrNodePath() with pid: " + pid);
return "/objects/" + pid;
return objectPath + "/" + pid;
}

/**
Expand Down
@@ -1,21 +1,25 @@

package org.fcrepo.services;

import org.junit.Test;

import static org.fcrepo.services.PathService.getDatastreamJcrNodePath;
import static org.fcrepo.services.PathService.getObjectJcrNodePath;
import static org.fcrepo.services.PathService.objectPath;
import static org.junit.Assert.assertEquals;

public class PathServiceTest {

@Test
public void testGetObjectJcrNodePath() throws Exception {
new PathService();
assertEquals("/objects/test:123", getObjectJcrNodePath("test:123"));
assertEquals(objectPath + "/test:123", getObjectJcrNodePath("test:123"));
}

@Test
public void testGetDatastreamJcrNodePath() throws Exception {
new PathService();
assertEquals("/objects/test:123/asdf", getDatastreamJcrNodePath("test:123", "asdf"));
assertEquals(objectPath + "/test:123/asdf", getDatastreamJcrNodePath(
"test:123", "asdf"));
}
}

0 comments on commit 8bb67b7

Please sign in to comment.