@Test public void singleDbms() { DbmsChangeSetFilter filter = new DbmsChangeSetFilter(new MySQLDatabase()); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null,null, "mysql"))); assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null,null, "mysql, oracle"))); assertFalse(filter.accepts(new ChangeSet(null, null, false, false, null,null, "oracle"))); 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 (databaseString != null && visitor.getApplicableDbms() != null && visitor.getApplicableDbms().size() > 0) { boolean shouldRemove = true; if (visitor.getApplicableDbms().contains(databaseString)) { shouldRemove = false; } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (databaseString == null) { return true; } if (changeSet.getDbmsSet() == null) { return true; } for (String dbms : changeSet.getDbmsSet()) { if (databaseString.equals(dbms)) { return true; } } return false; }
DbmsChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (databaseString != null && visitor.getApplicableDbms() != null && visitor.getApplicableDbms().size() > 0) { boolean shouldRemove = true; if (visitor.getApplicableDbms().contains(databaseString)) { shouldRemove = false; } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (databaseString == null) { return true; } if (changeSet.getDbmsSet() == null) { return true; } for (String dbms : changeSet.getDbmsSet()) { if (databaseString.equals(dbms)) { return true; } } return false; } }
DbmsChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (databaseString != null && visitor.getApplicableDbms() != null && visitor.getApplicableDbms().size() > 0) { boolean shouldRemove = true; if (visitor.getApplicableDbms().contains(databaseString)) { shouldRemove = false; } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (databaseString == null) { return true; } if (changeSet.getDbmsSet() == null) { return true; } for (String dbms : changeSet.getDbmsSet()) { if (databaseString.equals(dbms)) { return true; } } return false; } DbmsChangeSetFilter(Database database); }
DbmsChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (databaseString != null && visitor.getApplicableDbms() != null && visitor.getApplicableDbms().size() > 0) { boolean shouldRemove = true; if (visitor.getApplicableDbms().contains(databaseString)) { shouldRemove = false; } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (databaseString == null) { return true; } if (changeSet.getDbmsSet() == null) { return true; } for (String dbms : changeSet.getDbmsSet()) { if (databaseString.equals(dbms)) { return true; } } return false; } DbmsChangeSetFilter(Database database); boolean accepts(ChangeSet changeSet); }
DbmsChangeSetFilter implements ChangeSetFilter { public boolean accepts(ChangeSet changeSet) { List<SqlVisitor> visitorsToRemove = new ArrayList<SqlVisitor>(); for (SqlVisitor visitor : changeSet.getSqlVisitors()) { if (databaseString != null && visitor.getApplicableDbms() != null && visitor.getApplicableDbms().size() > 0) { boolean shouldRemove = true; if (visitor.getApplicableDbms().contains(databaseString)) { shouldRemove = false; } if (shouldRemove) { visitorsToRemove.add(visitor); } } } changeSet.getSqlVisitors().removeAll(visitorsToRemove); if (databaseString == null) { return true; } if (changeSet.getDbmsSet() == null) { return true; } for (String dbms : changeSet.getDbmsSet()) { if (databaseString.equals(dbms)) { return true; } } return false; } DbmsChangeSetFilter(Database database); boolean accepts(ChangeSet changeSet);  }