/** 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); }
@Before public void init() { // Init ProcessIFes ListProcessesStub processes = new ListProcessesStub(); ProcessIF p = new ProcessStubImpl(); p.setProcessName("UMS"); p.setMachineId("machine_1"); p.setDietId("diet_1_1"); p.setState(1); p.setTimestamp(123); p.setScript("script1"); processes.getProcesses().add(p); p = new ProcessStubImpl(); p.setProcessName("IMS"); p.setMachineId("machine_1"); p.setDietId("diet_1_2"); p.setState(1); p.setTimestamp(124); p.setScript("script2"); processes.getProcesses().add(p); p = new ProcessStubImpl(); p.setProcessName("IMS"); p.setMachineId("machine_2"); p.setDietId("diet_2_1"); p.setState(1); p.setTimestamp(126); p.setScript("script3"); processes.getProcesses().add(p); p = new ProcessStubImpl(); p.setProcessName("FMS"); p.setMachineId("machine_2"); p.setDietId("diet_2_2"); p.setState(1); p.setTimestamp(126); p.setScript("script4"); processes.getProcesses().add(p); p = new ProcessStubImpl(); p.setProcessName("TMS"); p.setMachineId("machine_2"); p.setDietId("diet_2_3"); p.setState(1); p.setTimestamp(127); p.setScript("script5"); processes.getProcesses().add(p); VISHNU_IMSStub.setProcesses(processes); }