@BeforeClass
 public static void setUpClass() throws Exception {
   tempDir = File.createTempFile("fcrepo-store-jcr", null);
   tempDir.delete();
   repository = new TransientRepository(tempDir);
   credentials = new SimpleCredentials("admin", "admin".toCharArray());
   jcr = repository.login(credentials);
   store = new JCRFedoraStoreSession(jcr, new FOXMLReader(), new FOXMLWriter());
 }
예제 #2
0
 @Override
 public Session login(Credentials pCreds, String pPropsFile) throws RepositoryException {
   try {
     FileInputStream fis = new FileInputStream(pPropsFile);
     Properties props = new Properties();
     props.load(fis);
     fis.close();
     TransientRepository rep =
         new TransientRepository(props.getProperty("configFile"), props.getProperty("repHome"));
     Session ses = rep.login(pCreds, props.getProperty("workspace"));
     String[] ns = CARS_Factory.gRepNamespaces.split(",");
     CARS_Factory.getLastFactory().addNamespaces(ses.getWorkspace().getNamespaceRegistry(), ns);
     String[] cnds = CARS_Factory.gRepCNDFiles.split(",");
     CARS_Factory.getLastFactory().addNodeTypesDefinitions(ses, cnds);
     return ses;
   } catch (Exception e) {
     throw new RepositoryException(e);
   }
 }
 @After
 public void tearDown() throws Exception {
   if (store.closed()) {
     // some tests will close the session; need to re-establish one
     jcr = repository.login(credentials);
     store = new JCRFedoraStoreSession(jcr, new FOXMLReader(), new FOXMLWriter());
   }
   removeItem("/ca/88/test_new-object");
   removeItem("/66/c7/test_existing");
   removeItem("/08/cf/test_o1");
   removeItem("/26/b6/test_o2");
   jcr.save();
 }
 @AfterClass
 public static void tearDownClass() throws Exception {
   store.close();
   repository.shutdown();
   FileUtils.deleteDirectory(tempDir);
 }