Skip to content

Commit

Permalink
ringhold: update for cadc-inventory-db refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pdowler committed Feb 16, 2024
1 parent f197591 commit bd7e186
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ringhold/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ group = 'org.opencadc'

dependencies {
compile 'org.opencadc:cadc-util:[1.6,2.0)'
compile 'org.opencadc:cadc-inventory:[0.9,2.0)'
compile 'org.opencadc:cadc-inventory-db:[0.14,1.0)'
compile 'org.opencadc:cadc-inventory:[0.10,)'
compile 'org.opencadc:cadc-inventory-db:[0.15,1.0)'

testCompile 'junit:junit:[4.12,5.0)'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import ca.nrc.cadc.db.ConnectionConfig;
import ca.nrc.cadc.db.DBConfig;
import ca.nrc.cadc.db.DBUtil;
import ca.nrc.cadc.db.version.InitDatabase;
import ca.nrc.cadc.util.FileUtil;
import ca.nrc.cadc.util.HexUtil;
import ca.nrc.cadc.util.Log4jInit;
Expand Down Expand Up @@ -101,7 +102,7 @@
import org.opencadc.inventory.db.ArtifactDAO;
import org.opencadc.inventory.db.DeletedStorageLocationEventDAO;
import org.opencadc.inventory.db.SQLGenerator;
import org.opencadc.inventory.db.version.InitDatabase;
import org.opencadc.inventory.db.version.InitDatabaseSI;
import org.springframework.jdbc.core.JdbcTemplate;

/**
Expand Down Expand Up @@ -168,7 +169,7 @@ public InventoryValidatorTest() throws Exception {

try {
DataSource dataSource = DBUtil.findJNDIDataSource(jndiPath);
InitDatabase init = new InitDatabase(dataSource, INVENTORY_DATABASE, INVENTORY_SCHEMA);
InitDatabase init = new InitDatabaseSI(dataSource, INVENTORY_DATABASE, INVENTORY_SCHEMA);
init.doInit();
log.debug("initDatabase: " + jndiPath + " " + INVENTORY_SCHEMA + " OK");
} catch (Exception ex) {
Expand All @@ -178,7 +179,8 @@ public InventoryValidatorTest() throws Exception {
daoConfig.put(SQLGenerator.class.getName(), SQLGenerator.class);
daoConfig.put("jndiDataSourceName", jndiPath);
daoConfig.put("database", INVENTORY_DATABASE);
daoConfig.put("schema", INVENTORY_SCHEMA);
daoConfig.put("invSchema", INVENTORY_SCHEMA);
daoConfig.put("genSchema", INVENTORY_SCHEMA);

artifactDAO.setConfig(daoConfig);
deletedStorageLocationEventDAO.setConfig(daoConfig);
Expand Down
6 changes: 4 additions & 2 deletions ringhold/src/main/java/org/opencadc/ringhold/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,15 @@ public static void main(final String[] args) {
}

final Map<String, Object> daoConfig = new TreeMap<>();
daoConfig.put("schema", props.getFirstPropertyValue(DB_SCHEMA_CONFIG_KEY));
daoConfig.put("invSchema", props.getFirstPropertyValue(DB_SCHEMA_CONFIG_KEY));
daoConfig.put("genSchema", props.getFirstPropertyValue(DB_SCHEMA_CONFIG_KEY));
daoConfig.put("jndiDataSourceName", "jdbc/inventory-txn");
final String configuredSQLGenerator = props.getFirstPropertyValue(SQLGENERATOR_CONFIG_KEY);
daoConfig.put(SQLGENERATOR_CONFIG_KEY, Class.forName(configuredSQLGenerator));

final Map<String, Object> iterConfig = new TreeMap<>();
iterConfig.put("schema", daoConfig.get("schema"));
iterConfig.put("invSchema", daoConfig.get("schema"));
iterConfig.put("genSchema", daoConfig.get("schema"));
iterConfig.put("jndiDataSourceName", "jdbc/inventory-iter");
iterConfig.put(SQLGENERATOR_CONFIG_KEY, Class.forName(configuredSQLGenerator));

Expand Down

0 comments on commit bd7e186

Please sign in to comment.