@Test(dependsOnMethods = {"testInstantiateAndIsRegistered", "testUnregister"}, expectedExceptions = {SchedulerException.class}) public void testEvaluateUnregisteredAction() throws SchedulerException { DurationEvaluators d = new DurationEvaluators(); d.evaluate(mo, MigrateVM.class, vm1); }
public int evaluate(Model mo, Class<? extends Action> a, Element e) throws SchedulerException { ActionDurationEvaluator<Element> ev = durations.get(a); if (ev == null) { throw new SchedulerModelingException(null, "Unable to estimate the duration of action '" + a.getSimpleName() + "' related to '" + e + "'"); } int d = ev.evaluate(mo, e); if (d <= 0) { throw new SchedulerModelingException(null, "The duration for action " + a.getSimpleName() + " over '" + e + "' has been evaluated to a negative value (" + d + "). Unsupported"); } return d; }
DurationEvaluators { public int evaluate(Model mo, Class<? extends Action> a, Element e) throws SchedulerException { ActionDurationEvaluator<Element> ev = durations.get(a); if (ev == null) { throw new SchedulerModelingException(null, "Unable to estimate the duration of action '" + a.getSimpleName() + "' related to '" + e + "'"); } int d = ev.evaluate(mo, e); if (d <= 0) { throw new SchedulerModelingException(null, "The duration for action " + a.getSimpleName() + " over '" + e + "' has been evaluated to a negative value (" + d + "). Unsupported"); } return d; } }
DurationEvaluators { public int evaluate(Model mo, Class<? extends Action> a, Element e) throws SchedulerException { ActionDurationEvaluator<Element> ev = durations.get(a); if (ev == null) { throw new SchedulerModelingException(null, "Unable to estimate the duration of action '" + a.getSimpleName() + "' related to '" + e + "'"); } int d = ev.evaluate(mo, e); if (d <= 0) { throw new SchedulerModelingException(null, "The duration for action " + a.getSimpleName() + " over '" + e + "' has been evaluated to a negative value (" + d + "). Unsupported"); } return d; } DurationEvaluators(); }
DurationEvaluators { public int evaluate(Model mo, Class<? extends Action> a, Element e) throws SchedulerException { ActionDurationEvaluator<Element> ev = durations.get(a); if (ev == null) { throw new SchedulerModelingException(null, "Unable to estimate the duration of action '" + a.getSimpleName() + "' related to '" + e + "'"); } int d = ev.evaluate(mo, e); if (d <= 0) { throw new SchedulerModelingException(null, "The duration for action " + a.getSimpleName() + " over '" + e + "' has been evaluated to a negative value (" + d + "). Unsupported"); } return d; } DurationEvaluators(); boolean register(Class<? extends Action> a, ActionDurationEvaluator e); boolean unRegister(Class<? extends Action> a); boolean isRegistered(Class<? extends Action> a); ActionDurationEvaluator<Element> getEvaluator(Class<? extends Action> a); int evaluate(Model mo, Class<? extends Action> a, Element e); static DurationEvaluators newBundle(); }
DurationEvaluators { public int evaluate(Model mo, Class<? extends Action> a, Element e) throws SchedulerException { ActionDurationEvaluator<Element> ev = durations.get(a); if (ev == null) { throw new SchedulerModelingException(null, "Unable to estimate the duration of action '" + a.getSimpleName() + "' related to '" + e + "'"); } int d = ev.evaluate(mo, e); if (d <= 0) { throw new SchedulerModelingException(null, "The duration for action " + a.getSimpleName() + " over '" + e + "' has been evaluated to a negative value (" + d + "). Unsupported"); } return d; } DurationEvaluators(); boolean register(Class<? extends Action> a, ActionDurationEvaluator e); boolean unRegister(Class<? extends Action> a); boolean isRegistered(Class<? extends Action> a); ActionDurationEvaluator<Element> getEvaluator(Class<? extends Action> a); int evaluate(Model mo, Class<? extends Action> a, Element e); static DurationEvaluators newBundle();  }