You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2009/01/28 14:35:48 UTC
svn commit: r738480 [3/3] - in /jackrabbit/sandbox/spi: ./ spi2davex/
spi2davex/src/ spi2davex/src/main/ spi2davex/src/main/java/
spi2davex/src/main/java/org/ spi2davex/src/main/java/org/apache/
spi2davex/src/main/java/org/apache/jackrabbit/ spi2davex/...
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,731 @@
+/*
+ * 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.spi.spi2davex;
+
+import org.apache.jackrabbit.spi.AbstractSPITest;
+import org.apache.jackrabbit.spi.Batch;
+import org.apache.jackrabbit.spi.ChildInfo;
+import org.apache.jackrabbit.spi.ItemInfo;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.NodeInfo;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.PropertyInfo;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QValueFactory;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.uuid.UUID;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.NamespaceException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * <code>ConnectionTest</code>...
+ */
+public class BatchTest extends AbstractSPITest {
+
+ private final String testPath = "/test";
+ private NamePathResolver resolver;
+ private RepositoryService rs;
+ private SessionInfo si;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ rs = helper.getRepositoryService();
+ si = helper.getAdminSessionInfo();
+ NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
+ public String getURI(String prefix) throws NamespaceException {
+ return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
+ }
+ public String getPrefix(String uri) throws NamespaceException {
+ return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
+ }
+ };
+ resolver = new DefaultNamePathResolver(nsResolver);
+
+ try {
+ rs.getNodeInfo(si, getNodeId(testPath));
+ } catch (RepositoryException e) {
+ Batch b = rs.createBatch(si, getNodeId("/"));
+ b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
+ rs.submit(b);
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ try {
+ Batch b = rs.createBatch(si, getNodeId("/"));
+ b.remove(getNodeId(testPath));
+ rs.submit(b);
+ } finally {
+ rs.dispose(si);
+ super.tearDown();
+ }
+ }
+
+ public void testAddNode() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Batch b = rs.createBatch(si, nid);
+
+ b.addNode(nid, resolver.getQName("aNode"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addProperty(nid, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING));
+ b.addProperty(nid, resolver.getQName("aName"), new QValue[] {rs.getQValueFactory().create(NameConstants.JCR_ENCODING), rs.getQValueFactory().create(NameConstants.JCR_DATA)});
+ b.addProperty(nid, resolver.getQName("aBinary"), rs.getQValueFactory().create(new byte[] { 'a', 'b', 'c'}));
+
+ rs.submit(b);
+
+ NodeId id = rs.getIdFactory().createNodeId(nid, resolver.getQPath("aNode"));
+ Iterator it = rs.getItemInfos(si, id);
+ while (it.hasNext()) {
+ ItemInfo info = (ItemInfo) it.next();
+ if (info.denotesNode()) {
+ NodeInfo nInfo = (NodeInfo) info;
+ assertEquals(NameConstants.NT_UNSTRUCTURED, nInfo.getNodetype());
+ Iterator childIt = nInfo.getChildInfos();
+ assertTrue(childIt == null || !childIt.hasNext());
+ assertEquals(id, nInfo.getId());
+ }
+ }
+
+ b = rs.createBatch(si, nid);
+ b.remove(id);
+ rs.submit(b);
+ }
+
+ public void testImport() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Batch b = rs.createBatch(si, nid);
+
+ String uuid = UUID.randomUUID().toString();
+ b.addNode(nid, resolver.getQName("testUUIDNode"), NameConstants.NT_UNSTRUCTURED, uuid);
+
+ NodeId id = getNodeId(testPath + "/testUUIDNode");
+ b.setMixins(id, new Name[] {NameConstants.MIX_REFERENCEABLE});
+
+ rs.submit(b);
+
+ NodeInfo nInfo = rs.getNodeInfo(si, id);
+ assertEquals(uuid, nInfo.getId().getUniqueID());
+ Name[] mixins = nInfo.getMixins();
+ assertEquals(1, mixins.length);
+ assertEquals(NameConstants.MIX_REFERENCEABLE, mixins[0]);
+
+ b = rs.createBatch(si, nid);
+ b.remove(rs.getIdFactory().createNodeId(uuid));
+ rs.submit(b);
+
+ try {
+ rs.getItemInfos(si, id);
+ fail();
+ } catch (RepositoryException e) {
+ // success
+ }
+ try {
+ rs.getItemInfos(si, rs.getIdFactory().createNodeId(uuid));
+ fail();
+ } catch (RepositoryException e) {
+ // success
+ }
+ }
+
+ public void testSetMixin() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null);
+ NodeId id = getNodeId(testPath + "/anyNode");
+ b.setMixins(id, new Name[] {NameConstants.MIX_LOCKABLE});
+ rs.submit(b);
+
+ b = rs.createBatch(si, id);
+ b.setMixins(id, new Name[0]);
+ rs.submit(b);
+
+ NodeInfo nInfo = rs.getNodeInfo(si, id);
+ assertEquals(0, nInfo.getMixins().length);
+ }
+
+ public void testMove() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null);
+ rs.submit(b);
+
+ NodeId id = getNodeId(testPath + "/anyNode");
+
+ b = rs.createBatch(si, nid);
+ b.move(id, nid, resolver.getQName("moved"));
+ rs.submit(b);
+
+ try {
+ rs.getItemInfos(si, id);
+ fail();
+ } catch (RepositoryException e) {
+ // ok
+ }
+
+ rs.getNodeInfo(si, getNodeId(testPath + "/moved"));
+ }
+
+ public void testReorder() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addNode(nid, resolver.getQName("1"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addNode(nid, resolver.getQName("3"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addNode(nid, resolver.getQName("2"), NameConstants.NT_UNSTRUCTURED, null);
+ rs.submit(b);
+
+ b = rs.createBatch(si, nid);
+ b.reorderNodes(nid, getNodeId(testPath + "/3"), null);
+ rs.submit(b);
+
+ Iterator it = rs.getChildInfos(si, nid);
+ int i = 1;
+ while (it.hasNext()) {
+ ChildInfo ci = (ChildInfo) it.next();
+ assertEquals(i, new Integer(ci.getName().getLocalName()).intValue());
+ i++;
+ }
+ }
+
+ public void testReorder1() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addNode(nid, resolver.getQName("2"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addNode(nid, resolver.getQName("3"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addNode(nid, resolver.getQName("1"), NameConstants.NT_UNSTRUCTURED, null);
+ rs.submit(b);
+
+ b = rs.createBatch(si, nid);
+ b.reorderNodes(nid, getNodeId(testPath + "/1"), getNodeId(testPath + "/2"));
+ rs.submit(b);
+
+ Iterator it = rs.getChildInfos(si, nid);
+ int i = 1;
+ while (it.hasNext()) {
+ ChildInfo ci = (ChildInfo) it.next();
+ assertEquals(i, new Integer(ci.getName().getLocalName()).intValue());
+ i++;
+ }
+ }
+
+ public void testRemove() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Batch b = rs.createBatch(si, nid);
+
+ NodeId id = getNodeId(testPath + "/aTestNode");
+ b.addNode(nid, resolver.getQName("aTestNode"), NameConstants.NT_UNSTRUCTURED, null);
+ b.addProperty(id, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING));
+ rs.submit(b);
+
+ PropertyId pid = getPropertyId(id, resolver.getQName("aString"));
+ b = rs.createBatch(si, nid);
+ b.remove(pid);
+ rs.submit(b);
+
+ try {
+ rs.getPropertyInfo(si, pid);
+ fail();
+ } catch (RepositoryException e) {
+ // success
+ }
+ }
+
+ public void testEmptyValueArray() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("mvProperty");
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, new QValue[0]);
+ rs.submit(b);
+
+ PropertyId pid = getPropertyId(nid, propName);
+ PropertyInfo pi = rs.getPropertyInfo(si, pid);
+ assertTrue(pi.isMultiValued());
+ assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues()));
+ assertFalse(pi.getType() == PropertyType.UNDEFINED);
+
+ Iterator it = rs.getItemInfos(si, nid);
+ while (it.hasNext()) {
+ ItemInfo info = (ItemInfo) it.next();
+ if (!info.denotesNode()) {
+ PropertyInfo pInfo = (PropertyInfo) info;
+ if (propName.equals((pInfo.getId().getName()))) {
+ assertTrue(pi.isMultiValued());
+ assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues()));
+ assertFalse(pi.getType() == PropertyType.UNDEFINED);
+ break;
+ }
+ }
+ }
+ }
+
+ public void testEmptyValueArray2() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("mvProperty");
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, new QValue[] { rs.getQValueFactory().create(true)});
+ rs.submit(b);
+
+ PropertyId pid = getPropertyId(nid, propName);
+ b = rs.createBatch(si, pid);
+ b.setValue(pid, new QValue[0]);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, pid);
+ assertTrue(pi.isMultiValued());
+ assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues()));
+ }
+
+ public void testMultiValuedProperty() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("mvProperty2");
+ QValue[] vs = new QValue[] {rs.getQValueFactory().create(111), rs.getQValueFactory().create(222), rs.getQValueFactory().create(333)};
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, vs);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertTrue(pi.isMultiValued());
+ assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues()));
+ assertEquals(PropertyType.LONG, pi.getType());
+ }
+
+ public void testSetBinaryValue() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binProp");
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}));
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals("abc", pi.getValues()[0].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+ }
+
+ public void testSetEmptyBinaryValue() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binProp");
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[0]));
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ InputStream in = pi.getValues()[0].getStream();
+ assertTrue(in.read() == -1);
+ assertEquals("", pi.getValues()[0].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertFalse(pi.isMultiValued());
+ in = pi.getValues()[0].getStream();
+ assertTrue(in.read() == -1);
+ assertEquals("", pi.getValues()[0].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+ }
+
+ public void testSetBinaryValues() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binPropMV");
+
+ Batch b = rs.createBatch(si, nid);
+ QValue[] vs = new QValue[] {
+ rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}),
+ rs.getQValueFactory().create(new byte[] {'d', 'e', 'f'}),
+ rs.getQValueFactory().create(new byte[] {'g', 'h', 'i'})
+ };
+ b.addProperty(nid, propName, vs);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertTrue(pi.isMultiValued());
+ vs = pi.getValues();
+ assertEquals("abc", vs[0].getString());
+ assertEquals("def", vs[1].getString());
+ assertEquals("ghi", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ vs = pi.getValues();
+ assertEquals("abc", vs[0].getString());
+ assertEquals("def", vs[1].getString());
+ assertEquals("ghi", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+ }
+
+ public void testSetMixedBinaryValues() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binPropMV");
+
+ Batch b = rs.createBatch(si, nid);
+ QValue[] vs = new QValue[] {
+ rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}),
+ rs.getQValueFactory().create(new byte[0]),
+ rs.getQValueFactory().create(new byte[] {'g', 'h', 'i'})
+ };
+ b.addProperty(nid, propName, vs);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertTrue(pi.isMultiValued());
+ vs = pi.getValues();
+ assertEquals("abc", vs[0].getString());
+ assertEquals("", vs[1].getString());
+ assertEquals("ghi", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ vs = pi.getValues();
+ assertEquals("abc", vs[0].getString());
+ assertEquals("", vs[1].getString());
+ assertEquals("ghi", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+ }
+
+ public void testSetEmptyBinaryValues() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binPropMV");
+
+ Batch b = rs.createBatch(si, nid);
+ QValue[] vs = new QValue[] {
+ rs.getQValueFactory().create(new byte[0]),
+ rs.getQValueFactory().create(new byte[0]),
+ rs.getQValueFactory().create(new byte[0])
+ };
+ b.addProperty(nid, propName, vs);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertTrue(pi.isMultiValued());
+ vs = pi.getValues();
+ assertEquals("", vs[0].getString());
+ assertEquals("", vs[1].getString());
+ assertEquals("", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ vs = pi.getValues();
+ assertEquals("", vs[0].getString());
+ assertEquals("", vs[1].getString());
+ assertEquals("", vs[2].getString());
+ assertEquals(PropertyType.BINARY, pi.getType());
+ }
+
+ public void testBinary() throws RepositoryException, IOException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("binProp");
+
+ Batch b = rs.createBatch(si, nid);
+ ClassLoader loader = getClass().getClassLoader();
+ InputStream in = loader.getResourceAsStream("org/apache/jackrabbit/spi/spi2davex/image.bmp");
+ if (in != null) {
+ try {
+ QValue v = rs.getQValueFactory().create(in);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ String str1 = pi.getValues()[0].getString();
+
+ pi = getPropertyInfo(nid, propName);
+ String str2 = pi.getValues()[0].getString();
+ assertEquals(str1, str2);
+ } finally {
+ in.close();
+ }
+ }
+ }
+
+ public void testSetDoubleValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("doubleProp");
+
+ QValue v = rs.getQValueFactory().create((double) 12);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.DOUBLE, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.DOUBLE, pi.getType());
+ }
+
+ public void testSetLongValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("doubleProp");
+
+ QValue v = rs.getQValueFactory().create(234567);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.LONG, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.LONG, pi.getType());
+ }
+
+ public void testSetDateValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("dateProp");
+
+ QValue v = rs.getQValueFactory().create(Calendar.getInstance());
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.DATE, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.DATE, pi.getType());
+ }
+
+ public void testSetStringValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("stringProp");
+ QValueFactory vf = rs.getQValueFactory();
+
+ List l = new ArrayList();
+ l.add("String value containing \"double quotes\" and \'single\' and \"undeterminated quote.");
+ l.add("String value \ncontaining \n\rline \r\nseparators and \t tab.");
+ l.add("String value containing \r\n\r\r\n\r\n multiple \r\n\r\n line separators in sequence.");
+ l.add("String value containing >diff -char +act ^ters.");
+ l.add("String value containing \n>line sep \r+and \r\n-diff\n\r^chars.");
+ l.add("String value containing \u0633\u0634 unicode chars.");
+
+ for (Iterator it = l.iterator(); it.hasNext();) {
+ QValue v = vf.create(it.next().toString(), PropertyType.STRING);
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = getPropertyInfo(nid, propName);
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.STRING, pi.getType());
+
+ pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(v.getString(), pi.getValues()[0].getString());
+ assertEquals(PropertyType.STRING, pi.getType());
+ }
+ }
+
+ public void testSetNameValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("nameProp");
+
+ QValue[] vs = new QValue[] {
+ rs.getQValueFactory().create(NameConstants.JCR_BASEVERSION),
+ rs.getQValueFactory().create(NameConstants.JCR_DEFAULTPRIMARYTYPE),
+ rs.getQValueFactory().create(NameConstants.MIX_LOCKABLE),
+ rs.getQValueFactory().create(NameConstants.JCR_PRIMARYTYPE),
+ rs.getQValueFactory().create(NameConstants.NT_VERSION)
+ };
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, vs);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertTrue(pi.isMultiValued());
+ assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues()));
+ assertEquals(PropertyType.NAME, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(vs[0].getName(), pi.getValues()[0].getName());
+ assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues()));
+ assertEquals(PropertyType.NAME, pi.getType());
+ }
+
+ public void testSetPathValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("pathProp");
+
+ QValue v = rs.getQValueFactory().create(resolver.getQPath(testPath));
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(PropertyType.PATH, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(v.getPath(), pi.getValues()[0].getPath());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(PropertyType.PATH, pi.getType());
+ }
+
+ public void testSetBooleanValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("booleanProp");
+
+ QValue v = rs.getQValueFactory().create(false);
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertFalse(pi.getValues()[0].getBoolean());
+ assertEquals(PropertyType.BOOLEAN, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertFalse(pi.getValues()[0].getBoolean());
+ assertEquals(PropertyType.BOOLEAN, pi.getType());
+ }
+
+ public void testSetReferenceValue() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ NodeInfo nInfo = rs.getNodeInfo(si, nid);
+ if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
+ Batch b = rs.createBatch(si, nid);
+ b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
+ rs.submit(b);
+ }
+
+ String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
+ Name propName = resolver.getQName("refProp");
+ QValue v = rs.getQValueFactory().create(ref, PropertyType.REFERENCE);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(PropertyType.REFERENCE, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertEquals(v, pi.getValues()[0]);
+ assertEquals(PropertyType.REFERENCE, pi.getType());
+ }
+
+ public void testSetPropertyTwice() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Name propName = resolver.getQName("nameProp");
+ PropertyId pid = getPropertyId(nid, propName);
+
+ QValue v = rs.getQValueFactory().create(NameConstants.JCR_AUTOCREATED);
+ QValue v2 = rs.getQValueFactory().create(NameConstants.JCR_BASEVERSION);
+ QValue v3 = rs.getQValueFactory().create(NameConstants.JCR_CONTENT);
+
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, propName, v);
+ b.setValue(pid, v2);
+ b.setValue(pid, v3);
+ rs.submit(b);
+
+ PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+ assertFalse(pi.isMultiValued());
+ assertEquals(1, pi.getValues().length);
+ assertEquals(v3, pi.getValues()[0]);
+ assertEquals(PropertyType.NAME, pi.getType());
+
+ pi = getPropertyInfo(nid, propName);
+ assertFalse(pi.isMultiValued());
+ assertEquals(1, pi.getValues().length);
+ assertEquals(v3, pi.getValues()[0]);
+ assertEquals(PropertyType.NAME, pi.getType());
+ }
+
+ public void testUseConsumedBatch() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ Batch b = rs.createBatch(si, nid);
+ b.addProperty(nid, resolver.getQName("any"), rs.getQValueFactory().create(1.34));
+ rs.submit(b);
+
+ try {
+ b.remove(nid);
+ rs.submit(b);
+ fail();
+ } catch (IllegalStateException e) {
+ // success
+ }
+ }
+ //--------------------------------------------------------------------------
+ private NodeId getNodeId(String path) throws NamespaceException, RepositoryException {
+ return rs.getIdFactory().createNodeId((String) null, resolver.getQPath(path));
+ }
+
+ private PropertyId getPropertyId(NodeId nId, Name propName) throws RepositoryException {
+ return rs.getIdFactory().createPropertyId(nId, propName);
+ }
+
+ private PropertyInfo getPropertyInfo(NodeId parentId, Name propName) throws RepositoryException {
+ Iterator it = rs.getItemInfos(si, parentId);
+ while (it.hasNext()) {
+ ItemInfo info = (ItemInfo) it.next();
+ if (!info.denotesNode()) {
+ PropertyInfo pInfo = (PropertyInfo) info;
+ if (propName.equals((pInfo.getId().getName()))) {
+ return pInfo;
+ }
+ }
+ }
+ throw new ItemNotFoundException();
+ }
+}
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/BatchTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,63 @@
+/*
+ * 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.spi.spi2davex;
+
+import org.apache.jackrabbit.spi.AbstractSPITest;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+
+import javax.jcr.LoginException;
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.SimpleCredentials;
+
+/**
+ * <code>ConnectionTest</code>...
+ */
+public class ConnectionTest extends AbstractSPITest {
+
+ private final String testPath = "/";
+ private NamePathResolver resolver;
+ private RepositoryService rs;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ rs = helper.getRepositoryService();
+ NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
+ public String getURI(String prefix) throws NamespaceException {
+ return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
+ }
+ public String getPrefix(String uri) throws NamespaceException {
+ return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
+ }
+ };
+ resolver = new DefaultNamePathResolver(nsResolver);
+ }
+
+ public void testObtainWithNullWorkspaceName() throws RepositoryException, LoginException {
+ SessionInfo sInfo = rs.obtain(new SimpleCredentials("admin", "admin".toCharArray()), null);
+ try {
+ assertEquals("default",sInfo.getWorkspaceName());
+ } finally {
+ rs.dispose(sInfo);
+ }
+ }
+}
\ No newline at end of file
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ConnectionTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.spi.spi2davex;
+
+/**
+ * <code>DummyJSONHandler</code>...
+ */
+class DummyJSONHandler implements JSONHandler {
+
+ public void object() {
+ System.out.println("Object");
+ }
+
+ public void endObject() {
+ System.out.println("Object: END");
+ }
+
+ public void array() {
+ System.out.println("\tArray");
+ }
+
+ public void endArray() {
+ System.out.println("\tArray: END");
+ }
+ public void key(String key) {
+ System.out.println("Key = " + key);
+ }
+
+ public void value(String value) {
+ System.out.println("\tValue = " + value);
+ }
+
+ public void value(long value) {
+ System.out.println("\tValue (long) = " + value);
+ }
+
+ public void value(double value) {
+ System.out.println("\tValue (double) = " + value);
+ }
+
+ public void value(boolean value) {
+ System.out.println("\tValue (boolean) = " + value);
+ }
+}
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/DummyJSONHandler.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,555 @@
+/*
+ * 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.spi.spi2davex;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import junit.framework.TestCase;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * <code>JSONParserTest</code>...
+ */
+public class JSONParserTest extends TestCase {
+
+ private final JSONHandler handler = new DummyJSONHandler();
+ private JSONParser parser;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parser = new JSONParser(handler);
+ }
+
+ public void testParser() throws JSONException, IOException {
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(getObj().toString());
+ }
+
+ public void testParseBooleanValue() throws IOException, JSONException {
+ JSONObject obj = new JSONObject();
+ obj.put("boolean", true);
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("boolean", key);
+ }
+ public void value(String value) {
+ fail();
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ assertEquals(true, value);
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testParseLongValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("long", 123456);
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("long", key);
+ }
+ public void value(String value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ public void value(long value) {
+ assertEquals(123456, value);
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testDoubleValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("double", 1235674.342424);
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("double", key);
+ }
+ public void value(String value) {
+ fail();
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ public void value(double value) {
+ assertEquals(new Double(1235674.342424), new Double(value));
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "abc");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("abc", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithQuoteValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "abc\"abc");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("abc\"abc", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithBackSlashValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "abc\\abc");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("abc\\abc", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithBackSlashValue2() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "\'abc\\\\x\\'abc");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("\'abc\\\\x\\'abc", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithUnicode() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "abc\u2345ab\u00EB\u0633c");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("abc\u2345ab\u00EB\u0633c", value);
+ assertEquals("abc\u2345abë\u0633c", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithUnicode2() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("string", "\u00EB");
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals("\u00EB", value);
+ assertEquals("ë", value);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testStringWithReturn() throws JSONException, IOException {
+ ArrayList l = new ArrayList();
+ l.add("abc\ndef");
+ l.add("abc\rdef");
+ l.add("abc\n\rdef");
+ l.add("abc\tdef");
+ l.add("abc\bdef");
+ l.add("abc\n\\\tdef");
+ l.add("abc\f\u3456\b\\def");
+
+ for (Iterator it = l.iterator(); it.hasNext();) {
+ final String expValue = it.next().toString();
+ JSONObject obj = new JSONObject();
+ obj.put("string", expValue);
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("string", key);
+ }
+ public void value(String value) {
+ assertEquals(expValue, value);
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+ }
+
+ public void testNullValue() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("null", JSONObject.NULL);
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals("null", key);
+ }
+ public void value(String value) {
+ assertNull(value);
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testArray() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("array", Arrays.asList(new String[] {"a", "b", "c"}));
+
+ JSONHandler handler = new DummyJSONHandler() {
+ boolean arrayStarted = false;
+ int index = 0;
+
+ public void key(String key) {
+ assertEquals("array", key);
+ }
+ public void array() {
+ assertFalse(arrayStarted);
+ arrayStarted = true;
+ }
+ public void endArray() {
+ assertTrue(arrayStarted);
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ public void value(String value) {
+ assertTrue(arrayStarted);
+ switch (index) {
+ case 0: assertEquals("a", value); break;
+ case 1: assertEquals("b", value); break;
+ case 2: assertEquals("c", value); break;
+ default: fail();
+ }
+ index++;
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testLongArray() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("longarray", Arrays.asList(new Long[] {new Long(123), new Long(3456), new Long(45367)}));
+
+ JSONHandler handler = new DummyJSONHandler() {
+ boolean arrayStarted = false;
+ int index = 0;
+
+ public void key(String key) {
+ assertEquals("longarray", key);
+ }
+ public void array() {
+ assertFalse(arrayStarted);
+ arrayStarted = true;
+ }
+ public void endArray() {
+ assertTrue(arrayStarted);
+ }
+ public void value(long value) {
+ assertTrue(arrayStarted);
+ switch (index) {
+ case 0: assertEquals(123, value); break;
+ case 1: assertEquals(3456, value); break;
+ case 2: assertEquals(45367, value); break;
+ default: fail();
+ }
+ index++;
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ public void value(String value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(obj.toString());
+ }
+
+ public void testParser2() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("obj1", getSimpleObj("bla"));
+ obj.put("obj2", getSimpleObj("blu"));
+ obj.put("obj3", getSimpleObj("bli"));
+
+ parser.parse(obj.toString());
+ }
+
+ public void testParser4() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("arr1", getSimpleArray(new String[] {"s", "t", "r"}));
+ obj.put("arr2", getSimpleArray(new String[] {"s", "t", "r"}));
+ obj.put("arr3", getSimpleArray(new String[] {"s", "t", "r"}));
+ obj.put("arr4", getSimpleArray(new String[] {"s", "t", "r"}));
+
+ parser.parse(obj.toString());
+ }
+
+ public void testParser5() throws JSONException, IOException {
+ JSONObject obj = new JSONObject();
+ obj.put("arr1", getSimpleArray(new JSONObject[] { getSimpleObj(new Integer(1)), getSimpleObj("abc"), getSimpleObj(Boolean.TRUE) }));
+ obj.put("objvalue", getSimpleObj( getSimpleArray(new Object[] {"a", new Double(2.3), Boolean.FALSE})));
+ obj.put("arrarr", getSimpleArray( new Object[] {getSimpleArray(new Object[] {"a", new Double(2.3), Boolean.FALSE})}));
+ obj.put("simplv", Boolean.TRUE);
+
+ parser.parse(obj.toString());
+ }
+
+ public void testParser6() throws JSONException, IOException {
+ final String expKey = "prop1";
+ final String expValue = "Any string containing comma, period. question mark?";
+
+ JSONHandler handler = new DummyJSONHandler() {
+ public void key(String key) {
+ assertEquals(expKey, key);
+ }
+
+ public void value(String value) {
+ assertEquals(expValue, value);
+ }
+ };
+
+ String str = "{\"" +expKey+ "\":\""+expValue+"\"}";
+
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(str);
+ }
+
+ public void testParseEmptyObject() throws IOException, JSONException {
+ JSONHandler handler = new DummyJSONHandler() {
+ private int objectCnt = 0;
+ public void object() {
+ objectCnt++;
+ }
+ public void endObject() {
+ assertEquals(1, objectCnt);
+ }
+ public void array() {
+ fail();
+ }
+ public void endArray() {
+ fail();
+ }
+ public void key(String key) {
+ fail();
+ }
+ public void value(String value) {
+ fail();
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+ JSONParser parser = new JSONParser(handler);
+ parser.parse("{}");
+ }
+
+ public void testParseEmptyObjectValue() throws IOException, JSONException {
+
+ List l = new ArrayList();
+ l.add("{\"a\":{},\"b\":{},\"c\":{}}");
+ l.add("{\"a\":{\"b\":{\"c\":{}}}}");
+ l.add("{\"a\":{},\"b\":{\"c\":{}}}");
+ l.add("{\"a\":{\"b\":{},\"c\":{}}}");
+
+ for (Iterator it = l.iterator(); it.hasNext();) {
+ JSONHandler handler = new DummyJSONHandler() {
+ private int objectCnt = 0;
+ public void object() {
+ objectCnt++;
+ }
+ public void endObject() {
+ assertFalse(objectCnt > 4);
+ }
+ public void array() {
+ fail();
+ }
+ public void endArray() {
+ fail();
+ }
+ public void value(String value) {
+ fail();
+ }
+ public void value(long value) {
+ fail();
+ }
+ public void value(double value) {
+ fail();
+ }
+ public void value(boolean value) {
+ fail();
+ }
+ };
+
+ JSONParser parser = new JSONParser(handler);
+ parser.parse(it.next().toString());
+ }
+ }
+
+ private static JSONObject getObj() throws JSONException {
+ JSONObject obj = new JSONObject();
+ obj.put("boolean", true);
+ obj.put("long", 1);
+ obj.put("double", 1235674.342424);
+ obj.put("array", Arrays.asList(new String[] {"a", "b", "c"}));
+ obj.put("longarray", Arrays.asList(new Long[] {new Long(123), new Long(3456), new Long(45367)}));
+ obj.put("string", "abc");
+ obj.put("string1", "123.456");
+ return obj;
+ }
+
+ private static JSONObject getSimpleObj(Object value) throws JSONException {
+ JSONObject obj = new JSONObject();
+ obj.put("v", value);
+ return obj;
+ }
+
+ private static JSONArray getSimpleArray(Object[] values) throws JSONException {
+ JSONArray arr = new JSONArray();
+ for (int i = 0; i < values.length; i++) {
+ arr.put(values[i]);
+ }
+ return arr;
+ }
+
+}
\ No newline at end of file
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/JSONParserTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,153 @@
+/*
+ * 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.spi.spi2davex;
+
+import org.apache.jackrabbit.spi.Batch;
+import org.apache.jackrabbit.spi.ItemInfo;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.PropertyInfo;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.AbstractSPITest;
+import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import java.util.Iterator;
+
+/**
+ * <code>ConnectionTest</code>...
+ */
+public class ReadTest extends AbstractSPITest {
+
+ private final String testPath = "/test";
+ private NamePathResolver resolver;
+ private RepositoryService rs;
+ private SessionInfo si;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ rs = helper.getRepositoryService();
+ si = helper.getAdminSessionInfo();
+
+ NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
+ public String getURI(String prefix) throws NamespaceException {
+ return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
+ }
+ public String getPrefix(String uri) throws NamespaceException {
+ return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
+ }
+ };
+ resolver = new DefaultNamePathResolver(nsResolver);
+
+ try {
+ rs.getNodeInfo(si, getNodeId(testPath));
+ } catch (RepositoryException e) {
+ Batch b = rs.createBatch(si, getNodeId("/"));
+ b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
+ rs.submit(b);
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ try {
+ Batch b = rs.createBatch(si, getNodeId("/"));
+ b.remove(getNodeId(testPath));
+ rs.submit(b);
+ } finally {
+ rs.dispose(si);
+ super.tearDown();
+ }
+ }
+
+ public void testReadNode() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ rs.getItemInfos(si, nid);
+ }
+
+ public void testReadNonExistingNode() throws RepositoryException {
+ NodeId nid = getNodeId(testPath + "/non-existing");
+ try {
+ rs.getItemInfos(si, nid);
+ fail();
+ } catch (ItemNotFoundException e) {
+ // ok
+ }
+ }
+
+ public void testReadNonExistingNode2() throws RepositoryException {
+ NodeId nid = getNodeId(testPath + "/non-existing");
+ try {
+ rs.getNodeInfo(si, nid);
+ fail();
+ } catch (ItemNotFoundException e) {
+ // ok
+ }
+ }
+
+ public void testReadPropertyAsNode() throws RepositoryException {
+ NodeId nid = getNodeId(testPath + "/jcr:primaryType");
+ try {
+ rs.getItemInfos(si, nid);
+ fail();
+ } catch (ItemNotFoundException e) {
+ // ok
+ }
+ }
+
+ public void testReadNonExistingProperty() throws RepositoryException {
+ NodeId nid = getNodeId(testPath);
+ PropertyId pid = getPropertyId(nid, NameConstants.JCR_CHILDNODEDEFINITION);
+
+ try {
+ rs.getPropertyInfo(si, pid);
+ fail();
+ } catch (ItemNotFoundException e) {
+ // ok
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ private NodeId getNodeId(String path) throws NamespaceException, RepositoryException {
+ return rs.getIdFactory().createNodeId((String) null, resolver.getQPath(path));
+ }
+
+ private PropertyId getPropertyId(NodeId nId, Name propName) throws RepositoryException {
+ return rs.getIdFactory().createPropertyId(nId, propName);
+ }
+
+ private PropertyInfo getPropertyInfo(NodeId parentId, Name propName) throws RepositoryException {
+ Iterator it = rs.getItemInfos(si, parentId);
+ while (it.hasNext()) {
+ ItemInfo info = (ItemInfo) it.next();
+ if (!info.denotesNode()) {
+ PropertyInfo pInfo = (PropertyInfo) info;
+ if (propName.equals((pInfo.getId().getName()))) {
+ return pInfo;
+ }
+ }
+ }
+ throw new ItemNotFoundException();
+ }
+}
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ReadTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,95 @@
+/*
+ * 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.spi.spi2davex;
+
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.RepositoryServiceStub;
+import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Credentials;
+import javax.jcr.RepositoryException;
+import javax.jcr.SimpleCredentials;
+import java.util.Properties;
+
+/** <code>ServiceStubImpl</code>... */
+public class ServiceStubImpl extends RepositoryServiceStub {
+
+ private static Logger log = LoggerFactory.getLogger(ServiceStubImpl.class);
+
+ public static final String PROP_REPOSITORY_URI = "org.apache.jackrabbit.spi.spi2davex.uri";
+ public static final String PROP_DEFAULT_DEPTH = "org.apache.jackrabbit.spi.spi2davex.defaultDepth";
+ public static final String PROP_WSP_NAME = "org.apache.jackrabbit.spi.spi2davex.workspacename";
+
+ private RepositoryService service;
+ private Credentials adminCredentials;
+ private Credentials readOnlyCredentials;
+
+ /**
+ * Implementations of this class must overwrite this constructor.
+ *
+ * @param env the environment variables. This parameter must not be null.
+ */
+ public ServiceStubImpl(Properties env) {
+ super(env);
+ }
+
+ /**
+ * Workaround for SPI issue JCR-1851
+ *
+ * @param propName Configuration property name.
+ * @return Configured property value.
+ */
+ public String getProperty(String propName) {
+ String prop = super.getProperty(propName);
+ if (prop == null && propName.equals("workspacename")) {
+ prop = super.getProperty(PROP_WSP_NAME);
+ }
+ return prop;
+ }
+
+ public RepositoryService getRepositoryService() throws RepositoryException {
+ if (service == null) {
+ String uri = getProperty(PROP_REPOSITORY_URI);
+ service = new RepositoryServiceImpl(uri, new BatchReadConfig() {
+ public int getDepth(Path path, PathResolver resolver) {
+ String depthStr = getProperty(PROP_DEFAULT_DEPTH);
+ return Integer.parseInt(depthStr);
+ }
+ });
+ }
+ return service;
+ }
+
+ public Credentials getAdminCredentials() {
+ if (adminCredentials == null) {
+ adminCredentials = new SimpleCredentials(getProperty(RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_ADMIN_NAME),
+ getProperty(RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_ADMIN_PWD).toCharArray());
+ }
+ return adminCredentials;
+ }
+
+ public Credentials getReadOnlyCredentials() {
+ if (readOnlyCredentials == null) {
+ readOnlyCredentials = new SimpleCredentials(getProperty(RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_READONLY_NAME),
+ getProperty(RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_READONLY_PWD).toCharArray());
+ }
+ return readOnlyCredentials;
+ }
+}
\ No newline at end of file
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/ServiceStubImpl.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java Wed Jan 28 13:35:47 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.spi.spi2davex;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/** <code>TestAll</code>... */
+public class TestAll extends TestCase {
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite("SPI and SPI-implementation tests");
+
+ suite.addTest(org.apache.jackrabbit.spi.TestAll.suite());
+
+ // impl specific spi tests
+ suite.addTestSuite(ConnectionTest.class);
+ suite.addTestSuite(ReadTest.class);
+ suite.addTestSuite(BatchTest.class);
+
+ // impl specific tests
+ suite.addTestSuite(JSONParserTest.class);
+ return suite;
+ }
+}
\ No newline at end of file
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/java/org/apache/jackrabbit/spi/spi2davex/TestAll.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Added: jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties Wed Jan 28 13:35:47 2009
@@ -0,0 +1,36 @@
+# 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.
+
+# Set root logger level to INFO and its only appender to file.
+log4j.rootLogger=INFO, file
+#log4j.rootLogger=DEBUG, stdout, file
+#log4j.rootLogger=ERROR, stdout, file
+
+log4j.logger.org.apache.jackrabbit.test=DEBUG
+
+# 'stdout' is set to be a ConsoleAppender.
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+
+# 'stdout' uses PatternLayout
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
+
+# 'file' is set to be a FileAppender.
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=target/jcr.log
+
+# 'file' uses PatternLayout.
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn =
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/sandbox/spi/spi2davex/src/test/resources/org/apache/jackrabbit/spi/spi2davex/image.bmp
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/resources/org/apache/jackrabbit/spi/spi2davex/image.bmp?rev=738480&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/resources/org/apache/jackrabbit/spi/spi2davex/image.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties?rev=738480&view=auto
==============================================================================
--- jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties (added)
+++ jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties Wed Jan 28 13:35:47 2009
@@ -0,0 +1,33 @@
+# 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.
+
+#
+# This is the configuration file for the jackrabbit repositoryservice test stub.
+#
+
+# the ServiceStubImpl used for SPI tests.
+org.apache.jackrabbit.spi.repository_service_stub_impl=org.apache.jackrabbit.spi.spi2davex.ServiceStubImpl
+
+org.apache.jackrabbit.spi.admin.pwd=admin
+org.apache.jackrabbit.spi.admin.name=admin
+org.apache.jackrabbit.spi.readonly.pwd=anonymous
+org.apache.jackrabbit.spi.readonly.name=
+org.apache.jackrabbit.spi.workspacename=default
+
+org.apache.jackrabbit.spi.QValueFactoryTest.reference=cafebabe-cafe-babe-cafe-babecafebabe
+
+org.apache.jackrabbit.spi.spi2davex.uri=http://localhost:8080/jackrabbit/server
+org.apache.jackrabbit.spi.spi2davex.workspacename=default
+org.apache.jackrabbit.spi.spi2davex.defaultDepth=4
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties
------------------------------------------------------------------------------
svn =
Propchange: jackrabbit/sandbox/spi/spi2davex/src/test/resources/repositoryServiceStubImpl.properties
------------------------------------------------------------------------------
svn:eol-style = native