Index: jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java =================================================================== --- jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java (revision 929516) +++ jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java (revision ) @@ -39,10 +39,11 @@ // add nodes suite.addTestSuite(AddNodeTest.class); - + // set/add property suite.addTestSuite(GetPropertyTest.class); suite.addTestSuite(AddPropertyTest.class); + suite.addTestSuite(AddMultiValuePropertyTest.class); suite.addTestSuite(AddNewPropertyTest.class); suite.addTestSuite(SingleValuedPropertyTest.class); suite.addTestSuite(MultiValuedPropertyTest.class); Index: jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddMultiValuePropertyTest.java =================================================================== --- jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddMultiValuePropertyTest.java (revision ) +++ jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AddMultiValuePropertyTest.java (revision ) @@ -0,0 +1,57 @@ +/* + * 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.jcr2spi; + +import org.apache.jackrabbit.test.AbstractJCRTest; + +import javax.jcr.Node; +import javax.jcr.Property; +import javax.jcr.PropertyType; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.Value; + +public class AddMultiValuePropertyTest extends AbstractJCRTest { + + public void testAddEmptyMultiStringProperty() throws RepositoryException { + String prop = mkName(testRootNode, "prop"); + Value[] values = new Value[0]; + testRootNode.setProperty(mkName(testRootNode, prop), values, PropertyType.BOOLEAN); + superuser.save(); + + Session session = getHelper().getReadOnlySession(); + Property propAgain = session.getProperty(testRoot + "/" + prop); + assertTrue(propAgain.isMultiple()); + + Value[] valuesAgain = propAgain.getValues(); + assertEquals(PropertyType.BOOLEAN, propAgain.getType()); + assertEquals(values.length, valuesAgain.length); + for (int k = 0; k < values.length; k++) { + assertEquals(values[k], valuesAgain[k]); + } + } + + //------------------------------------------< private >--- + + private static String mkName(Node node, String baseName) throws RepositoryException { + while (node.hasProperty(baseName)) { + baseName = baseName + "_"; + } + return baseName; + } +}