// upgrade the tables and add new columns to the old tables
@Test
    public void testUpgradeTables() throws Exception {
        TestRMTxStore store = new TestRMTxStore();
        store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
        // workaround for the db file deletion problem during the tests
        store.setUrl(MessageFormat.format("jdbc:derby:{0};create=true", TEST_DB_NAME));
        // use the old db definitions to create the tables
        store.init();
        // verify the absence of the new columns in the tables
        verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
        verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
        verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true);
        verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true);
        // upgrade the tables and add new columns to the old tables
        store.upgrade();
        store.init();
        // verify the presence of the new columns in the upgraded tables
        verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
        verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
        verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, false);
        verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, false);
    }
verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true);
verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true);
// upgrade the tables and add new columns to the old tables
store.upgrade();
store.init();
store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
// workaround for the db file deletion problem during the tests
store.setUrl(MessageFormat.format("jdbc:derby:{0};create=true", TEST_DB_NAME));
// use the old db definitions to create the tables
store.init();
// verify the absence of the new columns in the tables
verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true);
verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true);
// upgrade the tables and add new columns to the old tables
store.upgrade();
store.init();
// verify the presence of the new columns in the upgraded tables
verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, false);
verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, false);
}
@Test
public void testUpgradeTables() throws Exception {
TestRMTxStore store = new TestRMTxStore();
store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
// workaround for the db file deletion problem during the tests
store.setUrl(MessageFormat.format("jdbc:derby:{0};create=true", TEST_DB_NAME));
// use the old db definitions to create the tables
store.init();
// verify the absence of the new columns in the tables
verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true);
verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true);
verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true);
// upgrade the tables and add new columns to the old tables
store.upgrade();
store.init();
// verify the presence of the new columns in the upgraded tables
verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false);
verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, false);
verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, false);
}