Author: mduerig
Date: Fri Jan 18 16:08:51 2013
New Revision: 1435215
URL: http://svn.apache.org/viewvc?rev=1435215&view=rev
Log:
OAK-554: PropertyStates#createProperty ignores namespace mappings when creating states of
type NAME and PATH
test case
Added:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
(with props)
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TestNameMapper.java
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TestNameMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TestNameMapper.java?rev=1435215&r1=1435214&r2=1435215&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TestNameMapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TestNameMapper.java
Fri Jan 18 16:08:51 2013
@@ -1,18 +1,20 @@
/*
- * 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
+ * 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
+ * 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.
+ * 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;
@@ -39,6 +41,11 @@ public final class TestNameMapper extend
this.global = Collections.singletonMap(TEST_PREFIX, TEST_URI);
}
+ public TestNameMapper(Map<String, String> global, Map<String, String> local)
{
+ super(local);
+ this.global = global;
+ }
+
public TestNameMapper(Map<String, String> global) {
super(global);
this.global = global;
Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java?rev=1435215&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
Fri Jan 18 16:08:51 2013
@@ -0,0 +1,59 @@
+/*
+ * 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.plugins.memory;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+
+import org.apache.jackrabbit.oak.TestNameMapper;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
+import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static java.util.Collections.singletonMap;
+import static org.junit.Assert.assertEquals;
+
+public class PropertyStatesTest {
+
+ private final NamePathMapperImpl namePathMapper = new NamePathMapperImpl(new TestNameMapper(
+ singletonMap("oak-prefix", TestNameMapper.TEST_URI),
+ singletonMap("jcr-prefix", TestNameMapper.TEST_URI) ));
+
+ @Test
+ @Ignore // FIXME OAK-554
+ public void namePropertyFromNameValue() throws RepositoryException {
+ PropertyState nameProperty = PropertyStates.createProperty("name", "oak-prefix:value",
PropertyType.NAME);
+ Value nameValue = ValueFactoryImpl.createValue(nameProperty, namePathMapper);
+ PropertyState namePropertyFromValue = PropertyStates.createProperty("name", nameValue);
+ assertEquals(nameProperty, namePropertyFromValue);
+ }
+
+ @Test
+ @Ignore // FIXME OAK-554
+ public void pathPropertyFromPathValue() throws RepositoryException {
+ PropertyState pathProperty = PropertyStates.createProperty("path", "oak-prefix:a/oak-prefix:b",
PropertyType.PATH);
+ Value nameValue = ValueFactoryImpl.createValue(pathProperty, namePathMapper);
+ PropertyState namePropertyFromValue = PropertyStates.createProperty("path", nameValue);
+ assertEquals(pathProperty, namePropertyFromValue);
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStatesTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
|