예제 #1
0
 @Test
 public void shouldInitializeTlbWithDefaultPortIfNotGiven() {
   Component component = initializer.init();
   ServerList servers = component.getServers();
   assertThat(servers.size(), is(1));
   assertThat(servers.get(0).getPort(), is(7019));
 }
예제 #2
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);
   }
 }
예제 #3
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));
 }
예제 #4
0
 @Test
 public void shouldCreateApplicationContextWithRepoFactory() {
   ConcurrentMap<String, Object> map = initializer.application().getContext().getAttributes();
   assertThat(map.get(TlbConstants.Server.REPO_FACTORY), is(EntryRepoFactory.class));
 }
예제 #5
0
 @Test
 public void shouldCreateTlbApplication() {
   final Restlet app = initializer.application();
   assertThat(app, is(TlbApplication.class));
 }