use of io.syndesis.server.jsondb.impl.SqlJsonDB in project syndesis by syndesisio.
the class DataStoreConfiguration method jsonDB.
@Bean
@Autowired
@SuppressWarnings("PMD.EmptyCatchBlock")
public SqlJsonDB jsonDB(DBI dbi, Optional<List<Index>> beanIndexes) {
ArrayList<Index> indexes = new ArrayList<>();
if (beanIndexes.isPresent()) {
indexes.addAll(beanIndexes.get());
}
for (Kind kind : Kind.values()) {
addIndex(indexes, kind, kind.getModelClass().getAnnotation(UniqueProperty.class));
UniqueProperty.Multiple ump = kind.getModelClass().getAnnotation(UniqueProperty.Multiple.class);
if (ump != null) {
for (UniqueProperty p : ump.value()) {
addIndex(indexes, kind, p);
}
}
addIndex(indexes, kind, kind.getModelClass().getAnnotation(IndexedProperty.class));
IndexedProperty.Multiple imp = kind.getModelClass().getAnnotation(IndexedProperty.Multiple.class);
if (imp != null) {
for (IndexedProperty p : imp.value()) {
addIndex(indexes, kind, p);
}
}
}
SqlJsonDB jsondb = new SqlJsonDB(dbi, null, indexes);
try {
jsondb.createTables();
} catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception ignore) {
LOG.debug("Could not create tables", ignore);
}
return jsondb;
}
use of io.syndesis.server.jsondb.impl.SqlJsonDB in project syndesis by syndesisio.
the class ActivityTrackingControllerTest method before.
@Before
public void before() {
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:mem:t;DB_CLOSE_DELAY=-1;MODE=PostgreSQL");
this.dbi = new DBI(ds);
this.jsondb = new SqlJsonDB(dbi, null);
this.jsondb.createTables();
}
use of io.syndesis.server.jsondb.impl.SqlJsonDB in project syndesis by syndesisio.
the class MetricsCollectorTest method before.
@Before
public void before() throws IOException, ParseException {
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL");
DBI dbi = new DBI(ds);
this.jsondb = new SqlJsonDB(dbi, null, Arrays.asList(new Index("/pair", "key")));
try {
this.jsondb.dropTables();
} catch (Exception e) {
}
this.jsondb.createTables();
jsondbRM = new JsonDBRawMetrics(jsondb);
load();
CacheManager cacheManager = new LRUCacheManager(100);
EncryptionComponent encryptionComponent = new EncryptionComponent(null);
ResourceLoader resourceLoader = new DefaultResourceLoader();
// Create Data Manager
dataManager = new DataManager(cacheManager, Collections.emptyList(), null, encryptionComponent, resourceLoader);
intMH = new IntegrationMetricsHandler(dataManager);
}
Aggregations