Skip to content

Commit

Permalink
Merge pull request #149 from futures/pid-identifier
Browse files Browse the repository at this point in the history
rename the REST endpoint fcr:pid to fcr:identifier (fixes #51098049)
  • Loading branch information
Andrew Woods committed Nov 13, 2013
2 parents 1abe16a + d988782 commit 234b9ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Expand Up @@ -60,14 +60,14 @@
import com.hp.hpl.jena.rdf.model.Resource;

/**
* JAX-RS Resource offering PID creation.
* JAX-RS Resource offering identifier creation.
*
* @author ajs6f
* @author cbeer
*/
@Component
@Scope("prototype")
@Path("/{path: .*}/fcr:pid")
@Path("/{path: .*}/fcr:identifier")
public class FedoraIdentifiers extends AbstractResource {

@InjectedSession
Expand All @@ -76,7 +76,7 @@ public class FedoraIdentifiers extends AbstractResource {
/**
* Mint identifiers (without creating the objects)
*
* POST /path/to/mint/from/fcr:pid?numPids=15
* POST /path/to/mint/from/fcr:identifier?numPids=15
*
* @param numPids number of PIDs to return
* @return HTTP 200 with block of PIDs
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
@Component
@Scope("prototype")
@Path("/fcr:pid")
@Path("/fcr:identifier")
public class FedoraRepositoryIdentifiers extends FedoraIdentifiers {

@InjectedSession
Expand Down
Expand Up @@ -88,7 +88,7 @@ public String apply(final Object input) {
setField(testObj, "pidMinter", mockPidMinter);

when(uriInfo.getAbsolutePath()).thenReturn(
new URI("http://localhost/fcrepo/fcr:pid"));
new URI("http://localhost/fcrepo/fcr:identifier"));

final Node mockNode = mock(Node.class);
when(mockNode.getPath()).thenReturn("/asdf:123");
Expand All @@ -98,7 +98,7 @@ public String apply(final Object input) {

LOGGER.debug("Got dataset {}", np.getDefaultModel().toString());
assertTrue(np.getDefaultModel().contains(
createResource("http://localhost/fcrepo/fcr:pid"),
createResource("http://localhost/fcrepo/fcr:identifier"),
HAS_MEMBER_OF_RESULT,
createResource("http://localhost/fcrepo/asdf:123")));

Expand All @@ -118,7 +118,7 @@ public String apply(final Object input) {
setField(testObj, "pidMinter", mockPidMinter);

when(uriInfo.getAbsolutePath()).thenReturn(
new URI("http://localhost/fcrepo/objects/fcr:pid"));
new URI("http://localhost/fcrepo/objects/fcr:identifier"));

when(mockNode.getPath()).thenReturn("/objects/asdf:123");
when(mockSession.getNode("/objects/asdf:123")).thenReturn(mockNode);
Expand All @@ -128,7 +128,7 @@ public String apply(final Object input) {

LOGGER.debug("Got dataset {}", np.getDefaultModel().toString());
assertTrue(np.getDefaultModel().contains(
createResource("http://localhost/fcrepo/objects/fcr:pid"),
createResource("http://localhost/fcrepo/objects/fcr:identifier"),
HAS_MEMBER_OF_RESULT,
createResource("http://localhost/fcrepo/objects/asdf:123")));

Expand Down
Expand Up @@ -36,61 +36,61 @@ public class FedoraIdentifiersIT extends AbstractResourceIT {

@Test
public void testGetNextPidResponds() throws Exception {
final HttpPost method = new HttpPost(serverAddress + "fcr:pid");
final HttpPost method = new HttpPost(serverAddress + "fcr:identifier");
logger.debug("Executed testGetNextPidResponds()");
assertEquals(SC_OK, getStatus(method));
}

@Test
public void testGetNextHasAPid() throws IOException {
final HttpPost method = new HttpPost(serverAddress + "fcr:pid");
final HttpPost method = new HttpPost(serverAddress + "fcr:identifier");
logger.debug("Executed testGetNextHasAPid()");
final GraphStore graphStore = getGraphStore(method);
assertTrue("Didn't find a single dang PID!", graphStore.contains(ANY,
ResourceFactory.createResource(serverAddress + "fcr:pid")
ResourceFactory.createResource(serverAddress + "fcr:identifier")
.asNode(), HAS_MEMBER_OF_RESULT.asNode(), ANY));

}

@Test
public void testGetNextHasTwoPids() throws IOException {
final HttpPost method =
new HttpPost(serverAddress + "fcr:pid?numPids=2");
new HttpPost(serverAddress + "fcr:identifier?numPids=2");
method.setHeader("Accept", "application/n3");
logger.debug("Executed testGetNextHasTwoPids()");
final GraphStore graphStore = getGraphStore(method);
assertEquals("Didn't find two dang PIDs!", 2, size(graphStore.find(ANY,
createResource(serverAddress + "fcr:pid").asNode(),
createResource(serverAddress + "fcr:identifier").asNode(),
HAS_MEMBER_OF_RESULT.asNode(), ANY)));

}

@Test
public void testGetNextPidRespondsWithPath() throws Exception {
final HttpPost method = new HttpPost(serverAddress + "fcr:pid");
final HttpPost method = new HttpPost(serverAddress + "fcr:identifier");
logger.debug("Executed testGetNextPidRespondsWithPath()");
assertEquals(SC_OK, getStatus(method));
}

@Test
public void testGetNextHasAPidWithPath() throws IOException {
final HttpPost method = new HttpPost(serverAddress + "fcr:pid");
final HttpPost method = new HttpPost(serverAddress + "fcr:identifier");
logger.debug("Executed testGetNextHasAPidWithPath()");
final GraphStore graphStore = getGraphStore(method);
assertTrue("Didn't find a single dang PID!", graphStore.contains(ANY,
createResource(serverAddress + "fcr:pid").asNode(),
createResource(serverAddress + "fcr:identifier").asNode(),
HAS_MEMBER_OF_RESULT.asNode(), ANY));

}

@Test
public void testGetNextHasTwoPidsWithPath() throws IOException {
final HttpPost method =
new HttpPost(serverAddress + "fcr:pid?numPids=2");
new HttpPost(serverAddress + "fcr:identifier?numPids=2");
logger.debug("Executed testGetNextHasTwoPidsWithPath()");
final GraphStore graphStore = getGraphStore(method);
assertEquals("Didn't find two dang PIDs!", 2, size(graphStore.find(ANY,
createResource(serverAddress + "fcr:pid").asNode(),
createResource(serverAddress + "fcr:identifier").asNode(),
HAS_MEMBER_OF_RESULT.asNode(), ANY)));

}
Expand Down

0 comments on commit 234b9ef

Please sign in to comment.