mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-11256: SchemaBootstrap must compare running schema against reference dump
Reference schemas (e.g. classpath:org/alfresco/util/schemacomp/reference/PostgreSQLDialect-Reference.xml) are loaded (if present) and the database is compared to that reference schema. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31991 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,7 +42,7 @@ public abstract class AbstractDbObject implements DbObject
|
||||
/** How differences in the name field should be reported */
|
||||
private Strength nameStrength = Strength.ERROR;
|
||||
protected ComparisonUtils comparisonUtils = new DefaultComparisonUtils();
|
||||
private List<DbValidator<?>> validators = new ArrayList<DbValidator<?>>();
|
||||
private List<DbValidator> validators = new ArrayList<DbValidator>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -212,7 +212,7 @@ public abstract class AbstractDbObject implements DbObject
|
||||
|
||||
|
||||
@Override
|
||||
public List<DbValidator<? extends DbObject>> getValidators()
|
||||
public List<DbValidator> getValidators()
|
||||
{
|
||||
return validators;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public abstract class AbstractDbObject implements DbObject
|
||||
* @param validators the validators to set
|
||||
*/
|
||||
@Override
|
||||
public void setValidators(List<DbValidator<? extends DbObject>> validators)
|
||||
public void setValidators(List<DbValidator> validators)
|
||||
{
|
||||
if (validators == null)
|
||||
{
|
||||
|
@@ -113,11 +113,10 @@ public class AbstractDbObjectTest
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void canGetValidators()
|
||||
{
|
||||
List<DbValidator<? extends DbObject>> validators = dbObject.getValidators();
|
||||
List<DbValidator> validators = dbObject.getValidators();
|
||||
assertEquals(0, validators.size());
|
||||
|
||||
dbObject.setValidators(null);
|
||||
@@ -166,13 +165,13 @@ public class AbstractDbObjectTest
|
||||
}
|
||||
|
||||
|
||||
private List<DbValidator<? extends DbObject>> validatorList(DbValidator<? extends DbObject>... validators)
|
||||
private List<DbValidator> validatorList(DbValidator... validators)
|
||||
{
|
||||
return Arrays.asList(validators);
|
||||
}
|
||||
|
||||
|
||||
private static class TestValidator extends AbstractDbValidator<DbObject>
|
||||
private static class TestValidator extends AbstractDbValidator
|
||||
{
|
||||
@Override
|
||||
public void validate(DbObject reference, DbObject target, DiffContext ctx)
|
||||
|
@@ -18,13 +18,12 @@
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.util.schemacomp.DbObjectVisitor;
|
||||
import org.alfresco.util.schemacomp.DiffContext;
|
||||
import org.alfresco.util.schemacomp.Results;
|
||||
import org.alfresco.util.schemacomp.Result.Strength;
|
||||
import org.alfresco.util.schemacomp.Results;
|
||||
import org.alfresco.util.schemacomp.validator.DbValidator;
|
||||
|
||||
/**
|
||||
@@ -98,12 +97,12 @@ public interface DbObject
|
||||
* @see DbValidator
|
||||
* @return DbValidator List
|
||||
*/
|
||||
List<DbValidator<? extends DbObject>> getValidators();
|
||||
List<DbValidator> getValidators();
|
||||
|
||||
/**
|
||||
* Set/override the validators associated with this database object.
|
||||
*
|
||||
* @param validators
|
||||
*/
|
||||
void setValidators(List<DbValidator<? extends DbObject>> validators);
|
||||
void setValidators(List<DbValidator> validators);
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@ import org.alfresco.util.schemacomp.DbObjectVisitor;
|
||||
import org.alfresco.util.schemacomp.DbProperty;
|
||||
import org.alfresco.util.schemacomp.DiffContext;
|
||||
import org.alfresco.util.schemacomp.Result.Strength;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Represents an index on a table.
|
||||
@@ -35,6 +37,7 @@ public class Index extends AbstractDbObject
|
||||
{
|
||||
private final List<String> columnNames = new ArrayList<String>();
|
||||
private boolean unique;
|
||||
private static Log logger = LogFactory.getLog(Index.class);
|
||||
|
||||
public Index(String name)
|
||||
{
|
||||
|
Reference in New Issue
Block a user