Search in sources :

Example 1 with JdbcStringBasedStore

use of org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore in project infinispan by infinispan.

the class TxStoreTest method assertRowCount.

private void assertRowCount(int rowCount) {
    JdbcStringBasedStore jdbcStore = (JdbcStringBasedStore) store.delegate();
    ConnectionFactory connectionFactory = jdbcStore.getConnectionFactory();
    TableName tableName = jdbcStore.getTableManager().getDataTableName();
    int value = UnitTestDatabaseManager.rowCount(connectionFactory, tableName);
    assert value == rowCount : "Expected " + rowCount + " rows, actual value is " + value;
}
Also used : TableName(org.infinispan.persistence.jdbc.impl.table.TableName) ConnectionFactory(org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory) JdbcStringBasedStore(org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore)

Example 2 with JdbcStringBasedStore

use of org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore in project infinispan by infinispan.

the class TableNameUniquenessTest method testForJdbcStringBasedCacheStore.

public void testForJdbcStringBasedCacheStore() throws Exception {
    CacheContainer cm = null;
    try {
        cm = TestCacheManagerFactory.fromXml("configs/all/string-based.xml");
        Cache<String, String> first = cm.getCache("first");
        Cache<String, String> second = cm.getCache("second");
        StoreConfiguration firstCacheLoaderConfig = first.getCacheConfiguration().persistence().stores().get(0);
        StoreConfiguration secondCacheLoaderConfig = second.getCacheConfiguration().persistence().stores().get(0);
        assertEquals(JdbcStringBasedStoreConfiguration.class, firstCacheLoaderConfig.getClass());
        assertEquals(JdbcStringBasedStoreConfiguration.class, secondCacheLoaderConfig.getClass());
        WaitDelegatingNonBlockingStore<String, String> firstCs = TestingUtil.getFirstStoreWait(first);
        WaitDelegatingNonBlockingStore<String, String> secondCs = TestingUtil.getFirstStoreWait(second);
        JdbcStringBasedStore<String, String> firstJdbcS = (JdbcStringBasedStore<String, String>) firstCs.delegate();
        assertTableExistence(firstJdbcS.getConnectionFactory().getConnection(), firstJdbcS.getTableManager().getIdentifierQuoteString(), "second", "first", "ISPN_STRING_TABLE");
        assertNoOverlapingState(first, second, firstCs, secondCs);
    } finally {
        TestingUtil.killCacheManagers(cm);
    }
}
Also used : CacheContainer(org.infinispan.manager.CacheContainer) StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) JdbcStringBasedStoreConfiguration(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfiguration) JdbcStringBasedStore(org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore)

Aggregations

JdbcStringBasedStore (org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore)2 StoreConfiguration (org.infinispan.configuration.cache.StoreConfiguration)1 CacheContainer (org.infinispan.manager.CacheContainer)1 ConnectionFactory (org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory)1 JdbcStringBasedStoreConfiguration (org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfiguration)1 TableName (org.infinispan.persistence.jdbc.impl.table.TableName)1