You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/10/14 13:27:07 UTC
[1/5] syncope git commit: Fixed SYNCOPE-707
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 <ma...@tirasa.net>
Authored: Tue Oct 13 15:50:08 2015 +0200
Committer: massi <ma...@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());
}
[4/5] syncope git commit: changed message error, SYNCOPE-708
Posted by il...@apache.org.
changed message error, SYNCOPE-708
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/91cb526c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/91cb526c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/91cb526c
Branch: refs/heads/master
Commit: 91cb526c6ccb853d20677562e812d88fc53c252d
Parents: 5063ce6
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 14 11:56:13 2015 +0200
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 14 11:56:13 2015 +0200
----------------------------------------------------------------------
.../test/java/org/apache/syncope/core/rest/LoggerTestITCase.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/91cb526c/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
index 8092098..025dc25 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
@@ -221,7 +221,7 @@ public class LoggerTestITCase extends AbstractTest {
public void issueSYNCOPE708() {
try {
loggerService.read(LoggerType.LOG, "notExists");
- fail("Read a not exists logger, it should go in exception");
+ fail("Reading non-existing logger, it should go in exception");
} catch (final WebServiceException ex) {
fail("Exception is WebServiceException but it should be SyncopeClientException");
} catch (final SyncopeClientException ex) {
[5/5] syncope git commit: Merge branch '1_2_X'
Posted by il...@apache.org.
Merge branch '1_2_X'
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/2f137b21
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/2f137b21
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/2f137b21
Branch: refs/heads/master
Commit: 2f137b211e14b8c97d610f7a1831885774ef644b
Parents: 009a87e 91cb526
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Oct 14 13:26:35 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Oct 14 13:26:35 2015 +0200
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/5] syncope git commit: removed useless try/catch for delete test,
SYNCOPE-707
Posted by il...@apache.org.
removed useless try/catch for delete test, SYNCOPE-707
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/876fde9a
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/876fde9a
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/876fde9a
Branch: refs/heads/master
Commit: 876fde9aa6abe7501a6cfdd53e32be0828ecdf03
Parents: 091b066
Author: massi <ma...@tirasa.net>
Authored: Tue Oct 13 16:22:05 2015 +0200
Committer: massi <ma...@tirasa.net>
Committed: Tue Oct 13 16:22:05 2015 +0200
----------------------------------------------------------------------
.../syncope/core/rest/ConfigurationTestITCase.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/876fde9a/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 ca70092..c34015c 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
@@ -19,6 +19,7 @@
package org.apache.syncope.core.rest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -79,16 +80,13 @@ public class ConfigurationTestITCase extends AbstractTest {
AttributeTO tokenLength = configurationService.read("token.length");
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());
- }
+
+ AttributeTO actual = configurationService.read(tokenLength.getSchema());
+ assertNotEquals(actual, tokenLength);
configurationService.set(tokenLength.getSchema(), tokenLength);
- AttributeTO actual = configurationService.read(tokenLength.getSchema());
+ actual = configurationService.read(tokenLength.getSchema());
assertEquals(actual, tokenLength);
}
[3/5] syncope git commit: Fixed SYNCOPE-708
Posted by il...@apache.org.
Fixed SYNCOPE-708
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5063ce6e
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5063ce6e
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5063ce6e
Branch: refs/heads/master
Commit: 5063ce6e1b6db266470e42e17cae244b789e1dc4
Parents: 876fde9
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 14 11:51:54 2015 +0200
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 14 11:51:54 2015 +0200
----------------------------------------------------------------------
.../core/rest/controller/LoggerController.java | 32 +++++++++++++++++---
.../core/services/LoggerServiceImpl.java | 15 +++++----
.../syncope/core/rest/LoggerTestITCase.java | 16 ++++++++++
3 files changed, 53 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/5063ce6e/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
index f38d0b2..d077cd1 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
@@ -116,6 +116,31 @@ public class LoggerController extends AbstractTransactionalController<LoggerTO>
throw sce;
}
+ @PreAuthorize("hasRole('LOG_LIST')")
+ @Transactional(readOnly = true)
+ public LoggerTO readLog(final String name) {
+ for (final LoggerTO logger : listLogs()) {
+ if (logger.getName().equals(name)) {
+ return logger;
+ }
+ }
+ throw new NotFoundException("Logger " + name);
+ }
+
+ @PreAuthorize("hasRole('AUDIT_LIST')")
+ @Transactional(readOnly = true)
+ public LoggerTO readAudit(final String name) {
+ for (final AuditLoggerName logger : listAudits()) {
+ if (logger.toLoggerName().equals(name)) {
+ final LoggerTO loggerTO = new LoggerTO();
+ loggerTO.setName(logger.toLoggerName());
+ loggerTO.setLevel(LoggerLevel.DEBUG);
+ return loggerTO;
+ }
+ }
+ throw new NotFoundException("Logger " + name);
+ }
+
private LoggerTO setLevel(final String name, final Level level, final LoggerType expectedType) {
SyncopeLogger syncopeLogger = loggerDAO.find(name);
if (syncopeLogger == null) {
@@ -213,11 +238,10 @@ public class LoggerController extends AbstractTransactionalController<LoggerTO>
try {
final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
- final MetadataReaderFactory metadataReaderFactory =
- new CachingMetadataReaderFactory(resourcePatternResolver);
+ final MetadataReaderFactory metadataReaderFactory
+ = new CachingMetadataReaderFactory(resourcePatternResolver);
- final String packageSearchPath =
- ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ final String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(
SystemPropertyUtils.resolvePlaceholders(this.getClass().getPackage().getName()))
+ "/" + "**/*.class";
http://git-wip-us.apache.org/repos/asf/syncope/blob/5063ce6e/core/src/main/java/org/apache/syncope/core/services/LoggerServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/services/LoggerServiceImpl.java b/core/src/main/java/org/apache/syncope/core/services/LoggerServiceImpl.java
index 1308e1f..2b106d1 100644
--- a/core/src/main/java/org/apache/syncope/core/services/LoggerServiceImpl.java
+++ b/core/src/main/java/org/apache/syncope/core/services/LoggerServiceImpl.java
@@ -80,13 +80,16 @@ public class LoggerServiceImpl extends AbstractServiceImpl implements LoggerServ
@Override
public LoggerTO read(final LoggerType type, final String name) {
- List<LoggerTO> logger = list(type);
- for (LoggerTO l : logger) {
- if (l.getName().equals(name)) {
- return l;
- }
+ switch (type) {
+ case LOG:
+ return controller.readLog(name);
+
+ case AUDIT:
+ return controller.readAudit(name);
+
+ default:
+ throw new BadRequestException();
}
- throw new NotFoundException();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/5063ce6e/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
index 58927f0..8092098 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/LoggerTestITCase.java
@@ -22,9 +22,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import java.text.ParseException;
import java.util.List;
+import javax.ws.rs.core.Response;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.common.to.EventCategoryTO;
import org.apache.syncope.common.to.LoggerTO;
import org.apache.syncope.common.types.AttributableType;
@@ -212,4 +216,16 @@ public class LoggerTestITCase extends AbstractTest {
}
assertTrue(found);
}
+
+ @Test
+ public void issueSYNCOPE708() {
+ try {
+ loggerService.read(LoggerType.LOG, "notExists");
+ fail("Read a not exists logger, it should go in exception");
+ } catch (final WebServiceException ex) {
+ fail("Exception is WebServiceException but it should be SyncopeClientException");
+ } catch (final SyncopeClientException ex) {
+ assertEquals(Response.Status.NOT_FOUND, ex.getType().getResponseStatus());
+ }
+ }
}