use of org.smartdata.model.ActionInfo in project SSM by Intel-bigdata.
the class TestMetaStore method testInsertListActions.
@Test
public void testInsertListActions() throws Exception {
Map<String, String> args = new HashMap();
ActionInfo actionInfo = new ActionInfo(1, 1, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertActions(new ActionInfo[] { actionInfo });
List<ActionInfo> actionInfos = metaStore.getActions(null, null);
Assert.assertTrue(actionInfos.size() == 1);
actionInfo.setResult("Finished");
metaStore.updateActions(new ActionInfo[] { actionInfo });
actionInfos = metaStore.getActions(null, null);
Assert.assertTrue(actionInfos.get(0).equals(actionInfo));
}
use of org.smartdata.model.ActionInfo in project SSM by Intel-bigdata.
the class TestMetaStore method testdeleteFinishedCmdletsWithGenTimeBefore.
@Test
public void testdeleteFinishedCmdletsWithGenTimeBefore() throws Exception {
Map<String, String> args = new HashMap();
CmdletInfo command1 = new CmdletInfo(0, 78, CmdletState.CANCELLED, "test", 123L, 232444444L);
metaStore.insertCmdlet(command1);
CmdletInfo command2 = new CmdletInfo(1, 78, CmdletState.DONE, "tt", 128L, 232444994L);
metaStore.insertCmdlet(command2);
ActionInfo actionInfo = new ActionInfo(1, 0, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertAction(actionInfo);
ActionInfo actionInfo2 = new ActionInfo(2, 1, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertAction(actionInfo2);
ActionInfo actionInfo3 = new ActionInfo(3, 0, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertAction(actionInfo3);
metaStore.deleteFinishedCmdletsWithGenTimeBefore(125);
Assert.assertTrue(metaStore.getCmdletById(0) == null);
Assert.assertTrue(metaStore.getActionById(1) == null);
Assert.assertTrue(metaStore.getActionById(2) != null);
}
use of org.smartdata.model.ActionInfo in project SSM by Intel-bigdata.
the class TestMetaStore method testGetNewCreatedActions.
@Test
public void testGetNewCreatedActions() throws Exception {
Map<String, String> args = new HashMap();
List<ActionInfo> actionInfos;
ActionInfo actionInfo = new ActionInfo(1, 1, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertAction(actionInfo);
actionInfo.setActionId(2);
metaStore.insertAction(actionInfo);
actionInfos = metaStore.getNewCreatedActions(1);
Assert.assertTrue(actionInfos.size() == 1);
actionInfos = metaStore.getNewCreatedActions("cache", 1, true, true);
Assert.assertTrue(actionInfos.size() == 1);
actionInfos = metaStore.getNewCreatedActions(2);
Assert.assertTrue(actionInfos.size() == 2);
}
use of org.smartdata.model.ActionInfo in project SSM by Intel-bigdata.
the class TestMetaStore method testGetMaxActionId.
@Test
public void testGetMaxActionId() throws Exception {
long currentId = metaStore.getMaxActionId();
Map<String, String> args = new HashMap();
Assert.assertTrue(currentId == 0);
ActionInfo actionInfo = new ActionInfo(currentId, 1, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertActions(new ActionInfo[] { actionInfo });
currentId = metaStore.getMaxActionId();
Assert.assertTrue(currentId == 1);
actionInfo = new ActionInfo(currentId, 1, "cache", args, "Test", "Test", true, 123213213L, true, 123123L, 100);
metaStore.insertActions(new ActionInfo[] { actionInfo });
currentId = metaStore.getMaxActionId();
Assert.assertTrue(currentId == 2);
}
use of org.smartdata.model.ActionInfo in project SSM by Intel-bigdata.
the class TestCopy2S3Scheduler method testZeroLength.
@Test(timeout = 45000)
public void testZeroLength() throws Exception {
waitTillSSMExitSafeMode();
MetaStore metaStore = ssm.getMetaStore();
SmartAdmin admin = new SmartAdmin(smartContext.getConf());
DistributedFileSystem dfs = cluster.getFileSystem();
final String srcPath = "/src/";
dfs.mkdirs(new Path(srcPath));
// Write to src
for (int i = 0; i < 3; i++) {
// Create test files
DFSTestUtil.createFile(dfs, new Path(srcPath + i), 0, (short) 1, 1);
}
long ruleId = admin.submitRule("file: path matches \"/src/*\"| copy2s3 -dest s3a://xxxctest/dest/", RuleState.ACTIVE);
Thread.sleep(2500);
List<ActionInfo> actions = metaStore.getActions(ruleId, 0);
Assert.assertEquals(actions.size(), 0);
}
Aggregations