jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1644678 - in /jackrabbit/branches/2.6: jackrabbit-core/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/
Date Thu, 11 Dec 2014 15:29:48 GMT
Author: unico
Date: Thu Dec 11 15:29:48 2014
New Revision: 1644678

URL: http://svn.apache.org/r1644678
Log:
JCR-3840 limit the number of null child node definitions to match with to the number of slots
available

Modified:
    jackrabbit/branches/2.6/jackrabbit-core/pom.xml
    jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/DecimalConvertTest.java
    jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java

Modified: jackrabbit/branches/2.6/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/pom.xml?rev=1644678&r1=1644677&r2=1644678&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/pom.xml (original)
+++ jackrabbit/branches/2.6/jackrabbit-core/pom.xml Thu Dec 11 15:29:48 2014
@@ -116,7 +116,6 @@ org.apache.jackrabbit.core.data.Concurre
 org.apache.jackrabbit.core.data.GarbageCollectorTest#testCloseSessionWhileRunningGc
 org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testRightOuterJoin1<!--JCR-3493,
JCR-3498-->
 org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testLeftOuterJoin2<!--JCR-3493,
JCR-3498-->
-org.apache.jackrabbit.core.ReplacePropertyWhileOthersReadTest
               </value>
             </property>
             <property>

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/DecimalConvertTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/DecimalConvertTest.java?rev=1644678&r1=1644677&r2=1644678&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/DecimalConvertTest.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/DecimalConvertTest.java
Thu Dec 11 15:29:48 2014
@@ -58,9 +58,6 @@ public class DecimalConvertTest extends
     }
     
     public void testRandomized() {
-        if (true) { // JCR-3834
-            return;
-        }
         ArrayList<BigDecimal> list = new ArrayList<BigDecimal>();
         list.add(BigDecimal.ZERO);
         list.add(BigDecimal.ONE);

Modified: jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java?rev=1644678&r1=1644677&r2=1644678&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
Thu Dec 11 15:29:48 2014
@@ -36,6 +36,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * A <code>NodeTypeDefDiff</code> represents the result of the comparison of
@@ -733,10 +734,18 @@ public class NodeTypeDefDiff {
             });
             // select the most compatible ones
             final int size = defs1.size() > defs2.size() ? defs1.size() : defs2.size();
+            AtomicInteger allowedNewNull = new AtomicInteger(defs1.size() - defs2.size());
+            AtomicInteger allowedOldNull = new AtomicInteger(defs2.size() - defs1.size());
             final List<ChildNodeDefDiff> results = new ArrayList<ChildNodeDefDiff>();
             for (ChildNodeDefDiff diff : diffs) {
-                if (!alreadyMatched(results, diff.getNewDef(), diff.getOldDef())) {
+                if (!alreadyMatched(results, diff.getNewDef(), diff.getOldDef(), allowedNewNull,
allowedOldNull)) {
                     results.add(diff);
+                    if (diff.getNewDef() == null) {
+                        allowedNewNull.decrementAndGet();
+                    }
+                    if (diff.getOldDef() == null) {
+                        allowedOldNull.decrementAndGet();
+                    }
                 }
                 if (results.size() == size) {
                     break;
@@ -745,17 +754,31 @@ public class NodeTypeDefDiff {
             return results;
         }
 
-        private boolean alreadyMatched(final List<ChildNodeDefDiff> result, final QNodeDefinition
newDef, final QNodeDefinition oldDef) {
+        private boolean alreadyMatched(final List<ChildNodeDefDiff> result, final QNodeDefinition
newDef, final QNodeDefinition oldDef, final AtomicInteger allowedNewNull, final AtomicInteger
allowedOldNull) {
             boolean containsNewDef = false, containsOldDef = false;
             for (ChildNodeDefDiff d : result) {
                 if (d.getNewDef() != null && d.getNewDef().equals(newDef)) {
                     containsNewDef = true;
+                    break;
                 }
                 if (d.getOldDef() != null && d.getOldDef().equals(oldDef)) {
                     containsOldDef = true;
+                    break;
+                }
+            }
+            if (oldDef == null) {
+                if (allowedOldNull.get() < 1) {
+                    containsOldDef = true;
+                }
+            }
+            if (newDef == null) {
+                if (allowedNewNull.get() < 1) {
+                    containsNewDef = true;
                 }
             }
+
             return containsNewDef || containsOldDef;
         }
     }
+
 }



Mime
View raw message