@Test public void cleanupDrain() throws Exception { Map<String, String> conf = new HashMap<>(); conf.put(JdbcProcess.TABLE.key(), "PAIR"); conf.put(JdbcProcess.COLUMNS.key(), "KEY,VALUE"); conf.put(JdbcProcess.JDBC_SUPPORT.key(), PairSupport.class.getName()); conf.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); ProcessScript<Pair> process = process(dummy(), new DriverScript("jdbc", conf)); h2.execute("INSERT INTO PAIR (KEY, VALUE) VALUES (1, 'Hello1, world!')"); h2.execute("INSERT INTO PAIR (KEY, VALUE) VALUES (2, 'Hello2, world!')"); h2.execute("INSERT INTO PAIR (KEY, VALUE) VALUES (3, 'Hello3, world!')"); JdbcResourceManipulator manipulator = new JdbcResourceManipulator(profile(), new ParameterList()); assertThat(h2.count("PAIR"), is(3)); manipulator.cleanupDrain(process); assertThat(h2.count("PAIR"), is(0)); }
@Override public void cleanupDrain(ProcessScript<?> script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } JdbcScript<?> jdbc = createOppositeJdbcScript(script, DriverScript.Kind.DRAIN); truncate(jdbc); }
JdbcResourceManipulator extends ResourceManipulator { @Override public void cleanupDrain(ProcessScript<?> script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } JdbcScript<?> jdbc = createOppositeJdbcScript(script, DriverScript.Kind.DRAIN); truncate(jdbc); } }
JdbcResourceManipulator extends ResourceManipulator { @Override public void cleanupDrain(ProcessScript<?> script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } JdbcScript<?> jdbc = createOppositeJdbcScript(script, DriverScript.Kind.DRAIN); truncate(jdbc); } JdbcResourceManipulator(JdbcProfile profile, ParameterList arguments); }
JdbcResourceManipulator extends ResourceManipulator { @Override public void cleanupDrain(ProcessScript<?> script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } JdbcScript<?> jdbc = createOppositeJdbcScript(script, DriverScript.Kind.DRAIN); truncate(jdbc); } JdbcResourceManipulator(JdbcProfile profile, ParameterList arguments); @Override String getName(); @Override void cleanupSource(ProcessScript<?> script); @Override void cleanupDrain(ProcessScript<?> script); @Override SourceDriver<T> createSourceForSource(ProcessScript<T> script); @Override DrainDriver<T> createDrainForSource(ProcessScript<T> script); @Override SourceDriver<T> createSourceForDrain(ProcessScript<T> script); @Override DrainDriver<T> createDrainForDrain(ProcessScript<T> script); }
JdbcResourceManipulator extends ResourceManipulator { @Override public void cleanupDrain(ProcessScript<?> script) throws IOException { if (script == null) { throw new IllegalArgumentException("script must not be null"); } JdbcScript<?> jdbc = createOppositeJdbcScript(script, DriverScript.Kind.DRAIN); truncate(jdbc); } JdbcResourceManipulator(JdbcProfile profile, ParameterList arguments); @Override String getName(); @Override void cleanupSource(ProcessScript<?> script); @Override void cleanupDrain(ProcessScript<?> script); @Override SourceDriver<T> createSourceForSource(ProcessScript<T> script); @Override DrainDriver<T> createDrainForSource(ProcessScript<T> script); @Override SourceDriver<T> createSourceForDrain(ProcessScript<T> script); @Override DrainDriver<T> createDrainForDrain(ProcessScript<T> script);  }