Skip to content

Commit

Permalink
Build failure: Oracle sets cascade action to cascade for update rule
Browse files Browse the repository at this point in the history
even though it is not supported, so override all setter methods for all
dialects that do not support cascade actions for delete or update.
  • Loading branch information
philipmarzullo64 committed Feb 15, 2019
1 parent 844e257 commit 7b86fdb
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 1 deletion.
Expand Up @@ -29,6 +29,8 @@
import java.util.Map;

import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.Trigger;
Expand Down Expand Up @@ -154,4 +156,15 @@ public Trigger mapRow(Row row) {
return triggers;
}

@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
// Greenplum does not support cascading
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}

@Override
protected void readForeignKeyDeleteRule(Map<String, Object> values, ForeignKey fk) {
// Greenplum does not support cascading
fk.setOnDeleteAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -34,6 +34,7 @@
import org.apache.commons.collections.map.ListOrderedMap;
import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.Trigger;
Expand Down Expand Up @@ -200,4 +201,10 @@ public Trigger mapRow(Row row) {

return triggers;
}

@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
// Informix does not support cascade update
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -32,6 +32,7 @@

import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Reference;
import org.jumpmind.db.model.Table;
Expand Down Expand Up @@ -248,4 +249,15 @@ protected Integer mapUnknownJdbcTypeForColumn(Map<String, Object> values) {
}
}

@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
// NuoDb does not support cascade actions
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}

@Override
protected void readForeignKeyDeleteRule(Map<String, Object> values, ForeignKey fk) {
// NuoDb does not support cascade actions
fk.setOnDeleteAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -44,6 +44,8 @@
import org.apache.commons.lang.StringUtils;
import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ColumnTypes;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.Trigger;
Expand Down Expand Up @@ -517,4 +519,10 @@ protected Set<String> readPkIndecies(Connection connection, String schema, Strin
}
return values;
}

// Oracle does not support on update actions
@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -28,11 +28,13 @@
import java.util.Map;

import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.Trigger;
import org.jumpmind.db.model.TypeMap;
import org.jumpmind.db.model.Trigger.TriggerType;
import org.jumpmind.db.model.TypeMap;
import org.jumpmind.db.platform.AbstractJdbcDdlReader;
import org.jumpmind.db.platform.DatabaseMetaDataWrapper;
import org.jumpmind.db.platform.IDatabasePlatform;
Expand Down Expand Up @@ -214,4 +216,15 @@ public Trigger mapRow(Row row) {
return triggers;
}

@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
// Redshift does not support cascade actions
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}

@Override
protected void readForeignKeyDeleteRule(Map<String, Object> values, ForeignKey fk) {
// Redshift does not support cascade actions
fk.setOnDeleteAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -23,6 +23,8 @@
import org.apache.commons.lang.StringUtils;
import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ColumnTypes;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.PlatformColumn;
import org.jumpmind.db.model.Table;
Expand Down Expand Up @@ -447,4 +449,10 @@ public Trigger mapRow(Row row) {

return triggers;
}

// Tibero does not support on update actions
@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}
}
Expand Up @@ -25,6 +25,8 @@
import java.util.Map;

import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.ForeignKey;
import org.jumpmind.db.model.ForeignKey.ForeignKeyAction;
import org.jumpmind.db.model.IIndex;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.platform.AbstractJdbcDdlReader;
Expand Down Expand Up @@ -82,4 +84,15 @@ protected void disableAutoIncrement(Table table) {
}
}

@Override
protected void readForeignKeyUpdateRule(Map<String, Object> values, ForeignKey fk) {
// VoltDB does not support cascade actions
fk.setOnUpdateAction(ForeignKeyAction.NOACTION);
}

@Override
protected void readForeignKeyDeleteRule(Map<String, Object> values, ForeignKey fk) {
// VoltDB does not support cascade actions
fk.setOnDeleteAction(ForeignKeyAction.NOACTION);
}
}
1 change: 1 addition & 0 deletions symmetric-jdbc/src/test/resources/db-test.properties
Expand Up @@ -53,6 +53,7 @@ oracle.root.db.password=admin
oracle.client.db.user=SymmetricClient
oracle.client.db.password=admin
oracle.db.url=jdbc:oracle:thin:@dbdev1.loc:1521:XE
oracle.bulk.load.sqlldr.cmd=/usr/local/instantclient_18_3/sqlldr

derby.db.driver=org.apache.derby.jdbc.EmbeddedDriver
derby.db.user=
Expand Down
Expand Up @@ -111,6 +111,7 @@ public class SimpleIntegrationTest extends AbstractIntegrationTest {

@Test(timeout = 3600000)
public void test01CreateServer() {
logTestRunning();
ISymmetricEngine server = getServer();
assertNotNull(server);
server.getParameterService().saveParameter(ParameterConstants.FILE_SYNC_ENABLE, false, "unit_test");
Expand Down Expand Up @@ -213,6 +214,7 @@ public void test03InitialLoad() {

@Test(timeout = 900000)
public void test04LobSyncUsingStreaming() throws Exception {
logTestRunning();
String text = "Another test. Should not find this in text in sym_data, but it should be in the client database";
if (serverTestService.insertIntoTestUseStreamLob(200, "test_use_stream_lob", text)) {
//IDatabasePlatform platform = getServer().getDatabasePlatform();
Expand All @@ -230,6 +232,7 @@ public void test04LobSyncUsingStreaming() throws Exception {

@Test(timeout = 900000)
public void test05LobSyncUsingCapture() throws Exception {
logTestRunning();
String text = "Another test. Should not find this in text in sym_data, but it should be in the client database";
if (serverTestService.insertIntoTestUseStreamLob(200, "test_use_capture_lob", text)) {
String rowData = getServer()
Expand Down Expand Up @@ -320,6 +323,7 @@ public void test07SyncToClientMultipleUpdates() {

@Test(timeout = 900000)
public void test08InsertSqlEvent() {
logTestRunning();
assertTrue(getClient().getSqlTemplate().queryForInt(
"select count(*) from sym_node where schema_version='test'") == 0);
getServer()
Expand All @@ -333,6 +337,7 @@ public void test08InsertSqlEvent() {

@Test(timeout = 900000)
public void test09EmptyNullLob() {
logTestRunning();
Customer customer = new Customer(300, "Eric", true, "100 Main Street", "Columbus", "OH",
43082, new Date(), new Date(), "", new byte[0]);

Expand Down Expand Up @@ -382,6 +387,7 @@ public void test10LargeLob() {
if (!isServerOracle()) {
return;
}
logTestRunning();
String bigString = StringUtils.rightPad("Feeling tired... ", 6000, "Z");
Customer customer = new Customer(400, "Eric", true, "100 Main Street", "Columbus", "OH",
43082, new Date(), new Date(), bigString, bigString.getBytes());
Expand Down Expand Up @@ -692,6 +698,7 @@ public void test14SuspendIgnorePullRemoteLocalComboBatches() throws Exception {

@Test(timeout = 900000)
public void test15UpdateDataWithNoChangesSyncToClient() throws Exception {
logTestRunning();
int clientIncomingBatchCount = getIncomingBatchCountForClient();
int rowsUpdated = getServer().getSqlTemplate().update(
"update test_sync_column_level set string_value=string_value");
Expand Down Expand Up @@ -1132,6 +1139,7 @@ public void test29SyncShellCommand() throws Exception {

@Test
public void test30AutoConfigureTablesAfterAlreadyCreated() {
logTestRunning();
testAutoConfigureTablesAfterAlreadyCreated(getServer());
testAutoConfigureTablesAfterAlreadyCreated(getClient());
}
Expand All @@ -1145,6 +1153,7 @@ public void test31ReloadMissingForeignKeys() {
getClient().getSymmetricDialect().getName().equalsIgnoreCase(DatabaseNamesConstants.GENERIC)) {
return;
}
logTestRunning();
ISqlTransaction tran = getServer().getSqlTemplate().startSqlTransaction();
getServer().getSymmetricDialect().disableSyncTriggers(tran, null);
tran.execute("insert into test_a (id) values ('1')");
Expand All @@ -1166,6 +1175,7 @@ protected void testAutoConfigureTablesAfterAlreadyCreated(ISymmetricEngine engin

@Test
public void test99Shutdown() throws Exception {
logTestRunning();
getClient().destroy();
getWebServer().stop();
}
Expand Down

0 comments on commit 7b86fdb

Please sign in to comment.