@Test public void nullListContexts() { ContextChangeSetFilter filter = new ContextChangeSetFilter(); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test1", null))); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test2", null))); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test1, test2", null))); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, null))); }
public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (visitor.getContexts() != null && visitor.getContexts().size() > 0) { boolean shouldRemove = true; for (String context : contexts) { if (visitor.getContexts().contains(context.toLowerCase())) { shouldRemove = false; } } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (contexts == null || contexts.size() == 0) { return true; } if (changeSet.getContexts() == null) { return true; } for (String context : changeSet.getContexts()) { if (contexts.contains(context.toLowerCase())) { return true; } } return false; }
ContextChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (visitor.getContexts() != null && visitor.getContexts().size() > 0) { boolean shouldRemove = true; for (String context : contexts) { if (visitor.getContexts().contains(context.toLowerCase())) { shouldRemove = false; } } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (contexts == null || contexts.size() == 0) { return true; } if (changeSet.getContexts() == null) { return true; } for (String context : changeSet.getContexts()) { if (contexts.contains(context.toLowerCase())) { return true; } } return false; } }
ContextChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (visitor.getContexts() != null && visitor.getContexts().size() > 0) { boolean shouldRemove = true; for (String context : contexts) { if (visitor.getContexts().contains(context.toLowerCase())) { shouldRemove = false; } } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (contexts == null || contexts.size() == 0) { return true; } if (changeSet.getContexts() == null) { return true; } for (String context : changeSet.getContexts()) { if (contexts.contains(context.toLowerCase())) { return true; } } return false; } ContextChangeSetFilter(String... contexts); }
ContextChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (visitor.getContexts() != null && visitor.getContexts().size() > 0) { boolean shouldRemove = true; for (String context : contexts) { if (visitor.getContexts().contains(context.toLowerCase())) { shouldRemove = false; } } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (contexts == null || contexts.size() == 0) { return true; } if (changeSet.getContexts() == null) { return true; } for (String context : changeSet.getContexts()) { if (contexts.contains(context.toLowerCase())) { return true; } } return false; } ContextChangeSetFilter(String... contexts); boolean accepts(ChangeSet changeSet); }
ContextChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (visitor.getContexts() != null && visitor.getContexts().size() > 0) { boolean shouldRemove = true; for (String context : contexts) { if (visitor.getContexts().contains(context.toLowerCase())) { shouldRemove = false; } } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (contexts == null || contexts.size() == 0) { return true; } if (changeSet.getContexts() == null) { return true; } for (String context : changeSet.getContexts()) { if (contexts.contains(context.toLowerCase())) { return true; } } return false; } ContextChangeSetFilter(String... contexts); boolean accepts(ChangeSet changeSet);  }