@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());
 }
 @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());
 }
 @Test
 public void testDataRoot() throws IOException {
   RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
   assertNull(instance.getDataRootFile());
   assertNull(instance.getDataRootPath());
   File f = File.createTempFile("dataroot", null);
   String path = f.getCanonicalPath();
   assertTrue(f.delete());
   assertFalse(f.exists());
   instance.setDataRoot(path);
   // setDataRoot() used to create path if it didn't exist, but that
   // logic has been moved. Verify that it is so.
   assertFalse(f.exists());
   assertTrue(f.mkdirs());
   assertEquals(path, instance.getDataRootPath());
   assertEquals(path, instance.getDataRootFile().getCanonicalPath());
 }
  @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());
  }