@Test public void accepts_noneRun() throws DatabaseException { Database database = createMock(Database.class); expect(database.getRanChangeSetList()).andReturn(new ArrayList<RanChangeSet>()); replay(database); ShouldRunChangeSetFilter filter = new ShouldRunChangeSetFilter(database); assertTrue(filter.accepts(new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null))); }
@SuppressWarnings({"RedundantIfStatement"}) public boolean accepts(ChangeSet changeSet) { for (RanChangeSet ranChangeSet : ranChangeSets) { if (ranChangeSet.getId().equals(changeSet.getId()) && ranChangeSet.getAuthor().equals(changeSet.getAuthor()) && isPathEquals(changeSet, ranChangeSet)) { if (changeSet.shouldAlwaysRun() && ranChangeSet.getLastCheckSum() != null) { return true; } else if (changeSet.shouldRunOnChange() && !changeSet.generateCheckSum().equals(ranChangeSet.getLastCheckSum())) { return true; } else { return false; } } } return true; }
ShouldRunChangeSetFilter implements ChangeSetFilter { @SuppressWarnings({"RedundantIfStatement"}) public boolean accepts(ChangeSet changeSet) { for (RanChangeSet ranChangeSet : ranChangeSets) { if (ranChangeSet.getId().equals(changeSet.getId()) && ranChangeSet.getAuthor().equals(changeSet.getAuthor()) && isPathEquals(changeSet, ranChangeSet)) { if (changeSet.shouldAlwaysRun() && ranChangeSet.getLastCheckSum() != null) { return true; } else if (changeSet.shouldRunOnChange() && !changeSet.generateCheckSum().equals(ranChangeSet.getLastCheckSum())) { return true; } else { return false; } } } return true; } }
ShouldRunChangeSetFilter implements ChangeSetFilter { @SuppressWarnings({"RedundantIfStatement"}) public boolean accepts(ChangeSet changeSet) { for (RanChangeSet ranChangeSet : ranChangeSets) { if (ranChangeSet.getId().equals(changeSet.getId()) && ranChangeSet.getAuthor().equals(changeSet.getAuthor()) && isPathEquals(changeSet, ranChangeSet)) { if (changeSet.shouldAlwaysRun() && ranChangeSet.getLastCheckSum() != null) { return true; } else if (changeSet.shouldRunOnChange() && !changeSet.generateCheckSum().equals(ranChangeSet.getLastCheckSum())) { return true; } else { return false; } } } return true; } ShouldRunChangeSetFilter(Database database); }
ShouldRunChangeSetFilter implements ChangeSetFilter { @SuppressWarnings({"RedundantIfStatement"}) public boolean accepts(ChangeSet changeSet) { for (RanChangeSet ranChangeSet : ranChangeSets) { if (ranChangeSet.getId().equals(changeSet.getId()) && ranChangeSet.getAuthor().equals(changeSet.getAuthor()) && isPathEquals(changeSet, ranChangeSet)) { if (changeSet.shouldAlwaysRun() && ranChangeSet.getLastCheckSum() != null) { return true; } else if (changeSet.shouldRunOnChange() && !changeSet.generateCheckSum().equals(ranChangeSet.getLastCheckSum())) { return true; } else { return false; } } } return true; } ShouldRunChangeSetFilter(Database database); @SuppressWarnings({"RedundantIfStatement"}) boolean accepts(ChangeSet changeSet); }
ShouldRunChangeSetFilter implements ChangeSetFilter { @SuppressWarnings({"RedundantIfStatement"}) public boolean accepts(ChangeSet changeSet) { for (RanChangeSet ranChangeSet : ranChangeSets) { if (ranChangeSet.getId().equals(changeSet.getId()) && ranChangeSet.getAuthor().equals(changeSet.getAuthor()) && isPathEquals(changeSet, ranChangeSet)) { if (changeSet.shouldAlwaysRun() && ranChangeSet.getLastCheckSum() != null) { return true; } else if (changeSet.shouldRunOnChange() && !changeSet.generateCheckSum().equals(ranChangeSet.getLastCheckSum())) { return true; } else { return false; } } } return true; } ShouldRunChangeSetFilter(Database database); @SuppressWarnings({"RedundantIfStatement"}) boolean accepts(ChangeSet changeSet); public List<RanChangeSet> ranChangeSets; }