@Test public void createDrain() throws Exception { File source = folder.newFile("source"); File drain = folder.newFile("drain"); try (FileResourceMirror resource = new FileResourceMirror("testing")) { ProcessScript<String> script = script(source, drain); ProcessScript<String> opposite = script(drain, source); resource.prepare(gate(script, opposite)); try (DrainDriver<String> driver = resource.createDrain(script)) { driver.prepare(); driver.put("Hello"); driver.put("World!"); } try (SourceDriver<String> verifier = resource.createSource(opposite)) { verifier.prepare(); assertThat(verifier.next(), is(true)); assertThat(verifier.get(), is("Hello")); assertThat(verifier.next(), is(true)); assertThat(verifier.get(), is("World!")); assertThat(verifier.next(), is(false)); } } }
@Override public <T> DrainDriver<T> createDrain(ProcessScript<T> script) throws IOException { File file = getPath(script, DriverScript.Kind.DRAIN); return new FileDrainDriver<>(script.getDataClass(), file); }
FileResourceMirror extends ResourceMirror { @Override public <T> DrainDriver<T> createDrain(ProcessScript<T> script) throws IOException { File file = getPath(script, DriverScript.Kind.DRAIN); return new FileDrainDriver<>(script.getDataClass(), file); } }
FileResourceMirror extends ResourceMirror { @Override public <T> DrainDriver<T> createDrain(ProcessScript<T> script) throws IOException { File file = getPath(script, DriverScript.Kind.DRAIN); return new FileDrainDriver<>(script.getDataClass(), file); } FileResourceMirror(String name); }
FileResourceMirror extends ResourceMirror { @Override public <T> DrainDriver<T> createDrain(ProcessScript<T> script) throws IOException { File file = getPath(script, DriverScript.Kind.DRAIN); return new FileDrainDriver<>(script.getDataClass(), file); } FileResourceMirror(String name); @Override String getName(); @Override void prepare(GateScript script); @Override SourceDriver<T> createSource(ProcessScript<T> script); @Override DrainDriver<T> createDrain(ProcessScript<T> script); @Override void close(); }
FileResourceMirror extends ResourceMirror { @Override public <T> DrainDriver<T> createDrain(ProcessScript<T> script) throws IOException { File file = getPath(script, DriverScript.Kind.DRAIN); return new FileDrainDriver<>(script.getDataClass(), file); } FileResourceMirror(String name); @Override String getName(); @Override void prepare(GateScript script); @Override SourceDriver<T> createSource(ProcessScript<T> script); @Override DrainDriver<T> createDrain(ProcessScript<T> script); @Override void close();  }