use of org.apache.oozie.util.Instrumentation in project oozie by apache.
the class TestActionStartXCommand method testActionStartPreCondition2.
/**
* Test : verify the PreconditionException is thrown when pending = true and action = START_RETRY and job != RUNNING
*
* @throws Exception
*/
public void testActionStartPreCondition2() throws Exception {
Instrumentation inst = Services.get().get(InstrumentationService.class).get();
WorkflowJobBean job = this.addRecordToWfJobTable(WorkflowJob.Status.FAILED, WorkflowInstance.Status.FAILED);
WorkflowActionBean action = this.addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.START_RETRY);
assertNull(inst.getCounters().get(XCommand.INSTRUMENTATION_GROUP));
ActionStartXCommand startCmd = new ActionStartXCommand(action.getId(), "map-reduce");
startCmd.call();
// precondition failed because of pending = true and action =
// START_RETRY and job != RUNNING
Long counterVal = inst.getCounters().get(XCommand.INSTRUMENTATION_GROUP).get(startCmd.getName() + ".preconditionfailed").getValue();
assertEquals(new Long(1), new Long(counterVal));
}
use of org.apache.oozie.util.Instrumentation in project oozie by apache.
the class TestInstrumentationService method testInstrumentation.
public void testInstrumentation() throws Exception {
assertNotNull(Services.get().get(InstrumentationService.class));
assertNotNull(Services.get().get(InstrumentationService.class).get());
Instrumentation instr = Services.get().get(InstrumentationService.class).get();
assertTrue("Metrics is enabled by default since 5.0.0", instr instanceof MetricsInstrumentation);
}
use of org.apache.oozie.util.Instrumentation in project oozie by apache.
the class TestZKJobsConcurrencyService method testInstrumentation.
public void testInstrumentation() throws Exception {
ZKJobsConcurrencyService zkjcs = new ZKJobsConcurrencyService();
// We'll use some DummyZKXOozies here to pretend to be other Oozie servers that will influence the instrumentation
// once they are running in that the there will be other Oozie "servers"
DummyZKOozie dummyOozie = null;
DummyZKOozie dummyOozie2 = null;
Instrumentation instr = new Instrumentation();
try {
zkjcs.init(Services.get());
zkjcs.instrument(instr);
String servers = ZK_ID + "=" + ConfigUtils.getOozieURL(false);
assertEquals(servers, instr.getVariables().get("oozie").get("servers").getValue());
dummyOozie = new DummyZKOozie("0000", "http://blah1");
servers = ZK_ID + "=" + ConfigUtils.getOozieURL(false) + ",0000=http://blah1";
assertEquals(servers, instr.getVariables().get("oozie").get("servers").getValue());
dummyOozie2 = new DummyZKOozie("z", "http://blah2");
servers = ZK_ID + "=" + ConfigUtils.getOozieURL(false) + ",0000=http://blah1" + ",z=http://blah2";
assertEquals(servers, instr.getVariables().get("oozie").get("servers").getValue());
dummyOozie.teardown();
servers = ZK_ID + "=" + ConfigUtils.getOozieURL(false) + ",z=http://blah2";
assertEquals(servers, instr.getVariables().get("oozie").get("servers").getValue());
dummyOozie2.teardown();
servers = ZK_ID + "=" + ConfigUtils.getOozieURL(false);
assertEquals(servers, instr.getVariables().get("oozie").get("servers").getValue());
} finally {
zkjcs.destroy();
if (dummyOozie != null) {
dummyOozie.teardown();
}
if (dummyOozie2 != null) {
dummyOozie2.teardown();
}
}
}
Aggregations