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