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 09:58:47 UTC
[sling-org-apache-sling-resource-inventory] annotated tag
org.apache.sling.resource.inventory-1.0.6 created (now eea762a)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git.
at eea762a (tag)
tagging 86e1bc7198ebeea50205c2cf1a006e9200ce5ff4 (commit)
by Timothée Maret
on Thu Jan 26 10:27:55 2017 +0000
- Log -----------------------------------------------------------------
org.apache.sling.resource.inventory-1.0.6
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 12839ad SLING-3018 : Add an inventory printer which dumps a resource tree into json
new b692003 Set svn:ignore
new 6d2ad49 Add metatype info
new 0f3f228 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
new 09ea917 [maven-release-plugin] rollback the release of org.apache.sling.resource.inventory-0.5.0
new fa37b1f Correct scm info
new 773e549 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
new 8db6343 [maven-release-plugin] prepare for next development iteration
new 81b2fa4 SLING-3197 : ClassCastException when serializing arrays of scalar types
new a6fd992 SLING-3198 : JSON Tree Rendering should do tree depth first tree traversal
new ab62e38 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.0
new 564a3ec [maven-release-plugin] prepare for next development iteration
new 01bf0a8 SLING-3507 : Potential NPE in JSON dump from JMX
new 6428026 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.2
new b556e64 [maven-release-plugin] prepare for next development iteration
new 3529b23 SLING-4625 : No resource inventory if mbean attribute value is a double
new 365b839 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.4
new 4aef166 [maven-release-plugin] prepare for next development iteration
new 82c7ac1 Use latest parent pom
new e37e1d2 Update contrib modules to Parent 23
new 67d49cd set parent version to 24 and add empty relativePath where missing
new f839f3e Update the contrib reactor to parent 25
new 471306d Switch to parent pom 26
new a5151b7 Switch to parent pom 29 and OSGi annotations
new 3833d03 SLING-6468 - Improve code coverage for Sling Inventory Printer
new adf43b2 [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.6
new 86e1bc7 [maven-release-plugin] copy for tag org.apache.sling.resource.inventory-1.0.6
The 27 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-resource-inventory] 10/10:
[maven-release-plugin] copy for tag
org.apache.sling.resource.inventory-1.0.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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 86e1bc7198ebeea50205c2cf1a006e9200ce5ff4
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 26 10:27:55 2017 +0000
[maven-release-plugin] copy for tag org.apache.sling.resource.inventory-1.0.6
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6@1780353 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 02/10: Use latest
parent pom
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 82c7ac1f223544bd8e1d3db5476881648f1cde45
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 27 16:34:19 2015 +0000
Use latest parent pom
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1676331 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b9481a9..971fc6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>17</version>
+ <version>22</version>
</parent>
<groupId>org.apache.sling</groupId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 06/10: Switch to parent
pom 26
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 471306d2c181e01fcfa90d87be545ff2777e6896
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000
Switch to parent pom 26
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4b3590e..c942084 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>25</version>
+ <version>26</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 05/10: Update the
contrib reactor to parent 25
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit f839f3eb0efbc13b7d6ecd9ec8f579eeecfc9455
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:04:15 2015 +0000
Update the contrib reactor to parent 25
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1706781 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 94c12c4..4b3590e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>24</version>
+ <version>25</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 03/10: Update contrib
modules to Parent 23
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit e37e1d2412763cc59da9b4c9f5910a14f46acfa6
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:10:59 2015 +0000
Update contrib modules to Parent 23
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1687503 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 971fc6f..8e186a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>22</version>
+ <version>23</version>
</parent>
<groupId>org.apache.sling</groupId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 07/10: Switch to parent
pom 29 and OSGi annotations
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit a5151b745c7f1b2fda76b6575260a9f340f0813c
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Nov 15 14:50:11 2016 +0000
Switch to parent pom 29 and OSGi annotations
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1769844 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 12 +----
.../impl/ResourceInventoryPrinterFactory.java | 54 +++++++++++++---------
.../OSGI-INF/metatype/metatype.properties | 36 ---------------
3 files changed, 34 insertions(+), 68 deletions(-)
diff --git a/pom.xml b/pom.xml
index c942084..8e046fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>26</version>
+ <version>29</version>
<relativePath/>
</parent>
@@ -81,20 +81,12 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
index 77148ad..a3618e4 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -19,50 +19,60 @@
package org.apache.sling.resource.inventory.impl;
import java.io.PrintWriter;
-import java.util.Map;
import org.apache.felix.inventory.Format;
import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.LoginException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.commons.json.JSONException;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.slf4j.LoggerFactory;
-@Component(configurationFactory=true, policy=ConfigurationPolicy.REQUIRE, metatype=true)
-@Service(value=InventoryPrinter.class)
-@Properties({
- @Property(name=InventoryPrinter.FORMAT, value="JSON", propertyPrivate=true),
- @Property(name=InventoryPrinter.NAME),
- @Property(name=InventoryPrinter.TITLE),
- @Property(name=InventoryPrinter.WEBCONSOLE, boolValue=false, propertyPrivate=true)
-})
+@Component(service = InventoryPrinter.class,
+ configurationPolicy=ConfigurationPolicy.REQUIRE,
+ property = {
+ InventoryPrinter.FORMAT + "=JSON",
+ InventoryPrinter.WEBCONSOLE + ":Boolean=false"
+ })
+@Designate(ocd=ResourceInventoryPrinterFactory.Config.class, factory=true)
public class ResourceInventoryPrinterFactory implements InventoryPrinter {
- @Property(value = "")
- private static final String PROP_PATH = "path";
+ @ObjectClassDefinition(name = "Apache Sling Resource Inventory Printer Factory",
+ description = "This factory can be used to add " +
+ "resource trees to the inventory of the system.")
+ public @interface Config {
- private String path;
+ @AttributeDefinition(name="Name", description="The unique name of the inventory printer.")
+ String felix_inventory_printer_name();
- @Activate
- protected void activate(final Map<String, Object> props) {
- this.path = (String)props.get(PROP_PATH);
+ @AttributeDefinition(name="Title", description="The title of the inventory printer.")
+ String felix_inventory_printer_title();
+
+ @AttributeDefinition(name="Path", description="The resource path to include.")
+ String path() default "";
}
+ private String path;
@Reference
private ResourceResolverFactory factory;
+ @Activate
+ protected void activate(final Config config) {
+ this.path = config.path();
+ }
+
/**
* @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
*/
+ @Override
public void print(PrintWriter printWriter, Format format, boolean isZip) {
if ( this.path == null || !format.equals(Format.JSON) ) {
return;
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
deleted file mode 100644
index 7850046..0000000
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#
-# This file contains localization strings for configuration labels and
-# descriptions as used in the metatype.xml descriptor generated by the
-# the SCR plugin
-
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.name=Apache Sling Resource Inventory Printer Factory
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.desription=This factory can be used to add \
- resource trees to the inventory of the system.
-
-felix.inventory.printer.name.name=Name
-felix.inventory.printer.name.description=The unique name of the inventory printer.
-
-felix.inventory.printer.title.name=Title
-felix.inventory.printer.title.description=The title of the inventory printer.
-
-path.name=Path
-path.description=The resource path to include.
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 09/10:
[maven-release-plugin] prepare release
org.apache.sling.resource.inventory-1.0.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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit adf43b2bad6addb892007d20415e75b4a7adb4fa
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 26 10:27:41 2017 +0000
[maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.6
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1780352 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9cd4bb1..a68a64e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,20 +24,20 @@
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
<version>29</version>
- <relativePath/>
+ <relativePath />
</parent>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.resource.inventory</artifactId>
- <version>1.0.5-SNAPSHOT</version>
+ <version>1.0.6</version>
<packaging>bundle</packaging>
<name>Apache Sling Inventory Printer Based on Resources</name>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.6</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 08/10: SLING-6468 -
Improve code coverage for Sling Inventory Printer
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 3833d0311906bd981d9b49c08aa3c66e42394cf3
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Mon Jan 16 13:51:21 2017 +0000
SLING-6468 - Improve code coverage for Sling Inventory Printer
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1779030 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 19 +++
.../inventory/impl/JsonObjectCreatorTest.java | 131 +++++++++++++++++++++
.../inventory/impl/ResourceTraversorTest.java | 71 +++++++++++
3 files changed, 221 insertions(+)
diff --git a/pom.xml b/pom.xml
index 8e046fe..9cd4bb1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,5 +94,24 @@
<version>3.0</version>
<scope>provided</scope>
</dependency>
+ <!-- TESTING -->
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
+ <version>1.1.16</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
new file mode 100644
index 0000000..4b072b0
--- /dev/null
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.resource.inventory.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.json.JSONArray;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.testing.resourceresolver.MockHelper;
+import org.apache.sling.testing.resourceresolver.MockResource;
+import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonObjectCreatorTest {
+
+ private ResourceResolver resolver;
+
+ @Before
+ public void setup() throws LoginException {
+ resolver = new MockResourceResolverFactory()
+ .getAdministrativeResourceResolver(null);
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("byte", 0x0A);
+ properties.put("int", 10);
+ properties.put("long", 10L);
+ properties.put("float", 10.0f);
+ properties.put("double", 10.0d);
+ properties.put("string", "10");
+ properties.put("boolean", false);
+ properties.put("object", new Object(){
+ public String toString() {
+ return "object";
+ }
+ });
+ Resource resource = new MockResource("/some/path", properties, resolver);
+
+ JSONObject json = JsonObjectCreator.create(resource);
+
+ assertEquals(10, json.get("byte"));
+ assertEquals(10, json.get("int"));
+ assertEquals("10.0", json.get("float"));
+ assertEquals("10.0", json.get("double"));
+ assertEquals("10", json.get("string"));
+ assertEquals(false, json.get("boolean"));
+ assertEquals("object", json.get("object"));
+ }
+
+ @Test
+ public void testCreateArray() throws Exception {
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("emptyArray", new Object[]{});
+ properties.put("stringArray", new String[]{"10","100"});
+ properties.put("intArray", new int[]{10, 100});
+ properties.put("doubleArray", new double[]{10d, 100d});
+ properties.put("byteArray", new byte[]{0x0A, 0x64});
+ properties.put("floatArray", new float[]{10.0f, 100.0f});
+ properties.put("shortArray", new short[]{10, 100});
+ properties.put("longArray", new long[]{10, 100});
+ properties.put("booleanArray", new boolean[]{true, false});
+ properties.put("charArray", new char[]{'a', 'b'});
+ Resource resource = new MockResource("/some/path", properties, resolver);
+
+ JSONObject json = JsonObjectCreator.create(resource);
+ assertEquals(0, json.getJSONArray("emptyArray").length());
+ JSONArray array;
+ array = json.getJSONArray("stringArray");
+ assertEquals("10", array.get(0));
+ array = json.getJSONArray("intArray");
+ assertEquals(10, array.get(0));
+ array = json.getJSONArray("doubleArray");
+ assertEquals("10.0", array.get(0));
+ array = json.getJSONArray("byteArray");
+ assertEquals("10", array.get(0));
+ array = json.getJSONArray("floatArray");
+ assertEquals("10.0", array.get(0));
+ array = json.getJSONArray("shortArray");
+ assertEquals("10", array.get(0));
+ array = json.getJSONArray("longArray");
+ assertEquals(10L, array.get(0));
+ array = json.getJSONArray("booleanArray");
+ assertEquals(true, array.get(0));
+ array = json.getJSONArray("charArray");
+ assertEquals("a", array.get(0));
+
+ }
+
+ @Test
+ public void testCreateDeep() throws Exception {
+
+ MockHelper.create(resolver)
+ .resource("/some")
+ .p("p1", "v1")
+ .resource("/some/path")
+ .p("p2", "v2")
+ .commit();
+ Resource resource = resolver.getResource("/some");
+
+ JSONObject json = JsonObjectCreator.create(resource);
+ assertEquals("v1", json.get("p1"));
+ JSONObject path = json.getJSONObject("path");
+ assertEquals("v2", path.get("p2"));
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
new file mode 100644
index 0000000..4a6a767
--- /dev/null
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.resource.inventory.impl;
+
+import java.util.Collections;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.testing.resourceresolver.MockHelper;
+import org.apache.sling.testing.resourceresolver.MockResource;
+import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class ResourceTraversorTest {
+
+ private ResourceResolver resolver;
+
+ @Before
+ public void setup() throws LoginException {
+ resolver = new MockResourceResolverFactory()
+ .getAdministrativeResourceResolver(null);
+ }
+
+ @Test
+ public void testCollectResources() throws Exception {
+ MockHelper.create(resolver)
+ .resource("/some")
+ .p("p1", "v1")
+ .resource("/some/path")
+ .p("p2", "v2")
+ .commit();
+ Resource resource = resolver.getResource("/some");
+ ResourceTraversor traversor = new ResourceTraversor(resource);
+ traversor.collectResources();
+ JSONObject json = traversor.getJSONObject();
+ assertEquals("v1", json.get("p1"));
+ JSONObject path = json.getJSONObject("path");
+ assertNotNull(path);
+ assertEquals("v2", path.get("p2"));
+
+ }
+
+ @Test
+ public void testGetJSONObject() throws Exception {
+ Resource resource = new MockResource("/some/path", Collections.<String, Object>singletonMap("p1", "v1"), resolver);
+ JSONObject json = new ResourceTraversor(resource).getJSONObject();
+ assertEquals("v1", json.get("p1"));
+
+ }
+
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 04/10: set parent
version to 24 and add empty relativePath where missing
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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 67d49cdd2fdc2eef7e49f831f411d31acf2393b3
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 07:36:29 2015 +0000
set parent version to 24 and add empty relativePath where missing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1689588 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8e186a4..94c12c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,8 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>23</version>
+ <version>24</version>
+ <relativePath/>
</parent>
<groupId>org.apache.sling</groupId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-resource-inventory] 01/10:
[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.resource.inventory-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git
commit 4aef16656da12c45fd1c74ed5d463396fceef0cf
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 15 10:16:44 2015 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory@1673710 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index c452c40..b9481a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.resource.inventory</artifactId>
- <version>1.0.4</version>
+ <version>1.0.5-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Apache Sling Inventory Printer Based on Resources</name>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.4</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.