public void test() throws EtlExecutorException { EtlExecutor se = prepareExecutor(null); se.execute(); assertEquals("jdbc:hsqldb:mem:propertiestest", params.getUrl()); assertEquals("sa", params.getUser()); assertEquals("", params.getPassword()); // check substituted properties in a context assertEquals("1", ctx.getParameter("a")); assertEquals("bar", ctx.getParameter("foo")); assertEquals("1", ctx.getParameter("var")); assertEquals("1|1|1|1|1|1", ctx.getParameter("b")); assertEquals("jdbc:hsqldb:mem", ctx.getParameter("url.prefix")); assertEquals("propertiestest", ctx.getParameter("dbname")); assertEquals("org.hsqldb.jdbcDriver", ctx.getParameter("driver")); assertEquals("org.hsqldb.jdbcDriver", ctx.getParameter("driver")); assertEquals("jdbc:hsqldb:mem:propertiestest", ctx.getParameter("url")); assertEquals("sa", ctx.getParameter("user")); assertEquals("", ctx.getParameter("password")); Map<String, String> extra = new HashMap<String, String>(); extra.put("var", "2"); se = prepareExecutor(extra); se.execute(); assertEquals("2", ctx.getParameter("var")); assertEquals("2|2|2|2|2|2", ctx.getParameter("b")); }
public void test() throws EtlExecutorException { getConnection("text"); // Call just to close the DB final ByteArrayOutputStream out = new ByteArrayOutputStream(); testURLHandler = new TestURLHandler() { public InputStream getInputStream(final URL u) { return new ByteArrayInputStream( ("10,Ten,Ten,12-07-2012 10:00,10.1\n" + "11, Eleven , Eleven , 12-07-2012 11:00,-null-") .getBytes()); } public OutputStream getOutputStream(final URL u) { return out; } public int getContentLength(final URL u) { throw new UnsupportedOperationException(); } }; final EtlExecutor se = newEtlExecutor(); se.execute(); // 10,11 where parsed from CSV, 1,2,3 were directly inserted into DB String expectedResult = "1/One/One/11-07-2012 22:33/-null-\n" + "2/Two/ Two /11-07-2012 20:00/2.10\n" + "3/Three/ Three /11-07-2012 20:00/3.10\n" + "10/Ten/Ten/12-07-2012 10:00/10.10\n" + "11/Eleven/ Eleven /12-07-2012 11:00/-null-\n"; assertEquals(expectedResult, out.toString()); }
public void closeAll(final EtlContext ctx) { super.closeAll(ctx); }
public void rollbackAll(final EtlContext ctx) { super.rollbackAll(ctx); }