@Test(dependsOnMethods = {"testInit", "testGoodCommits"}, expectedExceptions = InfeasibleActionException.class) public void testCommitBlocked() { ReconfigurationPlan plan = makePlan(); ReconfigurationPlanMonitor exec = new DefaultReconfigurationPlanMonitor(plan); exec.commit(a3); }
@Override public Set<Action> commit(Action a) { Set<Action> s = new HashSet<>(); synchronized (lock) { boolean ret = a.apply(curModel); if (!ret) { throw new InfeasibleActionException(curModel, a); } nbCommitted++; Set<Dependency> deps = pre.get(a); if (deps != null) { for (Dependency dep : deps) { Set<Action> actions = dep.getDependencies(); actions.remove(a); if (actions.isEmpty()) { Action x = dep.getAction(); s.add(x); } } } } return s; }
DefaultReconfigurationPlanMonitor implements ReconfigurationPlanMonitor { @Override public Set<Action> commit(Action a) { Set<Action> s = new HashSet<>(); synchronized (lock) { boolean ret = a.apply(curModel); if (!ret) { throw new InfeasibleActionException(curModel, a); } nbCommitted++; Set<Dependency> deps = pre.get(a); if (deps != null) { for (Dependency dep : deps) { Set<Action> actions = dep.getDependencies(); actions.remove(a); if (actions.isEmpty()) { Action x = dep.getAction(); s.add(x); } } } } return s; } }
DefaultReconfigurationPlanMonitor implements ReconfigurationPlanMonitor { @Override public Set<Action> commit(Action a) { Set<Action> s = new HashSet<>(); synchronized (lock) { boolean ret = a.apply(curModel); if (!ret) { throw new InfeasibleActionException(curModel, a); } nbCommitted++; Set<Dependency> deps = pre.get(a); if (deps != null) { for (Dependency dep : deps) { Set<Action> actions = dep.getDependencies(); actions.remove(a); if (actions.isEmpty()) { Action x = dep.getAction(); s.add(x); } } } } return s; } DefaultReconfigurationPlanMonitor(ReconfigurationPlan p); }
DefaultReconfigurationPlanMonitor implements ReconfigurationPlanMonitor { @Override public Set<Action> commit(Action a) { Set<Action> s = new HashSet<>(); synchronized (lock) { boolean ret = a.apply(curModel); if (!ret) { throw new InfeasibleActionException(curModel, a); } nbCommitted++; Set<Dependency> deps = pre.get(a); if (deps != null) { for (Dependency dep : deps) { Set<Action> actions = dep.getDependencies(); actions.remove(a); if (actions.isEmpty()) { Action x = dep.getAction(); s.add(x); } } } } return s; } DefaultReconfigurationPlanMonitor(ReconfigurationPlan p); @Override Model getCurrentModel(); @Override Set<Action> commit(Action a); @Override int getNbCommitted(); @Override boolean isBlocked(Action a); @Override ReconfigurationPlan getReconfigurationPlan(); }
DefaultReconfigurationPlanMonitor implements ReconfigurationPlanMonitor { @Override public Set<Action> commit(Action a) { Set<Action> s = new HashSet<>(); synchronized (lock) { boolean ret = a.apply(curModel); if (!ret) { throw new InfeasibleActionException(curModel, a); } nbCommitted++; Set<Dependency> deps = pre.get(a); if (deps != null) { for (Dependency dep : deps) { Set<Action> actions = dep.getDependencies(); actions.remove(a); if (actions.isEmpty()) { Action x = dep.getAction(); s.add(x); } } } } return s; } DefaultReconfigurationPlanMonitor(ReconfigurationPlan p); @Override Model getCurrentModel(); @Override Set<Action> commit(Action a); @Override int getNbCommitted(); @Override boolean isBlocked(Action a); @Override ReconfigurationPlan getReconfigurationPlan();  }