You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:25:07 UTC

[sling-org-apache-sling-testing-sling-mock] annotated tag org.apache.sling.testing.sling-mock-1.9.6 created (now 6bc0bb5)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to annotated tag org.apache.sling.testing.sling-mock-1.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git.


      at 6bc0bb5  (tag)
 tagging dd806bf7e7741bae37bb73398a6a337a24a793ae (commit)
      by Stefan Seifert
      on Mon Mar 27 15:24:11 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.testing.sling-mock-1.9.6
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 2aa4712  SLING-4042 Donate sling-mock, jcr-mock, osgi-mock implementation
     new d63d89c  svn:ignore
     new a6e7c1a  SLING-4042 move all mock projects to mocks/ subdirectory
     new d1f839a  SLING-4042 add missing package-info files
     new e9e968a  SLING-4042 per default no charencoding should be set in mock response
     new 43eb350  SLING-4042 do not forget to register ResourceResolverFactory in OSGi context as well
     new 3d36daf  SLING-4042 make sure JCR mock supports accessing data using multiple sessions
     new 4fc4baf  SLING-4042 add README files
     new 4aa90b9  add/update SCM urls
     new 22c8024  update to released versions
     new 1ba5459  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.0.0
     new 5dcb3d7  [maven-release-plugin] prepare for next development iteration
     new 5b0b3fe  update dependencies in release process to next snapshot version
     new 1f52235  SLING-4085 NPE when using SlingContext rule without constructor argument
     new 9442dd8  SLING-4086 SlingHttpServlerRequest should support getResourceBundle() methods
     new 2f5faf4  set to released version now available on maven central
     new 6964d49  SLING-4090 Define package versions for Sling Mock, JCR Mock, OSGi Mock
     new 448fe45  SLING-4108 JCR/Sling/ResourceResolver Mock: Support providing authentication info
     new 5b4c01c  fix some javadoc errors and warnings
     new cb5f237  SLING-4162 Introduce "OsgiContext" junit rule for OSGi and OsgiContextImpl
     new e72ad4b  SLING-4229 add test cases for deep path access support in sling-mock as well
     new a07abf8  SLING-4108 default to getAdministrativeResourceResolver in sling-mock to support jackrabbit resource resolver adapter as well
     new 3cbedc6  fix some javadoc errors/warnings
     new 47cc45e  update to released versions
     new fccd947  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.1.0
     new 4b72ed2  [maven-release-plugin] prepare for next development iteration
     new 85cdaa4  update to next snapshot version until releases available in maven central
     new 2de8a96  SLING-4266 - SlingContext always uses the default resourceResolverType
     new 0a167f6  SLING-4268 - ContentLoader should not try to import ACLs
     new 9ee66c6  SLING-4269 - SlingContextImpl's resource resolver should be an administrative one
     new 6f6321b  switch back to released versions for dependencies
     new a969262  SLING-4267 add some more property names to be ignored on import because they are managed by JCR internally
     new 62e7e2a  SLING-4267 support importing nt:resource noded in jackrabbit with empty binary data enable content loader unit tests in sling-mock-jackrabbit
     new 6569ce2  assertions can be activated now after updating to latest mock dependencies
     new b816e47  SLING-4267 support importing nt:resource nodes in jackrabbit with empty binary data
     new 32c3978  update dependencies to released versions
     new c05aeae  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.1.2
     new e57b7e1  [maven-release-plugin] prepare for next development iteration
     new d9fcb59  update to next development snapshot unit released artifacts are in maven central
     new c0e8f71  switch back to released versions now available in maven central
     new e8d2807  SLING-4362 make sure JCR namespaces are correctly registered in JCR mock on initialization through sling mock
     new 90ddb94  SLING-4376 ResourceResolver.resolve(null) should resolve to root resource
     new c49b0e1  SLING-4394 Sling Mock with JCR-based Resource Resolver: Support default search paths
     new 5e1c2d6  SLING-848 Support getting versioned resources by using uri path parameters
     new 4e72c06  Use the recent resourceresolver SNAPSHOT in sling-mock
     new eb9da99  SLING-848 revert updating sling api/resource resolver/jcr resource dependenciens - using sling mock in a project should not enforce using the latest version of those keep adding of getThreadResourceResolver() method, but throw UnsupportedOperationException
     new 2259bfe  SLING-4431 Sling Mocks: Remove Dependency on ResourceResolverInjector
     new 74de88f  cosmetic code formatting changes
     new 9e35c02  SLING-4434 refactor integration with sling models: remove MockModelAdapterFactory and directly integrate the original ModelAdapterFactory using the new osgi mock dynamic service reference feature
     new 71bbb5c  SLING-4437 MockJcrResourceResolverFactory should allow to register services dynamically
     new fc5346f  SLING-4433 use real AdapterManagerImpl implementation with support for ADAPTER_CLASSES/ADAPTABLE_CLASSES
     new a4d3ac9  SLING-4433 remove dependency to org.apache.sling.adapter and inline helper classes instead
     new 58f81ee  update to release versions
     new ac35a62  update package version
     new 29e7fda  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.2.0
     new f96f34a  [maven-release-plugin] prepare for next development iteration
     new 93110e5  remove service description and vendor for this mock service - makes problems with baseline check
     new f187b33  remove service description and vendor for this mock service - makes problems with baseline check
     new 1b68139  update to next development snapshot unit released artifacts are in maven central
     new 53be964  switch to released versions
     new 34954fa  SLING-4522 Sling Mocks: ContentLoader fails for UTF8 encoded json files on Windows Systems
     new 75d379a  Fix scr xml parsing when updating to new scr plugin by using fix for SLING-4670
     new b0f4a0a  SLING-4698 - Set parent.relativePath to empty for all modules
     new 28f1b00  SLING-4654 Support ResourceResolver.findResources with JCR_MOCK
     new 6728203  SLING-4721 sling-mock: Fully support ResourceResolverFactoryActivator for jcr-mock
     new 8a9b3c4  SLING-4729 Sling Mock: Add "NONE" resource resolver type
     new 5d2ffa2  SLING-4470 introduce separate "logging-mock" project for default log configuration in mock tests, remove compile-dependency on slf4j-simple
     new 192936d  update dependencies for release
     new ab204bb  update dependencies for release
     new 5482f51  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.3.0
     new 7baf341  [maven-release-plugin] prepare for next development iteration
     new 9a0fa2b  update to next development snapshot unit released artifacts are in maven central
     new bb58061  SLING-4605 - Add support for an Oak resource resolver type mock
     new 3601bfd  Mocks: use latest snapshots
     new b6207fb  SLING-4605 - Add support for an Oak resource resolver type mock
     new bac4c7f  update to released mock versions
     new 37c868a  SLING-4756 add support for filtering via felix.framework FilterImpl implementation
     new 546986a  SLING-4605 javadoc updates and add initializing for ContextResourceResolverFactory
     new 6e3e339  Minor wording fixes when the ResourceResolverTypeAdapter can't be found.
     new f4c6d5d  SLING-4775 - MockSlingSettingService shoud support getSlingId()
     new 7a57b01  SLING-4775 move the now supported method out of the "unsupported operations" block
     new e0cc675  SLING-4773 ensure sling namespace is always registered when using JCR_MOCK resource resolver adapter
     new d39a8a6  update to released versions
     new 54d3fe0  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.4.0
     new 8913f6c  [maven-release-plugin] prepare for next development iteration
     new 37fa126  update to latest development snapshots
     new df31839  Update to Sling Parent 23
     new e497760  Testing: remove superflous sling.java.version=6 as it's the default now
     new d8691fa  switch to released versions
     new a3f2ae9  set parent version to 24 and add empty relativePath where missing
     new 05758ef  SLING-4932, make compatible with o.a.s.jcr.resource 2.5 (requires also an upgrade to Sling API 2.9)
     new 169f6e0  SLING-4932 switch back to old api/jcr.resource versions and ensure compatibility by initiating PathMapper service by reflection if it exists
     new 9ab5f09  SLING-4938 exclude optional transitive dependencies of reflections
     new 347ce2a  SLING-4990 Support HttpSession invalidate, new, lastAccessedTime, maxInteractiveInterval
     new 602f4a9  SLING-4993 Support RequestParameter in MockSlingHttpServlerRequest
     new ec0efee  SLING-4994 Support InputStream, ContentLenght, ContentType and CharacterEncoding in Request
     new 489ae34  SLING-4998 ResponseBodySupport - use default charset if no response charset is set
     new 9832809  cosmetic: beautify error messages when setup/teardown fails
     new da53509  SLING-5002 - [sling-mock] Update dependency version of org.reflections
     new 3fafd8e  SLING-5003 Support request dispatcher in MockSlingHttpServletRequest
     new b4037bf  SLING-5002 switch back to 0.9.9 due to threading issues in 0.9.10 when running junit tests in parallel
     new e52575e  update other mocks to latest releases
     new 2a934a4  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.5.0
     new 8f19c45  [maven-release-plugin] prepare for next development iteration
     new d58abbe  switch to latest snapshot version until release is available in maven central
     new 07c6650  SLING-5007 add unit test to explicitly test root path child listing in sling-mock as well
     new d5ebb42  SLING-5007 realx unit test to test root path child listing in sling-mock-jackrabbit and sling-mock-jackrabbit and sling-mock-oak because in real repositories multiple root test nodes may be created in parallel, or nodes already exist
     new 8580a55  update release versions
     new 5846795  update to next snapshot version until releases are available in maven central
     new f960880  SLING-5007 use same unit tests for root node tests for all resource resolver types without counting the number of children.
     new 0ac864b  switch back to released version
     new add520f  SLING-5042 ResourceResolver.commit() does not call session.save() on the backing JCR Session
     new 8123868  SLING-5043 sling-mocks: Execute commit() after ContentLoader operations
     new c1ce2e6  SLING-5057 - Support HttpServletRequest#getRemoteUser
     new b10d3bb  SLING-5057 - Support HttpServletRequest#getRemoteUser
     new 53bfbe5  SLING-5064 sling-mock: Register JCR node types for OSGi bundles in class path
     new 853e02b  SLING-5064 sling-mock: Register JCR node types for OSGi bundles in class path
     new c7551b3  cosmetic: fix log message
     new 317bf58  SLING-5066 sling-mock: Close ResourceResolver on JUnit test tearDown
     new f008644  SLING-5064 sling-mock: Register JCR node types for OSGi bundles in class path
     new 8c79b81  SLING-5067 sling-mock: "uniqueRoot()" to simplify creation and cleanup of unique root paths in repository
     new b24a116  SLING-5067 rewrite unit tests to use new "uniqueRoot" feature
     new 3c296a7  SLING-5064 manual registration of node types no longer required; register namespaces and node types centrally depending on NodeTypeMode
     new d795bcc  SLING-5067 fix cleanup issue with "uniqueRoot" feature
     new d74181d  SLING-5086 sling-mock: Add SlingContext.registerAdapter convenience method
     new fd0b260  SLING-5086 sling-mock: Add SlingContext.registerAdapter convenience method
     new cf03565  cosmetic: eliminate some javadoc warnings
     new 5c7c77d  SLING-5088 update to latest osgi-mock to make sure all services are deactivated properly
     new 856784c  SLING-5088 refactor unit test to make sure resource resolver and bundle contexts are properly shutdown
     new b90bd44  SLING-5088 refactor resource resolver initialization
     new 81f87d0  SLING-5088 rewrite setup code for resource resolver factory
     new 1b9e8db  SLING-5088 deprecate all methods that may lead to thread leaks
     new 8801d99  SLING-5088 control SlingRepository resources via activate/deactivate methods; make sure all oak ExecutorServices are shutdown properly
     new c1525db  cosmetic: fix javadoc errors
     new 47f0035  SLING-5088 avoid registering ResourceResolverFactory twice
     new 21a5c64  SLING-5088 register default service user mapping for mock bundle
     new 2b7ac22  Update the main reactor to parent 25
     new 1089980  update dependency
     new 8949c00  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.6.0
     new 90239a1  [maven-release-plugin] prepare for next development iteration
     new 9f9253b  set dependencies to next snapshot version until released versions are available in maven central
     new 7ac242f  switch back to released versions of dependency
     new 1f318cf  SLING-5197 sling-mock: Do not override ResourceResolverFactoryActivator's default values
     new f7609c8  SLING-5197 sling-mock: Do not override ResourceResolverFactoryActivator's default values
     new d444456  update to latest osgi-mock version
     new dd7948a  SLING-5339 sling-mock: Support remote add, remote host and remote port in MockSlingHttpSevletRequest
     new a52790b  SLING-5392 sling-mock: Use javax.servlet-api dependency instead of mortbay version
     new 3234a24  Switch to parent pom 26
     new dfd873c  SLING-5428 Move MockSlingHttpServletRequest+Response to org.apache.sling.servlet-helpers
     new e7cd297  update mock dependencies to latest versions
     new 0186990  fix javadoc errors
     new 64a8b38  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.6.2
     new a56450f  [maven-release-plugin] prepare for next development iteration
     new 37d2b26  update to next snapshot dependency until released artifacts are available in maven central
     new e39da4c  update to released versions
     new 7335608  1.x maintenance branch
     new 0ac29f6  update branch url
     new 780dae1  SLING-5551 MockSlingHttpServletRequest: make sure given bundleContext is used
     new 1d3a77f  SLING-5552 ModelAdapterFactoryUtil: Suppress info log messages from Reflections library
     new 16788a7  SLING-5770 add support for custom resource resolver factory activator configuration via SlingContextBuilder add support for additional callbacks before setup and after teardown
     new 9c111ba  SLING-5770 update javadoc
     new 117debd  update dependencies to released versions
     new 124d98e  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.7.0
     new a58defe  [maven-release-plugin] prepare for next development iteration
     new 0aaa86f  SLING-5968 sling-mock: Update to latest servlet-helpers
     new 10aa538  SLING-6040 add ResourceBuilder support to SlingContext This closes #167
     new ceb4f5e  SLING-6049 sling-mock ContentBuilder: Support creating resources with object vararg parameter
     new 387c8ad  SLING-6049 use MapUtil from osgi-mock
     new 1f8f4b4  update dependencies
     new dfc0de6  revert: SLING-5968 sling-mock: Update to latest servlet-helpers update creates problesm with javadoc generated - and is not really required, users can choose dependency themselves
     new f4f63ae  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.8.0
     new fea50a3  [maven-release-plugin] prepare for next development iteration
     new a59a81f  update to latest jcr-mock
     new 641e366  update dependencies to latest snapshots until released versions are available in maven central
     new a22c110  switch back to released versions
     new fc94229  SLING-6077 enhance unit test to ensure the problem from this bug ticket does not exist in sling-mock 1.x
     new 7ed1e91  update to latest resourcebuilder snapshot
     new 502088e  SLING-6358 osgi-mock: OsgiContext.getServices should return correctly typed array when empty
     new 9125ce1  SLING-6359 osgi-mock, sling-mock: Make ContextCallback and ContextBuilder more flexible
     new 6e46477  SLING-6359 context plugin support
     new 3423b62  SLING-6359 context plugin support
     new 0efe53a  SLING-6363 Automatically register Sling Models from Classpath also: - add SlingContext.addModelsForClasses method - fix bug in addModelsForPackages that registered "sibling" packages with same prefix as well - make sure classpath scanning takes place only once for alle unit tests, not for each unit test which requests the same package - witch NodeTypeDefinitionScanner to osgi-mock ManifestScanner as well
     new 37ef0fe  SLING-6363 add methods for OSGi R5/R6 support
     new 984c0de  update to release version
     new db06b23  update osgi-mock dependency
     new 328bd46  fix javadoc errors
     new 6781b1e  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.0
     new beaf105  [maven-release-plugin] prepare for next development iteration
     new cf16a1c  update to next snapshot version until releases are available on maven central
     new b04e7ff  cosmetic: fix javadoc typos
     new 06a073b  update to osgi-mock,sling-mock release versions
     new bb0aa98  update to latest jcr-mock snapshot
     new 86dbe21  SLING-6387 Allow to control autocommit mode for ContentLoader (patch provided by Dirk Rudolph, with modifications)
     new 5281ef4  update to release version
     new 972e86a  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.2
     new 56f2be6  [maven-release-plugin] prepare for next development iteration
     new e2c7719  update to next snapshot version until releases are available on maven central
     new dbc37fd  switch to released versions
     new 0888b2f  SLING-6410 sling-mock: Add support für scripting BindingsValuesProvidersByContext
     new 43ce44e  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.4
     new cd0d03c  [maven-release-plugin] prepare for next development iteration
     new 4ba9db5  update unit tests to test BigDecimal conversion (related to SLING-6416)
     new 970f0bb  update to latest resourceresolver-mock version
     new a06b401  set to released version
     new 51ac9a3  update to latest osgi-mock version
     new cc5c406  SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files
     new 59d96ff  SLING-6595 update to latest API
     new d4e6719  SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files
     new 1504230  switch to MockOsgi.setConfigForPid
     new 29ca6a1  SLING-6595 switch to latest contentparser API
     new 2033a72  update dependencies
     new 93b82f1  add test to make sure "NONE" resource resolver type works
     new fd9d531  [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.6
     new dd806bf  [maven-release-plugin] copy for tag org.apache.sling.testing.sling-mock-1.9.6

The 214 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-testing-sling-mock] 11/14: update dependencies

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 2033a72fd926c6b1f4ac9d62a7966b0834bc0ef7
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Mar 23 15:13:02 2017 +0000

    update dependencies
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1788264 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 39602ab..0a56364 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
-            <version>1.9.3-SNAPSHOT</version>
+            <version>1.9.4</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -125,7 +125,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.contentparser</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 04/14: set to released version

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit a06b401a21105d0e63114314c152bfbbea19bca1
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Dec 27 13:18:00 2016 +0000

    set to released version
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1776125 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d397207..dd7aaab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
-            <version>1.1.15-SNAPSHOT</version>
+            <version>1.1.16</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 06/14: SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit cc5c406e8e2eb1316e059172ad1b21d783db0048
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Mar 2 17:29:40 2017 +0000

    SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1785168 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   4 +-
 .../testing/mock/sling/loader/ContentLoader.java   | 178 +++------------------
 2 files changed, 27 insertions(+), 155 deletions(-)

diff --git a/pom.xml b/pom.xml
index ea725d6..3e3752c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,8 +124,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.json</artifactId>
-            <version>2.0.6</version>
+            <artifactId>org.apache.sling.fscontentparser</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
index 63fbadb..c38684c 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
@@ -21,17 +21,10 @@ package org.apache.sling.testing.mock.sling.loader;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.CharEncoding;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.sling.api.resource.ModifiableValueMap;
@@ -39,11 +32,12 @@ import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceUtil;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
-import org.apache.sling.commons.json.jcr.JsonItemWriter;
 import org.apache.sling.commons.mime.MimeTypeService;
+import org.apache.sling.fscontentparser.ContentFileExtension;
+import org.apache.sling.fscontentparser.ContentFileParser;
+import org.apache.sling.fscontentparser.ContentFileParserFactory;
+import org.apache.sling.fscontentparser.ParseException;
+import org.apache.sling.fscontentparser.ParserOptions;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
@@ -56,13 +50,10 @@ import com.google.common.collect.ImmutableSet;
  */
 public final class ContentLoader {
 
-    private static final String REFERENCE = "jcr:reference:";
-    private static final String PATH = "jcr:path:";
     private static final String CONTENTTYPE_OCTET_STREAM = "application/octet-stream";
     private static final String JCR_DATA_PLACEHOLDER = ":jcr:data";
 
     private static final Set<String> IGNORED_NAMES = ImmutableSet.of(
-            JcrConstants.JCR_PRIMARYTYPE,
             JcrConstants.JCR_MIXINTYPES,
             JcrConstants.JCR_UUID,
             JcrConstants.JCR_BASEVERSION,
@@ -73,10 +64,14 @@ public final class ContentLoader {
             "jcr:checkedOut",
             "jcr:isCheckedOut",
             "rep:policy");
+    
+    private static ContentFileParser JSON_PARSER = ContentFileParserFactory.create(ContentFileExtension.JSON, new ParserOptions()
+            .detectCalendarValues(true)
+            .ignorePropertyNames(IGNORED_NAMES)
+            .ignoreResourceNames(IGNORED_NAMES));
 
     private final ResourceResolver resourceResolver;
     private final BundleContext bundleContext;
-    private final DateFormat calendarFormat;
     private final boolean autoCommit;
 
     /**
@@ -102,7 +97,6 @@ public final class ContentLoader {
     public ContentLoader(ResourceResolver resourceResolver, BundleContext bundleContext, boolean autoCommit) {
         this.resourceResolver = resourceResolver;
         this.bundleContext = bundleContext;
-        this.calendarFormat = new SimpleDateFormat(JsonItemWriter.ECMA_DATE_FORMAT, JsonItemWriter.DATE_FORMAT_LOCALE);
         this.autoCommit = autoCommit;
     }
 
@@ -183,14 +177,13 @@ public final class ContentLoader {
                 throw new IllegalArgumentException("Resource does already exist: " + destPath);
             }
 
-            String jsonString = convertToJsonString(inputStream).trim();
-            JSONObject json = new JSONObject(jsonString);
-            Resource resource = this.createResource(parentResource, childName, json);
+            Map<String,Object> content = JSON_PARSER.parse(inputStream);
+            Resource resource = this.createResource(parentResource, childName, content);
             if (autoCommit) {
                 resourceResolver.commit();
             }
             return resource;
-        } catch (JSONException ex) {
+        } catch (ParseException ex) {
             throw new RuntimeException(ex);
         } catch (IOException ex) {
             throw new RuntimeException(ex);
@@ -215,37 +208,22 @@ public final class ContentLoader {
         }
     }
 
-    private Resource createResource(Resource parentResource, String childName, JSONObject jsonObject)
-            throws IOException, JSONException {
-
+    @SuppressWarnings("unchecked")
+    private Resource createResource(Resource parentResource, String childName, Map<String,Object> content) throws IOException {
+        
         // collect all properties first
         boolean hasJcrData = false;
         Map<String, Object> props = new HashMap<String, Object>();
-        JSONArray names = jsonObject.names();
-        for (int i = 0; names != null && i < names.length(); i++) {
-            final String name = names.getString(i);
+        for (Map.Entry<String,Object> entry : content.entrySet()) {
+            final String name = entry.getKey();
             if (StringUtils.equals(name, JCR_DATA_PLACEHOLDER)) {
                 hasJcrData = true;
             }
-            else if (!IGNORED_NAMES.contains(name)) {
-                Object obj = jsonObject.get(name);
-                if (!(obj instanceof JSONObject)) {
-                    this.setProperty(props, name, obj);
-                }
+            else if (!(entry.getValue() instanceof Map)) {
+                props.put(name, entry.getValue());
             }
         }
-
-        // validate JCR primary type
-        Object primaryTypeObj = jsonObject.opt(JcrConstants.JCR_PRIMARYTYPE);
-        String primaryType = null;
-        if (primaryTypeObj != null) {
-            primaryType = String.valueOf(primaryTypeObj);
-        }
-        if (primaryType == null) {
-            primaryType = JcrConstants.NT_UNSTRUCTURED;
-        }
-        props.put(JcrConstants.JCR_PRIMARYTYPE, primaryType);
-
+        
         // create resource
         Resource resource = resourceResolver.create(parentResource, childName, props);
         
@@ -256,121 +234,15 @@ public final class ContentLoader {
         }
 
         // add child resources
-        for (int i = 0; names != null && i < names.length(); i++) {
-            final String name = names.getString(i);
-            if (!IGNORED_NAMES.contains(name)) {
-                Object obj = jsonObject.get(name);
-                if (obj instanceof JSONObject) {
-                    createResource(resource, name, (JSONObject) obj);
-                }
+        for (Map.Entry<String,Object> entry : content.entrySet()) {
+            if (entry.getValue() instanceof Map) {
+                createResource(resource, entry.getKey(), (Map<String,Object>)entry.getValue());
             }
         }
 
         return resource;
     }
 
-    private void setProperty(Map<String, Object> props, String name, Object value) throws JSONException {
-        if (value instanceof JSONArray) {
-            // multivalue
-            final JSONArray array = (JSONArray) value;
-            if (array.length() > 0) {
-                final Object[] values = new Object[array.length()];
-                for (int i = 0; i < array.length(); i++) {
-                    values[i] = array.get(i);
-                }
-
-                if (values[0] instanceof Double || values[0] instanceof Float) {
-                    Double[] arrayValues = new Double[values.length];
-                    for (int i = 0; i < values.length; i++) {
-                        arrayValues[i] = (Double) values[i];
-                    }
-                    props.put(cleanupJsonName(name), arrayValues);
-                } else if (values[0] instanceof Number) {
-                    Long[] arrayValues = new Long[values.length];
-                    for (int i = 0; i < values.length; i++) {
-                        arrayValues[i] = ((Number) values[i]).longValue();
-                    }
-                    props.put(cleanupJsonName(name), arrayValues);
-                } else if (values[0] instanceof Boolean) {
-                    Boolean[] arrayValues = new Boolean[values.length];
-                    for (int i = 0; i < values.length; i++) {
-                        arrayValues[i] = (Boolean) values[i];
-                    }
-                    props.put(cleanupJsonName(name), arrayValues);
-                } else {
-                    String[] arrayValues = new String[values.length];
-                    for (int i = 0; i < values.length; i++) {
-                        arrayValues[i] = values[i].toString();
-                    }
-                    props.put(cleanupJsonName(name), arrayValues);
-                }
-            } else {
-                props.put(cleanupJsonName(name), new String[0]);
-            }
-
-        } else {
-            // single value
-            if (value instanceof Double || value instanceof Float) {
-                props.put(cleanupJsonName(name), value);
-            } else if (value instanceof Number) {
-                props.put(cleanupJsonName(name), ((Number) value).longValue());
-            } else if (value instanceof Boolean) {
-                props.put(cleanupJsonName(name), value);
-            } else {
-                String stringValue = value.toString();
-
-                // check if value is a Calendar object
-                Calendar calendar = tryParseCalendarValue(stringValue);
-                if (calendar != null) {
-                    props.put(cleanupJsonName(name), calendar);
-                } else {
-                    props.put(cleanupJsonName(name), stringValue);
-                }
-
-            }
-        }
-    }
-
-    private String cleanupJsonName(String name) {
-        if (name.startsWith(REFERENCE)) {
-            return name.substring(REFERENCE.length());
-        }
-        if (name.startsWith(PATH)) {
-            return name.substring(PATH.length());
-        }
-        return name;
-    }
-
-    private String convertToJsonString(InputStream inputStream) {
-        try {
-            return IOUtils.toString(inputStream, CharEncoding.UTF_8);
-        } catch (IOException ex) {
-            throw new RuntimeException(ex);
-        } finally {
-            try {
-                inputStream.close();
-            } catch (IOException ex) {
-                // ignore
-            }
-        }
-    }
-
-    private Calendar tryParseCalendarValue(String value) {
-        if (StringUtils.isNotBlank(value)) {
-            synchronized (calendarFormat) {
-                try {
-                    Date date = calendarFormat.parse(value);
-                    Calendar calendar = Calendar.getInstance();
-                    calendar.setTime(date);
-                    return calendar;
-                } catch (ParseException ex) {
-                    // ignore
-                }
-            }
-        }
-        return null;
-    }
-
     /**
      * Import binary file as nt:file binary node into repository. Auto-creates
      * parent hierarchies as nt:unstrucured nodes if missing. Mime type is
@@ -622,7 +494,7 @@ public final class ContentLoader {
         if (bundleContext != null && StringUtils.isNotEmpty(fileExtension)) {
             ServiceReference ref = bundleContext.getServiceReference(MimeTypeService.class.getName());
             if (ref != null) {
-                MimeTypeService mimeTypeService = (MimeTypeService) bundleContext.getService(ref);
+                MimeTypeService mimeTypeService = (MimeTypeService)bundleContext.getService(ref);
                 mimeType = mimeTypeService.getMimeType(fileExtension);
             }
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 10/14: SLING-6595 switch to latest contentparser API

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 29ca6a10c06dee280a9d60a916f2834fbb539436
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Mar 17 22:28:32 2017 +0000

    SLING-6595 switch to latest contentparser API
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1787514 13f79535-47bb-0310-9956-ffa450edef68
---
 .../testing/mock/sling/loader/ContentLoader.java   | 44 +---------
 .../mock/sling/loader/LoaderContentHandler.java    | 94 ++++++++++++++++++++++
 2 files changed, 97 insertions(+), 41 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
index ac6de5c..d21d49d 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.testing.mock.sling.loader;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
@@ -27,7 +26,6 @@ import java.util.Set;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
@@ -51,7 +49,6 @@ import com.google.common.collect.ImmutableSet;
 public final class ContentLoader {
 
     private static final String CONTENTTYPE_OCTET_STREAM = "application/octet-stream";
-    private static final String JCR_DATA_PLACEHOLDER = ":jcr:data";
 
     private static final Set<String> IGNORED_NAMES = ImmutableSet.of(
             JcrConstants.JCR_MIXINTYPES,
@@ -177,12 +174,12 @@ public final class ContentLoader {
                 throw new IllegalArgumentException("Resource does already exist: " + destPath);
             }
 
-            Map<String,Object> content = JSON_PARSER.parse(inputStream);
-            Resource resource = this.createResource(parentResource, childName, content);
+            LoaderContentHandler contentHandler = new LoaderContentHandler(destPath, resourceResolver);
+            JSON_PARSER.parse(contentHandler, inputStream);
             if (autoCommit) {
                 resourceResolver.commit();
             }
-            return resource;
+            return resourceResolver.getResource(destPath);
         } catch (ParseException ex) {
             throw new RuntimeException(ex);
         } catch (IOException ex) {
@@ -208,41 +205,6 @@ public final class ContentLoader {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private Resource createResource(Resource parentResource, String childName, Map<String,Object> content) throws IOException {
-        
-        // collect all properties first
-        boolean hasJcrData = false;
-        Map<String, Object> props = new HashMap<String, Object>();
-        for (Map.Entry<String,Object> entry : content.entrySet()) {
-            final String name = entry.getKey();
-            if (StringUtils.equals(name, JCR_DATA_PLACEHOLDER)) {
-                hasJcrData = true;
-            }
-            else if (!(entry.getValue() instanceof Map)) {
-                props.put(name, entry.getValue());
-            }
-        }
-        
-        // create resource
-        Resource resource = resourceResolver.create(parentResource, childName, props);
-        
-        if (hasJcrData) {
-            ModifiableValueMap valueMap = resource.adaptTo(ModifiableValueMap.class);
-            // we cannot import binary data here - but to avoid complaints by JCR we create it with empty binary data
-            valueMap.put(JcrConstants.JCR_DATA, new ByteArrayInputStream(new byte[0]));
-        }
-
-        // add child resources
-        for (Map.Entry<String,Object> entry : content.entrySet()) {
-            if (entry.getValue() instanceof Map) {
-                createResource(resource, entry.getKey(), (Map<String,Object>)entry.getValue());
-            }
-        }
-
-        return resource;
-    }
-
     /**
      * Import binary file as nt:file binary node into repository. Auto-creates
      * parent hierarchies as nt:unstrucured nodes if missing. Mime type is
diff --git a/src/main/java/org/apache/sling/testing/mock/sling/loader/LoaderContentHandler.java b/src/main/java/org/apache/sling/testing/mock/sling/loader/LoaderContentHandler.java
new file mode 100644
index 0000000..9077cd4
--- /dev/null
+++ b/src/main/java/org/apache/sling/testing/mock/sling/loader/LoaderContentHandler.java
@@ -0,0 +1,94 @@
+/*
+ * 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.testing.mock.sling.loader;
+
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.sling.api.resource.ModifiableValueMap;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.jcr.contentparser.ContentHandler;
+
+final class LoaderContentHandler implements ContentHandler {
+
+    private static final String JCR_DATA_PLACEHOLDER = ":jcr:data";
+    
+    private final String rootPath;
+    private final ResourceResolver resourceResolver;
+    
+    public LoaderContentHandler(String rootPath, ResourceResolver resourceResolver) {
+        this.rootPath = rootPath;
+        this.resourceResolver = resourceResolver;
+    }
+
+    @Override
+    public void resource(String path, Map<String, Object> properties) {
+        String fullPath = rootPath;
+        if (!StringUtils.equals(path, "/")) {
+            fullPath += path;
+        }
+        String parentPath = ResourceUtil.getParent(fullPath);
+        String name = ResourceUtil.getName(fullPath);
+        
+        Resource parentResource = resourceResolver.getResource(parentPath);
+        if (parentResource == null) {
+            throw new RuntimeException("Parent resource '" + parentPath + "' not found.");
+        }
+        try {
+            createResource(parentResource, name, properties);
+        } 
+        catch (PersistenceException ex) {
+            throw new RuntimeException("Unable to create resource at '" + fullPath + "'.", ex);
+        }
+    }
+
+    private Resource createResource(Resource parentResource, String childName, Map<String,Object> content) throws PersistenceException {
+        
+        // collect all properties first
+        boolean hasJcrData = false;
+        Map<String, Object> props = new HashMap<String, Object>();
+        for (Map.Entry<String,Object> entry : content.entrySet()) {
+            final String name = entry.getKey();
+            if (StringUtils.equals(name, JCR_DATA_PLACEHOLDER)) {
+                hasJcrData = true;
+            }
+            else {
+                props.put(name, entry.getValue());
+            }
+        }
+        
+        // create resource
+        Resource resource = resourceResolver.create(parentResource, childName, props);
+        
+        if (hasJcrData) {
+            ModifiableValueMap valueMap = resource.adaptTo(ModifiableValueMap.class);
+            // we cannot import binary data here - but to avoid complaints by JCR we create it with empty binary data
+            valueMap.put(JcrConstants.JCR_DATA, new ByteArrayInputStream(new byte[0]));
+        }
+
+        return resource;
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 12/14: add test to make sure "NONE" resource resolver type works

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 93b82f1279f69b737559ad0676685efb33f9fe92
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 27 15:03:42 2017 +0000

    add test to make sure "NONE" resource resolver type works
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1788942 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/context/NoResourceResolverTypeTest.java  | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/src/test/java/org/apache/sling/testing/mock/sling/context/NoResourceResolverTypeTest.java b/src/test/java/org/apache/sling/testing/mock/sling/context/NoResourceResolverTypeTest.java
new file mode 100644
index 0000000..23369ea
--- /dev/null
+++ b/src/test/java/org/apache/sling/testing/mock/sling/context/NoResourceResolverTypeTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.testing.mock.sling.context;
+
+import static org.junit.Assert.assertNull;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.testing.mock.sling.ResourceResolverType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class NoResourceResolverTypeTest {
+
+    @Rule
+    public SlingContext context = new SlingContext(ResourceResolverType.NONE);
+    
+    @Test
+    public void testRoot() {
+        Resource root = context.resourceResolver().getResource("/");
+        assertNull(root);
+    }
+    
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 03/14: update to latest resourceresolver-mock version

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 970f0bbec05b62d518a7b26dbcf1f40c95a27019
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Dec 21 14:22:08 2016 +0000

    update to latest resourceresolver-mock version
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1775434 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                            | 2 +-
 .../mock/sling/resource/AbstractSlingCrudResourceResolverTest.java | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 703455a..d397207 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
-            <version>1.1.14</version>
+            <version>1.1.15-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <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 f548eb2..a98c26e 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
@@ -144,11 +144,8 @@ public abstract class AbstractSlingCrudResourceResolverTest {
         Resource resource1 = context.resourceResolver().getResource(getTestRootResource().getPath() + "/node1");
         ValueMap props = ResourceUtil.getValueMap(resource1);
 
-        // TODO: enable this test when resourceresolver-mock implementation supports BigDecimal conversion (SLING-6416)
-        if (getResourceResolverType() != ResourceResolverType.RESOURCERESOLVER_MOCK) {
-            assertEquals(new BigDecimal(DOUBLE_VALUE).doubleValue(), props.get("doubleProp", BigDecimal.class).doubleValue(), 0.0001d);
-            assertEquals(BIGDECIMAL_VALUE.doubleValue() , props.get("bigDecimalProp", Double.class), 0.0001d);
-        }
+        assertEquals(new BigDecimal(DOUBLE_VALUE).doubleValue(), props.get("doubleProp", BigDecimal.class).doubleValue(), 0.0001d);
+        assertEquals(BIGDECIMAL_VALUE.doubleValue() , props.get("bigDecimalProp", Double.class), 0.0001d);
     }
 
     @Test

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 05/14: update to latest osgi-mock version

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 51ac9a384866c7811aefb37bdda2639d52f300e2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Mar 1 17:30:28 2017 +0000

    update to latest osgi-mock version
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1785006 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)

diff --git a/pom.xml b/pom.xml
index dd7aaab..ea725d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
-            <version>1.9.2</version>
+            <version>1.9.3-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -183,36 +183,6 @@
             <version>1.8.3</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.reflections</groupId>
-            <artifactId>reflections</artifactId>
-            <!-- Do not use version 0.9.10, it created threading issues when running junit tests in parallel (see SLING-5002) -->
-            <version>0.9.9</version>
-            <scope>compile</scope>
-            <!-- exclude all optional dependencies -->
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>dom4j</groupId>
-                    <artifactId>dom4j</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.google.code.gson</groupId>
-                    <artifactId>gson</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>servlet-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-simple</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
     
         <dependency>
             <groupId>javax.servlet</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 13/14: [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.6

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit fd9d5319f4d7f4e3ba76c21b6d61f46160ddeafd
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 27 15:23:57 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.testing.sling-mock-1.9.6
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1788949 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0a56364..95c47ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-    <version>1.9.5-SNAPSHOT</version>
+    <version>1.9.6</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Testing Sling Mock</name>
     <description>Mock implementation of selected Sling APIs.</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/branches/testing/mocks/sling-mock-1.x</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.sling-mock-1.9.6</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.sling-mock-1.9.6</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.testing.sling-mock-1.9.6</url>
     </scm>
 
     <dependencies>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 02/14: update unit tests to test BigDecimal conversion (related to SLING-6416)

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 4ba9db5c0abe250ef1e8b19ab208176ac0e95a21
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Dec 19 11:52:49 2016 +0000

    update unit tests to test BigDecimal conversion (related to SLING-6416)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1775067 13f79535-47bb-0310-9956-ffa450edef68
---
 .../AbstractSlingCrudResourceResolverTest.java     | 40 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 6 deletions(-)

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 e9f4dbd..f548eb2 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
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
@@ -63,7 +64,9 @@ public abstract class AbstractSlingCrudResourceResolverTest {
     private static final String STRING_VALUE = "value1";
     private static final String[] STRING_ARRAY_VALUE = new String[] { "value1", "value2" };
     private static final int INTEGER_VALUE = 25;
+    private static final long LONG_VALUE = 250L;
     private static final double DOUBLE_VALUE = 3.555d;
+    private static final BigDecimal BIGDECIMAL_VALUE = new BigDecimal("12345.678");
     private static final boolean BOOLEAN_VALUE = true;
     private static final Date DATE_VALUE = new Date(10000);
     private static final Calendar CALENDAR_VALUE = Calendar.getInstance();
@@ -83,7 +86,9 @@ public abstract class AbstractSlingCrudResourceResolverTest {
         props.put("stringProp", STRING_VALUE);
         props.put("stringArrayProp", STRING_ARRAY_VALUE);
         props.put("integerProp", INTEGER_VALUE);
+        props.put("longProp", LONG_VALUE);
         props.put("doubleProp", DOUBLE_VALUE);
+        props.put("bigDecimalProp", BIGDECIMAL_VALUE);
         props.put("booleanProp", BOOLEAN_VALUE);
         props.put("dateProp", DATE_VALUE);
         props.put("calendarProp", CALENDAR_VALUE);
@@ -118,12 +123,35 @@ public abstract class AbstractSlingCrudResourceResolverTest {
         ValueMap props = ResourceUtil.getValueMap(resource1);
         assertEquals(STRING_VALUE, props.get("stringProp", String.class));
         assertArrayEquals(STRING_ARRAY_VALUE, props.get("stringArrayProp", String[].class));
-        assertEquals((Integer) INTEGER_VALUE, props.get("integerProp", Integer.class));
+        assertEquals((Integer)INTEGER_VALUE, props.get("integerProp", Integer.class));
+        assertEquals((Long)LONG_VALUE, props.get("longProp", Long.class));
         assertEquals(DOUBLE_VALUE, props.get("doubleProp", Double.class), 0.0001);
+        assertEquals(BIGDECIMAL_VALUE, props.get("bigDecimalProp", BigDecimal.class));
         assertEquals(BOOLEAN_VALUE, props.get("booleanProp", Boolean.class));
     }
 
     @Test
+    public void testSimpleProperties_IntegerLongConversion() throws IOException {
+        Resource resource1 = context.resourceResolver().getResource(getTestRootResource().getPath() + "/node1");
+        ValueMap props = ResourceUtil.getValueMap(resource1);
+
+        assertEquals((Integer)(int)LONG_VALUE, props.get("longProp", Integer.class));
+        assertEquals((Long)(long)INTEGER_VALUE, props.get("integerProp", Long.class));
+    }
+
+    @Test
+    public void testSimpleProperties_DecimalConversion() throws IOException {
+        Resource resource1 = context.resourceResolver().getResource(getTestRootResource().getPath() + "/node1");
+        ValueMap props = ResourceUtil.getValueMap(resource1);
+
+        // TODO: enable this test when resourceresolver-mock implementation supports BigDecimal conversion (SLING-6416)
+        if (getResourceResolverType() != ResourceResolverType.RESOURCERESOLVER_MOCK) {
+            assertEquals(new BigDecimal(DOUBLE_VALUE).doubleValue(), props.get("doubleProp", BigDecimal.class).doubleValue(), 0.0001d);
+            assertEquals(BIGDECIMAL_VALUE.doubleValue() , props.get("bigDecimalProp", Double.class), 0.0001d);
+        }
+    }
+
+    @Test
     public void testSimpleProperties_DeepPathAccess() throws IOException {
         Resource resource1 = context.resourceResolver().getResource(testRoot.getPath());
         assertNotNull(resource1);
@@ -132,8 +160,10 @@ public abstract class AbstractSlingCrudResourceResolverTest {
         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((Integer)INTEGER_VALUE, props.get("node1/integerProp", Integer.class));
+        assertEquals((Long)LONG_VALUE, props.get("node1/longProp", Long.class));
         assertEquals(DOUBLE_VALUE, props.get("node1/doubleProp", Double.class), 0.0001);
+        assertEquals(BIGDECIMAL_VALUE, props.get("node1/bigDecimalProp", BigDecimal.class));
         assertEquals(BOOLEAN_VALUE, props.get("node1/booleanProp", Boolean.class));
         assertEquals(STRING_VALUE, props.get("node1/node11/stringProp11", String.class));
     }
@@ -142,8 +172,7 @@ public abstract class AbstractSlingCrudResourceResolverTest {
     public void testDateProperty() throws IOException {
         Resource resource1 = context.resourceResolver().getResource(getTestRootResource().getPath() + "/node1");
         ValueMap props = ResourceUtil.getValueMap(resource1);
-        // TODO: enable this test when JCR resource implementation supports
-        // writing Date objects (SLING-3846)
+        // TODO: enable this test when JCR resource implementation supports writing Date objects (SLING-3846)
         if (getResourceResolverType() != ResourceResolverType.JCR_MOCK
                 && getResourceResolverType() != ResourceResolverType.JCR_JACKRABBIT 
                 && getResourceResolverType() != ResourceResolverType.JCR_OAK ) {
@@ -155,8 +184,7 @@ public abstract class AbstractSlingCrudResourceResolverTest {
     public void testDatePropertyToCalendar() throws IOException {
         Resource resource1 = context.resourceResolver().getResource(getTestRootResource().getPath() + "/node1");
         ValueMap props = ResourceUtil.getValueMap(resource1);
-        // TODO: enable this test when JCR resource implementation supports
-        // writing Date objects (SLING-3846)
+        // TODO: enable this test when JCR resource implementation supports writing Date objects (SLING-3846)
         if (getResourceResolverType() != ResourceResolverType.JCR_MOCK
                 && getResourceResolverType() != ResourceResolverType.JCR_JACKRABBIT
                 && getResourceResolverType() != ResourceResolverType.JCR_OAK ) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 07/14: SLING-6595 update to latest API

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 59d96ff86f93722d1ec98eb382ab846cee339edd
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Mar 2 21:58:55 2017 +0000

    SLING-6595 update to latest API
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1785202 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                               | 2 +-
 .../org/apache/sling/testing/mock/sling/loader/ContentLoader.java     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3e3752c..8da83f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,7 +124,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.fscontentparser</artifactId>
+            <artifactId>org.apache.sling.commons.fscontentparser</artifactId>
             <version>1.0.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
diff --git a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
index c38684c..78afecd 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
@@ -33,9 +33,9 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.commons.mime.MimeTypeService;
-import org.apache.sling.fscontentparser.ContentFileExtension;
 import org.apache.sling.fscontentparser.ContentFileParser;
 import org.apache.sling.fscontentparser.ContentFileParserFactory;
+import org.apache.sling.fscontentparser.ContentFileType;
 import org.apache.sling.fscontentparser.ParseException;
 import org.apache.sling.fscontentparser.ParserOptions;
 import org.osgi.framework.BundleContext;
@@ -65,7 +65,7 @@ public final class ContentLoader {
             "jcr:isCheckedOut",
             "rep:policy");
     
-    private static ContentFileParser JSON_PARSER = ContentFileParserFactory.create(ContentFileExtension.JSON, new ParserOptions()
+    private static ContentFileParser JSON_PARSER = ContentFileParserFactory.create(ContentFileType.JSON, new ParserOptions()
             .detectCalendarValues(true)
             .ignorePropertyNames(IGNORED_NAMES)
             .ignoreResourceNames(IGNORED_NAMES));

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 08/14: SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit d4e67191e89048eb71f3a7019c420a4a06d03c46
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Mar 14 10:42:46 2017 +0000

    SLING-6595 sling-mock: Use File System Content Parser for parsing JSON files
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1786871 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                      |  2 +-
 .../sling/testing/mock/sling/loader/ContentLoader.java       | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8da83f2..39602ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,7 +124,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.fscontentparser</artifactId>
+            <artifactId>org.apache.sling.jcr.contentparser</artifactId>
             <version>1.0.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
diff --git a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
index 78afecd..ac6de5c 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java
@@ -33,11 +33,11 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.commons.mime.MimeTypeService;
-import org.apache.sling.fscontentparser.ContentFileParser;
-import org.apache.sling.fscontentparser.ContentFileParserFactory;
-import org.apache.sling.fscontentparser.ContentFileType;
-import org.apache.sling.fscontentparser.ParseException;
-import org.apache.sling.fscontentparser.ParserOptions;
+import org.apache.sling.jcr.contentparser.ContentParser;
+import org.apache.sling.jcr.contentparser.ContentParserFactory;
+import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.ParseException;
+import org.apache.sling.jcr.contentparser.ParserOptions;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
@@ -65,7 +65,7 @@ public final class ContentLoader {
             "jcr:isCheckedOut",
             "rep:policy");
     
-    private static ContentFileParser JSON_PARSER = ContentFileParserFactory.create(ContentFileType.JSON, new ParserOptions()
+    private static ContentParser JSON_PARSER = ContentParserFactory.create(ContentType.JSON, new ParserOptions()
             .detectCalendarValues(true)
             .ignorePropertyNames(IGNORED_NAMES)
             .ignoreResourceNames(IGNORED_NAMES));

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 01/14: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit cd0d03c94cc885828bb9f078fe90813b3a311078
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Dec 19 08:50:53 2016 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1775017 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index b745b95..703455a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-    <version>1.9.4</version>
+    <version>1.9.5-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Testing Sling Mock</name>
     <description>Mock implementation of selected Sling APIs.</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.sling-mock-1.9.4</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.sling-mock-1.9.4</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.testing.sling-mock-1.9.4</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/branches/testing/mocks/sling-mock-1.x</url>
     </scm>
 
     <dependencies>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 09/14: switch to MockOsgi.setConfigForPid

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 1504230190ec49e8f36f1af3c39168222cdee03c
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Mar 14 22:12:20 2017 +0000

    switch to MockOsgi.setConfigForPid
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/testing/mocks/sling-mock-1.x@1786961 13f79535-47bb-0310-9956-ffa450edef68
---
 .../mock/sling/context/SlingContextImpl.java       | 28 ++--------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java b/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
index fcda623..3c3a25c 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
@@ -18,9 +18,6 @@
  */
 package org.apache.sling.testing.mock.sling.context;
 
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Set;
 
@@ -52,6 +49,7 @@ import org.apache.sling.resourcebuilder.impl.ResourceBuilderFactoryService;
 import org.apache.sling.scripting.core.impl.BindingsValuesProvidersByContextImpl;
 import org.apache.sling.scripting.core.impl.ScriptEngineManagerFactory;
 import org.apache.sling.settings.SlingSettingsService;
+import org.apache.sling.testing.mock.osgi.MockOsgi;
 import org.apache.sling.testing.mock.osgi.context.OsgiContextImpl;
 import org.apache.sling.testing.mock.sling.MockSling;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
@@ -63,10 +61,6 @@ import org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo;
 import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
 import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletResponse;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableMap;
@@ -87,8 +81,6 @@ public class SlingContextImpl extends OsgiContextImpl {
 
     private static final String RESOURCERESOLVERFACTORYACTIVATOR_PID = "org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl";
     
-    private static final Logger log = LoggerFactory.getLogger(SlingContextImpl.class);
-    
     protected ResourceResolverFactory resourceResolverFactory;
     protected ResourceResolverType resourceResolverType;
     protected ResourceResolver resourceResolver;
@@ -123,23 +115,7 @@ public class SlingContextImpl extends OsgiContextImpl {
         
         if (this.resourceResolverFactoryActivatorProps != null) {
             // use OSGi ConfigurationAdmin to pass over customized configuration to Resource Resolver Factory Activator service
-            ConfigurationAdmin configAdmin = getService(ConfigurationAdmin.class);
-            if (configAdmin == null) {
-              log.warn("ConfigAdmin not found in osgi-mock context - please make sure osgi-mock 1.7.0 or higher is used.");
-            }
-            else {
-              try {
-                Configuration resourceResolverFactoryActivatorConfig = configAdmin.getConfiguration(RESOURCERESOLVERFACTORYACTIVATOR_PID);
-                Dictionary<String, Object> props = new Hashtable<String, Object>();
-                for (Map.Entry<String, Object> item : this.resourceResolverFactoryActivatorProps.entrySet()) {
-                    props.put(item.getKey(), item.getValue());
-                }
-                resourceResolverFactoryActivatorConfig.update(props);
-              }
-              catch (IOException ex) {
-                throw new RuntimeException(ex);
-              }
-            }
+            MockOsgi.setConfigForPid(bundleContext(), RESOURCERESOLVERFACTORYACTIVATOR_PID, this.resourceResolverFactoryActivatorProps);
         }
         
         this.resourceResolverFactory = newResourceResolverFactory();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-testing-sling-mock] 14/14: [maven-release-plugin] copy for tag org.apache.sling.testing.sling-mock-1.9.6

Posted by ro...@apache.org.
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.9.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit dd806bf7e7741bae37bb73398a6a337a24a793ae
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 27 15:24:11 2017 +0000

    [maven-release-plugin] copy for tag org.apache.sling.testing.sling-mock-1.9.6
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.sling-mock-1.9.6@1788950 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.