@Test
 public void testIndexWordLimit() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals(Integer.MAX_VALUE, instance.getIndexWordLimit()); // default is unlimited
   instance.setIndexWordLimit(100000);
   assertEquals(100000, instance.getIndexWordLimit());
 }
 @Test
 public void testRemoteScmSupported() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertFalse(instance.isRemoteScmSupported());
   instance.setRemoteScmSupported(true);
   assertTrue(instance.isRemoteScmSupported());
 }
 @Test
 public void testQuickContextScan() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertTrue(instance.isQuickContextScan());
   instance.setQuickContextScan(false);
   assertFalse(instance.isQuickContextScan());
 }
 @Test
 public void testIndexVersionedFilesOnly() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertFalse(instance.isIndexVersionedFilesOnly());
   instance.setIndexVersionedFilesOnly(true);
   assertTrue(instance.isIndexVersionedFilesOnly());
 }
 @Test
 public void testGenerateHtml() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertTrue(instance.isGenerateHtml());
   instance.setGenerateHtml(false);
   assertFalse(instance.isGenerateHtml());
 }
 @Test
 public void testCompressXref() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertTrue(instance.isCompressXref());
   instance.setCompressXref(false);
   assertFalse(instance.isCompressXref());
 }
 @Test
 public void testStoreHistoryCacheInDB() {
   RuntimeEnvironment env = RuntimeEnvironment.getInstance();
   assertFalse(env.storeHistoryCacheInDB());
   env.setStoreHistoryCacheInDB(true);
   assertTrue(env.storeHistoryCacheInDB());
 }
 @Test
 public void testUseHistoryCache() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals(true, instance.useHistoryCache());
   instance.setUseHistoryCache(false);
   assertEquals(false, instance.useHistoryCache());
 }
 @Test
 public void testHistoryReaderTimeLimit() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals(30, instance.getHistoryReaderTimeLimit());
   instance.setHistoryReaderTimeLimit(50);
   assertEquals(50, instance.getHistoryReaderTimeLimit());
 }
Пример #10
0
 @Test
 public void testOptimizeDatabase() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertTrue(instance.isOptimizeDatabase());
   instance.setOptimizeDatabase(false);
   assertFalse(instance.isOptimizeDatabase());
 }
Пример #11
0
 @Test
 public void testVerbose() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertFalse(instance.isVerbose());
   instance.setVerbose(true);
   assertTrue(instance.isVerbose());
 }
Пример #12
0
 @AfterClass
 public static void tearDownClass() throws Exception {
   // restore the configuration
   RuntimeEnvironment.getInstance().readConfiguration(originalConfig);
   RuntimeEnvironment.getInstance().register();
   originalConfig.delete();
 }
Пример #13
0
 @Test
 public void testUsingLuceneLocking() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertFalse(instance.isUsingLuceneLocking());
   instance.setUsingLuceneLocking(true);
   assertTrue(instance.isUsingLuceneLocking());
 }
Пример #14
0
 @Test
 public void testWebappLAF() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals("default", instance.getWebappLAF());
   instance.setWebappLAF("foo");
   assertEquals("foo", instance.getWebappLAF());
 }
Пример #15
0
 @Test
 public void testIgnoredNames() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertNotNull(instance.getIgnoredNames());
   instance.setIgnoredNames(null);
   assertNull(instance.getIgnoredNames());
 }
Пример #16
0
 @Test
 public void testAllowLeadingWildcard() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertFalse(instance.isAllowLeadingWildcard());
   instance.setAllowLeadingWildcard(true);
   assertTrue(instance.isAllowLeadingWildcard());
 }
Пример #17
0
 @Test
 public void testUrlPrefix() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals("/source/s?", instance.getUrlPrefix());
   String prefix = "/opengrok/s?";
   instance.setUrlPrefix(prefix);
   assertEquals(prefix, instance.getUrlPrefix());
 }
Пример #18
0
 @Test
 public void testReviewPattern() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   String page = "\\b(\\d{4}/\\d{3})\\b";
   assertEquals(page, instance.getReviewPattern());
   instance.setReviewPattern(page.substring(5));
   assertEquals(page.substring(5), instance.getReviewPattern());
 }
Пример #19
0
 @Test
 public void testReviewPage() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   String page = "http://arc.myserver.org/caselog/PSARC/";
   assertEquals(page, instance.getReviewPage());
   instance.setReviewPage(page.substring(5));
   assertEquals(page.substring(5), instance.getReviewPage());
 }
Пример #20
0
 @Test
 public void testBugPattern() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   String page = "\\b([12456789][0-9]{6})\\b";
   assertEquals(page, instance.getBugPattern());
   instance.setBugPattern(page.substring(5));
   assertEquals(page.substring(5), instance.getBugPattern());
 }
Пример #21
0
 @Test
 public void testBugPage() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   String page = "http://bugs.myserver.org/bugdatabase/view_bug.do?bug_id=";
   assertEquals(page, instance.getBugPage());
   instance.setBugPage(page.substring(5));
   assertEquals(page.substring(5), instance.getBugPage());
 }
Пример #22
0
 @Test
 public void testCtags() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertEquals("ctags", instance.getCtags());
   String path = "/usr/bin/ctags";
   instance.setCtags(path);
   assertEquals(path, instance.getCtags());
 }
Пример #23
0
 @Test
 public void testUserPage() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   String page = "http://www.myserver.org/viewProfile.jspa?username=";
   assertEquals(page, instance.getUserPage());
   instance.setUserPage(page.substring(5));
   assertEquals(page.substring(5), instance.getUserPage());
 }
Пример #24
0
 @Test
 public void testBug3154() throws IOException {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   File file = File.createTempFile("dataroot", null);
   assertTrue(file.delete());
   assertFalse(file.exists());
   instance.setDataRoot(file.getAbsolutePath());
   // The point of this test was to verify that setDataRoot() created
   // the directory, but that logic has been moved as of bug 16986, so
   // expect that the file does not exist.
   assertFalse(file.exists());
 }
Пример #25
0
  @Test
  public void testObfuscateEMail() throws IOException {
    RuntimeEnvironment env = RuntimeEnvironment.getInstance();

    // By default, don't obfuscate.
    assertObfuscated(false, env);

    env.setObfuscatingEMailAddresses(true);
    assertObfuscated(true, env);

    env.setObfuscatingEMailAddresses(false);
    assertObfuscated(false, env);
  }
Пример #26
0
 @Test
 public void testBug3095() throws IOException {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   File file = new File("foobar");
   assertTrue(file.createNewFile());
   assertFalse(file.isAbsolute());
   instance.setDataRoot(file.getName());
   File f = instance.getDataRootFile();
   assertNotNull(f);
   assertEquals("foobar", f.getName());
   assertTrue(f.isAbsolute());
   assertTrue(file.delete());
 }
Пример #27
0
 @Test
 public void testConfigListenerThread() throws IOException {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   SocketAddress addr = new InetSocketAddress(0);
   assertTrue(instance.startConfigurationListenerThread(addr));
   try {
     Thread.sleep(1000);
   } catch (InterruptedException exp) {
     // do nothing
   }
   instance.writeConfiguration();
   instance.stopConfigurationListenerThread();
 }
Пример #28
0
  @Test
  public void testProjects() throws IOException {
    RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
    assertFalse(instance.hasProjects());
    assertNotNull(instance.getProjects());
    assertEquals(0, instance.getProjects().size());
    assertNull(instance.getDefaultProject());

    File file = new File("/opengrok_automatic_test/foo/bar");
    instance.setSourceRoot("/opengrok_automatic_test/foo");
    Project p = new Project();
    p.setPath("/bar");
    assertEquals("/bar", p.getId());
    instance.getProjects().add(p);
    assertEquals(p, Project.getProject(file));
    instance.setProjects(null);
    assertNull(instance.getProjects());
  }
Пример #29
0
  @Test
  public void testRegister() throws InterruptedException, IOException {
    RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
    String path = "/tmp/dataroot";
    instance.setDataRoot(path);
    instance.register();
    Thread t =
        new Thread(
            new Runnable() {

              public void run() {
                Configuration c = new Configuration();
                RuntimeEnvironment.getInstance().setConfiguration(c);
              }
            });
    t.start();
    t.join();
    assertEquals(new File(path).getCanonicalFile().getAbsolutePath(), instance.getDataRootPath());
  }
Пример #30
0
 @Test
 public void testRepositories() {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertNotNull(instance.getRepositories());
   instance.setRepositories(null);
   assertNull(instance.getRepositories());
   List<RepositoryInfo> reps = new ArrayList<RepositoryInfo>();
   instance.setRepositories(reps);
   assertSame(reps, instance.getRepositories());
 }