Ejemplo n.º 1
0
 @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);
 }
Ejemplo n.º 2
0
  @Before
  public void setUp() throws Exception {
    initMocks(this);
    testObj = spy(new FedoraVersioning(path));
    mockSession = mockSession(testObj);
    setField(testObj, "nodeService", mockNodes);
    setField(testObj, "uriInfo", getUriInfoImpl());
    setField(testObj, "session", mockSession);
    setField(testObj, "versionService", mockVersions);
    when(mockSessionFactory.getInternalSession()).thenReturn(mockSession);
    when(mockResource.getPath()).thenReturn(path);
    when(mockResource.getNode()).thenReturn(mockNode);
    when(mockNodeType.getName()).thenReturn("nt:folder");
    when(mockNode.getPrimaryNodeType()).thenReturn(mockNodeType);
    when(mockNode.getPath()).thenReturn(path);
    when(mockSession.getNode(path)).thenReturn(mockNode);
    doReturn(mockResource).when(testObj).resource();

    setField(
        testObj,
        "idTranslator",
        new HttpResourceConverter(
            mockSession, UriBuilder.fromUri("http://localhost/fcrepo/{path: .*}")));
  }