Repository: syncope Updated Branches: refs/heads/master a3e23c1f1 -> fcd85f6c4
Fixed SYNCOPE-707 Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/fcd85f6c Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/fcd85f6c Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/fcd85f6c Branch: refs/heads/master Commit: fcd85f6c4f9225919c1a55e4535cf0c151aab8e9 Parents: a3e23c1 Author: massi <[email protected]> Authored: Tue Oct 13 15:38:14 2015 +0200 Committer: massi <[email protected]> Committed: Tue Oct 13 15:38:14 2015 +0200 ---------------------------------------------------------------------- .../org/apache/syncope/core/logic/ConfigurationLogic.java | 9 +++++++++ .../syncope/fit/core/reference/ConfigurationITCase.java | 2 ++ 2 files changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/fcd85f6c/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java ---------------------------------------------------------------------- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java index b36c4ea..dca3768 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java @@ -61,6 +61,15 @@ public class ConfigurationLogic extends AbstractTransactionalLogic<ConfTO> { @PreAuthorize("hasRole('" + Entitlement.CONFIGURATION_DELETE + "')") public void delete(final String schema) { + + final CPlainAttr conf = confDAO.find(schema); + if (conf == null) { + final PlainSchema plainSchema = plainSchemaDAO.find(schema); + if (plainSchema == null) { + throw new NotFoundException("Configuration schema " + schema); + } + } + confDAO.delete(schema); } http://git-wip-us.apache.org/repos/asf/syncope/blob/fcd85f6c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java index 71317e4..dc618eb 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java @@ -68,6 +68,7 @@ public class ConfigurationITCase extends AbstractITCase { public void delete() throws UnsupportedEncodingException { try { configurationService.delete("nonExistent"); + fail("The delete operation should throw an exception because of nonExistent schema"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -77,6 +78,7 @@ public class ConfigurationITCase extends AbstractITCase { configurationService.delete("token.length"); try { configurationService.get("token.length"); + fail("The delete operation should throw an exception because token.length does not exist anymore"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); }
