public void execute(WorkerProcessContext workerProcessContext) { // Check environment assertThat(System.getProperty("test.system.property"), equalTo("value")); assertThat(System.getenv().get("TEST_ENV_VAR"), equalTo("value")); // Check ClassLoaders ClassLoader antClassLoader = Project.class.getClassLoader(); ClassLoader thisClassLoader = getClass().getClassLoader(); ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); assertThat(antClassLoader, not(sameInstance(systemClassLoader))); assertThat(thisClassLoader, not(sameInstance(systemClassLoader))); assertThat(antClassLoader.getParent(), equalTo(systemClassLoader.getParent())); try { assertThat( thisClassLoader.loadClass(Project.class.getName()), sameInstance((Object) Project.class)); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } // Send some messages TestListenerInterface sender = workerProcessContext.getServerConnection().addOutgoing(TestListenerInterface.class); sender.send("message 1", 1); sender.send("message 2", 2); }
private void readObject(ObjectInputStream instr) { System.exit(0); }