Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
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);
  }
Ejemplo n.º 4
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);
 }