svn commit: r1375928 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java

2012-08-22 Thread mduerig
Author: mduerig
Date: Wed Aug 22 08:03:39 2012
New Revision: 1375928

URL: http://svn.apache.org/viewvc?rev=1375928view=rev
Log:
OAK-268: XPathQueryEvaluator generates incorrect XPath query
 Thanks Chetan Mehrotra for the patch

Modified:

jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java?rev=1375928r1=1375927r2=1375928view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/query/XPathQueryEvaluator.java
 Wed Aug 22 08:03:39 2012
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.oak.jcr.security.user.query;
 
 import java.util.Iterator;
+
 import javax.annotation.Nonnull;
 import javax.jcr.Node;
 import javax.jcr.PropertyType;
@@ -131,13 +132,13 @@ public class XPathQueryEvaluator impleme
 @Override
 public void visit(Condition.Node condition) throws RepositoryException {
 xPath.append('(')
-.append(jcr:like()
+.append(jcr:like(@)
 
.append(namePathMapper.getJcrName(UserConstants.REP_PRINCIPAL_NAME))
 .append(,')
 .append(condition.getPattern())
 .append('))
 .append( or )
-.append(jcr:like(fn:name(.),')
+.append(jcr:like(fn:name(),')
 .append(escape(condition.getPattern()))
 .append('))
 .append(')');




svn commit: r1375930 [2/2] - in /jackrabbit/oak/trunk: oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ oak-core/src/main/java/org/apache/jackrabbit/mk/index/ oak-core/src/main/java

2012-08-22 Thread alexparvulescu
Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java?rev=1375930r1=1375929r2=1375930view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
 Wed Aug 22 08:04:51 2012
@@ -22,6 +22,10 @@ import java.util.TreeMap;
 import junit.framework.Assert;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.plugins.index.BTree;
+import org.apache.jackrabbit.oak.plugins.index.Cursor;
+import org.apache.jackrabbit.oak.plugins.index.Indexer;
+import org.apache.jackrabbit.oak.plugins.index.PropertyIndex;
 import org.junit.Test;
 
 /**

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java?rev=1375930r1=1375929r2=1375930view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
 Wed Aug 22 08:04:51 2012
@@ -20,6 +20,8 @@ import java.util.Iterator;
 import junit.framework.Assert;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.plugins.index.Indexer;
+import org.apache.jackrabbit.oak.plugins.index.PrefixIndex;
 import org.junit.Test;
 
 /**

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java?rev=1375930r1=1375929r2=1375930view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
 Wed Aug 22 08:04:51 2012
@@ -19,6 +19,8 @@ package org.apache.jackrabbit.mk.index;
 import junit.framework.Assert;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.plugins.index.Indexer;
+import org.apache.jackrabbit.oak.plugins.index.PropertyIndex;
 import org.junit.Test;
 
 /**

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/wrapper/IndexWrapperTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/wrapper/IndexWrapperTest.java?rev=1375930r1=1375929r2=1375930view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/wrapper/IndexWrapperTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/wrapper/IndexWrapperTest.java
 Wed Aug 22 08:04:51 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.mk.wrapper;
 
+import static 
org.apache.jackrabbit.oak.plugins.index.Indexer.INDEX_CONFIG_PATH;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import org.apache.jackrabbit.mk.api.MicroKernel;
@@ -36,47 +37,47 @@ public class IndexWrapperTest {
 
 @Test
 public void getNodes() {
-assertNull(mk.getNodes(/jcr:system/indexes/unknown, head, 1, 0, -1, 
null));
+assertNull(mk.getNodes(INDEX_CONFIG_PATH + /unknown, head, 1, 0, -1, 
null));
 assertNull(mk.getNodes(/unknown, head, 1, 0, -1, null));
 }
 
 @Test
 public void prefix() {
-head = mk.commit(/jcr:system/indexes, + \prefix@x\: {}, head, 
);
+head = mk.commit(INDEX_CONFIG_PATH, + \prefix@x\: {}, head, );
 head = mk.commit(/, + \n1\: { \value\:\a:no\ }, head, );
 head = mk.commit(/, + \n2\: { \value\:\x:yes\ }, head, );
 head = mk.commit(/, + \n3\: { \value\:\x:a\ }, head, );
 head = mk.commit(/, + \n4\: { \value\:\x:a\ }, head, );
-String empty = mk.getNodes(/jcr:system/indexes/prefix@x?x:no, head, 
1, 0, -1, null);
+String empty = mk.getNodes(INDEX_CONFIG_PATH + /prefix@x?x:no, head, 
1, 0, -1, null);
 assertEquals([], empty);
-String yes = mk.getNodes(/jcr:system/indexes/prefix@x?x:yes, head, 
1, 0, -1, null);
+String yes = mk.getNodes(INDEX_CONFIG_PATH + /prefix@x?x:yes, head, 
1, 0, 

svn commit: r1375984 - /jackrabbit/oak/trunk/oak-jcr/pom.xml

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 11:07:44 2012
New Revision: 1375984

URL: http://svn.apache.org/viewvc?rev=1375984view=rev
Log:
OAK-6: update test exclusions

Modified:
jackrabbit/oak/trunk/oak-jcr/pom.xml

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1375984r1=1375983r2=1375984view=diff
==
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Aug 22 11:07:44 2012
@@ -48,9 +48,6 @@ org.apache.jackrabbit.test.api.NodeTest#
 org.apache.jackrabbit.test.api.NodeTest#testMixinTypesProtected!--OAK-66--
 
org.apache.jackrabbit.test.api.NodeUUIDTest#testSaveReferentialIntegrityException!--OAK-66--
 org.apache.jackrabbit.test.api.NodeUUIDTest#testSaveMovedRefNode!--OAK-66--
-org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID!-- OAK-66 --
-org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID!-- 
OAK-66 --
-org.apache.jackrabbit.test.api.ExportSysViewTest!-- OAK-66 --
 
org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforeUnsupportedRepositoryOperationException!--OAK-169--
 
org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndParentSave!--OAK-169--
 
org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndSessionSave!--OAK-169--




svn commit: r1376003 - in /jackrabbit/oak/trunk/oak-core/src/test: java/org/apache/jackrabbit/oak/query/ resources/org/apache/jackrabbit/oak/query/

2012-08-22 Thread thomasm
Author: thomasm
Date: Wed Aug 22 11:44:45 2012
New Revision: 1376003

URL: http://svn.apache.org/viewvc?rev=1376003view=rev
Log:
OAK-28 Query implementation - split tests into sql1, sql2, sql2 explain, and 
xpath

Added:

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
  - copied, changed from r1375949, 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt
  - copied, changed from r1375949, 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryXpathTest.txt
Removed:

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryXpathTest.txt
Modified:

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1376003r1=1376002r2=1376003view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
 Wed Aug 22 11:44:45 2012
@@ -38,13 +38,23 @@ import org.junit.Test;
 public class QueryTest extends AbstractQueryTest {
 
 @Test
-public void script() throws Exception {
-test(queryTest.txt);
+public void sql1() throws Exception {
+test(sql1.txt);
+}
+
+@Test
+public void sql2() throws Exception {
+test(sql2.txt);
+}
+
+@Test
+public void sql2Explain() throws Exception {
+test(sql2_explain.txt);
 }
 
 @Test
 public void xpath() throws Exception {
-test(queryXpathTest.txt);
+test(xpath.txt);
 }
 
 @Test
@@ -88,9 +98,9 @@ public class QueryTest extends AbstractQ
 line = line.trim();
 if (line.startsWith(#) || line.length() == 0) {
 w.println(line);
-} else if (line.startsWith(xpath)) {
-line = line.substring(xpath.length()).trim();
-w.println(xpath  + line);
+} else if (line.startsWith(xpath2sql)) {
+line = line.substring(xpath2sql.length()).trim();
+w.println(xpath2sql  + line);
 XPathToSQL2Converter c = new XPathToSQL2Converter();
 String got;
 try {

Added: 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt?rev=1376003view=auto
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt
 (added)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql1.txt
 Wed Aug 22 11:44:45 2012
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the License); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Syntax:
+# * lines starting with # are remarks.
+# * lines starting with select are queries, followed by expected results and 
an empty line
+# * lines starting with explain are followed by expected query plan and an 
empty line
+# * lines starting with sql1 are run using the sql1 language
+# * lines starting with xpath2sql are just converted from xpath to sql2
+# * all other lines are are committed into the microkernel (line by line)
+# * new tests are typically be added on top, after the syntax docs
+# * use ascii character only
+
+# sql-1 query (nt:unstructured needs to be 

svn commit: r1376004 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java

2012-08-22 Thread thomasm
Author: thomasm
Date: Wed Aug 22 11:45:42 2012
New Revision: 1376004

URL: http://svn.apache.org/viewvc?rev=1376004view=rev
Log:
OAK-261 Support querying on property types

Modified:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java?rev=1376004r1=1376003r2=1376004view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/PrefixContentIndex.java
 Wed Aug 22 11:45:42 2012
@@ -44,29 +44,36 @@ public class PrefixContentIndex implemen
 
 @Override
 public double getCost(Filter filter) {
-Filter.PropertyRestriction restriction = 
filter.getPropertyRestriction(*);
-if (restriction == null) {
-return Double.MAX_VALUE;
+if (getPropertyTypeRestriction(filter) != null) {
+return 100;
 }
-if (restriction.first != restriction.last) {
-// only support equality matches (for now)
-return Double.MAX_VALUE;
-}
-if (restriction.propertyType == PropertyType.UNDEFINED) {
-return Double.MAX_VALUE;
-}
-String hint = CoreValueMapper.getHintForType(restriction.propertyType);
-String prefix = hint + :;
-if (!prefix.equals(index.getPrefix())) {
-// wrong prefix (wrong property type)
-return Double.MAX_VALUE;
+return Double.MAX_VALUE;
+}
+
+private Filter.PropertyRestriction getPropertyTypeRestriction(Filter 
filter) {
+for (Filter.PropertyRestriction restriction : 
filter.getPropertyRestrictions()) {
+if (restriction == null) {
+continue;
+}
+if (restriction.first != restriction.last) {
+// only support equality matches (for now)
+continue;
+}
+if (restriction.propertyType == PropertyType.UNDEFINED) {
+continue;
+}
+String hint = 
CoreValueMapper.getHintForType(restriction.propertyType);
+String prefix = hint + :;
+if (prefix.equals(index.getPrefix())) {
+return restriction;
+}
 }
-return 100;
+return null;
 }
 
 @Override
 public String getPlan(Filter filter) {
-Filter.PropertyRestriction restriction = 
filter.getPropertyRestriction(*);
+Filter.PropertyRestriction restriction = 
getPropertyTypeRestriction(filter);
 if (restriction == null) {
 throw new IllegalArgumentException(No restriction for *);
 }
@@ -78,7 +85,7 @@ public class PrefixContentIndex implemen
 
 @Override
 public Cursor query(Filter filter, String revisionId, NodeState root) {
-Filter.PropertyRestriction restriction = 
filter.getPropertyRestriction(*);
+Filter.PropertyRestriction restriction = 
getPropertyTypeRestriction(filter);
 if (restriction == null) {
 throw new IllegalArgumentException(No restriction for *);
 }




svn commit: r1376021 - /jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 12:43:54 2012
New Revision: 1376021

URL: http://svn.apache.org/viewvc?rev=1376021view=rev
Log:
OAK-6: fix typos (test case was renamed in TCK)

Modified:

jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties?rev=1376021r1=1376020r2=1376021view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
(original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
Wed Aug 22 12:43:54 2012
@@ -195,9 +195,9 @@ javax.jcr.tck.NodeTest.testRemoveMandato
 javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=jcr:content
 
 # Test class: NodeTest
-# Test method: testSaveContstraintViolationException
+# Test method: testSaveConstraintViolationException
 # nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=nt:file
+javax.jcr.tck.NodeTest.testSaveConstraintViolationException.nodetype2=nt:file
 
 # Test class: NodeAddMixinTest
 # Test method: testAddInheritedMixin




svn commit: r1376023 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/spi/security/user/ test/java/org/apache/jackrabbit/oak/security/ test/java/org/apache/jackrabbit/oak/s

2012-08-22 Thread angela
Author: angela
Date: Wed Aug 22 12:47:14 2012
New Revision: 1376023

URL: http://svn.apache.org/viewvc?rev=1376023view=rev
Log:
OAK-50 : Implement User Management (WIP)

Added:

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java
Modified:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java?rev=1376023r1=1376022r2=1376023view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java
 Wed Aug 22 12:47:14 2012
@@ -33,7 +33,8 @@ public interface UserConstants {
 String REP_MEMBERS = rep:members;
 String REP_IMPERSONATORS = rep:impersonators;
 
-String DEFAULT_USER_PATH = rep:security/rep:authorizables/rep:users;
-String DEFAULT_GROUP_PATH = rep:security/rep:authorizables/rep:groups;
+String DEFAULT_USER_PATH = /rep:security/rep:authorizables/rep:users;
+String DEFAULT_GROUP_PATH = /rep:security/rep:authorizables/rep:groups;
+int DEFAULT_DEPTH = 2;
 
 }
\ No newline at end of file

Added: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java?rev=1376023view=auto
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java
 (added)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java
 Wed Aug 22 12:47:14 2012
@@ -0,0 +1,371 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.security.user;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.oak.AbstractOakTest;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.core.DefaultConflictHandler;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
+import org.apache.jackrabbit.oak.spi.security.user.UserProvider;
+import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
+import org.apache.jackrabbit.util.Text;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * UserProviderImplTest...
+ *
+ * TODO: create tests with custom config that persists changes (currently 
fails since config used in UserValidator is different)
+ * TODO: add tests for setProtectedProperty (might still be refactored...)
+ */
+public class UserProviderImplTest extends AbstractOakTest {
+
+private ContentSession contentSession;
+private Root root;
+
+private UserConfig defaultConfig;

svn commit: r1376028 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java

2012-08-22 Thread angela
Author: angela
Date: Wed Aug 22 13:00:48 2012
New Revision: 1376028

URL: http://svn.apache.org/viewvc?rev=1376028view=rev
Log:
OAK-50 : Implement User Management (WIP)

Modified:

jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java?rev=1376028r1=1376027r2=1376028view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImplTest.java
 Wed Aug 22 13:00:48 2012
@@ -16,6 +16,20 @@
  */
 package org.apache.jackrabbit.oak.jcr.security.user;
 
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.AuthorizableExistsException;
 import org.apache.jackrabbit.api.security.user.Group;
@@ -27,20 +41,6 @@ import org.apache.jackrabbit.test.NotExe
 import org.junit.Ignore;
 import org.junit.Test;
 
-import javax.jcr.Credentials;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.Value;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 public class UserManagerImplTest extends AbstractUserTest {
 
 private String getTestUserId(Principal p) throws RepositoryException {
@@ -802,11 +802,10 @@ public class UserManagerImplTest extends
 Principal p = getTestPrincipal();
 String uid = p.getName();
 
-String usersPath = /home/users; // TODO
-
 ListString invalid = new ArrayListString();
 invalid.add(../../path);
-invalid.add(usersPath + /../test);
+invalid.add(UserConstants.DEFAULT_USER_PATH + /../test);
+invalid.add(../../../home/users/test);
 
 for (String path : invalid) {
 try {




svn commit: r1376041 - /jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 13:36:29 2012
New Revision: 1376041

URL: http://svn.apache.org/viewvc?rev=1376041view=rev
Log:
OAK-6: fix typos in test config file

Modified:

jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties?rev=1376041r1=1376040r2=1376041view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
(original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
Wed Aug 22 13:36:29 2012
@@ -162,9 +162,9 @@ javax.jcr.tck.SessionTest.testMoveItemEx
 javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3=nt:folder
 
 # Test class: SessionTest
-# Test method: testSaveContstraintViolationException
+# Test method: testSaveConstraintViolationException
 # nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2=nt:file
+javax.jcr.tck.SessionTest.testSaveConstraintViolationException.nodetype2=nt:file
 
 # Test class: SessionUUIDTest
 # node type that has a property of type PropertyType.REFERENCE




svn commit: r1376044 - /jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 13:46:14 2012
New Revision: 1376044

URL: http://svn.apache.org/viewvc?rev=1376044view=rev
Log:
OAK-6: updae test config

Modified:

jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties?rev=1376044r1=1376043r2=1376044view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
(original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
Wed Aug 22 13:46:14 2012
@@ -238,12 +238,12 @@ javax.jcr.tck.SetPropertyNodeTest.nodety
 # Test class: SetPropertyValueTest
 # property that allows multiple values
 javax.jcr.tck.SetPropertyValueTest.propertyname2=test:multiProperty
-javax.jcr.tck.SetPropertyValueTest.nodetype=nt:unstructured
+javax.jcr.tck.SetPropertyValueTest.nodetype=test:setProperty
 
 # Test class: SetPropertyStringTest
 # property that allows multiple values
 javax.jcr.tck.SetPropertyStringTest.propertyname2=test:multiProperty
-javax.jcr.tck.SetPropertyStringTest.nodetype=nt:unstructured
+javax.jcr.tck.SetPropertyStringTest.nodetype=test:setProperty
 
 # Test class: WorkspaceCloneSameNameSibsTest
 
javax.jcr.tck.WorkspaceCloneSameNameSibsTest.sameNameSibsFalseNodeType=test:sameNameSibsFalseChildNodeDefinition




svn commit: r1376057 - /jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java

2012-08-22 Thread mduerig
Author: mduerig
Date: Wed Aug 22 14:02:26 2012
New Revision: 1376057

URL: http://svn.apache.org/viewvc?rev=1376057view=rev
Log:
OAK-245: Add import for org.h2 in oak-mk bundle
Thanks Chetan Mehrotra for the patch

Modified:

jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java

Modified: 
jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java?rev=1376057r1=1376056r2=1376057view=diff
==
--- 
jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/H2Persistence.java
 Wed Aug 22 14:02:26 2012
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.mk.model.St
 import org.apache.jackrabbit.mk.store.BinaryBinding;
 import org.apache.jackrabbit.mk.store.IdFactory;
 import org.apache.jackrabbit.mk.store.NotFoundException;
+import org.h2.Driver;
 import org.h2.jdbcx.JdbcConnectionPool;
 
 import java.io.ByteArrayInputStream;
@@ -58,7 +59,7 @@ public class H2Persistence implements GC
 dbDir.mkdirs();
 }
 
-Class.forName(org.h2.Driver);
+Driver.load();
 String url = jdbc:h2: + dbDir.getCanonicalPath() + /revs;
 if (FAST) {
 url += ;log=0;undo_log=0;




svn commit: r1376062 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java src/test/resources/repositoryStubImpl.properties

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 14:11:02 2012
New Revision: 1376062

URL: http://svn.apache.org/viewvc?rev=1376062view=rev
Log:
OAK-273: mark failing tests

Modified:
jackrabbit/oak/trunk/oak-jcr/pom.xml

jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java

jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1376062r1=1376061r2=1376062view=diff
==
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Aug 22 14:11:02 2012
@@ -53,10 +53,10 @@ org.apache.jackrabbit.test.api.NodeOrder
 
org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndSessionSave!--OAK-169--
 org.apache.jackrabbit.test.api.SetValueValueFormatExceptionTest
 org.apache.jackrabbit.test.api.SetValueFormatExceptionTest
-org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatException
-org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatExceptionWithPropertyType
-org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatException
-org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatExceptionWithPropertyType
+org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatException!--OAK-273--
+org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatExceptionWithPropertyType!--OAK-273--
+org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatException!--OAK-273--
+org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatExceptionWithPropertyType!--OAK-273--
 org.apache.jackrabbit.test.api.SetPropertyAssumeTypeTest
 org.apache.jackrabbit.test.api.NodeAddMixinTest#testAddInheritedMixin
 
org.apache.jackrabbit.test.api.ValueFactoryTest#testValueFormatException!--OAK-204--

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java?rev=1376062r1=1376061r2=1376062view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
 Wed Aug 22 14:11:02 2012
@@ -72,6 +72,17 @@ public class TestContentLoader {
 ntm.registerNodeType(nttmpl, true);
 }
 
+// test:canSetProperty
+{
+NodeTypeTemplate nttmpl = ntm.createNodeTypeTemplate();
+nttmpl.setName(test:canSetProperty);
+nttmpl.setDeclaredSuperTypeNames(new String[] { nt:base });
+
+// add property definitions
+
+ntm.registerNodeType(nttmpl, true);
+}
+
 Node data = getOrAddNode(session.getRootNode(), testdata);
 addPropertyTestData(getOrAddNode(data, property));
 addQueryTestData(getOrAddNode(data, query));

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties?rev=1376062r1=1376061r2=1376062view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
(original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/test/resources/repositoryStubImpl.properties 
Wed Aug 22 14:11:02 2012
@@ -108,7 +108,7 @@ javax.jcr.tck.SetValueVersionExceptionTe
 javax.jcr.tck.SetValueVersionExceptionTest.propertyname3=jcr:content
 
 # Test class: SetValueValueFormatExceptionTest
-javax.jcr.tck.SetValueValueFormatExceptionTest.nodetype=nt:unstructured
+javax.jcr.tck.SetValueValueFormatExceptionTest.nodetype=test:canSetProperty
 javax.jcr.tck.SetValueValueFormatExceptionTest.testValue.propertyname1=Boolean
 
javax.jcr.tck.SetValueValueFormatExceptionTest.testValueArray.propertyname1=BooleanMultiple
 javax.jcr.tck.SetValueValueFormatExceptionTest.testString.propertyname1=Date
@@ -122,7 +122,7 @@ javax.jcr.tck.SetValueValueFormatExcepti
 
javax.jcr.tck.SetValueValueFormatExceptionTest.testNodeNotReferenceable.propertyname1=ReferenceConstraints
 
 # Test class: SetPropertyAssumeTypeTest
-javax.jcr.tck.SetPropertyAssumeTypeTest.nodetype=nt:unstructured
+javax.jcr.tck.SetPropertyAssumeTypeTest.nodetype=test:canSetProperty
 
javax.jcr.tck.SetPropertyAssumeTypeTest.testStringConstraintViolationExceptionBecauseOfInvalidTypeParameter.propertyname1=String
 

svn commit: r1376102 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/toke

2012-08-22 Thread angela
Author: angela
Date: Wed Aug 22 15:49:20 2012
New Revision: 1376102

URL: http://svn.apache.org/viewvc?rev=1376102view=rev
Log:
OAK-50 : Implement User Management (WIP)
OAK-91 : Authentication (WIP)

Added:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/Authentication.java
  - copied, changed from r1376019, 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/Authentication.java
Removed:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/Authentication.java
Modified:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationImpl.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenAuthentication.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenInfo.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AbstractLoginModule.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserProvider.java

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderImplTest.java

jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableImpl.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationImpl.java?rev=1376102r1=1376101r2=1376102view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationImpl.java
 Wed Aug 22 15:49:20 2012
@@ -16,11 +16,13 @@
  */
 package org.apache.jackrabbit.oak.security.authentication;
 
+import java.security.Principal;
+import java.util.Set;
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
 import javax.jcr.SimpleCredentials;
-import java.security.Principal;
-import java.util.Set;
+
+import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;
 
 /**
  * AuthenticationImpl...

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java?rev=1376102r1=1376101r2=1376102view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
 Wed Aug 22 15:49:20 2012
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.securi
 
 import java.io.IOException;
 import java.security.Principal;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -36,8 +35,8 @@ import javax.security.auth.login.LoginEx
 
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import 
org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule;
+import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;
 import 
org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
-import 
org.apache.jackrabbit.oak.spi.security.authentication.PrincipalProviderCallback;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -165,33 +164,6 @@ public class LoginModuleImpl extends Abs
 }
 
 
//--
-
-private SetPrincipal getPrincipals(String userID) {
-PrincipalProvider principalProvider = getPrincipalProvider();
-if (principalProvider == null) {
-log.debug(Commit: Cannot retrieve principals. No principal 
provider configured.);
-return 

svn commit: r1376118 - /jackrabbit/oak/trunk/oak-jcr/pom.xml

2012-08-22 Thread thomasm
Author: thomasm
Date: Wed Aug 22 16:12:25 2012
New Revision: 1376118

URL: http://svn.apache.org/viewvc?rev=1376118view=rev
Log:
OAK-262 Query: support pseudo properties like jcr:score() and rep:excerpt() - 
re-enable tests

Modified:
jackrabbit/oak/trunk/oak-jcr/pom.xml

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1376118r1=1376117r2=1376118view=diff
==
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Aug 22 16:12:25 2012
@@ -91,12 +91,6 @@ org.apache.jackrabbit.test.api.query.Sav
 org.apache.jackrabbit.test.api.query.SimpleSelectionTest#testSingleProperty
 
org.apache.jackrabbit.test.api.query.qom.ColumnTest#testExpandColumnsForNodeType
 org.apache.jackrabbit.test.api.query.qom.SelectorTest#testUnknownNodeType
-
-org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testFullTextSearch
-org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testScoreColumn
-org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testPathColumn
-org.apache.jackrabbit.test.api.query.TextNodeTest#testTextNodeTestContains
-
 org.apache.jackrabbit.test.api.util
 org.apache.jackrabbit.test.api.observation.EventTest#testGetUserId
 org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveNode




svn commit: r1376131 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/ test/java/org/apache/jackrabbit/oak/query/ test/resources/org/apache/jackrabbit/oak/query/

2012-08-22 Thread thomasm
Author: thomasm
Date: Wed Aug 22 16:29:30 2012
New Revision: 1376131

URL: http://svn.apache.org/viewvc?rev=1376131view=rev
Log:
OAK-262 Query: support pseudo properties like jcr:score() and rep:excerpt()

Modified:

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java

jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java

jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt

jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java?rev=1376131r1=1376130r2=1376131view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
 Wed Aug 22 16:29:30 2012
@@ -133,7 +133,13 @@ public class SQL2Parser {
 }
 Query q = new Query(source, constraint, orderings, columnArray, 
valueFactory);
 q.setExplain(explain);
-q.init();
+try {
+q.init();
+} catch (Exception e) {
+ParseException e2 = new ParseException(query + :  + 
e.getMessage(), 0);
+e2.initCause(e);
+throw e2;
+}
 return q;
 }
 

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java?rev=1376131r1=1376130r2=1376131view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
 Wed Aug 22 16:29:30 2012
@@ -430,7 +430,8 @@ public class XPathToSQL2Converter {
 } else if (fn:name.equals(functionName)) {
 Function f = new Function(name);
 if (!readIf())) {
-f.params.add(parseExpression());
+// only name(.) and name() are currently supported
+read(.);
 read());
 }
 return f;
@@ -837,6 +838,9 @@ public class XPathToSQL2Converter {
 
 @Override
 public String toString() {
+if (name.equals(*)) {
+return name;
+}
 return '[' + name + ']';
 }
 

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1376131r1=1376130r2=1376131view=diff
==
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
 Wed Aug 22 16:29:30 2012
@@ -103,16 +103,22 @@ public class QueryTest extends AbstractQ
 w.println(xpath2sql  + line);
 XPathToSQL2Converter c = new XPathToSQL2Converter();
 String got;
+boolean failed;
 try {
 got = c.convert(line);
+failed = false;
 } catch (ParseException e) {
 got = invalid:  + e.getMessage().replace('\n', ' ');
+failed = true;
 }
 line = r.readLine().trim();
 w.println(got);
 if (!line.equals(got)) {
 errors = true;
 }
+if (!failed) {
+executeQuery(got, QueryEngineImpl.SQL2, null);
+}
 } else if (line.startsWith(select) || 
line.startsWith(explain) || line.startsWith(sql1)) {
 w.println(line);
 String language = QueryEngineImpl.SQL2;

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1376131r1=1376130r2=1376131view=diff

svn commit: r1376134 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java

2012-08-22 Thread reschke
Author: reschke
Date: Wed Aug 22 16:42:00 2012
New Revision: 1376134

URL: http://svn.apache.org/viewvc?rev=1376134view=rev
Log:
OAK-273: reject attempts to replace single-valued props by multi-valued props 
and vice versa

Modified:
jackrabbit/oak/trunk/oak-jcr/pom.xml

jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1376134r1=1376133r2=1376134view=diff
==
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Aug 22 16:42:00 2012
@@ -53,10 +53,6 @@ org.apache.jackrabbit.test.api.NodeOrder
 
org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndSessionSave!--OAK-169--
 org.apache.jackrabbit.test.api.SetValueValueFormatExceptionTest
 org.apache.jackrabbit.test.api.SetValueFormatExceptionTest
-org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatException!--OAK-273--
-org.apache.jackrabbit.test.api.SetPropertyStringTest#testSetSingleStringArrayValueFormatExceptionWithPropertyType!--OAK-273--
-org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatException!--OAK-273--
-org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatExceptionWithPropertyType!--OAK-273--
 org.apache.jackrabbit.test.api.SetPropertyAssumeTypeTest
 org.apache.jackrabbit.test.api.NodeAddMixinTest#testAddInheritedMixin
 
org.apache.jackrabbit.test.api.ValueFactoryTest#testValueFormatException!--OAK-204--

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1376134r1=1376133r2=1376134view=diff
==
--- 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
 Wed Aug 22 16:42:00 2012
@@ -29,6 +29,7 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.ValueFormatException;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
@@ -278,7 +279,11 @@ public class NodeDelegate extends ItemDe
  * @return  the set property
  */
 @Nonnull
-public PropertyDelegate setProperty(String name, CoreValue value) throws 
InvalidItemStateException {
+public PropertyDelegate setProperty(String name, CoreValue value) throws 
InvalidItemStateException, ValueFormatException {
+PropertyState old = getTree().getProperty(name);
+if (old != null  old.isArray()) {
+throw new ValueFormatException(Attempt to set a single value to 
multi-valued property.);
+}
 PropertyState propertyState = getTree().setProperty(name, value);
 return new PropertyDelegate(sessionDelegate, getTree(), propertyState);
 }
@@ -294,7 +299,11 @@ public class NodeDelegate extends ItemDe
  * @return  the set property
  */
 @Nonnull
-public PropertyDelegate setProperty(String name, ListCoreValue value) 
throws InvalidItemStateException {
+public PropertyDelegate setProperty(String name, ListCoreValue value) 
throws InvalidItemStateException, ValueFormatException {
+PropertyState old = getTree().getProperty(name);
+if (old != null  ! old.isArray()) {
+throw new ValueFormatException(Attempt to set multiple values to 
single valued property.);
+}
 PropertyState propertyState = getTree().setProperty(name, value);
 return new PropertyDelegate(sessionDelegate, getTree(), propertyState);
 }