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 2017/06/13 11:23:00 UTC

[1/4] syncope git commit: Fixing JNDI name for DataSource

Repository: syncope
Updated Branches:
  refs/heads/2_0_X b6ae826a6 -> 1bf49e3fd


Fixing JNDI name for DataSource


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ddf2d5ee
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ddf2d5ee
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ddf2d5ee

Branch: refs/heads/2_0_X
Commit: ddf2d5ee90825df1e3fbc77bd67d3f858afff689
Parents: b6ae826
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jun 13 11:10:33 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jun 13 11:10:33 2017 +0200

----------------------------------------------------------------------
 .../systemadministration/javaeecontainer.adoc                | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ddf2d5ee/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
index 58c4b59..a7ea928 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
@@ -42,7 +42,7 @@ domain and MySQL): please also check that the connection parameters are the same
 
 [source,xml]
 ....
-<Resource name="jdbc/MasterDataSource" auth="Container" type="javax.sql.DataSource"
+<Resource name="jdbc/syncopeMasterDataSource" auth="Container" type="javax.sql.DataSource"
           factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testWhileIdle="true"
           testOnBorrow="true" testOnReturn="true" validationQuery="SELECT 1" validationInterval="30000"
           maxActive="100" minIdle="2" maxWait="10000" initialSize="2" removeAbandonedTimeout="20000"
@@ -64,13 +64,13 @@ When using a datasource for internal storage, be sure to add
 [source,xml]
 ....
 <resource-ref>
-  <res-ref-name>jdbc/MasterDataSource</res-ref-name>
-  <jndi-name>jdbc/MasterDataSource</jndi-name>
+  <res-ref-name>jdbc/syncopeMasterDataSource</res-ref-name>
+  <jndi-name>jdbc/syncopeMasterDataSource</jndi-name>
 </resource-ref>
 ....
 
 right after `</context-root>` in `core/src/main/webapp/WEB-INF/glassfish-web.xml`, assuming that your Glassfish instance
-provides a datasource named `jdbc/MasterDataSource`.
+provides a datasource named `jdbc/syncopeMasterDataSource`.
 
 ===== Wildfly 9 and 10
 


[4/4] syncope git commit: [SYNCOPE-1084] Running MySQL fine with HikariCP

Posted by il...@apache.org.
[SYNCOPE-1084] Running MySQL fine with HikariCP


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1bf49e3f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1bf49e3f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1bf49e3f

Branch: refs/heads/2_0_X
Commit: 1bf49e3fd9f934c1bc4e7d4ee0e715e49f1e2bc7
Parents: 3ad2ef7
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jun 13 12:59:07 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jun 13 12:59:07 2017 +0200

----------------------------------------------------------------------
 fit/core-reference/pom.xml                                |  4 ++--
 .../src/main/resources/mysql/domains/Master.properties    |  2 +-
 .../systemadministration/dbms.adoc                        |  4 ++--
 .../systemadministration/javaeecontainer.adoc             | 10 ++++++----
 4 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/1bf49e3f/fit/core-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index 1a116aa..8aa248b 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -524,7 +524,7 @@ under the License.
         <dependency>
           <groupId>mysql</groupId>
           <artifactId>mysql-connector-java</artifactId>
-          <version>5.1.39</version>
+          <version>5.1.42</version>
           <scope>test</scope>
         </dependency>
       </dependencies>
@@ -560,7 +560,7 @@ under the License.
         <dependency>
           <groupId>org.mariadb.jdbc</groupId>
           <artifactId>mariadb-java-client</artifactId>
-          <version>1.5.9</version>
+          <version>1.6.1</version>
           <scope>test</scope>
         </dependency>
       </dependencies>

http://git-wip-us.apache.org/repos/asf/syncope/blob/1bf49e3f/fit/core-reference/src/main/resources/mysql/domains/Master.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mysql/domains/Master.properties b/fit/core-reference/src/main/resources/mysql/domains/Master.properties
index ce7251f..ce09eec 100644
--- a/fit/core-reference/src/main/resources/mysql/domains/Master.properties
+++ b/fit/core-reference/src/main/resources/mysql/domains/Master.properties
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 Master.driverClassName=com.mysql.jdbc.Driver
-Master.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8
+Master.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8&relaxAutoCommit=true
 Master.schema=
 Master.username=syncope
 Master.password=syncope

http://git-wip-us.apache.org/repos/asf/syncope/blob/1bf49e3f/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
index 2734785..4849c60 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
@@ -64,7 +64,7 @@ In `domains/Master.properties` (for the `Master` domain):
 
 ....
 Master.driverClassName=com.mysql.jdbc.Driver
-Master.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8
+Master.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8&relaxAutoCommit=true
 Master.schema=
 Master.username=syncope
 Master.password=syncope
@@ -107,7 +107,7 @@ Master.orm=META-INF/spring-orm.xml
 ....
 
 [WARNING]
-This assumes that you have a MySQL instance running on localhost, listening on its default port 3306 with a database
+This assumes that you have a MariaDB instance running on localhost, listening on its default port 3306 with a database
 `syncope` fully accessible by user `syncope` with password `syncope`.
 
 ===== Oracle Database

http://git-wip-us.apache.org/repos/asf/syncope/blob/1bf49e3f/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
index a7ea928..d0eca2c 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/javaeecontainer.adoc
@@ -44,10 +44,12 @@ domain and MySQL): please also check that the connection parameters are the same
 ....
 <Resource name="jdbc/syncopeMasterDataSource" auth="Container" type="javax.sql.DataSource"
           factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testWhileIdle="true"
-          testOnBorrow="true" testOnReturn="true" validationQuery="SELECT 1" validationInterval="30000"
-          maxActive="100" minIdle="2" maxWait="10000" initialSize="2" removeAbandonedTimeout="20000"
-          removeAbandoned="true" logAbandoned="true" suspectTimeout="20000"
-          timeBetweenEvictionRunsMillis="5000" minEvictableIdleTimeMillis="5000"
+          testOnBorrow="true" testOnReturn="true"
+          validationQuery="SELECT 1" validationInterval="30000"
+          maxActive="100" minIdle="2" maxWait="10000" initialSize="2"
+          removeAbandonedTimeout="20000" removeAbandoned="true" logAbandoned="true"
+          suspectTimeout="20000" timeBetweenEvictionRunsMillis="5000"
+          minEvictableIdleTimeMillis="5000" defaultAutoCommit="false"
           jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
             org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
           username="syncope" password="syncope" driverClassName="com.mysql.jdbc.Driver"


[3/4] syncope git commit: Ensuring SAML2ITCase is disabled when running tests without SAML support

Posted by il...@apache.org.
Ensuring SAML2ITCase is disabled when running tests without SAML support


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3ad2ef76
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3ad2ef76
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3ad2ef76

Branch: refs/heads/2_0_X
Commit: 3ad2ef76d5787bae38ebf9ab5c752b7a72c157f6
Parents: ae947c7
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jun 13 12:57:48 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jun 13 12:57:48 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/syncope/fit/core/SAML2ITCase.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/3ad2ef76/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java
index ece9e6c..6e4cbca 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java
@@ -63,7 +63,9 @@ public class SAML2ITCase extends AbstractITCase {
 
     @BeforeClass
     public static void importFromIdPMetadata() {
-        Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable());
+        if (!SAML2SPDetector.isSAML2SPAvailable()) {
+            return;
+        }
 
         assertTrue(saml2IdPService.list().isEmpty());
 
@@ -86,7 +88,9 @@ public class SAML2ITCase extends AbstractITCase {
 
     @AfterClass
     public static void clearIdPs() {
-        Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable());
+        if (!SAML2SPDetector.isSAML2SPAvailable()) {
+            return;
+        }
 
         for (SAML2IdPTO idp : saml2IdPService.list()) {
             saml2IdPService.delete(idp.getKey());
@@ -115,6 +119,8 @@ public class SAML2ITCase extends AbstractITCase {
 
     @Test
     public void createLoginRequest() {
+        Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable());
+
         SAML2RequestTO loginRequest = anonymous.getService(SAML2SPService.class).
                 createLoginRequest(ADDRESS, "https://idp.testshib.org/idp/shibboleth");
         assertNotNull(loginRequest);
@@ -127,6 +133,8 @@ public class SAML2ITCase extends AbstractITCase {
 
     @Test
     public void setIdPMapping() {
+        Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable());
+
         SAML2IdPTO ssoCircle = IterableUtils.find(saml2IdPService.list(), new Predicate<SAML2IdPTO>() {
 
             @Override


[2/4] syncope git commit: Always conditionally handling notification and audit events in a Quartz job

Posted by il...@apache.org.
Always conditionally handling notification and audit events in a Quartz job


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ae947c72
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ae947c72
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ae947c72

Branch: refs/heads/2_0_X
Commit: ae947c721cb65fcef39aa405f028894b933800e2
Parents: ddf2d5e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jun 13 11:14:02 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jun 13 11:14:02 2017 +0200

----------------------------------------------------------------------
 .../pushpull/AbstractPushResultHandler.java     | 55 +++++++++++++++-----
 .../pushpull/RealmPushResultHandlerImpl.java    | 41 ++++++++++-----
 2 files changed, 68 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ae947c72/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
index 542009b..d84fa25 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
@@ -46,9 +46,11 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
 import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.provisioning.api.AuditManager;
 import org.apache.syncope.core.provisioning.api.MappingManager;
 import org.apache.syncope.core.provisioning.api.TimeoutException;
 import org.apache.syncope.core.provisioning.api.event.AfterHandlingEvent;
+import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
 import org.apache.syncope.core.provisioning.api.pushpull.IgnoreProvisionException;
 import org.apache.syncope.core.provisioning.api.pushpull.SyncopePushResultHandler;
 import org.apache.syncope.core.provisioning.api.utils.EntityUtils;
@@ -66,6 +68,18 @@ import org.springframework.transaction.annotation.Transactional;
 public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHandler<PushTask, PushActions>
         implements SyncopePushResultHandler {
 
+    /**
+     * Notification Manager.
+     */
+    @Autowired
+    protected NotificationManager notificationManager;
+
+    /**
+     * Audit Manager.
+     */
+    @Autowired
+    protected AuditManager auditManager;
+
     @Autowired
     protected MappingManager mappingManager;
 
@@ -196,7 +210,6 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
 
         Object output = null;
         Result resultStatus = null;
-        String operation = null;
 
         // Try to read remote object BEFORE any actual operation
         Provision provision = profile.getTask().getResource().getProvision(any.getType());
@@ -214,9 +227,22 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
             }
             result.setStatus(ProvisioningReport.Status.SUCCESS);
         } else {
+            String operation = beforeObj == null
+                    ? UnmatchingRule.toEventName(profile.getTask().getUnmatchingRule())
+                    : MatchingRule.toEventName(profile.getTask().getMatchingRule());
+
+            boolean notificationsAvailable = notificationManager.notificationsAvailable(
+                    AuditElements.EventCategoryType.PUSH,
+                    any.getType().getKind().name().toLowerCase(),
+                    profile.getTask().getResource().getKey(),
+                    operation);
+            boolean auditRequested = auditManager.auditRequested(
+                    AuditElements.EventCategoryType.PUSH,
+                    any.getType().getKind().name().toLowerCase(),
+                    profile.getTask().getResource().getKey(),
+                    operation);
             try {
                 if (beforeObj == null) {
-                    operation = UnmatchingRule.toEventName(profile.getTask().getUnmatchingRule());
                     result.setOperation(getResourceOperation(profile.getTask().getUnmatchingRule()));
 
                     switch (profile.getTask().getUnmatchingRule()) {
@@ -266,7 +292,6 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                         // do nothing
                     }
                 } else {
-                    operation = MatchingRule.toEventName(profile.getTask().getMatchingRule());
                     result.setOperation(getResourceOperation(profile.getTask().getMatchingRule()));
 
                     switch (profile.getTask().getMatchingRule()) {
@@ -365,17 +390,19 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
 
                 throw new JobExecutionException(e);
             } finally {
-                Map<String, Object> jobMap = new HashMap<>();
-                jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
-                        AuditElements.EventCategoryType.PUSH,
-                        any.getType().getKind().name().toLowerCase(),
-                        profile.getTask().getResource().getKey(),
-                        operation,
-                        resultStatus,
-                        beforeObj,
-                        output,
-                        any));
-                AfterHandlingJob.schedule(scheduler, jobMap);
+                if (notificationsAvailable || auditRequested) {
+                    Map<String, Object> jobMap = new HashMap<>();
+                    jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
+                            AuditElements.EventCategoryType.PUSH,
+                            any.getType().getKind().name().toLowerCase(),
+                            profile.getTask().getResource().getKey(),
+                            operation,
+                            resultStatus,
+                            beforeObj,
+                            output,
+                            any));
+                    AfterHandlingJob.schedule(scheduler, jobMap);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/ae947c72/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/RealmPushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/RealmPushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/RealmPushResultHandlerImpl.java
index 313a527..50e68f0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/RealmPushResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/RealmPushResultHandlerImpl.java
@@ -152,7 +152,6 @@ public class RealmPushResultHandlerImpl
 
         Object output = null;
         Result resultStatus = null;
-        String operation = null;
 
         // Try to read remote object BEFORE any actual operation
         ConnectorObject beforeObj = getRemoteObject(
@@ -168,9 +167,22 @@ public class RealmPushResultHandlerImpl
             }
             result.setStatus(ProvisioningReport.Status.SUCCESS);
         } else {
+            String operation = beforeObj == null
+                    ? UnmatchingRule.toEventName(profile.getTask().getUnmatchingRule())
+                    : MatchingRule.toEventName(profile.getTask().getMatchingRule());
+
+            boolean notificationsAvailable = notificationManager.notificationsAvailable(
+                    AuditElements.EventCategoryType.PUSH,
+                    REALM_TYPE.toLowerCase(),
+                    profile.getTask().getResource().getKey(),
+                    operation);
+            boolean auditRequested = auditManager.auditRequested(
+                    AuditElements.EventCategoryType.PUSH,
+                    REALM_TYPE.toLowerCase(),
+                    profile.getTask().getResource().getKey(),
+                    operation);
             try {
                 if (beforeObj == null) {
-                    operation = UnmatchingRule.toEventName(profile.getTask().getUnmatchingRule());
                     result.setOperation(getResourceOperation(profile.getTask().getUnmatchingRule()));
 
                     switch (profile.getTask().getUnmatchingRule()) {
@@ -220,7 +232,6 @@ public class RealmPushResultHandlerImpl
                         // do nothing
                     }
                 } else {
-                    operation = MatchingRule.toEventName(profile.getTask().getMatchingRule());
                     result.setOperation(getResourceOperation(profile.getTask().getMatchingRule()));
 
                     switch (profile.getTask().getMatchingRule()) {
@@ -322,17 +333,19 @@ public class RealmPushResultHandlerImpl
 
                 throw new JobExecutionException(e);
             } finally {
-                Map<String, Object> jobMap = new HashMap<>();
-                jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
-                        AuditElements.EventCategoryType.PUSH,
-                        REALM_TYPE.toLowerCase(),
-                        profile.getTask().getResource().getKey(),
-                        operation,
-                        resultStatus,
-                        beforeObj,
-                        output,
-                        realm));
-                AfterHandlingJob.schedule(scheduler, jobMap);
+                if (notificationsAvailable || auditRequested) {
+                    Map<String, Object> jobMap = new HashMap<>();
+                    jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
+                            AuditElements.EventCategoryType.PUSH,
+                            REALM_TYPE.toLowerCase(),
+                            profile.getTask().getResource().getKey(),
+                            operation,
+                            resultStatus,
+                            beforeObj,
+                            output,
+                            realm));
+                    AfterHandlingJob.schedule(scheduler, jobMap);
+                }
             }
         }
     }