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