use of org.btrplace.plan.event.EventCommittedListener in project scheduler by btrplace.
the class DefaultPlanApplierTest method testEventCommittedListeners.
@Test
public void testEventCommittedListeners() {
DefaultPlanApplier app = new MockApplier();
EventCommittedListener ev = mock(EventCommittedListener.class);
app.addEventCommittedListener(ev);
Assert.assertTrue(app.removeEventCommittedListener(ev));
}
use of org.btrplace.plan.event.EventCommittedListener in project scheduler by btrplace.
the class DefaultPlanApplierTest method testFireComposedAction.
@Test
public void testFireComposedAction() {
DefaultPlanApplier app = new MockApplier();
EventCommittedListener ev = mock(EventCommittedListener.class);
app.addEventCommittedListener(ev);
BootVM b = new BootVM(vms.get(0), ns.get(0), 0, 5);
AllocateEvent pre = new AllocateEvent(vms.get(0), "cpu", 7);
b.addEvent(Action.Hook.PRE, pre);
SubstitutedVMEvent post = new SubstitutedVMEvent(vms.get(0), vms.get(3));
b.addEvent(Action.Hook.POST, post);
InOrder order = inOrder(ev);
app.fireAction(b);
order.verify(ev).committed(pre);
order.verify(ev).committed(b);
order.verify(ev).committed(post);
}
use of org.btrplace.plan.event.EventCommittedListener in project scheduler by btrplace.
the class DefaultPlanApplierTest method testFireSimpleAction.
@Test(dependsOnMethods = { "testEventCommittedListeners" })
public void testFireSimpleAction() {
DefaultPlanApplier app = new MockApplier();
EventCommittedListener ev = mock(EventCommittedListener.class);
app.addEventCommittedListener(ev);
BootVM b = new BootVM(vms.get(0), ns.get(0), 0, 5);
app.fireAction(b);
verify(ev, times(1)).committed(b);
ShutdownVM svm = new ShutdownVM(vms.get(0), ns.get(0), 0, 5);
app.fireAction(svm);
verify(ev, times(1)).committed(svm);
BootNode bn = new BootNode(ns.get(0), 0, 5);
app.fireAction(bn);
verify(ev, times(1)).committed(bn);
ShutdownNode sn = new ShutdownNode(ns.get(0), 0, 5);
app.fireAction(sn);
verify(ev, times(1)).committed(sn);
SuspendVM susVM = new SuspendVM(vms.get(0), ns.get(0), ns.get(1), 0, 5);
app.fireAction(susVM);
verify(ev, times(1)).committed(susVM);
ResumeVM resVM = new ResumeVM(vms.get(0), ns.get(0), ns.get(1), 0, 5);
app.fireAction(resVM);
verify(ev, times(1)).committed(resVM);
MigrateVM miVM = new MigrateVM(vms.get(0), ns.get(0), ns.get(1), 0, 5);
app.fireAction(miVM);
verify(ev, times(1)).committed(miVM);
KillVM kvm = new KillVM(vms.get(0), ns.get(0), 0, 5);
app.fireAction(kvm);
verify(ev, times(1)).committed(kvm);
ForgeVM fvm = new ForgeVM(vms.get(0), 0, 5);
app.fireAction(fvm);
verify(ev, times(1)).committed(fvm);
}
Aggregations