store.updateUser(user); } catch (PasswordPolicyException e) { store.load(); // rollback throw new RuntimeException("Never should reach this point", e);
@After public void rollback() throws Exception { if (ugStore != null) ugStore.load(); if (roleStore != null) roleStore.load(); }
try {ugStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex);
try {ugStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex);
try {ugStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex);
try {ugStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex);
@Before public void removeBill() throws Exception { GeoServerUserGroupStore ugStore = getSecurityManager().loadUserGroupService("gaugs").createStore(); GeoServerUser bill = ugStore.getUserByUsername("bill"); if (bill != null) { ugStore.removeUser(bill); ugStore.store(); } else { ugStore.load(); } }
try { store.load(); } catch (IOException ex2) {}; throw ex;
try { store.load(); } catch (IOException ex2) {}; throw ex;
try { store.load(); } catch (IOException ex2) {
@Override protected void onFormSubmit(GeoServerUserGroup group) throws IOException { GeoServerUserGroupStore store=null; try { store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(),group.isEnabled()); store.addGroup(group); store.store(); } catch (IOException ex) { try { store.load(); } catch (IOException ex2) {}; throw ex; } GeoServerRoleStore gaStore=null; try { if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) { gaStore = getRoleStore(getSecurityManager().getActiveRoleService().getName()); gaStore = new RoleStoreValidationWrapper(gaStore); for (GeoServerRole role : rolePalette.getSelectedRoles()) { gaStore.associateRoleToGroup(role, group.getGroupname()); } gaStore.store(); } } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw ex; } }
@Override protected void onFormSubmit(GeoServerUserGroup group) throws IOException { GeoServerUserGroupStore store=null; try { store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(),group.isEnabled()); store.addGroup(group); store.store(); } catch (IOException ex) { try { store.load(); } catch (IOException ex2) {}; throw ex; } GeoServerRoleStore gaStore=null; try { if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) { gaStore = getRoleStore(getSecurityManager().getActiveRoleService().getName()); gaStore = new RoleStoreValidationWrapper(gaStore); for (GeoServerRole role : rolePalette.getSelectedRoles()) { gaStore.associateRoleToGroup(role, group.getGroupname()); } gaStore.store(); } } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw ex; } }
} catch (IOException ex) { try { store.load(); } catch (IOException ex2) {
@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); }
@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 testRemoveUserNotInGroup() throws Exception { GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); GeoServerUserGroupStore ugStore = ugService.createStore(); GeoServerUser sally = ugStore.createUserObject("sally", "foobar", true); ugStore.addUser(sally); ugStore.associateUserToGroup(sally, admins); ugStore.store(); setAuth(); ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); ugStore = ugService.createStore(); try { ugStore.removeUser(sally); fail(); } catch (IOException e) { ugStore.load(); } ; } }
@Test public void testModify() throws Exception { // all is empty 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); }