@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); }
assertTrue(store.isModified()); store.load(); assertFalse(store.isModified()); store.updateRole(role); assertTrue(store.isModified()); store.load(); store.load(); store.disAssociateRoleFromGroup(role, "agroup"); assertTrue(store.isModified()); store.load(); store.disAssociateRoleFromUser(role, "auser"); assertTrue(store.isModified()); store.load(); store.clear(); assertTrue(store.isModified()); store.load();
@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); } }
@After public void rollback() throws Exception { if (ugStore != null) ugStore.load(); if (roleStore != null) roleStore.load(); }
protected boolean onSubmit(AjaxRequestTarget target, Component contents) { // cascade delete the whole selection GeoServerRoleStore gaStore = null; try { GeoServerRoleService gaService = GeoServerApplication.get().getSecurityManager().loadRoleService(roleServiceName); gaStore = new RoleStoreValidationWrapper(gaService.createStore()); for (GeoServerRole role : removePanel.getRoots()) { gaStore.removeRole(role); } gaStore.store(); } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex); } // the deletion will have changed what we see in the page // so better clear out the selection roles.clearSelection(); return true; }
protected boolean onSubmit(AjaxRequestTarget target, Component contents) { // cascade delete the whole selection GeoServerRoleStore gaStore = null; try { GeoServerRoleService gaService = GeoServerApplication.get().getSecurityManager().loadRoleService(roleServiceName); gaStore = new RoleStoreValidationWrapper(gaService.createStore()); for (GeoServerRole role : removePanel.getRoots()) { gaStore.removeRole(role); } gaStore.store(); } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw new RuntimeException(ex); } // the deletion will have changed what we see in the page // so better clear out the selection roles.clearSelection(); return true; }
@Override protected void onFormSubmit(GeoServerRole updated) throws IOException{ if (hasRoleStore(roleServiceName)==false) { throw new RuntimeException("Invalid workflow, cannot store in a read only role service"); } GeoServerRoleStore store=null; try { store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); GeoServerRole role = store.getRoleByName(updated.getAuthority()); role.getProperties().clear(); role.getProperties().putAll(updated.getProperties()); store.updateRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
@Override protected void onFormSubmit(GeoServerRole updated) throws IOException{ if (hasRoleStore(roleServiceName)==false) { throw new RuntimeException("Invalid workflow, cannot store in a read only role service"); } GeoServerRoleStore store=null; try { store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); GeoServerRole role = store.getRoleByName(updated.getAuthority()); role.getProperties().clear(); role.getProperties().putAll(updated.getProperties()); store.updateRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
protected boolean onSubmit( AjaxRequestTarget target, Component contents) { // cascade delete the whole selection GeoServerRoleStore gaStore = null; try { GeoServerRoleService gaService = GeoServerApplication.get() .getSecurityManager() .loadRoleService(roleServiceName); gaStore = new RoleStoreValidationWrapper(gaService.createStore()); for (GeoServerRole role : removePanel.getRoots()) { gaStore.removeRole(role); } gaStore.store(); } catch (IOException ex) { try { gaStore.load(); } catch (IOException ex2) { } ; throw new RuntimeException(ex); } // the deletion will have changed what we see in the page // so better clear out the selection roles.clearSelection(); return true; }
} catch (IOException ex) { try { store.load(); } catch (IOException ex2) {
@Override protected void onFormSubmit(GeoServerRole role) throws IOException { GeoServerRoleStore store = null; try { store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); //copy into a new one so we can set the name properly GeoServerRole newRole= store.createRoleObject(get("form:name").getDefaultModelObjectAsString()); newRole.setUserName(role.getUserName()); newRole.getProperties().putAll(role.getProperties()); role = newRole; store.addRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
@Override protected void onFormSubmit(GeoServerRole role) throws IOException { GeoServerRoleStore store = null; try { //copy into a new one so we can set the name properly GeoServerRole newRole = new GeoServerRole(get("form:name").getDefaultModelObjectAsString()); newRole.setUserName(role.getUserName()); newRole.getProperties().putAll(role.getProperties()); role = newRole; store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); store.addRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
} catch (IOException ex) { try { store.load(); } catch (IOException ex2) {
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; } }
@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; } }
try {gaStore.load(); } catch (IOException ex2) {}; throw ex;
try {gaStore.load(); } catch (IOException ex2) {}; throw ex;
gaStore.load(); } catch (IOException ex2) {