/** Check if all resources are add in DietManager */ @Test public void test1() { dm = new DietManager(); vishnuPlugin = new GoVishnuPlugin(dm); vishnuPlugin.init(0); vishnuPlugin.stopListener(); vishnuPlugin.waitProperExit(); Assert.assertEquals(5, dm.getSeds().size()); Assert.assertNotNull(dm.getManagedSoftware("diet_1_1")); Assert.assertNotNull(dm.getManagedSoftware("diet_1_2")); Assert.assertNotNull(dm.getManagedSoftware("diet_2_2")); Assert.assertNotNull(dm.getManagedSoftware("diet_2_3")); Assert.assertNotNull(dm.getManagedSoftware("diet_2_1")); }
/** Simulate a removed resource. Restart polling */ @Test public void test2() { dm = new DietManager(); vishnuPlugin = new GoVishnuPlugin(dm); vishnuPlugin.init(0); ProcessIF processRemoved = new ProcessStubImpl(); processRemoved.setDietId("diet_2_1"); VISHNU_IMSStub.getProcesses("fakeSessionKey", null).getProcesses().remove(processRemoved); vishnuPlugin.stopListener(); vishnuPlugin.waitProperExit(); Assert.assertEquals(4, dm.getSeds().size()); Assert.assertNull(dm.getManagedSoftware("diet_2_1")); // Restart vishnuPlugin.init(0); }