You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2008/01/25 17:47:28 UTC
svn commit: r615265 - in /incubator/sling/trunk: commons/json/
commons/json/src/main/java/org/apache/sling/commons/json/jcr/
commons/json/src/test/ commons/json/src/test/java/
commons/json/src/test/java/org/ commons/json/src/test/java/org/apache/
commo...
Author: bdelacretaz
Date: Fri Jan 25 08:47:26 2008
New Revision: 615265
URL: http://svn.apache.org/viewvc?rev=615265&view=rev
Log:
SLING-201 - Move JsonItemWriter to o.a.s.commons.json
Added:
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/JsonItemWriter.java
- copied, changed from r615211, incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
incubator/sling/trunk/commons/json/src/test/
incubator/sling/trunk/commons/json/src/test/java/
incubator/sling/trunk/commons/json/src/test/java/org/
incubator/sling/trunk/commons/json/src/test/java/org/apache/
incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/
incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/
incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/
incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/
incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java (with props)
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java (with props)
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java (with props)
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java (with props)
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java (with props)
Removed:
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonItemWriter.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
Modified:
incubator/sling/trunk/commons/json/pom.xml
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNode.java
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java
Modified: incubator/sling/trunk/commons/json/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/json/pom.xml?rev=615265&r1=615264&r2=615265&view=diff
==============================================================================
--- incubator/sling/trunk/commons/json/pom.xml (original)
+++ incubator/sling/trunk/commons/json/pom.xml Fri Jan 25 08:47:26 2008
@@ -63,4 +63,22 @@
</plugin>
</plugins>
</build>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.testing</artifactId>
+ <version>2.0.0-incubator-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Copied: incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/JsonItemWriter.java (from r615211, incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java)
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/JsonItemWriter.java?p2=incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/JsonItemWriter.java&p1=incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java&r1=615211&r2=615265&rev=615265&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java (original)
+++ incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/jcr/JsonItemWriter.java Fri Jan 25 08:47:26 2008
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.servlet.resolver.helper;
+package org.apache.sling.commons.json.jcr;
import java.io.Writer;
import java.text.DateFormat;
@@ -92,6 +92,7 @@
if (!prop.getDefinition().isMultiple()) {
writeProperty(w, currentRecursionLevel, prop);
} else {
+ w.key(prop.getName());
w.array();
for(Value v : prop.getValues()) {
w.value(convertValue(v));
Added: incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java?rev=615265&view=auto
==============================================================================
--- incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java (added)
+++ incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java Fri Jan 25 08:47:26 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.commons.json.jcr;
+
+import java.io.StringWriter;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+import junit.framework.TestCase;
+
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.testing.jcr.MockNode;
+
+/** Test the JsonItemWriter */
+public class JsonItemWriterTest extends TestCase {
+
+ private final JsonItemWriter writer = new JsonItemWriter(null);
+
+ private String getJson(Node n, int levels) throws RepositoryException, JSONException {
+ final StringWriter sw = new StringWriter();
+ writer.dump(n, sw, 0);
+ return sw.toString();
+ }
+
+ public void testBasicJson() throws RepositoryException, JSONException {
+ final Node n = new MockNode("/test");
+ n.setProperty("testprop", "1234");
+ assertEquals("{\"testprop\":\"1234\"}",getJson(n, 0));
+ }
+
+ public void testMultivalued() throws RepositoryException, JSONException {
+ final Node n = new MockNode("/test");
+ final String [] values = { "1234", "yes" };
+ n.setProperty("testprop", values);
+ assertEquals("{\"testprop\":[\"1234\",\"yes\"]}",getJson(n, 0));
+ }
+}
Propchange: incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Modified: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNode.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNode.java?rev=615265&r1=615264&r2=615265&view=diff
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNode.java (original)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNode.java Fri Jan 25 08:47:26 2008
@@ -20,6 +20,8 @@
import java.io.InputStream;
import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
import javax.jcr.Item;
import javax.jcr.ItemVisitor;
@@ -27,18 +29,24 @@
import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NodeDefinition;
import javax.jcr.nodetype.NodeType;
import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
import javax.jcr.version.VersionHistory;
// simple mock implementation of a node
public class MockNode implements Node {
private String path;
+ private Map <String, Property> properties = new HashMap <String, Property>();
private NodeType nodeType;
@@ -162,7 +170,7 @@
}
public PropertyIterator getProperties() {
- return null;
+ return new MockPropertyIterator(properties.values().iterator());
}
public PropertyIterator getProperties(String namePattern) {
@@ -251,12 +259,18 @@
return null;
}
- public Property setProperty(String name, String[] values) {
- return null;
+ public Property setProperty(String name, String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
+ MockProperty p = new MockProperty(name);
+ p.setValue(values);
+ properties.put(name, p);
+ return p;
}
- public Property setProperty(String name, String value) {
- return null;
+ public Property setProperty(String name, String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
+ MockProperty p = new MockProperty(name);
+ p.setValue(value);
+ properties.put(name, p);
+ return p;
}
public Property setProperty(String name, InputStream value) {
Added: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java?rev=615265&view=auto
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java (added)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java Fri Jan 25 08:47:26 2008
@@ -0,0 +1,207 @@
+/*
+ * 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.sling.commons.testing.jcr;
+
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ItemVisitor;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.version.VersionException;
+
+public class MockProperty implements Property {
+
+ private Value [] values = {};
+ private final String name;
+
+ public MockProperty(String name) {
+ this.name = name;
+ }
+
+ public boolean getBoolean() throws ValueFormatException, RepositoryException {
+ return false;
+ }
+
+ public Calendar getDate() throws ValueFormatException, RepositoryException {
+ return null;
+ }
+
+ public PropertyDefinition getDefinition() throws RepositoryException {
+ return new MockPropertyDefinition(values.length > 1);
+ }
+
+ public double getDouble() throws ValueFormatException, RepositoryException {
+ return 0;
+ }
+
+ public long getLength() throws ValueFormatException, RepositoryException {
+ return 0;
+ }
+
+ public long[] getLengths() throws ValueFormatException, RepositoryException {
+ return null;
+ }
+
+ public long getLong() throws ValueFormatException, RepositoryException {
+ return 0;
+ }
+
+ public Node getNode() throws ValueFormatException, RepositoryException {
+ return null;
+ }
+
+ public InputStream getStream() throws ValueFormatException, RepositoryException {
+ return null;
+ }
+
+ public String getString() throws ValueFormatException, RepositoryException {
+ if(values.length > 0) return values[0].getString();
+ return null;
+ }
+
+ public int getType() throws RepositoryException {
+ return PropertyType.STRING;
+ }
+
+ public Value getValue() throws ValueFormatException, RepositoryException {
+ return new MockValue(getString());
+ }
+
+ public Value[] getValues() throws ValueFormatException, RepositoryException {
+ return values;
+ }
+
+ public void setValue(boolean value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(Calendar value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(double value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(InputStream value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(long value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(Node value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(String value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ values =new Value[1];
+ values[0] = new MockValue(value);
+ }
+
+ public void setValue(String[] inputValues) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ this.values = new Value[inputValues.length];
+ int i = 0;
+ for(String str : inputValues) {
+ values[i++] = new MockValue(str);
+ }
+ }
+
+ public void setValue(Value value) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException,
+ ConstraintViolationException, RepositoryException {
+ }
+
+ public void accept(ItemVisitor visitor) throws RepositoryException {
+ }
+
+ public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
+ return null;
+ }
+
+ public int getDepth() throws RepositoryException {
+ return 0;
+ }
+
+ public String getName() throws RepositoryException {
+ return name;
+ }
+
+ public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
+ return null;
+ }
+
+ public String getPath() throws RepositoryException {
+ return null;
+ }
+
+ public Session getSession() throws RepositoryException {
+ return null;
+ }
+
+ public boolean isModified() {
+ return false;
+ }
+
+ public boolean isNew() {
+ return false;
+ }
+
+ public boolean isNode() {
+ return false;
+ }
+
+ public boolean isSame(Item otherItem) throws RepositoryException {
+ return false;
+ }
+
+ public void refresh(boolean keepChanges) throws InvalidItemStateException, RepositoryException {
+ }
+
+ public void remove() throws VersionException, LockException, ConstraintViolationException, RepositoryException {
+ }
+
+ public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException,
+ InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException,
+ NoSuchNodeTypeException, RepositoryException {
+ }
+
+}
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java?rev=615265&view=auto
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java (added)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java Fri Jan 25 08:47:26 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.sling.commons.testing.jcr;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDefinition;
+
+public class MockPropertyDefinition implements PropertyDefinition {
+
+ private boolean multiple;
+
+ public MockPropertyDefinition(boolean multiple) {
+ this.multiple = multiple;
+
+ }
+ public Value[] getDefaultValues() {
+ return null;
+ }
+
+ public int getRequiredType() {
+ return 0;
+ }
+
+ public String[] getValueConstraints() {
+ return null;
+ }
+
+ public boolean isMultiple() {
+ return multiple;
+ }
+
+ public NodeType getDeclaringNodeType() {
+ return null;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public int getOnParentVersion() {
+ return 0;
+ }
+
+ public boolean isAutoCreated() {
+ return false;
+ }
+
+ public boolean isMandatory() {
+ return false;
+ }
+
+ public boolean isProtected() {
+ return false;
+ }
+
+}
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyDefinition.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java?rev=615265&view=auto
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java (added)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java Fri Jan 25 08:47:26 2008
@@ -0,0 +1,61 @@
+/*
+ * 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.sling.commons.testing.jcr;
+
+import java.util.Iterator;
+
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+
+public class MockPropertyIterator implements PropertyIterator {
+
+ private final Iterator<Property> iterator;
+ int index = 0;
+
+ public MockPropertyIterator(Iterator <Property> it) {
+ iterator = it;
+ }
+
+ public Property nextProperty() {
+ return iterator.next();
+ }
+
+ public long getPosition() {
+ return -1;
+ }
+
+ public long getSize() {
+ return -1;
+ }
+
+ public void skip(long skipNum) {
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return nextProperty();
+ }
+
+ public void remove() {
+ throw new Error("Not implemented: remove");
+ }
+}
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockPropertyIterator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java?rev=615265&view=auto
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java (added)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java Fri Jan 25 08:47:26 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.sling.commons.testing.jcr;
+
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+public class MockValue implements Value {
+
+ private final String value;
+
+ public MockValue(String str) {
+ value = str;
+ }
+
+ public boolean getBoolean() throws ValueFormatException, IllegalStateException, RepositoryException {
+ return false;
+ }
+
+ public Calendar getDate() throws ValueFormatException, IllegalStateException, RepositoryException {
+ return null;
+ }
+
+ public double getDouble() throws ValueFormatException, IllegalStateException, RepositoryException {
+ return 0;
+ }
+
+ public long getLong() throws ValueFormatException, IllegalStateException, RepositoryException {
+ return 0;
+ }
+
+ public InputStream getStream() throws IllegalStateException, RepositoryException {
+ return null;
+ }
+
+ public String getString() throws ValueFormatException, IllegalStateException, RepositoryException {
+ return value;
+ }
+
+ public int getType() {
+ return PropertyType.STRING;
+ }
+
+}
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockValue.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java?rev=615265&r1=615264&r2=615265&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java Fri Jan 25 08:47:26 2008
@@ -32,6 +32,7 @@
import org.apache.sling.api.resource.ResourceNotFoundException;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.jcr.JsonItemWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java?rev=615265&r1=615264&r2=615265&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java (original)
+++ incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java Fri Jan 25 08:47:26 2008
@@ -43,7 +43,7 @@
import org.apache.sling.api.resource.ResourceMetadata;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.servlet.resolver.helper.JsonItemWriter;
+import org.apache.sling.commons.json.jcr.JsonItemWriter;
/**
* The <code>DefaultServlet</code> is a very simple default resource handler.