@Test public void testGetMisplaced() { Model mo = new DefaultModel(); VM vm1 = mo.newVM(); VM vm2 = mo.newVM(); Node n1 = mo.newNode(); mo.getMapping().on(n1).ready(vm1).run(n1, vm2); Instance i = new Instance(mo, Collections.emptyList(), new MinMTTR()); CRunning k = new CRunning(new Running(vm1)); Assert.assertEquals(1, k.getMisPlacedVMs(i).size()); Assert.assertTrue(k.getMisPlacedVMs(i).contains(vm1)); k = new CRunning(new Running(vm2)); Assert.assertEquals(0, k.getMisPlacedVMs(i).size()); }
@Override public Set<VM> getMisPlacedVMs(Instance i) { VM vm = cstr.getInvolvedVMs().iterator().next(); Mapping map = i.getModel().getMapping(); if (!map.isRunning(vm)) { return Collections.singleton(vm); } return Collections.emptySet(); }
CRunning implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { VM vm = cstr.getInvolvedVMs().iterator().next(); Mapping map = i.getModel().getMapping(); if (!map.isRunning(vm)) { return Collections.singleton(vm); } return Collections.emptySet(); } }
CRunning implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { VM vm = cstr.getInvolvedVMs().iterator().next(); Mapping map = i.getModel().getMapping(); if (!map.isRunning(vm)) { return Collections.singleton(vm); } return Collections.emptySet(); } CRunning(Running c); }
CRunning implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { VM vm = cstr.getInvolvedVMs().iterator().next(); Mapping map = i.getModel().getMapping(); if (!map.isRunning(vm)) { return Collections.singleton(vm); } return Collections.emptySet(); } CRunning(Running c); @Override boolean inject(Parameters ps, ReconfigurationProblem rp); @Override Set<VM> getMisPlacedVMs(Instance i); @Override String toString(); }
CRunning implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { VM vm = cstr.getInvolvedVMs().iterator().next(); Mapping map = i.getModel().getMapping(); if (!map.isRunning(vm)) { return Collections.singleton(vm); } return Collections.emptySet(); } CRunning(Running c); @Override boolean inject(Parameters ps, ReconfigurationProblem rp); @Override Set<VM> getMisPlacedVMs(Instance i); @Override String toString();  }