// one task to drop, two failed schedule tries public void testAddToScheduleFailNoCleanup() { ConfigurationUtil.addFromArgs( TaskRunner.PARAM_DROP_TASK_MAX, "10", TaskRunner.PARAM_MIN_CLEANUP_INTERVAL, "0"); StepTask t1 = task(100, 200, 50); StepTask t2 = task(100, 200, 100); Schedule sched = sched(ListUtil.list(t1)); fact.setResult(sched); assertTrue(tr.addToSchedule(t1)); assertIsomorphic(ListUtil.list(t1), fact.scheduler.tasks); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getAcceptedTasks())); assertForegroundStat(1, TaskRunner.STAT_ACCEPTED); assertForegroundStat(0, TaskRunner.STAT_REFUSED); assertForegroundStat(1, TaskRunner.STAT_WAITING); assertForegroundStat(0, TaskRunner.STAT_DROPPED); assertFalse(tr.addToSchedule(t2)); assertEquals( ListUtil.list(ListUtil.list(t1), ListUtil.list(t1, t2), ListUtil.list(t1)), fact.createArgs); assertEquals(SetUtil.set(t1), SetUtil.theSet(fact.scheduler.tasks)); assertEquals(sched, tr.getCurrentSchedule()); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getAcceptedTasks())); assertForegroundStat(1, TaskRunner.STAT_ACCEPTED); assertForegroundStat(1, TaskRunner.STAT_REFUSED); assertForegroundStat(1, TaskRunner.STAT_WAITING); assertForegroundStat(0, TaskRunner.STAT_DROPPED); }
private void setEnabled(boolean enabled, int port) { ConfigurationUtil.addFromArgs( IcpManager.PARAM_ICP_ENABLED, Boolean.toString(enabled), IcpManager.PARAM_ICP_PORT, Integer.toString(enabled ? port : BAD_PORT)); }
public static void configHistoryParams(String rootLocation) throws IOException { ConfigurationUtil.addFromArgs( HistoryRepositoryImpl.PARAM_HISTORY_LOCATION, rootLocation, LockssRepositoryImpl.PARAM_CACHE_LOCATION, rootLocation, IdentityManager.PARAM_LOCAL_IP, "127.0.0.7"); }
// only one try, because no tasks to drop public void testAddToScheduleFailNothingToDrop() { ConfigurationUtil.addFromArgs(TaskRunner.PARAM_DROP_TASK_MAX, "2"); fact.setResult(null); StepTask t1 = task(100, 200, 50); assertFalse(tr.addToSchedule(t1)); assertEmpty(tr.getAcceptedTasks()); assertEquals(1, fact.createArgs.size()); assertForegroundStat(1, TaskRunner.STAT_REFUSED); assertForegroundStat(0, TaskRunner.STAT_WAITING); assertForegroundStat(0, TaskRunner.STAT_DROPPED); }
/* Inherit documentation */ public void setUp() throws Exception { super.setUp(); ConfigurationUtil.addFromArgs( "org.lockss.log.IcpManager.level", "debug3", "org.lockss.log.IcpSocketImpl.level", "debug3"); setEnabled(false, BAD_PORT); setConfigCalled = false; mockLockssDaemon = getMockLockssDaemon(); testableIcpManager = new TestableIcpManager(); mockLockssDaemon.setIcpManager(testableIcpManager); testableIcpManager.initService(mockLockssDaemon); mockLockssDaemon.setDaemonInited(true); testableIcpManager.startService(); }
// one task to drop, succeeds after dropping it public void testAddToScheduleOkAfterDrops() { log.debug("testAddToScheduleOkAfterDrops()"); ConfigurationUtil.addFromArgs( TaskRunner.PARAM_DROP_TASK_MAX, "10", TaskRunner.PARAM_MIN_CLEANUP_INTERVAL, "0"); StepTask t1 = task(100, 200, 50); StepTask t2 = task(100, 200, 100); Schedule sched1 = sched(ListUtil.list(t1)); Schedule sched2 = sched(ListUtil.list(t2)); fact.setResults(ListUtil.list(sched1, null, null, sched2, sched2)); TimeBase.step(101); assertTrue(tr.addToSchedule(t1)); assertIsomorphic(ListUtil.list(t1), fact.scheduler.tasks); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getAcceptedTasks())); assertForegroundStat(1, TaskRunner.STAT_ACCEPTED); assertForegroundStat(0, TaskRunner.STAT_REFUSED); assertForegroundStat(1, TaskRunner.STAT_WAITING); assertForegroundStat(0, TaskRunner.STAT_DROPPED); assertTrue(tr.addToSchedule(t2)); assertEquals( ListUtil.list( ListUtil.list(t1), ListUtil.list(t1, t2), ListUtil.list(t1), Collections.EMPTY_SET, ListUtil.list(t1, t2)), fact.createArgs); assertEquals(SetUtil.set(t1, t2), SetUtil.theSet(fact.scheduler.tasks)); assertTrue(t1.isDropped()); assertEquals(sched2, tr.getCurrentSchedule()); assertEquals(SetUtil.set(t1, t2), SetUtil.theSet(tr.getAcceptedTasks())); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getOverrunTasks())); assertForegroundStat(2, TaskRunner.STAT_ACCEPTED); assertForegroundStat(0, TaskRunner.STAT_REFUSED); assertForegroundStat(1, TaskRunner.STAT_WAITING); assertForegroundStat(1, TaskRunner.STAT_DROPPED); t2.cancel(); assertForegroundStat(2, TaskRunner.STAT_ACCEPTED); assertForegroundStat(0, TaskRunner.STAT_REFUSED); assertForegroundStat(0, TaskRunner.STAT_WAITING); assertForegroundStat(1, TaskRunner.STAT_DROPPED); assertForegroundStat(1, TaskRunner.STAT_CANCELLED); }
// one task not ready to start yet, so not droppable public void testAddToScheduleFailNoDroppable() { log.debug("testAddToScheduleOkAfterDrops()"); ConfigurationUtil.addFromArgs( TaskRunner.PARAM_DROP_TASK_MAX, "10", TaskRunner.PARAM_MIN_CLEANUP_INTERVAL, "0"); StepTask t1 = task(100, 200, 50); StepTask t2 = task(100, 200, 100); Schedule sched1 = sched(ListUtil.list(t1)); Schedule sched2 = sched(ListUtil.list(t2)); fact.setResults(ListUtil.list(sched1, null, null, sched2, sched2)); assertTrue(tr.addToSchedule(t1)); assertIsomorphic(ListUtil.list(t1), fact.scheduler.tasks); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getAcceptedTasks())); assertFalse(tr.addToSchedule(t2)); assertEquals( ListUtil.list(ListUtil.list(t1), ListUtil.list(t1, t2), ListUtil.list(t1)), fact.createArgs); assertEquals(SetUtil.set(t1), SetUtil.theSet(fact.scheduler.tasks)); assertFalse(t1.isDropped()); assertEquals(sched1, tr.getCurrentSchedule()); assertEquals(SetUtil.set(t1), SetUtil.theSet(tr.getAcceptedTasks())); assertEmpty(SetUtil.theSet(tr.getOverrunTasks())); }
public void setUp() throws Exception { super.setUp(); ConfigurationUtil.addFromArgs( CXSerializer.PARAM_COMPATIBILITY_MODE, Integer.toString(CXSerializer.XSTREAM_MODE)); }