@Test(groups = "slow") public void testWithArgument() throws Exception { dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory()); final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class); final DateTimeZone dateTimeZonePierre = DateTimeZone.UTC; somethingSqlDao.create(1, "pierre", dateTimeZonePierre); final DateTimeZone dateTimeZoneStephane = DateTimeZone.forID("Europe/London"); somethingSqlDao.create(2, "stephane", dateTimeZoneStephane); final String tzStringPierre = somethingSqlDao.getCreatedTZ(1); Assert.assertEquals(tzStringPierre, dateTimeZonePierre.toString()); final String tzStringStephane = somethingSqlDao.getCreatedTZ(2); Assert.assertEquals(tzStringStephane, dateTimeZoneStephane.toString()); }
@BeforeClass(groups = "slow") public void beforeClass() throws Exception { loadSystemPropertiesFromClasspath("/queue.properties"); clock = new ClockMock(); embeddedDB = new MySQLEmbeddedDB("killbillq", "killbillq", "killbillq"); embeddedDB.initialize(); embeddedDB.start(); final String ddl = toString(Resources.getResource("com/ning/billing/queue/ddl.sql").openStream()); embeddedDB.executeScript(ddl); dbi = new DBI(embeddedDB.getDataSource()); dbi.registerArgumentFactory(new UUIDArgumentFactory()); dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory()); dbi.registerArgumentFactory(new DateTimeArgumentFactory()); dbi.registerArgumentFactory(new LocalDateArgumentFactory()); dbi.registerArgumentFactory(new EnumArgumentFactory()); dbi.registerMapper(new UUIDMapper()); final ConfigSource configSource = new SimplePropertyConfigSource(System.getProperties()); persistentBusConfig = new ConfigurationObjectFactory(configSource).buildWithReplacements(PersistentBusConfig.class, ImmutableMap.<String, String>of("instanceName", "main")); notificationQueueConfig = new ConfigurationObjectFactory(configSource).buildWithReplacements(NotificationQueueConfig.class, ImmutableMap.<String, String>of("instanceName", "main")); }