Search in sources :

Example 1 with SmartClient

use of org.smartdata.client.SmartClient in project SSM by Intel-bigdata.

the class TestSmartClient method testDataIgnoreAndCover.

@Test
public void testDataIgnoreAndCover() throws Exception {
    waitTillSSMExitSafeMode();
    // Configuration can also be used for initializing SmartClient.
    Configuration conf = new Configuration();
    conf.set(SmartConfKeys.SMART_IGNORE_DIRS_KEY, "/test1");
    conf.set(SmartConfKeys.SMART_COVER_DIRS_KEY, "/test2");
    SmartClient client = new SmartClient(conf);
    Assert.assertTrue("This test file should be ignored", client.shouldIgnore("/test1/a.txt"));
    Assert.assertFalse("This test file should not be ignored", client.shouldIgnore("/test2/b.txt"));
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) SmartClient(org.smartdata.client.SmartClient) Test(org.junit.Test)

Example 2 with SmartClient

use of org.smartdata.client.SmartClient in project SSM by Intel-bigdata.

the class TestSmartClient method testGetFileState.

@Test
public void testGetFileState() throws Exception {
    waitTillSSMExitSafeMode();
    MetaStore metaStore = ssm.getMetaStore();
    String path = "/file1";
    FileState fileState = new NormalFileState(path);
    SmartClient client = new SmartClient(smartContext.getConf());
    FileState fileState1;
    // No entry in file_state table (Normal type as default)
    fileState1 = client.getFileState(path);
    Assert.assertEquals(fileState, fileState1);
    metaStore.insertUpdateFileState(fileState);
    fileState1 = client.getFileState(path);
    Assert.assertEquals(fileState, fileState1);
}
Also used : MetaStore(org.smartdata.metastore.MetaStore) FileState(org.smartdata.model.FileState) NormalFileState(org.smartdata.model.NormalFileState) NormalFileState(org.smartdata.model.NormalFileState) SmartClient(org.smartdata.client.SmartClient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 SmartClient (org.smartdata.client.SmartClient)2 Configuration (org.apache.hadoop.conf.Configuration)1 MetaStore (org.smartdata.metastore.MetaStore)1 FileState (org.smartdata.model.FileState)1 NormalFileState (org.smartdata.model.NormalFileState)1