@Override public boolean create(String storeName, String tableName) throws IOException { if (exists(storeName, tableName)) { throw new IOException(String.format("State already exists for storeName %s tableName %s", storeName, tableName)); } return true; }
@Override public void createAlias(String storeName, String original, String alias) throws IOException { if (!exists(storeName, original)) { throw new IOException(String.format("State does not exist for table %s", original)); } try (Connection connection = dataSource.getConnection(); PreparedStatement cloneStatement = connection.prepareStatement(CLONE_JOB_STATE_SQL)) { int index = 0; cloneStatement.setString(++index, alias); cloneStatement.setString(++index, storeName); cloneStatement.setString(++index, original); cloneStatement.executeUpdate(); connection.commit(); } catch (SQLException e) { throw new IOException(String.format("Failure creating alias for store %s original %s", storeName, original), e); } }
List<DatasetStoreDataset> datasets = datasetFinder.findDatasets(); Assert.assertTrue(this.dbJobStateStore.exists(TEST_JOB_NAME1, MysqlDatasetStateStore.CURRENT_DATASET_STATE_FILE_SUFFIX + MysqlDatasetStateStore.DATASET_STATE_STORE_TABLE_SUFFIX)); Assert.assertTrue(this.dbJobStateStore.exists(TEST_JOB_NAME2, MysqlDatasetStateStore.CURRENT_DATASET_STATE_FILE_SUFFIX + MysqlDatasetStateStore.DATASET_STATE_STORE_TABLE_SUFFIX)); Assert.assertFalse(this.dbJobStateStore.exists(TEST_JOB_NAME1, MysqlDatasetStateStore.CURRENT_DATASET_STATE_FILE_SUFFIX + MysqlDatasetStateStore.DATASET_STATE_STORE_TABLE_SUFFIX)); Assert.assertTrue(this.dbJobStateStore.exists(TEST_JOB_NAME2, MysqlDatasetStateStore.CURRENT_DATASET_STATE_FILE_SUFFIX + MysqlDatasetStateStore.DATASET_STATE_STORE_TABLE_SUFFIX));
@Override public boolean create(String storeName, String tableName) throws IOException { if (exists(storeName, tableName)) { throw new IOException(String.format("State already exists for storeName %s tableName %s", storeName, tableName)); } return true; }
@Override public void createAlias(String storeName, String original, String alias) throws IOException { if (!exists(storeName, original)) { throw new IOException(String.format("State does not exist for table %s", original)); } try (Connection connection = dataSource.getConnection(); PreparedStatement cloneStatement = connection.prepareStatement(CLONE_JOB_STATE_SQL)) { int index = 0; cloneStatement.setString(++index, alias); cloneStatement.setString(++index, storeName); cloneStatement.setString(++index, original); cloneStatement.executeUpdate(); connection.commit(); } catch (SQLException e) { throw new IOException(String.format("Failure creating alias for store %s original %s", storeName, original), e); } }