Esempio n. 1
0
 public static Database getDefaultHsqlDatabase(final String initDbFile) {
   if (dataSource == null) {
     dataSource = new jdbcDataSource();
     // dataSource.setDatabase("jdbc:hsqldb:hsql://localhost/squilldemodb");
     dataSource.setDatabase("jdbc:hsqldb:mem:squilldemodb");
     dataSource.setUser("SA");
     initDb(dataSource, initDbFile);
   }
   return new Database(dataSource);
 }
Esempio n. 2
0
 /////////////// private
 private DataSource getDataSource() throws Exception {
   FileSystem fs = getFileSystem();
   jdbcDataSource ds = new jdbcDataSource();
   ds.setDatabase("jdbc:hsqldb:.");
   ds.setUser("sa");
   ds.setPassword("");
   if (!DatabaseUtils.hasTable(ds, "ledge_id_table")) {
     DatabaseUtils.runScript(ds, fs.getReader("sql/database/IdGeneratorTables.sql", "UTF-8"));
   }
   if (!DatabaseUtils.hasTable(ds, "ledge_naming_context")) {
     DatabaseUtils.runScript(ds, fs.getReader("sql/naming/DBNamingTables.sql", "UTF-8"));
   }
   DatabaseUtils.runScript(ds, fs.getReader("sql/naming/DBNamingTest.sql", "UTF-8"));
   return ds;
 }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    assert gridName != null;

    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    if (gridName.contains("cache")) {
      String cacheName = "test-checkpoints";

      CacheConfiguration cacheCfg = defaultCacheConfiguration();

      cacheCfg.setName(cacheName);
      cacheCfg.setWriteSynchronizationMode(FULL_SYNC);

      CacheCheckpointSpi spi = new CacheCheckpointSpi();

      spi.setCacheName(cacheName);

      cfg.setCacheConfiguration(cacheCfg);

      cfg.setCheckpointSpi(spi);
    } else if (gridName.contains("jdbc")) {
      JdbcCheckpointSpi spi = new JdbcCheckpointSpi();

      jdbcDataSource ds = new jdbcDataSource();

      ds.setDatabase("jdbc:hsqldb:mem:gg_test_" + getClass().getSimpleName());
      ds.setUser("sa");
      ds.setPassword("");

      spi.setDataSource(ds);
      spi.setCheckpointTableName("test_checkpoints");
      spi.setKeyFieldName("key");
      spi.setValueFieldName("value");
      spi.setValueFieldType("longvarbinary");
      spi.setExpireDateFieldName("expire_date");

      cfg.setCheckpointSpi(spi);
    }

    return cfg;
  }