Пример #1
0
 @Test
 public void shouldHonorDiskStorageRootOverride() throws IOException, ClassNotFoundException {
   File tmpDir = TestUtil.createTmpDir();
   try {
     String tmpDirPath = tmpDir.getAbsolutePath();
     systemEnv.put(TlbConstants.Server.TLB_DATA_DIR.key, tmpDirPath);
     initializer = new TlbServerInitializer(new SystemEnvironment(systemEnv));
     EntryRepoFactory factory = initializer.repoFactory();
     File file =
         new File(
             tmpDirPath,
             new EntryRepoFactory.VersionedNamespace(LATEST_VERSION, SUBSET_SIZE)
                 .getIdUnder("quux"));
     file.deleteOnExit();
     writeEntriedTo(file);
     SubsetSizeRepo repo = factory.createSubsetRepo("quux", LATEST_VERSION);
     assertThat(
         (List<SubsetSizeEntry>) repo.list(),
         is(
             Arrays.asList(
                 new SubsetSizeEntry(1), new SubsetSizeEntry(2), new SubsetSizeEntry(3))));
   } finally {
     FileUtils.deleteQuietly(tmpDir);
   }
 }
Пример #2
0
 @Test
 public void shouldInitializeEntryRepoFactoryWithPresentWorkingDirectoryAsDiskStorageRoot()
     throws IOException, ClassNotFoundException {
   EntryRepoFactory factory = initializer.repoFactory();
   File dir = TestUtil.mkdirInPwd("tlb_store");
   File file =
       new File(
           dir,
           new EntryRepoFactory.VersionedNamespace(LATEST_VERSION, SUBSET_SIZE).getIdUnder("foo"));
   List<SubsetSizeEntry> entries = writeEntriedTo(file);
   SubsetSizeRepo repo = factory.createSubsetRepo("foo", LATEST_VERSION);
   assertThat((List<SubsetSizeEntry>) repo.list(), is(entries));
 }