@Test
  public void testFailWhenNoLocalStorageDir() throws Exception {
    File targetDir = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    try {
      assertTrue(targetDir.mkdirs());

      if (!targetDir.setWritable(false, false)) {
        System.err.println(
            "Cannot execute 'testFailWhenNoLocalStorageDir' because cannot mark directory non-writable");
        return;
      }

      RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);
      rocksDbBackend.setDbStoragePath(targetDir.getAbsolutePath());

      try {
        rocksDbBackend.initializeForJob(getMockEnvironment(), "foobar", IntSerializer.INSTANCE);
      } catch (Exception e) {
        assertTrue(e.getMessage().contains("No local storage directories available"));
        assertTrue(e.getMessage().contains(targetDir.getAbsolutePath()));
      }
    } finally {
      //noinspection ResultOfMethodCallIgnored
      targetDir.setWritable(true, false);
      FileUtils.deleteDirectory(targetDir);
    }
  }
  @Test
  public void testSetDbPath() throws Exception {
    RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);

    assertNull(rocksDbBackend.getDbStoragePaths());

    rocksDbBackend.setDbStoragePath("/abc/def");
    assertArrayEquals(new String[] {"/abc/def"}, rocksDbBackend.getDbStoragePaths());

    rocksDbBackend.setDbStoragePath(null);
    assertNull(rocksDbBackend.getDbStoragePaths());

    rocksDbBackend.setDbStoragePaths("/abc/def", "/uvw/xyz");
    assertArrayEquals(new String[] {"/abc/def", "/uvw/xyz"}, rocksDbBackend.getDbStoragePaths());

    //noinspection NullArgumentToVariableArgMethod
    rocksDbBackend.setDbStoragePaths(null);
    assertNull(rocksDbBackend.getDbStoragePaths());
  }
 @Test(expected = IllegalArgumentException.class)
 public void testNonFileSchemePath() throws Exception {
   RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);
   rocksDbBackend.setDbStoragePath("hdfs:///some/path/to/perdition");
 }