s_logger.debug("test data now: {}", _version1Instant);
s_logger.debug("test data later: {}", _version2Instant);
FudgeContext fudgeContext = OpenGammaFudgeContext.getInstance();
LobHandler lobHandler = new DefaultLobHandler();
final JdbcOperations template = _exgMaster.getDbConnector().getJdbcOperations();
ManageableExchange exchange = new ManageableExchange();
exchange.setUniqueId(UniqueId.of("DbExg", "101", "0"));
exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("E", "F")));
exchange.setName("TestExchange101");
exchange.setTimeZone(ZoneId.of("Europe/London"));
byte[] bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
"TestExchange101", "Europe/London", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
exchange.setUniqueId(UniqueId.of("DbExg", "102", "0"));
exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("G", "H")));
exchange.setName("TestExchange102");
exchange.setTimeZone(ZoneId.of("Europe/Paris"));
bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
"TestExchange102", "Europe/Paris", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
exchange.setUniqueId(UniqueId.of("DbExg", "201", "0"));
exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
exchange.setName("TestExchange201");
exchange.setTimeZone(ZoneId.of("Asia/Tokyo"));
bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
"TestExchange201", "Asia/Tokyo", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
exchange.setUniqueId(UniqueId.of("DbExg", "201", "1"));
exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
exchange.setName("TestExchange202");
exchange.setTimeZone(ZoneId.of("Asia/Tokyo"));
bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP,
"TestExchange202", "Asia/Tokyo", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
_totalExchanges = 3;