public void store() throws IOException { getStore().store(); }
@Override public void store() throws IOException { delegateAsStore().store(); }
/** * WRITE_LOCK * * @see org.geoserver.security.GeoServerRoleStore#store() */ public void store() throws IOException { writeLock(); try { getStore().store(); } finally { writeUnLock(); } }
@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); }
roleStore.store(); userGroupStore.store();
@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); } }
roleStore.store();
@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); }
store.store(); assertFalse(store.isModified()); store.addRole(role_parent); assertTrue(store.isModified()); store.store(); store.associateRoleToGroup(role, "agroup"); assertTrue(store.isModified()); store.store(); store.associateRoleToUser(role, "auser"); assertTrue(store.isModified()); store.store(); store.setParentRole(role, role_parent); assertTrue(store.isModified()); store.store(); store.store();
protected void createServices() throws Exception { GeoServerRoleService rservice = createRoleService("rs1"); GeoServerRoleStore rstore = rservice.createStore(); GeoServerRole root, derived; rstore.addRole(root = rstore.createRoleObject(rootRole)); rstore.addRole(derived = rstore.createRoleObject(derivedRole)); rstore.setParentRole(derived, root); rstore.associateRoleToUser(derived, testUserName); rstore.associateRoleToUser(derived, "castest"); rstore.store(); SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig(); mconfig.setRoleServiceName("rs1"); getSecurityManager().saveSecurityConfig(mconfig); GeoServerUserGroupService ugservice = createUserGroupService("ug1"); GeoServerUserGroupStore ugstore = ugservice.createStore(); GeoServerUser u1 = ugstore.createUserObject(testUserName, testPassword, true); ugstore.addUser(u1); GeoServerUser u2 = ugstore.createUserObject("abc@xyz.com", "abc", true); ugstore.addUser(u2); GeoServerUser u3 = ugstore.createUserObject("castest", "castest", true); ugstore.addUser(u3); ugstore.store(); GeoServerAuthenticationProvider prov = createAuthProvider(testProviderName, ugservice.getName()); prepareAuthProviders(prov.getName()); }
protected void insert(GeoServerRoleService roleService, String roleName) throws IOException { GeoServerRoleStore store = getStore(roleService); try { store.addRole(new GeoServerRole(roleName)); } finally { store.store(); } }
protected void associate(GeoServerRoleService roleService, String roleName, String userName) throws IOException { GeoServerRoleStore store = getStore(roleService); try { store.associateRoleToUser(getRole(store, roleName), userName); } finally { store.store(); } }
protected void delete(GeoServerRoleService roleService, String roleName) throws IOException { GeoServerRoleStore store = getStore(roleService); try { store.removeRole(getRole(store, roleName)); } finally { store.store(); } }
protected void disassociate(GeoServerRoleService roleService, String roleName, String userName) throws IOException { GeoServerRoleStore store = getStore(roleService); try { store.disAssociateRoleFromUser(getRole(store, roleName), userName); } finally { store.store(); } }
protected void syncbackends() throws IOException { roleStore.store(); usergroupStore.store(); } }
@Before public void cleraRoleService() throws Exception { store.clear(); store.store(); }
@After public void dropExistingTables() throws Exception { if (store != null) { JDBCRoleStore jdbcStore = (JDBCRoleStore) store; JDBCTestSupport.dropExistingTables(jdbcStore, jdbcStore.getConnection()); store.store(); } }
@Override protected void tearDownInternal() throws Exception { super.tearDownInternal(); if (store!=null) { JDBCRoleStore jdbcStore =(JDBCRoleStore)store; JDBCTestSupport.dropExistingTables(jdbcStore,jdbcStore.getConnection()); store.store(); } }
@Override protected void tearDownInternal() throws Exception { super.tearDownInternal(); JDBCRoleStore rs = (JDBCRoleStore) roleStore; JDBCTestSupport.dropExistingTables(rs, rs.getConnection()); roleStore.store(); JDBCUserGroupStore ugs = (JDBCUserGroupStore) ugStore; JDBCTestSupport.dropExistingTables(ugs, ugs.getConnection()); ugStore.store(); }
@Override protected void tearDownInternal() throws Exception { super.tearDownInternal(); if (roleStore!=null) { JDBCRoleStore jdbcStore1 =(JDBCRoleStore) roleStore; JDBCTestSupport.dropExistingTables(jdbcStore1,jdbcStore1.getConnection()); roleStore.store(); } if (usergroupStore!=null) { JDBCUserGroupStore jdbcStore2 =(JDBCUserGroupStore) usergroupStore; JDBCTestSupport.dropExistingTables(jdbcStore2,jdbcStore2.getConnection()); usergroupStore.store(); } }