コード例 #1
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);
 }
コード例 #2
0
 @Before
 public void setUp() throws Exception {
   initMocks(this);
   testObj = new FedoraVersions();
   mockSession = mockSession(testObj);
   setField(testObj, "nodeService", mockNodes);
   setField(testObj, "uriInfo", getUriInfoImpl());
   setField(testObj, "session", mockSession);
   setField(testObj, "versionService", mockVersions);
   setField(testObj, "sessionFactory", mockSessionFactory);
   when(mockSessionFactory.getInternalSession()).thenReturn(mockSession);
   when(mockNode.getPath()).thenReturn("/test/path");
   when(mockResource.getNode()).thenReturn(mockNode);
   when(mockNodeType.getName()).thenReturn("nt:folder");
   when(mockNode.getPrimaryNodeType()).thenReturn(mockNodeType);
 }