// ------------------------------------------------------------------------- @Test public void test_basics() throws Exception { assertNotNull(_secMaster); assertEquals(true, _secMaster.getUniqueIdScheme().equals("DbSec")); assertNotNull(_secMaster.getDbConnector()); assertNotNull(_secMaster.getClock()); }
private void init() throws Exception { super.setUp(); ConfigurableApplicationContext context = DbMasterTestUtils.getContext(getDatabaseType()); _secMaster = (DbSecurityMaster) context.getBean(getDatabaseType() + "DbSecurityMaster"); // id bigint not null, // oid bigint not null, // ver_from_instant timestamp not null, // ver_to_instant timestamp not null, // corr_from_instant timestamp not null, // corr_to_instant timestamp not null, // name varchar(255) not null, // sec_type varchar(255) not null, Instant now = Instant.now(); _secMaster.setTimeSource(TimeSource.fixed(now)); _version1Instant = now.minusSeconds(100); _version2Instant = now.minusSeconds(50); s_logger.debug("test data now: {}", _version1Instant); s_logger.debug("test data later: {}", _version2Instant); final SimpleJdbcTemplate template = _secMaster.getDbConnector().getJdbcTemplate(); template.update( "INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)", 101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity101", "EQUITY", "D"); template.update( "INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)", 102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity102", "EQUITY", "D"); template.update( "INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)", 201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity201", "EQUITY", "D"); template.update( "INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)", 202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "TestSecurity202", "EQUITY", "D"); _totalSecurities = 3; // id bigint not null, // key_scheme varchar(255) not null, // key_value varchar(255) not null, template.update("INSERT INTO sec_idkey VALUES (?,?,?)", 1, "A", "B"); template.update("INSERT INTO sec_idkey VALUES (?,?,?)", 2, "C", "D"); template.update("INSERT INTO sec_idkey VALUES (?,?,?)", 3, "E", "F"); template.update("INSERT INTO sec_idkey VALUES (?,?,?)", 4, "G", "HI"); // security_id bigint not null, // idkey_id bigint not null, template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 101, 1); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 101, 2); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 101, 3); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 102, 1); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 102, 2); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 102, 4); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 201, 2); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 201, 3); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 202, 2); template.update("INSERT INTO sec_security2idkey VALUES (?,?)", 202, 3); }