@Test
  public void itShouldRetrieveNodeTypes() throws RepositoryException {
    when(mockNodes.getNodeTypes(mockSession)).thenReturn(mockRdfStream);

    final RdfStream nodeTypes = testObj.getNodeTypes(mockUriInfo);

    assertEquals("Got wrong triples!", mockRdfStream, nodeTypes);
  }
Example #2
0
 @Test
 public void testRemoveVersion() throws RepositoryException {
   final String pid = UUID.randomUUID().toString();
   final String versionLabel = UUID.randomUUID().toString();
   when(mockNodes.getObject(any(Session.class), anyString())).thenReturn(mockResource);
   final Response response = testObj.removeVersion(createPathList(pid), versionLabel);
   verify(mockVersions).removeVersion(testObj.session.getWorkspace(), "/" + pid, versionLabel);
   assertNotNull(response);
 }
Example #3
0
 @Test(expected = PathNotFoundException.class)
 public void testRemoveVersionFailure() throws RepositoryException {
   final String pid = UUID.randomUUID().toString();
   final String versionLabel = UUID.randomUUID().toString();
   when(mockNodes.getObject(any(Session.class), anyString())).thenReturn(mockResource);
   doThrow(PathNotFoundException.class)
       .when(mockVersions)
       .removeVersion(any(Workspace.class), anyString(), anyString());
   testObj.removeVersion(createPathList(pid), versionLabel);
 }
Example #4
0
  @Test
  public void testAddVersionLabel() throws RepositoryException {
    final String pid = "FedoraVersioningTest";
    final String versionLabel = "FedoraVersioningTest1/fcr:versions/v0.0.1";
    when(mockNodes.getObject(any(Session.class), anyString())).thenReturn(mockResource);

    final Response response = testObj.addVersion(createPathList(pid), versionLabel);
    verify(mockResource).addVersionLabel(anyString());
    verify(mockVersions).createVersion(any(Workspace.class), Matchers.<Collection<String>>any());
    assertNotNull(response);
  }
 @Test
 public void testGetVersionList() {
   when(mockRequest.selectVariant(POSSIBLE_RDF_VARIANTS)).thenReturn(mockVariant);
   when(mockNodes.find(any(Session.class), anyString())).thenReturn(mockResource);
   when(mockResource.getTriples(any(IdentifierConverter.class), eq(VersionsRdfContext.class)))
       .thenReturn(mockRdfStream);
   when(mockResource.isVersioned()).thenReturn(true);
   when(mockVariant.getMediaType()).thenReturn(new MediaType("text", "turtle"));
   final RdfStream response = testObj.getVersionList();
   assertEquals("Got wrong RdfStream!", mockRdfStream, response);
 }
Example #6
0
 @Test
 public void testGetVersionList() throws RepositoryException {
   final String pid = "FedoraVersioningTest";
   when(mockRequest.selectVariant(POSSIBLE_RDF_VARIANTS)).thenReturn(mockVariant);
   when(mockNodes.getObject(any(Session.class), anyString())).thenReturn(mockResource);
   when(mockResource.getVersionTriples(any(HttpIdentifierTranslator.class)))
       .thenReturn(mockRdfStream);
   when(mockVariant.getMediaType()).thenReturn(new MediaType("text", "turtle"));
   final RdfStream response =
       testObj.getVersionList(createPathList(pid), mockRequest, getUriInfoImpl());
   assertEquals("Got wrong RdfStream!", mockRdfStream, response);
 }