mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-11370: ExportDbTest expects particular/PostgreSQL schema
Now creates own test tables, indexes and sequence and runs export test against those (if running PostgreSQL). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32022 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,6 +27,8 @@ import static org.junit.Assert.fail;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.util.schemacomp.model.Column;
|
import org.alfresco.util.schemacomp.model.Column;
|
||||||
import org.alfresco.util.schemacomp.model.DbObject;
|
import org.alfresco.util.schemacomp.model.DbObject;
|
||||||
@@ -36,10 +38,16 @@ import org.alfresco.util.schemacomp.model.PrimaryKey;
|
|||||||
import org.alfresco.util.schemacomp.model.Schema;
|
import org.alfresco.util.schemacomp.model.Schema;
|
||||||
import org.alfresco.util.schemacomp.model.Sequence;
|
import org.alfresco.util.schemacomp.model.Sequence;
|
||||||
import org.alfresco.util.schemacomp.model.Table;
|
import org.alfresco.util.schemacomp.model.Table;
|
||||||
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.dialect.PostgreSQLDialect;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the ExportDb class.
|
* Tests for the ExportDb class.
|
||||||
@@ -50,19 +58,38 @@ public class ExportDbTest
|
|||||||
{
|
{
|
||||||
private ApplicationContext ctx;
|
private ApplicationContext ctx;
|
||||||
private ExportDb exporter;
|
private ExportDb exporter;
|
||||||
|
private Dialect dialect;
|
||||||
|
private DataSource dataSource;
|
||||||
|
private SimpleJdbcTemplate jdbcTemplate;
|
||||||
|
private PlatformTransactionManager tx;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception
|
public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
ctx = ApplicationContextHelper.getApplicationContext();
|
ctx = ApplicationContextHelper.getApplicationContext();
|
||||||
|
dataSource = (DataSource) ctx.getBean("dataSource");
|
||||||
|
tx = (PlatformTransactionManager) ctx.getBean("transactionManager");
|
||||||
|
jdbcTemplate = new SimpleJdbcTemplate(dataSource);
|
||||||
exporter = new ExportDb(ctx);
|
exporter = new ExportDb(ctx);
|
||||||
|
exporter.setNamePrefix("export_test_");
|
||||||
|
dialect = (Dialect) ctx.getBean("dialect");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void exportDb() throws Exception
|
public void exportDb() throws Exception
|
||||||
{
|
{
|
||||||
exporter.setNamePrefix("alf_");
|
if (dialect.getClass().equals(PostgreSQLDialect.class))
|
||||||
|
{
|
||||||
|
exportPostgreSQL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void exportPostgreSQL() throws Exception
|
||||||
|
{
|
||||||
|
setupPostgreSQL();
|
||||||
|
|
||||||
exporter.execute();
|
exporter.execute();
|
||||||
|
|
||||||
Schema schema = exporter.getSchema();
|
Schema schema = exporter.getSchema();
|
||||||
@@ -70,34 +97,94 @@ public class ExportDbTest
|
|||||||
assertNull("Schema shouldn't have a parent", schema.getParent());
|
assertNull("Schema shouldn't have a parent", schema.getParent());
|
||||||
System.out.println(schema);
|
System.out.println(schema);
|
||||||
|
|
||||||
Table appliedPatchTable = null;
|
Table exampleTable = null;
|
||||||
Table qNameTable = null;
|
Table otherTable = null;
|
||||||
Sequence authoritySeq = null;
|
Sequence authoritySeq = null;
|
||||||
|
|
||||||
for (DbObject dbo : schema)
|
for (DbObject dbo : schema)
|
||||||
{
|
{
|
||||||
if (dbo.getName().equals("alf_applied_patch"))
|
if (dbo.getName().equals("export_test_example"))
|
||||||
{
|
{
|
||||||
appliedPatchTable = (Table) dbo;
|
exampleTable = (Table) dbo;
|
||||||
}
|
}
|
||||||
if (dbo.getName().equals("alf_qname"))
|
if (dbo.getName().equals("export_test_other"))
|
||||||
{
|
{
|
||||||
qNameTable = (Table) dbo;
|
otherTable = (Table) dbo;
|
||||||
}
|
}
|
||||||
if (dbo.getName().equals("alf_authority_seq"))
|
if (dbo.getName().equals("export_test_authority_seq"))
|
||||||
{
|
{
|
||||||
authoritySeq = (Sequence) dbo;
|
authoritySeq = (Sequence) dbo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkResultsFiltered(schema, "alf_");
|
checkResultsFiltered(schema, "export_test_");
|
||||||
checkAppliedPatchTable(schema, appliedPatchTable);
|
checkExampleTable(schema, exampleTable);
|
||||||
checkQNameTable(schema, qNameTable);
|
checkOtherTable(schema, otherTable);
|
||||||
// TODO: what to do about sequences? They can't easily be retrieved with JDBC's DatabaseMetaData
|
// TODO: what to do about sequences? They can't easily be retrieved with JDBC's DatabaseMetaData
|
||||||
//checkAuthoritySequence(schema, authoritySeq);
|
//checkAuthoritySequence(schema, authoritySeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setupPostgreSQL()
|
||||||
|
{
|
||||||
|
// Create database objects: this decouples test code from the actual schema which is
|
||||||
|
// free to change without breaking these tests.
|
||||||
|
|
||||||
|
final String[] createStatements = new String[]
|
||||||
|
{
|
||||||
|
"DROP TABLE IF EXISTS export_test_example CASCADE",
|
||||||
|
"CREATE TABLE export_test_example" +
|
||||||
|
" (" +
|
||||||
|
" id INT8 NOT NULL," +
|
||||||
|
" description VARCHAR(1024)," +
|
||||||
|
" fixes_from_schema INT4," +
|
||||||
|
" fixes_to_schema INT4," +
|
||||||
|
" applied_to_schema INT4," +
|
||||||
|
" target_schema INT4," +
|
||||||
|
" applied_on_date TIMESTAMP," +
|
||||||
|
" applied_to_server VARCHAR(64)," +
|
||||||
|
" was_executed BOOL," +
|
||||||
|
" succeeded BOOL," +
|
||||||
|
" report VARCHAR(1024)," +
|
||||||
|
" PRIMARY KEY (id)" +
|
||||||
|
" )",
|
||||||
|
|
||||||
|
"DROP TABLE IF EXISTS export_test_other CASCADE",
|
||||||
|
"CREATE TABLE export_test_other" +
|
||||||
|
" (" +
|
||||||
|
" id INT8 NOT NULL," +
|
||||||
|
" version INT8 NOT NULL," +
|
||||||
|
" ex_id INT8 NOT NULL," +
|
||||||
|
" local_name VARCHAR(200) NOT NULL," +
|
||||||
|
" CONSTRAINT export_test_fk_example FOREIGN KEY (ex_id) REFERENCES export_test_example (id)," +
|
||||||
|
" PRIMARY KEY (id)" +
|
||||||
|
" )",
|
||||||
|
|
||||||
|
"DROP INDEX IF EXISTS export_test_idx_other_1",
|
||||||
|
"CREATE UNIQUE INDEX export_test_idx_other_1 ON export_test_other (ex_id, local_name)",
|
||||||
|
|
||||||
|
"DROP INDEX IF EXISTS export_test_idx_other_2",
|
||||||
|
"CREATE INDEX export_test_idx_other_2 ON export_test_other (ex_id)",
|
||||||
|
|
||||||
|
"DROP SEQUENCE IF EXISTS export_test_authority_seq",
|
||||||
|
"CREATE SEQUENCE export_test_authority_seq START WITH 1 INCREMENT BY 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
TransactionTemplate tt = new TransactionTemplate(tx);
|
||||||
|
tt.execute(new TransactionCallbackWithoutResult()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void doInTransactionWithoutResult(TransactionStatus status)
|
||||||
|
{
|
||||||
|
for (String sql : createStatements)
|
||||||
|
{
|
||||||
|
jdbcTemplate.update(sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that all top level database objects are prefixed as expected
|
* Check that all top level database objects are prefixed as expected
|
||||||
* (no other objects should have been retrieved)
|
* (no other objects should have been retrieved)
|
||||||
@@ -117,191 +204,151 @@ public class ExportDbTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
private void checkOtherTable(Schema schema, Table otherTable)
|
||||||
* @param qNameTable
|
|
||||||
*/
|
|
||||||
private void checkQNameTable(Schema schema, Table qNameTable)
|
|
||||||
{
|
{
|
||||||
/*
|
assertNotNull("Couldn't find table export_test_other", otherTable);
|
||||||
CREATE TABLE alf_qname
|
assertSame("Incorrect parent or no parent set", schema, otherTable.getParent());
|
||||||
(
|
|
||||||
id INT8 NOT NULL,
|
|
||||||
version INT8 NOT NULL,
|
|
||||||
ns_id INT8 NOT NULL,
|
|
||||||
local_name VARCHAR(200) NOT NULL,
|
|
||||||
CONSTRAINT fk_alf_qname_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id),
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
CREATE UNIQUE INDEX ns_id ON alf_qname (ns_id, local_name);
|
|
||||||
CREATE INDEX fk_alf_qname_ns ON alf_qname (ns_id);
|
|
||||||
*/
|
|
||||||
|
|
||||||
assertNotNull("Couldn't find table alf_qname", qNameTable);
|
Iterator<Column> colIt = otherTable.getColumns().iterator();
|
||||||
assertSame("Incorrect parent or no parent set", schema, qNameTable.getParent());
|
|
||||||
|
|
||||||
Iterator<Column> colIt = qNameTable.getColumns().iterator();
|
|
||||||
Column col = colIt.next();
|
Column col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, col.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, col.getParent());
|
||||||
assertEquals("id", col.getName());
|
assertEquals("id", col.getName());
|
||||||
assertEquals("int8", col.getType());
|
assertEquals("int8", col.getType());
|
||||||
assertEquals(false, col.isNullable());
|
assertEquals(false, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, col.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, col.getParent());
|
||||||
assertEquals("version", col.getName());
|
assertEquals("version", col.getName());
|
||||||
assertEquals("int8", col.getType());
|
assertEquals("int8", col.getType());
|
||||||
assertEquals(false, col.isNullable());
|
assertEquals(false, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, col.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, col.getParent());
|
||||||
assertEquals("ns_id", col.getName());
|
assertEquals("ex_id", col.getName());
|
||||||
assertEquals("int8", col.getType());
|
assertEquals("int8", col.getType());
|
||||||
assertEquals(false, col.isNullable());
|
assertEquals(false, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, col.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, col.getParent());
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, col.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, col.getParent());
|
||||||
assertEquals("local_name", col.getName());
|
assertEquals("local_name", col.getName());
|
||||||
assertEquals("varchar(200)", col.getType());
|
assertEquals("varchar(200)", col.getType());
|
||||||
assertEquals(false, col.isNullable());
|
assertEquals(false, col.isNullable());
|
||||||
|
|
||||||
assertEquals(2, qNameTable.getIndexes().size());
|
assertEquals(2, otherTable.getIndexes().size());
|
||||||
Iterator<Index> indexIt = qNameTable.getIndexes().iterator();
|
Iterator<Index> indexIt = otherTable.getIndexes().iterator();
|
||||||
|
|
||||||
Index index = indexIt.next();
|
Index index = indexIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, index.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, index.getParent());
|
||||||
assertEquals("ns_id", index.getName());
|
assertEquals("export_test_idx_other_1", index.getName());
|
||||||
assertEquals(true, index.isUnique());
|
assertEquals(true, index.isUnique());
|
||||||
assertEquals(2, index.getColumnNames().size());
|
assertEquals(2, index.getColumnNames().size());
|
||||||
assertEquals("ns_id", index.getColumnNames().get(0));
|
assertEquals("ex_id", index.getColumnNames().get(0));
|
||||||
assertEquals("local_name", index.getColumnNames().get(1));
|
assertEquals("local_name", index.getColumnNames().get(1));
|
||||||
|
|
||||||
index = indexIt.next();
|
index = indexIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, index.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, index.getParent());
|
||||||
assertEquals("fk_alf_qname_ns", index.getName());
|
assertEquals("export_test_idx_other_2", index.getName());
|
||||||
assertEquals(1, index.getColumnNames().size());
|
assertEquals(1, index.getColumnNames().size());
|
||||||
assertEquals("ns_id", index.getColumnNames().get(0));
|
assertEquals("ex_id", index.getColumnNames().get(0));
|
||||||
|
|
||||||
PrimaryKey pk = qNameTable.getPrimaryKey();
|
PrimaryKey pk = otherTable.getPrimaryKey();
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, pk.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, pk.getParent());
|
||||||
assertEquals("id", pk.getColumnNames().get(0));
|
assertEquals("id", pk.getColumnNames().get(0));
|
||||||
|
|
||||||
assertEquals(1, qNameTable.getForeignKeys().size());
|
assertEquals(1, otherTable.getForeignKeys().size());
|
||||||
ForeignKey fk = qNameTable.getForeignKeys().get(0);
|
ForeignKey fk = otherTable.getForeignKeys().get(0);
|
||||||
assertSame("Incorrect parent or no parent set", qNameTable, fk.getParent());
|
assertSame("Incorrect parent or no parent set", otherTable, fk.getParent());
|
||||||
assertEquals("fk_alf_qname_ns", fk.getName());
|
assertEquals("export_test_fk_example", fk.getName());
|
||||||
assertEquals("ns_id", fk.getLocalColumn());
|
assertEquals("ex_id", fk.getLocalColumn());
|
||||||
assertEquals("alf_namespace", fk.getTargetTable());
|
assertEquals("export_test_example", fk.getTargetTable());
|
||||||
assertEquals("id", fk.getTargetColumn());
|
assertEquals("id", fk.getTargetColumn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
private void checkExampleTable(Schema schema, Table exampleTable)
|
||||||
* @param appliedPatch
|
|
||||||
*/
|
|
||||||
private void checkAppliedPatchTable(Schema schema, Table appliedPatch)
|
|
||||||
{
|
{
|
||||||
/*
|
assertNotNull("Couldn't find export_test_example", exampleTable);
|
||||||
CREATE TABLE alf_applied_patch
|
|
||||||
(
|
|
||||||
id VARCHAR(64) NOT NULL,
|
|
||||||
description VARCHAR(1024),
|
|
||||||
fixes_from_schema INT4,
|
|
||||||
fixes_to_schema INT4,
|
|
||||||
applied_to_schema INT4,
|
|
||||||
target_schema INT4,
|
|
||||||
applied_on_date TIMESTAMP,
|
|
||||||
applied_to_server VARCHAR(64),
|
|
||||||
was_executed BOOL,
|
|
||||||
succeeded BOOL,
|
|
||||||
report VARCHAR(1024),
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
assertNotNull("Couldn't find alf_applied_patch", appliedPatch);
|
|
||||||
|
|
||||||
assertSame("Incorrect parent or no parent set", schema, appliedPatch.getParent());
|
assertSame("Incorrect parent or no parent set", schema, exampleTable.getParent());
|
||||||
assertEquals("alf_applied_patch", appliedPatch.getName());
|
assertEquals("export_test_example", exampleTable.getName());
|
||||||
Iterator<Column> colIt = appliedPatch.getColumns().iterator();
|
Iterator<Column> colIt = exampleTable.getColumns().iterator();
|
||||||
Column col = colIt.next();
|
Column col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("id", col.getName());
|
assertEquals("id", col.getName());
|
||||||
assertEquals("varchar(64)", col.getType());
|
assertEquals("int8", col.getType());
|
||||||
assertEquals(false, col.isNullable());
|
assertEquals(false, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("description", col.getName());
|
assertEquals("description", col.getName());
|
||||||
assertEquals("varchar(1024)", col.getType());
|
assertEquals("varchar(1024)", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("fixes_from_schema", col.getName());
|
assertEquals("fixes_from_schema", col.getName());
|
||||||
assertEquals("int4", col.getType());
|
assertEquals("int4", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("fixes_to_schema", col.getName());
|
assertEquals("fixes_to_schema", col.getName());
|
||||||
assertEquals("int4", col.getType());
|
assertEquals("int4", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("applied_to_schema", col.getName());
|
assertEquals("applied_to_schema", col.getName());
|
||||||
assertEquals("int4", col.getType());
|
assertEquals("int4", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("target_schema", col.getName());
|
assertEquals("target_schema", col.getName());
|
||||||
assertEquals("int4", col.getType());
|
assertEquals("int4", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("applied_on_date", col.getName());
|
assertEquals("applied_on_date", col.getName());
|
||||||
assertEquals("timestamp", col.getType());
|
assertEquals("timestamp", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("applied_to_server", col.getName());
|
assertEquals("applied_to_server", col.getName());
|
||||||
assertEquals("varchar(64)", col.getType());
|
assertEquals("varchar(64)", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("was_executed", col.getName());
|
assertEquals("was_executed", col.getName());
|
||||||
assertEquals("bool", col.getType());
|
assertEquals("bool", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("succeeded", col.getName());
|
assertEquals("succeeded", col.getName());
|
||||||
assertEquals("bool", col.getType());
|
assertEquals("bool", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
col = colIt.next();
|
col = colIt.next();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, col.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, col.getParent());
|
||||||
assertEquals("report", col.getName());
|
assertEquals("report", col.getName());
|
||||||
assertEquals("varchar(1024)", col.getType());
|
assertEquals("varchar(1024)", col.getType());
|
||||||
assertEquals(true, col.isNullable());
|
assertEquals(true, col.isNullable());
|
||||||
|
|
||||||
PrimaryKey pk = appliedPatch.getPrimaryKey();
|
PrimaryKey pk = exampleTable.getPrimaryKey();
|
||||||
assertSame("Incorrect parent or no parent set", appliedPatch, pk.getParent());
|
assertSame("Incorrect parent or no parent set", exampleTable, pk.getParent());
|
||||||
assertEquals("id", pk.getColumnNames().get(0));
|
assertEquals("id", pk.getColumnNames().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void checkAuthoritySequence(Schema schema, Sequence seq)
|
public void checkAuthoritySequence(Schema schema, Sequence seq)
|
||||||
{
|
{
|
||||||
/*
|
assertNotNull("Couldn't find sequence export_test_authority_seq", seq);
|
||||||
CREATE SEQUENCE alf_authority_seq START WITH 1 INCREMENT BY 1;
|
|
||||||
*/
|
|
||||||
assertNotNull("Couldn't find sequence alf_authority_seq", seq);
|
|
||||||
assertSame("Incorrect parent or no parent set", schema, seq.getParent());
|
assertSame("Incorrect parent or no parent set", schema, seq.getParent());
|
||||||
assertEquals("alf_authority_seq", seq.getName());
|
assertEquals("export_test_authority_seq", seq.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user