Search in sources :

Example 1 with TransitionFactory

use of org.btrplace.scheduler.choco.transition.TransitionFactory in project scheduler by btrplace.

the class DefaultChocoSchedulerTest method testTransitionFactoryCustomisation.

/**
 * Remove the ready->running transition so the solving process will fail
 *
 * @throws org.btrplace.scheduler.SchedulerException
 */
@Test
public void testTransitionFactoryCustomisation() throws SchedulerException {
    ChocoScheduler cra = new DefaultChocoScheduler();
    TransitionFactory tf = cra.getTransitionFactory();
    VMTransitionBuilder b = tf.getBuilder(VMState.READY, VMState.RUNNING);
    Assert.assertTrue(tf.remove(b));
    Model mo = new DefaultModel();
    VM v = mo.newVM();
    mo.getMapping().addReadyVM(v);
    Assert.assertNull(cra.solve(mo, Collections.singletonList(new Running(v))));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) VM(org.btrplace.model.VM) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Running(org.btrplace.model.constraint.Running) VMTransitionBuilder(org.btrplace.scheduler.choco.transition.VMTransitionBuilder) TransitionFactory(org.btrplace.scheduler.choco.transition.TransitionFactory) Test(org.testng.annotations.Test)

Aggregations

DefaultModel (org.btrplace.model.DefaultModel)1 Model (org.btrplace.model.Model)1 VM (org.btrplace.model.VM)1 Running (org.btrplace.model.constraint.Running)1 TransitionFactory (org.btrplace.scheduler.choco.transition.TransitionFactory)1 VMTransitionBuilder (org.btrplace.scheduler.choco.transition.VMTransitionBuilder)1 Test (org.testng.annotations.Test)1