HDFS-12391. Ozone: TestKSMSQLCli is not working as expected. Contributed by Weiwei Yang.

This commit is contained in:
Chen Liang 2017-09-05 11:14:33 -07:00
parent ac5f01c316
commit d23e1ed8c4
2 changed files with 20 additions and 23 deletions

View File

@ -346,7 +346,7 @@ public class SQLCLI extends Configured implements Tool {
LOG.info("Create tables for sql ksm db."); LOG.info("Create tables for sql ksm db.");
File dbFile = dbPath.toFile(); File dbFile = dbPath.toFile();
try (MetadataStore dbStore = MetadataStoreBuilder.newBuilder() try (MetadataStore dbStore = MetadataStoreBuilder.newBuilder()
.setDbFile(dbFile).build(); .setConf(conf).setDbFile(dbFile).build();
Connection conn = connectDB(outPath.toString())) { Connection conn = connectDB(outPath.toString())) {
executeSQL(conn, CREATE_VOLUME_LIST); executeSQL(conn, CREATE_VOLUME_LIST);
executeSQL(conn, CREATE_VOLUME_INFO); executeSQL(conn, CREATE_VOLUME_INFO);

View File

@ -60,23 +60,23 @@ import static org.junit.Assert.assertTrue;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class TestKSMSQLCli { public class TestKSMSQLCli {
private static MiniOzoneCluster cluster = null; private MiniOzoneCluster cluster = null;
private static StorageHandler storageHandler; private StorageHandler storageHandler;
private static UserArgs userArgs; private UserArgs userArgs;
private static OzoneConfiguration conf; private OzoneConfiguration conf;
private static SQLCLI cli; private SQLCLI cli;
private static String userName = "userTest"; private String userName = "userTest";
private static String adminName = "adminTest"; private String adminName = "adminTest";
private static String volumeName0 = "volumeTest0"; private String volumeName0 = "volumeTest0";
private static String volumeName1 = "volumeTest1"; private String volumeName1 = "volumeTest1";
private static String bucketName0 = "bucketTest0"; private String bucketName0 = "bucketTest0";
private static String bucketName1 = "bucketTest1"; private String bucketName1 = "bucketTest1";
private static String bucketName2 = "bucketTest2"; private String bucketName2 = "bucketTest2";
private static String keyName0 = "key0"; private String keyName0 = "key0";
private static String keyName1 = "key1"; private String keyName1 = "key1";
private static String keyName2 = "key2"; private String keyName2 = "key2";
private static String keyName3 = "key3"; private String keyName3 = "key3";
@Parameterized.Parameters @Parameterized.Parameters
public static Collection<Object[]> data() { public static Collection<Object[]> data() {
@ -86,7 +86,7 @@ public class TestKSMSQLCli {
}); });
} }
private static String metaStoreType; private String metaStoreType;
public TestKSMSQLCli(String type) { public TestKSMSQLCli(String type) {
metaStoreType = type; metaStoreType = type;
@ -100,8 +100,8 @@ public class TestKSMSQLCli {
* *
* @throws IOException * @throws IOException
*/ */
@BeforeClass @Before
public static void setup() throws Exception { public void setup() throws Exception {
conf = new OzoneConfiguration(); conf = new OzoneConfiguration();
conf.set(OzoneConfigKeys.OZONE_HANDLER_TYPE_KEY, conf.set(OzoneConfigKeys.OZONE_HANDLER_TYPE_KEY,
OzoneConsts.OZONE_HANDLER_DISTRIBUTED); OzoneConsts.OZONE_HANDLER_DISTRIBUTED);
@ -151,10 +151,7 @@ public class TestKSMSQLCli {
stream.close(); stream.close();
cluster.shutdown(); cluster.shutdown();
}
@Before
public void init() throws Exception {
conf.set(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL, metaStoreType); conf.set(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL, metaStoreType);
cli = new SQLCLI(conf); cli = new SQLCLI(conf);
} }