Search in sources :

Example 1 with TableName

use of org.infinispan.persistence.jdbc.impl.table.TableName in project infinispan by infinispan.

the class TableNameTest method testEmptySchema.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testEmptySchema() {
    TableName tableName = new TableName(IDENTIFIER_QUOTE, ".ISPN", "FOOBAR");
    assertEquals(tableName.getSchema(), "");
}
Also used : TableName(org.infinispan.persistence.jdbc.impl.table.TableName) Test(org.testng.annotations.Test)

Example 2 with TableName

use of org.infinispan.persistence.jdbc.impl.table.TableName in project infinispan by infinispan.

the class TableNameTest method testSchema.

public void testSchema() {
    TableName tableName = new TableName(IDENTIFIER_QUOTE, "TEST.ISPN", "FOOBAR");
    assertEquals(tableName.getSchema(), "TEST");
    assertEquals(tableName.getName(), "ISPN_FOOBAR");
    assertEquals(tableName.toString(), "\"TEST\".\"ISPN_FOOBAR\"");
    tableName = new TableName(IDENTIFIER_QUOTE, "ISPN", "FOOBAR");
    assertEquals(tableName.getSchema(), null);
    assertEquals(tableName.getName(), "ISPN_FOOBAR");
    assertEquals(tableName.toString(), "\"ISPN_FOOBAR\"");
}
Also used : TableName(org.infinispan.persistence.jdbc.impl.table.TableName)

Example 3 with TableName

use of org.infinispan.persistence.jdbc.impl.table.TableName in project infinispan by infinispan.

the class TableNameTest method testName.

public void testName() {
    TableName tableName = new TableName(IDENTIFIER_QUOTE, "ISPN", "FOOBäR");
    assertEquals(tableName.toString(), "\"ISPN_FOOB_R\"");
}
Also used : TableName(org.infinispan.persistence.jdbc.impl.table.TableName)

Example 4 with TableName

use of org.infinispan.persistence.jdbc.impl.table.TableName 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 5 with TableName

use of org.infinispan.persistence.jdbc.impl.table.TableName in project infinispan by infinispan.

the class JdbcStringBasedStoreAltMapperTest method rowCount.

protected int rowCount() {
    ConnectionFactory connectionFactory = getConnection();
    TableName tableName = tableManager.getDataTableName();
    return UnitTestDatabaseManager.rowCount(connectionFactory, tableName);
}
Also used : TableName(org.infinispan.persistence.jdbc.impl.table.TableName) ConnectionFactory(org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory)

Aggregations

TableName (org.infinispan.persistence.jdbc.impl.table.TableName)7 ConnectionFactory (org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory)2 Test (org.testng.annotations.Test)2 PreparedStatement (java.sql.PreparedStatement)1 Random (java.util.Random)1 JdbcStringBasedStore (org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore)1 AbstractInfinispanTest (org.infinispan.test.AbstractInfinispanTest)1