You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2014/10/11 15:49:56 UTC

svn commit: r1631044 - in /sling/trunk/testing/resourceresolver-mock: pom.xml src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java

Author: sseifert
Date: Sat Oct 11 13:49:56 2014
New Revision: 1631044

URL: http://svn.apache.org/r1631044
Log:
SLING-4033 fix InputStream problem with API versions <= 2.6.0
add maven profiles to run unit tests against different API versions

Modified:
    sling/trunk/testing/resourceresolver-mock/pom.xml
    sling/trunk/testing/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java

Modified: sling/trunk/testing/resourceresolver-mock/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/testing/resourceresolver-mock/pom.xml?rev=1631044&r1=1631043&r2=1631044&view=diff
==============================================================================
--- sling/trunk/testing/resourceresolver-mock/pom.xml (original)
+++ sling/trunk/testing/resourceresolver-mock/pom.xml Sat Oct 11 13:49:56 2014
@@ -62,9 +62,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <!-- TODO: resarch why unit tests fail on InputStream tests with Sling API < 2.7.0 -->
-            <!--version>2.4.0</version-->
-            <version>2.7.0</version>
+            <version>2.4.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -96,4 +94,52 @@
         </dependency>
     </dependencies>
     
+    <!-- Profiles to run unit tests against different Sling API versions -->
+    <profiles>
+        <profile>
+            <id>api-2.5</id>
+            <dependencies>
+            <dependency>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>org.apache.sling.api</artifactId>
+                <version>2.5.0</version>
+                <scope>provided</scope>
+            </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>api-2.6</id>
+            <dependencies>
+            <dependency>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>org.apache.sling.api</artifactId>
+                <version>2.6.0</version>
+                <scope>provided</scope>
+            </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>api-2.7</id>
+            <dependencies>
+            <dependency>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>org.apache.sling.api</artifactId>
+                <version>2.7.0</version>
+                <scope>provided</scope>
+            </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>api-2.8</id>
+            <dependencies>
+            <dependency>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>org.apache.sling.api</artifactId>
+                <version>2.8.0</version>
+                <scope>provided</scope>
+            </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+    
 </project>

Modified: sling/trunk/testing/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java?rev=1631044&r1=1631043&r2=1631044&view=diff
==============================================================================
--- sling/trunk/testing/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java (original)
+++ sling/trunk/testing/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResource.java Sat Oct 11 13:49:56 2014
@@ -29,7 +29,6 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ModifiableValueMapDecorator;
-import org.apache.sling.api.wrappers.ValueMapDecorator;
 
 public class MockResource extends AbstractResource {
 
@@ -89,7 +88,7 @@ public class MockResource extends Abstra
     @Override
     public <AdapterType> AdapterType adaptTo(final Class<AdapterType> type) {
         if ( type == ValueMap.class ) {
-            return (AdapterType)new ValueMapDecorator(this.props);
+            return (AdapterType)this.props;
         }
         else if ( type == ModifiableValueMap.class ) {
             ((MockResourceResolver)this.resolver).addChanged(this.path, this.props);