diff --git a/.travis.yml b/.travis.yml
index 6746592975..a642a3eefa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,6 +32,12 @@ jobs:
- curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.jar
# Run WhiteSource Unified Agent
- java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config
+ - name: "Source Clear Scan"
+ # only on SP branches or master and if it is not a PR
+ if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request
+ script: skip
+ addons:
+ srcclr: true
- stage: release
name: "Push to Nexus"
if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/
diff --git a/pom.xml b/pom.xml
index b0643c8b6b..cd3c9c01ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,8 +26,8 @@
- 5.1.8.RELEASE
- 7.9
+ 5.2.3.RELEASE
+ 8.1
11
@@ -35,12 +35,7 @@
commons-codec
commons-codec
- 1.13
-
-
- commons-collections
- commons-collections
- 3.2.2
+ 1.14
commons-httpclient
@@ -68,22 +63,6 @@
2.0.0
asl
-
- org.mybatis
- mybatis
- 3.3.0
-
-
- org.mybatis
- mybatis-spring
- 1.2.5
-
-
- org.mybatis
- mybatis
-
-
-
log4j
log4j
@@ -112,15 +91,10 @@
spring-context
${dependency.spring.version}
-
- org.springframework
- spring-context-support
- ${dependency.spring.version}
-
org.quartz-scheduler
quartz
- 2.3.1
+ 2.3.2
@@ -163,12 +137,7 @@
joda-time
joda-time
- 2.10.4
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.10
+ 2.10.5
@@ -183,25 +152,19 @@
org.slf4j
slf4j-log4j12
- 1.7.28
- test
-
-
- org.springframework
- spring-test
- ${dependency.spring.version}
+ 1.7.30
test
junit
junit
- 4.12
+ 4.13
test
org.mockito
- mockito-all
- 1.10.19
+ mockito-core
+ 3.2.4
test
@@ -228,7 +191,7 @@
maven-jar-plugin
- 3.1.2
+ 3.2.0
diff --git a/src/main/java/org/alfresco/util/shard/ExplicitShardingPolicy.java b/src/main/java/org/alfresco/util/shard/ExplicitShardingPolicy.java
index 979d25471b..f5c421fef2 100644
--- a/src/main/java/org/alfresco/util/shard/ExplicitShardingPolicy.java
+++ b/src/main/java/org/alfresco/util/shard/ExplicitShardingPolicy.java
@@ -21,6 +21,8 @@ package org.alfresco.util.shard;
import java.util.LinkedList;
import java.util.List;
+import org.alfresco.error.AlfrescoRuntimeException;
+
/**
* Common ACL based index sharding behaviour for SOLR and the repository
*
@@ -67,6 +69,13 @@ public class ExplicitShardingPolicy
{
if (test % numNodes == nodeInstance - 1)
{
+ // This algorithm fails for some sets of parameters. (See SEARCH-1785)
+ if (shardIds.contains(shard % numShards))
+ {
+ throw new AlfrescoRuntimeException("Sharding configuration not supported - unable to create shard list for node " + nodeInstance
+ + " (shards:" + numShards + ", replication:" + replicationFactor + ", nodes:" + numNodes + ")."
+ + " Please set up the shards manually or use a different sharding configuration.");
+ }
shardIds.add(shard % numShards);
}
test++;
diff --git a/src/main/java/org/alfresco/util/transaction/SpringAwareUserTransaction.java b/src/main/java/org/alfresco/util/transaction/SpringAwareUserTransaction.java
index 6497901ff5..2e8d6c9c26 100644
--- a/src/main/java/org/alfresco/util/transaction/SpringAwareUserTransaction.java
+++ b/src/main/java/org/alfresco/util/transaction/SpringAwareUserTransaction.java
@@ -36,6 +36,7 @@ import org.springframework.transaction.CannotCreateTransactionException;
import org.springframework.transaction.NoTransactionException;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.transaction.interceptor.TransactionAttribute;
@@ -410,8 +411,15 @@ public class SpringAwareUserTransaction
// begin a transaction
try
{
+ TransactionManager tm = getTransactionManager();
+
+ if (tm != null && !(tm instanceof PlatformTransactionManager))
+ {
+ throw new IllegalStateException("Specified transaction manager is not a PlatformTransactionManager: " + tm);
+ }
+
internalTxnInfo = createTransactionIfNecessary(
- getTransactionManager(), getTransactionAttribute(null, null), getName());
+ (PlatformTransactionManager) tm, getTransactionAttribute(null, null), getName());
}
catch (CannotCreateTransactionException e)
{
diff --git a/src/test/java/org/alfresco/util/shard/ExplicitShardingPolicyTest.java b/src/test/java/org/alfresco/util/shard/ExplicitShardingPolicyTest.java
index 937c647225..ce188fb229 100644
--- a/src/test/java/org/alfresco/util/shard/ExplicitShardingPolicyTest.java
+++ b/src/test/java/org/alfresco/util/shard/ExplicitShardingPolicyTest.java
@@ -20,8 +20,11 @@ package org.alfresco.util.shard;
import static org.junit.Assert.*;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import org.alfresco.error.AlfrescoRuntimeException;
import org.junit.Test;
/**
@@ -116,6 +119,20 @@ public class ExplicitShardingPolicyTest
{
buildAndTest(10, 2, 4);
}
+
+ /** ExplicitShardingPolicy algorithm fails for 2 shards, 3 replicas, 3 nodes. (See SEARCH-1785) */
+ @Test(expected = AlfrescoRuntimeException.class)
+ public void search1785_233()
+ {
+ buildAndTest(2, 3, 3);
+ }
+
+ /** ExplicitShardingPolicy algorithm fails for 4 shards, 3 replicas, 6 nodes. (See SEARCH-1785) */
+ @Test (expected = AlfrescoRuntimeException.class)
+ public void search1785_436()
+ {
+ buildAndTest(4, 3, 6);
+ }
@Test
public void check_10_2()
@@ -163,7 +180,8 @@ public class ExplicitShardingPolicyTest
int[] found = new int[numShards];
for (int i = 0; i < numNodes; i++)
{
- List shardIds = policy.getShardIdsForNode(i + 1);
+ // Convert to a set to remove any duplicates.
+ Set shardIds = new HashSet<>(policy.getShardIdsForNode(i + 1));
assertEquals(numShards * replicationFactor / numNodes, shardIds.size());
for (Integer shardId : shardIds)
{