@Test(expected = IOException.class) public void prepare_invalid_drain() throws Exception { Map<String, String> conf = new HashMap<>(); DriverScript driverScript = new DriverScript("file", conf); try (FileResourceMirror resource = new FileResourceMirror(profile(), new ParameterList())) { ProcessScript<StringBuilder> a = process("a", driver("source"), dummy()); ProcessScript<StringBuilder> b = process("b", dummy(), driverScript); GateScript gate = script(a, b); resource.prepare(gate); fail(); } }
@Override public void prepare(GateScript script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } LOG.debug("Preparing file resource: {}", getName()); for (ProcessScript<?> process : script.getProcesses()) { if (process.getSourceScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.SOURCE); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.SOURCE); ProcessUtil.newDataModel(profile.getResourceName(), process); } if (process.getDrainScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.DRAIN); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.DRAIN); } } }
FileResourceMirror extends ResourceMirror { @Override public void prepare(GateScript script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } LOG.debug("Preparing file resource: {}", getName()); for (ProcessScript<?> process : script.getProcesses()) { if (process.getSourceScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.SOURCE); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.SOURCE); ProcessUtil.newDataModel(profile.getResourceName(), process); } if (process.getDrainScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.DRAIN); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.DRAIN); } } } }
FileResourceMirror extends ResourceMirror { @Override public void prepare(GateScript script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } LOG.debug("Preparing file resource: {}", getName()); for (ProcessScript<?> process : script.getProcesses()) { if (process.getSourceScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.SOURCE); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.SOURCE); ProcessUtil.newDataModel(profile.getResourceName(), process); } if (process.getDrainScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.DRAIN); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.DRAIN); } } } FileResourceMirror(FileProfile profile, ParameterList arguments); }
FileResourceMirror extends ResourceMirror { @Override public void prepare(GateScript script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } LOG.debug("Preparing file resource: {}", getName()); for (ProcessScript<?> process : script.getProcesses()) { if (process.getSourceScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.SOURCE); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.SOURCE); ProcessUtil.newDataModel(profile.getResourceName(), process); } if (process.getDrainScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.DRAIN); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.DRAIN); } } } FileResourceMirror(FileProfile profile, ParameterList arguments); @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 void prepare(GateScript script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } LOG.debug("Preparing file resource: {}", getName()); for (ProcessScript<?> process : script.getProcesses()) { if (process.getSourceScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.SOURCE); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.SOURCE); ProcessUtil.newDataModel(profile.getResourceName(), process); } if (process.getDrainScript().getResourceName().equals(getName())) { FileResourceUtil.getPath(profile, process, arguments, DriverScript.Kind.DRAIN); FileResourceUtil.loadSupport(profile, process, DriverScript.Kind.DRAIN); } } } FileResourceMirror(FileProfile profile, ParameterList arguments); @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();  }