Search in sources :

Example 6 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method testUpdateKO.

@Test(expected = IllegalArgumentException.class)
public void testUpdateKO() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.updateProperty(null);
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 7 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method testReadKO.

@Test(expected = PropertyAccessException.class)
public void testReadKO() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.readProperty("p1");
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 8 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method testListProperties.

@Test(expected = PropertyAccessException.class)
public void testListProperties() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.listPropertyNames();
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 9 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method tesDeleteKO.

@Test(expected = PropertyAccessException.class)
public void tesDeleteKO() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.deleteProperty("p1");
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 10 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method testClearKO.

@Test(expected = PropertyAccessException.class)
public void testClearKO() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.clear();
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Aggregations

JdbcPropertyStore (org.ff4j.property.store.JdbcPropertyStore)14 Test (org.junit.Test)11 SQLException (java.sql.SQLException)9 DataSource (javax.sql.DataSource)9 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)5 EmbeddedDatabase (org.springframework.jdbc.datasource.embedded.EmbeddedDatabase)2 PropertyString (org.ff4j.property.PropertyString)1 JdbcQueryBuilder (org.ff4j.store.JdbcQueryBuilder)1