@Test public void testColumnCaseChanges() throws Exception { String[] directives = new String[] { "change-column-case lower", }; List<Row> rows = Arrays.asList( new Row("Url", "1").add("Fname", "2").add("LName", "3").add("ADDRESS", "4") ); rows = TestingRig.execute(directives, rows); Assert.assertTrue(rows.size() == 1); Assert.assertEquals("url", rows.get(0).getColumn(0)); }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { for (int i = 0; i < row.width(); ++i) { String name = row.getColumn(i); if (toLower) { row.setColumn(i, name.toLowerCase()); } else { row.setColumn(i, name.toUpperCase()); } } } return rows; }
ChangeColCaseNames implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { for (int i = 0; i < row.width(); ++i) { String name = row.getColumn(i); if (toLower) { row.setColumn(i, name.toLowerCase()); } else { row.setColumn(i, name.toUpperCase()); } } } return rows; } }
ChangeColCaseNames implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { for (int i = 0; i < row.width(); ++i) { String name = row.getColumn(i); if (toLower) { row.setColumn(i, name.toLowerCase()); } else { row.setColumn(i, name.toUpperCase()); } } } return rows; }  }
ChangeColCaseNames implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { for (int i = 0; i < row.width(); ++i) { String name = row.getColumn(i); if (toLower) { row.setColumn(i, name.toLowerCase()); } else { row.setColumn(i, name.toUpperCase()); } } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); }
ChangeColCaseNames implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { for (int i = 0; i < row.width(); ++i) { String name = row.getColumn(i); if (toLower) { row.setColumn(i, name.toLowerCase()); } else { row.setColumn(i, name.toUpperCase()); } } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); static final String NAME; }