@Before public void init() throws IOException { service = getSecurityManager().loadRoleService("test"); store = createStore(service); }
@Test public void testModify() throws Exception { checkEmpty(service); checkEmpty(store); insertValues(store); store.store(); checkValuesInserted(store); checkValuesInserted(service); modifyValues(store); if (!isJDBCTest()) checkValuesInserted(service); checkValuesModified(store); store.load(); checkValuesInserted(store); checkValuesInserted(service); modifyValues(store); store.store(); checkValuesModified(store); checkValuesModified(service); }
@Test public void testRemove() throws Exception { // all is empty checkEmpty(service); checkEmpty(store); insertValues(store); store.store(); checkValuesInserted(store); checkValuesInserted(service); removeValues(store); if (!isJDBCTest()) checkValuesInserted(service); checkValuesRemoved(store); store.load(); checkValuesInserted(store); checkValuesInserted(service); removeValues(store); store.store(); checkValuesRemoved(store); checkValuesRemoved(service); } }
@Test public void testInsert() throws Exception { // all is empty checkEmpty(service); checkEmpty(store); // transaction has values ? insertValues(store); if (!isJDBCTest()) checkEmpty(service); checkValuesInserted(store); // rollback store.load(); checkEmpty(store); checkEmpty(service); // commit insertValues(store); store.store(); checkValuesInserted(store); checkValuesInserted(service); }
@Override public GeoServerRoleStore createStore(GeoServerRoleService service) throws IOException { JDBCRoleStore store = (JDBCRoleStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store, store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); service = createRoleService("test"); }
@Override protected SystemTestData createTestData() throws Exception { if ("h2".equalsIgnoreCase(getFixtureId())) return super.createTestData(); return new LiveDbmsDataSecurity(getFixtureId()); }
@Override protected TestData buildTestData() throws Exception { if ("h2".equalsIgnoreCase(getFixtureId())) return super.buildTestData(); return new LiveDbmsDataSecurity(getFixtureId()); }
@Override public GeoServerRoleStore createStore(GeoServerRoleService service) throws IOException { JDBCRoleStore store = (JDBCRoleStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store,store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }