package com.continuuity.data;

import com.continuuity.common.conf.Constants;
import com.continuuity.data.runtime.DataFabricLevelDBModule;
import com.continuuity.data2.dataset.api.DataSetClient;
import com.continuuity.data2.dataset.lib.table.BufferingOcTableClient;
import com.continuuity.data2.dataset.lib.table.OrderedColumnarTable;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.junit.BeforeClass;

/**
 *
 */
public class LocalDataSetAccessorTest extends NamespacingDataSetAccessorTest {
  private static DataSetAccessor dsAccessor;

  @BeforeClass
  public static void beforeClass() throws Exception {
    NamespacingDataSetAccessorTest.beforeClass();
    conf.unset(Constants.CFG_DATA_LEVELDB_DIR);
    Injector injector = Guice.createInjector(new DataFabricLevelDBModule(conf));
    dsAccessor = injector.getInstance(DataSetAccessor.class);
  }

  @Override
  protected DataSetAccessor getDataSetAccessor() {
    return dsAccessor;
  }

  @Override
  protected String getRawName(DataSetClient dsClient) {
    if (dsClient instanceof OrderedColumnarTable) {
      return ((BufferingOcTableClient) dsClient).getTableName();
    }

    throw new RuntimeException("Unknown DataSetClient type: " + dsClient.getClass());
  }
}

@@ -70,16 +70,75 @@
 stants;%0A
+import com.continuuity.common.guice.LocationRuntimeModule;%0A
 import c
@@ -182,32 +182,32 @@
 cLevelDBModule;%0A
-
 import com.conti
@@ -482,16 +482,84 @@
 reClass;
+%0Aimport org.junit.ClassRule;%0Aimport org.junit.rules.TemporaryFolder;
 %0A%0A/**%0A *
@@ -642,16 +642,98 @@
 rTest %7B%0A
+%0A  @ClassRule%0A  public static TemporaryFolder tmpFolder = new TemporaryFolder();%0A%0A
   privat
@@ -898,18 +898,16 @@
    conf.
-un
 set(Cons
@@ -920,72 +920,176 @@
 CFG_
-DATA_LEVELDB_DIR);%0A    Injector injector = Guice.createInjector(
+LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());%0A    Injector injector = Guice.createInjector(%0A      new LocationRuntimeModule().getSingleNodeModules(),%0A      
 new 

Fix broken test.