@Test public void execute_dual() throws Exception { File in = folder.newFile("in"); File temp = folder.newFile("temp"); File out = folder.newFile("out"); put(in, "aaa", "bbb", "ccc"); GateProfile profile = profile(); GateScript importer = script(p("testing", "fs1", in, "fs2", temp)); try (GateTask task = new GateTask( profile, importer, "testing", true, false, new ParameterList())) { task.execute(); } GateScript exporter = script(p("testing", "fs2", temp, "fs1", out)); try (GateTask task = new GateTask( profile, exporter, "testing", false, true, new ParameterList())) { task.execute(); } List<String> results = get(out); assertThat(results, is(Arrays.asList("aaa", "bbb", "ccc"))); }
public void execute() throws IOException, InterruptedException { WGLOG.info("I00000", sessionId, profile.getName(), script.getName()); long start = System.currentTimeMillis(); WGLOG.info("I00001", sessionId, profile.getName(), script.getName()); try { try (SafeCloser<SessionMirror> session = new SafeCloser<SessionMirror>() { @Override protected void handle(IOException exception) throws IOException { WGLOG.warn(exception, "W00001", sessionId, profile.getName(), script.getName()); } }) { session.set(attachSession(createSession)); WGLOG.info("I00002", sessionId, profile.getName(), script.getName()); List<ResourceMirror> resources = createResources(); if (createSession) { WGLOG.info("I00003", sessionId, profile.getName(), script.getName()); fireSessionCreated(resources); } WGLOG.info("I00004", sessionId, profile.getName(), script.getName()); prepareResources(resources); WGLOG.info("I00005", sessionId, profile.getName(), script.getName()); runGateProcesses(resources); if (completeSession) { WGLOG.info("I00006", sessionId, profile.getName(), script.getName()); fireSessionCompleted(resources); WGLOG.info("I00007", sessionId, profile.getName(), script.getName()); session.get().complete(); } } WGLOG.info("I00008", sessionId, profile.getName(), script.getName()); } finally { long end = System.currentTimeMillis(); WGLOG.info("I00999", sessionId, profile.getName(), script.getName(), end - start); } }
GateTask implements Closeable { public void execute() throws IOException, InterruptedException { WGLOG.info("I00000", sessionId, profile.getName(), script.getName()); long start = System.currentTimeMillis(); WGLOG.info("I00001", sessionId, profile.getName(), script.getName()); try { try (SafeCloser<SessionMirror> session = new SafeCloser<SessionMirror>() { @Override protected void handle(IOException exception) throws IOException { WGLOG.warn(exception, "W00001", sessionId, profile.getName(), script.getName()); } }) { session.set(attachSession(createSession)); WGLOG.info("I00002", sessionId, profile.getName(), script.getName()); List<ResourceMirror> resources = createResources(); if (createSession) { WGLOG.info("I00003", sessionId, profile.getName(), script.getName()); fireSessionCreated(resources); } WGLOG.info("I00004", sessionId, profile.getName(), script.getName()); prepareResources(resources); WGLOG.info("I00005", sessionId, profile.getName(), script.getName()); runGateProcesses(resources); if (completeSession) { WGLOG.info("I00006", sessionId, profile.getName(), script.getName()); fireSessionCompleted(resources); WGLOG.info("I00007", sessionId, profile.getName(), script.getName()); session.get().complete(); } } WGLOG.info("I00008", sessionId, profile.getName(), script.getName()); } finally { long end = System.currentTimeMillis(); WGLOG.info("I00999", sessionId, profile.getName(), script.getName(), end - start); } } }
GateTask implements Closeable { public void execute() throws IOException, InterruptedException { WGLOG.info("I00000", sessionId, profile.getName(), script.getName()); long start = System.currentTimeMillis(); WGLOG.info("I00001", sessionId, profile.getName(), script.getName()); try { try (SafeCloser<SessionMirror> session = new SafeCloser<SessionMirror>() { @Override protected void handle(IOException exception) throws IOException { WGLOG.warn(exception, "W00001", sessionId, profile.getName(), script.getName()); } }) { session.set(attachSession(createSession)); WGLOG.info("I00002", sessionId, profile.getName(), script.getName()); List<ResourceMirror> resources = createResources(); if (createSession) { WGLOG.info("I00003", sessionId, profile.getName(), script.getName()); fireSessionCreated(resources); } WGLOG.info("I00004", sessionId, profile.getName(), script.getName()); prepareResources(resources); WGLOG.info("I00005", sessionId, profile.getName(), script.getName()); runGateProcesses(resources); if (completeSession) { WGLOG.info("I00006", sessionId, profile.getName(), script.getName()); fireSessionCompleted(resources); WGLOG.info("I00007", sessionId, profile.getName(), script.getName()); session.get().complete(); } } WGLOG.info("I00008", sessionId, profile.getName(), script.getName()); } finally { long end = System.currentTimeMillis(); WGLOG.info("I00999", sessionId, profile.getName(), script.getName(), end - start); } } GateTask(
            GateProfile profile,
            GateScript script,
            String sessionId,
            boolean createSession,
            boolean completeSession,
            ParameterList arguments); }
GateTask implements Closeable { public void execute() throws IOException, InterruptedException { WGLOG.info("I00000", sessionId, profile.getName(), script.getName()); long start = System.currentTimeMillis(); WGLOG.info("I00001", sessionId, profile.getName(), script.getName()); try { try (SafeCloser<SessionMirror> session = new SafeCloser<SessionMirror>() { @Override protected void handle(IOException exception) throws IOException { WGLOG.warn(exception, "W00001", sessionId, profile.getName(), script.getName()); } }) { session.set(attachSession(createSession)); WGLOG.info("I00002", sessionId, profile.getName(), script.getName()); List<ResourceMirror> resources = createResources(); if (createSession) { WGLOG.info("I00003", sessionId, profile.getName(), script.getName()); fireSessionCreated(resources); } WGLOG.info("I00004", sessionId, profile.getName(), script.getName()); prepareResources(resources); WGLOG.info("I00005", sessionId, profile.getName(), script.getName()); runGateProcesses(resources); if (completeSession) { WGLOG.info("I00006", sessionId, profile.getName(), script.getName()); fireSessionCompleted(resources); WGLOG.info("I00007", sessionId, profile.getName(), script.getName()); session.get().complete(); } } WGLOG.info("I00008", sessionId, profile.getName(), script.getName()); } finally { long end = System.currentTimeMillis(); WGLOG.info("I00999", sessionId, profile.getName(), script.getName(), end - start); } } GateTask(
            GateProfile profile,
            GateScript script,
            String sessionId,
            boolean createSession,
            boolean completeSession,
            ParameterList arguments); void execute(); @Override void close(); }
GateTask implements Closeable { public void execute() throws IOException, InterruptedException { WGLOG.info("I00000", sessionId, profile.getName(), script.getName()); long start = System.currentTimeMillis(); WGLOG.info("I00001", sessionId, profile.getName(), script.getName()); try { try (SafeCloser<SessionMirror> session = new SafeCloser<SessionMirror>() { @Override protected void handle(IOException exception) throws IOException { WGLOG.warn(exception, "W00001", sessionId, profile.getName(), script.getName()); } }) { session.set(attachSession(createSession)); WGLOG.info("I00002", sessionId, profile.getName(), script.getName()); List<ResourceMirror> resources = createResources(); if (createSession) { WGLOG.info("I00003", sessionId, profile.getName(), script.getName()); fireSessionCreated(resources); } WGLOG.info("I00004", sessionId, profile.getName(), script.getName()); prepareResources(resources); WGLOG.info("I00005", sessionId, profile.getName(), script.getName()); runGateProcesses(resources); if (completeSession) { WGLOG.info("I00006", sessionId, profile.getName(), script.getName()); fireSessionCompleted(resources); WGLOG.info("I00007", sessionId, profile.getName(), script.getName()); session.get().complete(); } } WGLOG.info("I00008", sessionId, profile.getName(), script.getName()); } finally { long end = System.currentTimeMillis(); WGLOG.info("I00999", sessionId, profile.getName(), script.getName(), end - start); } } GateTask(
            GateProfile profile,
            GateScript script,
            String sessionId,
            boolean createSession,
            boolean completeSession,
            ParameterList arguments); void execute(); @Override void close();  }