private void validateNoBaselineBreaks(DbDeployerAppContext appContext, Predicate<? super CompareBreak> breakIgnorePredicate) { MutableList<CompareBreak> sortedCompareBreaks = this.calculateBaselineBreaks(appContext).toList().sortThis( Comparators.fromFunctions( CompareBreak.TO_COMPARE_SUBJECT, Functions.chain(CompareBreak.TO_CLAZZ, CLASS_TO_NAME), Functions.chain(Functions.getToClass(), CLASS_TO_NAME) )); MutableList<CompareBreak> relevantBreaks = sortedCompareBreaks.reject(breakIgnorePredicate); LOG.info("Found " + relevantBreaks.size() + " breaks"); if (!relevantBreaks.isEmpty()) { throw new IllegalArgumentException( "Found some mismatches between your change alters (LEFT) and your baseline files (RIGHT). Please review:\n" + relevantBreaks.makeString("\n")); } }
private void validateNoBaselineBreaks(DbDeployerAppContext appContext, Predicate<? super CompareBreak> breakIgnorePredicate) { MutableList<CompareBreak> sortedCompareBreaks = this.calculateBaselineBreaks(appContext).toList().sortThis( Comparators.fromFunctions( CompareBreak.TO_COMPARE_SUBJECT, Functions.chain(CompareBreak.TO_CLAZZ, CLASS_TO_NAME), Functions.chain(Functions.getToClass(), CLASS_TO_NAME) )); MutableList<CompareBreak> relevantBreaks = sortedCompareBreaks.reject(breakIgnorePredicate); LOG.info("Found " + relevantBreaks.size() + " breaks"); if (!relevantBreaks.isEmpty()) { throw new IllegalArgumentException( "Found some mismatches between your change alters (LEFT) and your baseline files (RIGHT). Please review:\n" + relevantBreaks.makeString("\n")); } }
private MutableList<IndexMap> getColumnsOrderedBySelectivity(MutableList<UnmatchedIndexMap> allMissingRows, MutableList<UnmatchedIndexMap> allSurplusRows, MutableList<IndexMap> columnIndices) { LOGGER.info("Calculating column selectivity"); MutableList<Pair<IndexMap, Integer>> columnSelectivities = Lists.mutable.of(); for (IndexMap column : columnIndices) { CellComparator expectedComparator = this.columnComparators.getComparator(expectedData.getColumnName(column.getExpectedIndex())); Set<String> expectedValues = getColumnValues(allMissingRows, Functions.chain(expectedValueFunction(column), expectedComparator.getFormatter())); CellComparator actualComparator = this.columnComparators.getComparator(actualData.getColumnName(column.getActualIndex())); Set<String> actualValues = getColumnValues(allSurplusRows, Functions.chain(actualValueFunction(column), actualComparator.getFormatter())); actualValues.retainAll(expectedValues); int selectivity = actualValues.size(); if (selectivity > 0) { columnSelectivities.add(Tuples.pair(column, Integer.valueOf(selectivity))); } } return columnSelectivities .sortThis(Comparators.reverse(Comparators.byFunction(Functions.<Integer>secondOfPair()))) .collect(Functions.<IndexMap>firstOfPair()); }
LOGGER.info("Grouping by '{}' column", this.actualData.getColumnName(column.getActualIndex())); CellComparator expectedComparator = this.columnComparators.getComparator(expectedData.getColumnName(column.getExpectedIndex())); MutableListMultimap<String, UnmatchedIndexMap> missingRowsByColumn = missingRows.groupBy(Functions.chain(expectedValueFunction(column), expectedComparator.getFormatter())); CellComparator actualComparator = this.columnComparators.getComparator(actualData.getColumnName(column.getActualIndex())); MutableListMultimap<String, UnmatchedIndexMap> surplusRowsByColumn = surplusRows.groupBy(Functions.chain(actualValueFunction(column), actualComparator.getFormatter())); for (String key : missingRowsByColumn.keysView())
final MutableList<Pair<T, SortableDependency>> sortedChanges = sortMetadataPairs.toSortedListBy(Functions.chain(Functions.<SortableDependency>secondOfPair(), new Function<SortableDependency, Integer>() { @Override public Integer valueOf(SortableDependency sortableDependency) {
final MutableList<Pair<T, SortableDependency>> sortedChanges = sortMetadataPairs.toSortedListBy(Functions.chain(Functions.<SortableDependency>secondOfPair(), new Function<SortableDependency, Integer>() { @Override public Integer valueOf(SortableDependency sortableDependency) {
private void verify_FUNC_WITH_OVERLOAD(Multimap<String, DaRoutine> routinesByName, String routineName) { if (isFuncOverloadSupported()) { routineName = convertName(routineName); Verify.assertSize(3, routinesByName.get(routineName)); MutableList<DaRoutine> routines = routinesByName.get(routineName).toList().toSortedListBy(DaRoutine.TO_DEFINITION); Verify.assertAllSatisfy(routines, Predicates.attributeEqual(Functions.chain(DaRoutine.TO_SCHEMA, DaSchema.TO_NAME), getSchemaName())); if (!isOnlySpSupported()) { Verify.assertAllSatisfy(routines, Predicates.attributeEqual(DaRoutine.TO_ROUTINE_TYPE, DaRoutineType.function)); } Verify.assertSize(3, routines.collect(DaRoutine.TO_SPECIFIC_NAME).toSet()); assertThat(routines.get(0).getDefinition(), equalToIgnoringWhiteSpace(get_FUNC_WITH_OVERLOAD_1())); assertThat(routines.get(1).getDefinition(), equalToIgnoringWhiteSpace(get_FUNC_WITH_OVERLOAD_2())); assertThat(routines.get(2).getDefinition(), equalToIgnoringWhiteSpace(get_FUNC_WITH_OVERLOAD_3())); } else { Verify.assertSize(1, routinesByName.get(routineName)); DaRoutine routine = routinesByName.get(routineName).toList().get(0); assertEquals(routineName, routine.getName()); assertEquals(getSchemaName(), routine.getSchema().getName()); if (!isOnlySpSupported()) { assertEquals(DaRoutineType.function, routine.getRoutineType()); } assertThat(routine.getSpecificName(), not(isEmptyString())); assertThat(routine.getDefinition(), equalToIgnoringWhiteSpace(get_FUNC_WITH_OVERLOAD_3())); } }
MutableList<DaRoutine> routines = routinesByName.get(routineName).toList().toSortedListBy(DaRoutine.TO_DEFINITION); Verify.assertAllSatisfy(routines, Predicates.attributeEqual(Functions.chain(DaRoutine.TO_SCHEMA, DaSchema.TO_NAME), getSchemaName())); Verify.assertAllSatisfy(routines, Predicates.attributeEqual(DaRoutine.TO_ROUTINE_TYPE, DaRoutineType.procedure));