This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.testing.sling-mock-1.1.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git
commit e72ad4b2b0cc40e8921070ea481417b84374dff4 Author: Stefan Seifert <[email protected]> AuthorDate: Tue Dec 9 13:09:54 2014 +0000 SLING-4229 add test cases for deep path access support in sling-mock as well git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/sling-mock@1644042 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 2 +- .../AbstractSlingCrudResourceResolverTest.java | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c3621a9..5e74b32 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId> - <version>1.0.0</version> + <version>1.0.1-SNAPSHOT</version> <scope>compile</scope> </dependency> diff --git a/src/test/java/org/apache/sling/testing/mock/sling/resource/AbstractSlingCrudResourceResolverTest.java b/src/test/java/org/apache/sling/testing/mock/sling/resource/AbstractSlingCrudResourceResolverTest.java index 20ed560..cf44b9e 100644 --- a/src/test/java/org/apache/sling/testing/mock/sling/resource/AbstractSlingCrudResourceResolverTest.java +++ b/src/test/java/org/apache/sling/testing/mock/sling/resource/AbstractSlingCrudResourceResolverTest.java @@ -45,6 +45,7 @@ import org.junit.Before; import org.junit.Test; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; /** * Implements simple write and read resource and values test. Sling CRUD API is @@ -90,7 +91,9 @@ public abstract class AbstractSlingCrudResourceResolverTest { props.put("binaryProp", new ByteArrayInputStream(BINARY_VALUE)); Resource node1 = this.resourceResolver.create(rootNode, "node1", props); - this.resourceResolver.create(node1, "node11", ValueMap.EMPTY); + resourceResolver.create(node1, "node11", ImmutableMap.<String, Object>builder() + .put("stringProp11", STRING_VALUE) + .build()); this.resourceResolver.create(node1, "node12", ValueMap.EMPTY); this.resourceResolver.commit(); @@ -136,6 +139,21 @@ public abstract class AbstractSlingCrudResourceResolverTest { } @Test + public void testSimpleProperties_DeepPathAccess() throws IOException { + Resource resource1 = resourceResolver.getResource(testRoot.getPath()); + assertNotNull(resource1); + assertEquals(testRoot.getName(), resource1.getName()); + + ValueMap props = ResourceUtil.getValueMap(resource1); + assertEquals(STRING_VALUE, props.get("node1/stringProp", String.class)); + assertArrayEquals(STRING_ARRAY_VALUE, props.get("node1/stringArrayProp", String[].class)); + assertEquals((Integer) INTEGER_VALUE, props.get("node1/integerProp", Integer.class)); + assertEquals(DOUBLE_VALUE, props.get("node1/doubleProp", Double.class), 0.0001); + assertEquals(BOOLEAN_VALUE, props.get("node1/booleanProp", Boolean.class)); + assertEquals(STRING_VALUE, props.get("node1/node11/stringProp11", String.class)); + } + + @Test public void testDateProperty() throws IOException { Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1"); ValueMap props = ResourceUtil.getValueMap(resource1); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
