Repository: syncope
Updated Branches:
  refs/heads/master 009a87e08 -> 2f137b211


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/091b0662
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/091b0662
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/091b0662

Branch: refs/heads/master
Commit: 091b0662c8d77b84bc96e7e4047a36da8c12643b
Parents: 7dd33ce
Author: massi <massimiliano.perr...@tirasa.net>
Authored: Tue Oct 13 15:50:08 2015 +0200
Committer: massi <massimiliano.perr...@tirasa.net>
Committed: Tue Oct 13 15:50:08 2015 +0200

----------------------------------------------------------------------
 .../core/rest/controller/ConfigurationController.java        | 8 ++++++++
 .../apache/syncope/core/rest/ConfigurationTestITCase.java    | 2 ++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/091b0662/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
 
b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
index b64d224..c71db6e 100644
--- 
a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
+++ 
b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
@@ -69,6 +69,14 @@ public class ConfigurationController extends 
AbstractTransactionalController<Con
 
     @PreAuthorize("hasRole('CONFIGURATION_DELETE')")
     public void delete(final String key) {
+        
+        final CAttr conf = confDAO.find(key);
+        if (conf == null) {
+            final CSchema schema = schemaDAO.find(key, CSchema.class);
+            if (schema == null) {
+                throw new NotFoundException("Configuration key " + key);
+            }
+        }
         confDAO.delete(key);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/091b0662/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java 
b/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
index d81afb7..ca70092 100644
--- 
a/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
+++ 
b/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
@@ -71,6 +71,7 @@ public class ConfigurationTestITCase extends AbstractTest {
     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());
         }
@@ -80,6 +81,7 @@ public class ConfigurationTestITCase extends AbstractTest {
         configurationService.delete("token.length");
         try {
             configurationService.read("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());
         }

Reply via email to