Package org.xmlBlaster.contrib.replication

Examples of org.xmlBlaster.contrib.replication.TableToWatchInfo


         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here


    *
    */
   public final void testTableToWatchInfoKeys() {
      log.info("Start testTableToWatchInfoKeys");
     
      TableToWatchInfo tableToWatchInfo = new TableToWatchInfo();
      String key1 = "table.catalog1.schema1.table1";
      String key2 = "table.schema2.table2";
      String key3 = "table..schema3.table3";
      String key4 = "table.table4";
      String key5 = "table...table5";

      String key6 = "  table.  catalog6  .  schema6  . table6 ";
      String key7 = " table. schema7 . table7 ";
      String key8 = " table. . schema8 . table8 ";
      String key9 = " table. table9";
      String key10 = " table. . . table10 ";
     
      try {
         tableToWatchInfo.assignFromInfoPair(key1, null);
         assertEquals("catalog for key1", "catalog1", tableToWatchInfo.getCatalog());
         assertEquals("schema for key1", "schema1", tableToWatchInfo.getSchema());
         assertEquals("catalog for key1", "table1", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key1 '" + key1 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key2, null);
         assertEquals("catalog for key2", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key2", "schema2", tableToWatchInfo.getSchema());
         assertEquals("catalog for key2", "table2", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key2 '" + key2 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key3, null);
         assertEquals("catalog for key3", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key3", "schema3", tableToWatchInfo.getSchema());
         assertEquals("catalog for key3", "table3", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key3 '" + key3 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key4, null);
         assertEquals("catalog for key4", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key4", " ", tableToWatchInfo.getSchema());
         assertEquals("catalog for key4", "table4", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key4 '" + key4 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key5, null);
         assertEquals("catalog for key5", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key5", " ", tableToWatchInfo.getSchema());
         assertEquals("catalog for key5", "table5", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key5 '" + key5 + "'", false);
      }


      try {
         tableToWatchInfo.assignFromInfoPair(key6, null);
         assertEquals("catalog for key6", "catalog6", tableToWatchInfo.getCatalog());
         assertEquals("schema for key6", "schema6", tableToWatchInfo.getSchema());
         assertEquals("catalog for key6", "table6", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key6 '" + key6 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key7, null);
         assertEquals("catalog for key7", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key7", "schema7", tableToWatchInfo.getSchema());
         assertEquals("catalog for key7", "table7", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key7 '" + key7 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key8, null);
         assertEquals("catalog for key8", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key8", "schema8", tableToWatchInfo.getSchema());
         assertEquals("catalog for key8", "table8", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key8 '" + key8 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key9, null);
         assertEquals("catalog for key9", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key9", " ", tableToWatchInfo.getSchema());
         assertEquals("catalog for key9", "table9", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key9 '" + key9 + "'", false);
      }
      try {
         tableToWatchInfo.assignFromInfoPair(key10, null);
         assertEquals("catalog for key10", " ", tableToWatchInfo.getCatalog());
         assertEquals("schema for key10", " ", tableToWatchInfo.getSchema());
         assertEquals("catalog for key10", "table10", tableToWatchInfo.getTable());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not happen when testing key10 '" + key10 + "'", false);
      }
View Full Code Here

      String key = "table.catalog.schema.table";

      try {
        
         String val1 = null;
         TableToWatchInfo tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val1);
         assertEquals("replicate for val1", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val1", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val1", -1L, tableToWatchInfo.getReplKey());

         String val2 = "";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val2);
         assertEquals("replicate for val2", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val2", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val2", -1L, tableToWatchInfo.getReplKey());
        
         String val3 = ",,";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val3);
         assertEquals("replicate for val3", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val3", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val3", -1L, tableToWatchInfo.getReplKey());

         String val4 = " , , ";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val4);
         assertEquals("replicate for val4", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val4", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val4", -1L, tableToWatchInfo.getReplKey());

         String val5 = "actions=IDU,trigger=trigger,sequence=10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val5);
         assertEquals("replicate for val5", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val5", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val5", 10L, tableToWatchInfo.getReplKey());

         String val6 = "actions =  IDU , trigger = trigger , sequence = 10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val6);
         assertEquals("replicate for val6", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val6", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val6", 10L, tableToWatchInfo.getReplKey());

         String val7 = "actions=,trigger=trigger,sequence=10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val7);
         assertEquals("replicate for val7", false, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val7", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val7", 10L, tableToWatchInfo.getReplKey());

         String val8 = "actions =  , trigger = trigger , sequence = 10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val8);
         assertEquals("replicate for val8", false, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val8", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val8", 10L, tableToWatchInfo.getReplKey());

         String val9 = "actions=IDU,sequence=10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val9);
         assertEquals("replicate for val9", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val9", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val9", 10L, tableToWatchInfo.getReplKey());

         String val10 = " actions = IDU , sequence = 10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val10);
         assertEquals("replicate for val10", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val10", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val10", 10L, tableToWatchInfo.getReplKey());

         String val11 = "actions=IDU,trigger=trigger";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val11);
         assertEquals("replicate for val11", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val11", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val11", -1L, tableToWatchInfo.getReplKey());

         String val12 = " actions = IDU , trigger = trigger";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val12);
         assertEquals("replicate for val12", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val12", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val12", -1L, tableToWatchInfo.getReplKey());

         String val13 = "sequence=10";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val13);
         assertEquals("replicate for val13", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val13", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val13", 10L, tableToWatchInfo.getReplKey());

         String val14 = " sequence =   10 ";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val14);
         assertEquals("replicate for val14", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val14", (String)null, tableToWatchInfo.getTrigger());
         assertEquals("replKey for val14", 10L, tableToWatchInfo.getReplKey());

         String val15 = "trigger=trigger";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val15);
         assertEquals("replicate for val15", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val15", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val15", -1L, tableToWatchInfo.getReplKey());

         String val16 = " trigger =  trigger  ";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val16);
         assertEquals("replicate for val16", true, tableToWatchInfo.isReplicate());
         assertEquals("trigger for val16", "trigger", tableToWatchInfo.getTrigger());
         assertEquals("replKey for val16", -1L, tableToWatchInfo.getReplKey());
        
         String val17 = "actions=IDU";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val17);
         assertEquals("replicate for val17", "IDU", tableToWatchInfo.getActions());
        
         String val18 = "actions=U";
         tableToWatchInfo = new TableToWatchInfo();
         tableToWatchInfo.assignFromInfoPair(key, val18);
         assertEquals("replicate for val17", "U", tableToWatchInfo.getActions());
      }
      catch (Exception ex) {
         ex.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.replication.TableToWatchInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.