Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.zonky.test.db.flyway;
import com.cedarsoftware.util.DeepEquals;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import javax.sql.DataSource;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import static org.springframework.util.ReflectionUtils.FieldFilter;
import static org.springframework.util.ReflectionUtils.doWithFields;
import static org.springframework.util.ReflectionUtils.getField;
import static org.springframework.util.ReflectionUtils.makeAccessible;
import static org.springframework.util.ReflectionUtils.setField;
public class FlywayDescriptor {
private static final Set BASIC_FIELDS = ImmutableSet.of(
"locations", "schemaNames", "table",
"sqlMigrationPrefix", "repeatableSqlMigrationPrefix",
"sqlMigrationSeparator", "sqlMigrationSuffixes",
"ignoreMissingMigrations", "ignoreFutureMigrations",
"validateOnMigrate"
);
// these objects require deep comparison of all nested fields
private static final Set SPECIAL_FIELDS = ImmutableSet.of(
"resourceProvider", "javaMigrationClassProvider",
"javaMigrations", "callbacks"
);
private static final Set EXCLUDED_FIELDS = ImmutableSet.of(
"cleanDisabled", "dbConnectionInfoPrinted", "classScanner", "pluginRegister"
);
private static final Set> EXCLUDED_TYPES = ImmutableSet.of(
DataSource.class, ClassLoader.class, OutputStream.class
);
private static final FieldFilter OTHER_FIELDS =
field -> !Modifier.isStatic(field.getModifiers())
&& !BASIC_FIELDS.contains(field.getName())
&& !SPECIAL_FIELDS.contains(field.getName())
&& !EXCLUDED_FIELDS.contains(field.getName())
&& !EXCLUDED_TYPES.contains(field.getType());
private static final FieldFilter PLUGIN_FIELDS =
field -> !Modifier.isStatic(field.getModifiers())
&& !EXCLUDED_TYPES.contains(field.getType());
private final List locations;
private final List schemas;
private final String table;
private final String sqlMigrationPrefix;
private final String repeatableSqlMigrationPrefix;
private final String sqlMigrationSeparator;
private final List sqlMigrationSuffixes;
private final boolean ignoreMissingMigrations;
private final boolean ignoreFutureMigrations;
private final boolean validateOnMigrate;
private final Object resourceProvider;
private final Object javaMigrationClassProvider;
private final List