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:16:53 UTC
[sling-maven-launchpad-plugin] annotated tag
maven-launchpad-plugin-2.3.0 created (now 8cdfdb0)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git.
at 8cdfdb0 (tag)
tagging ed6243271183a64e08592e9c1cbe1821ddaf9449 (commit)
by Carsten Ziegeler
on Mon Mar 3 07:30:30 2014 +0000
- Log -----------------------------------------------------------------
maven-launchpad-plugin-2.3.0
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 96dc6d5 Introducing the maven-launchpad-plugin and builder (fka uber) project described in SLING-1197
new ff6a77c SLING-1310 - Changing artifactId of launchpad.builder to launchpad
new 1f5bd24 SLING-1322 - adding check to avoid loading launchpad artifact if it's the same as the current project's
new 347e5fb SLING-1322 - removing extraneous project variable
new b8899de SLING-1323 - adding "bundlesToRemove" option
new 5682b2d Unifying bundle addition / removal code (re: SLING-1321)
new bb29c9b SLING-1351 Fixed, added the Start levels in when there are none defined.
new 8ffdfb1 SLING-1364 - creating prepare-test-webapp mojo
new d2e7962 SLING-1351 When the xpp parser loads a Bundle it only sets the attributes specified on the bundle, and takes no account of any containers, hence on merge the container start level must be inspected to determine where a bundle should be merged. If not specified (ie 0) it should be merged in the containing bundle. This means that its not going to be possible to specify a bundle as loading in start level 0 by setting the level on the bundle. To load in start level 0 you mus [...]
new 8c0ec78 SLING-1441 - adding run goal to launchpad plugin
new b3f5ef2 SLING-1454 - adding ability to read filtered sling properties from a file
new df85fd6 SLING-1442 - adding start and stop goals to launchpad plugin
new 74b72b9 exposing controlHost configuration parameter in launchpad plugin
new 99ee468 fix formatting of pom file
new 9768cfb SLING-1442 - shouldn't be killing the JVM on a "stop" command.
new dd65aa8 SLING-1491 - switching from pax web to felix httpservice
new eb5e840 updating to released launchpad base
new 2183492 reformatting pom
new cc7a04f [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.6
new d69b5db [maven-release-plugin] prepare for next development iteration
new 2e9d194 using next snapshot until release vote is finished
new e75b100 Update some notice files
new 2551177 Use released version of launchpad base
new 917e990 Use released parent pom.
new c6c90d7 SLING-1586 - adding overwrite version on merge code
new 99e00dc SLING-1591 - upgrading to latest base artifacts
new c52ad9c SLING-1692 - replacing dummy code for updated() method.
new 2945145 SLING-1693 - adding xml as a resource provider provided extension
new 42035b5 changing classname and adding missing license header
new 119f700 SLING-1693 - implemeting a search path for resources
new b508767 SLING-1743 / SLING-845 - setting slingHome to default to ${basedir}/sling. No longer need the antrun execution as a result
new ea8d50e SLING-1799 - adding output-bundle-list mojo
new d05a0b4 tabs -> spaces
new f300177 SLING-1795 - adding Drools-based rules for rewriting bundle list. Includes sample rule which can be activated by running "mvn -P test-reactor-sling-bundles clean install" from the root project.
new cbb45d4 updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
new 25154c3 adding jboss repository (for drools dependencies)
new 793fe22 trivial improvement in error handling
new 85a3ca6 SLING-1803 - adding emma report. runs with -P emma
new 3106d97 SLING-1843 - adding launchpad:display-bundle-updates goal
new c31bbfa Update to recent snapshots
new bad22bd prepping maven-launchpad-plugin for release
new 63eaf6e [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.8
new 9fd2bdb [maven-release-plugin] prepare for next development iteration
new 61f3f68 SLING-1597 - adding config installation via launchpad
new c0518da removing LICENSE and NOTICE files for future releases
new ede6563 SLING-1980 - fixing by adding some code as described by Benjamin on maven-users
new f33d169 updating pom pre-release
new 64e03a1 [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.10
new 6cec043 [maven-release-plugin] prepare for next development iteration
new c80a1cc using snapshots during vote
new d8dc15d Temporarily upgrade to 1.0.1-SNAPSHOT of the launchpad API to not fail builds
new 8c84089 SLING-1988 - removing errant files
new 2cddbb6 removing empty dir
new b751260 SLING-2105 - initial implementation of partial bundle lists
new f23f3d6 Code cleanup - remove unused stuff.
new d8c44e2 Code cleanup - remove unused stuff.
new 67eb316 SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app bundles
new 79e6e41 SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app bundles
new 2d6b5a8 SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app bundles
new cb3b66f SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app bundles
new 0a616ce SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app bundles
new 2fc71ae Remove unused code
new d72004a SLING-2134 : Provide a way to add additional properties to sling.properties
new 5039e0f SLING-2135 : Copying of resources should respect default includes
new 13dad4c SLING-2134 : Provide a way to add additional properties to sling.properties
new 98a09a7 SLING-2150 : Update plugins to use the latest available versions
new a0121dc Update to recent snapshot
new 893c07a Update to recent snapshot
new 917e094 Using latest released parent pom
new ba156ae SLING-2182 : Provide a way to specify additional bootstrap commands
new 934711b SLING-2182 : Provide a way to specify additional bootstrap commands
new 97dac9a SLING-2183 : Bundle configurations and sling files with bundlelist
new 0f6d05c Using released versions
new dff0438 SLING-2134 : Provide a way to add additional properties to sling.properties SLING-2182 : Provide a way to specify additional bootstrap commands
new f1a9178 SLING-2182 : Provide a way to specify additional bootstrap commands
new a35a90d SLING-2187 - adding new module to contain our custom notice file; adding remote-resources plugin configuration to parent pom and removing all existing appended-resources NOTICE files
new 179cc9b temporarily using snapshots during release vote
new 02a8aea SLING-2207 : Support different properties and bootstrap commands for standalone and webapp
new 44145b7 SLING-2207 : Support different properties and bootstrap commands for standalone and webapp
new 3b2fc20 Prepare for release
new 3325362 [maven-release-plugin] prepare release maven-launchpad-plugin-2.1.0
new f02592e [maven-release-plugin] prepare for next development iteration
new 4b57990 Use latest snapshot after release
new d32ced5 using latest releases
new 1a827c3 SLING-2212 : When merging bundle lists, the highest version should win
new bc03898 SLING-2238 - doing property interpolation on bundle list
new 6a0e12a SLING-2241 - AbstractLaunchpadStartingMojo uses protected fields from parent class
new b497a89 SLING-2194 - generating bundle list content from a project's dependencies; refactoring testing projects to use this feature.
new c2c4f2f SLING-2263 - validating partial bundle lists during their lifecycle
new 52fb200 trivial formatting and field name change
new eb65f0b SLING-2264 - add option to set includeDefaultBundles on command line
new 69e8764 SLING-2265 - adding maven-dependency-plugin style option includeDepenencies
new e0008c4 SLING-2273 - implementing a LifecycleParticipant which adds bundle list contents as dependencies
new 5d54df5 SLING-2292 - dependencies added by LaunchpadPluginLifecycleParticipant should be of scope provided
new c3a7120 SLING-2310 : Attach bundle list goal should also add configuration artifact
new 52f90be SLING-2203 : Allow for better configuration of sling home folder
new 5deee11 SLING-2331 : Values in partial bundle list should be interpolated Maven style
new bce914d SLING-2332 : Partial bundle list should be attachable to any maven project
new 210d0d4 SLING-2194 : generate a partial bundle list from a project's dependencies SLING-2265 : maven-launchpad-plugin should support a syntax similar to the maven-dependency-plugin
new 92b1ba9 SLING-2263 - no longer need to validate bundle lists as SLING-2273 handles that now.
new 802751b removing unused code
new bb6cf72 SLING-2194 - fail the build if a bundle list isn't available as this is now the only way to define a partial bundle list.
new 023486f SLING-2386 : It should be possible to remove bundles from an inherited partial bundle list. Apply patch from Timo Naroska
new 5099e0e SLING-2434 - upgrding to Drools 2.3.1.Final as that's in Maven Central
new 29f1677 SLING-2480 : Add config for maven-sling-plugin to m2e configuration
new 54d5e7f Update to latest parent pom
new d3b3dde Use released versions
new 2165db9 Use released version instead of older snapshot
new 069d580 [maven-release-plugin] prepare release maven-launchpad-plugin-2.1.2
new 2f1d9ed [maven-release-plugin] prepare for next development iteration
new bf9822b SLING-2589 : Project Configurations are overwritten by inherited
new 2bdd3ee SLING-2590 : Provide a way to exclude configurations from partial bundle lists
new 8285db3 SLING-2591 : Provide a way to exclude sling properties from partial bundle lists
new 42036ef SLING-2620 - creating target directories if they don't exist already
new 1bbcc8a SLING.2649 : Add support for run modes
new 064f394 SLING-2649 : Add support for run modes
new a428611 SLING-2662 : Enhance run mode handling
new 60ffbf5 [maven-release-plugin] prepare release maven-launchpad-plugin-2.2.0
new b59b346 [maven-release-plugin] prepare for next development iteration
new 054e38e SLING-1245 - adding pax-runner support. Thansk to Alex Collignon for the patch
new 953a31b Use latest releases and update to new parent pom
new f804b57 Update to latest parent pom and use latest releases in launchpad
new b032906 SLING-2843 : Launchpad plugin should check if configuration directory exists
new 92f0c29 Correct reactor pom and update to parent pom 16
new 7d69536 Update to latest parent pom
new 3858698 SLING-2978 - Create tooling top-level directory and move maven and ide under it
new 2ee4634 SLING-3011 - Bind the launchpad:prepare-package goal to the prepare-package lifecycle phase
new 463b114 Update to parent pom 18
new c8cd514 SLING-3142 : NullPointerException with Java8 in AbstractUsingBundleList
new d09a8f0 SLING-3205 - factor out BundleListContentProvider to make it easier to test, and add tests. No functional changes so far
new 4468f80 SLING-3205 - refactor if statement into more readable methods
new cc427a9 SLING-3205 - provide bundle resources under resources/install to support run modes
new 7458cb6 SLING-3205 - avoid confusing warning on config files
new cd47d73 SLING-3401 Support multiple bundles for the jarWebSupport
new 7b899ed SLING-3401 : Support multiple bundles for jarWebSupport Add support for reading multiple bundles when directly reading the maven xml (lifecycle participant) and add support to define several bundles in the dependencies.properties file
new ad4d1ff SLING-3401 : Support multiple bundles for jarWebSupport Implement toString and provide a way to get the contained artifact definitions
new 9b9ec72 SLING-3401 : Support multiple bundles for jarWebSupport Fix init method
new 3db5aaf SLING-3416 - Some tests in o.a.s.m.projectsupport.BundleListContentProviderTest fails on windows
new 848dfc0 [maven-release-plugin] prepare release maven-launchpad-plugin-2.3.0
new ed62432 [maven-release-plugin] copy for tag maven-launchpad-plugin-2.3.0
The 140 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-maven-launchpad-plugin] 22/22: [maven-release-plugin] copy
for tag maven-launchpad-plugin-2.3.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit ed6243271183a64e08592e9c1cbe1821ddaf9449
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 3 07:30:30 2014 +0000
[maven-release-plugin] copy for tag maven-launchpad-plugin-2.3.0
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.3.0@1573467 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 03/22: Use latest releases and
update to new 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 maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 953a31bceba6f295c7e7a04360199e521c440347
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Dec 23 06:53:35 2012 +0000
Use latest releases and update to new parent pom
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1425425 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 97a5388..123d041 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>13</version>
+ <version>14</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 02/22: SLING-1245 - adding
pax-runner support. Thansk to Alex Collignon for the patch
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 054e38eb75ec79d0969fda995bf6392c7cf8561f
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Nov 21 16:23:52 2012 +0000
SLING-1245 - adding pax-runner support. Thansk to Alex Collignon for the patch
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1412174 13f79535-47bb-0310-9956-ffa450edef68
---
.../CreatePaxRunnerBundleProvisionFileMojo.java | 77 ++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java
new file mode 100644
index 0000000..9e98997
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java
@@ -0,0 +1,77 @@
+/*
+ * 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.maven.projectsupport;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+
+/**
+ * Create and attach a Pax Runner bundle provision file.
+ *
+ * @goal create-paxrunner-provision-file
+ * @phase package
+ * @description create a Pax Runner bundle provision file
+ * @requiresDependencyResolution test
+ */
+public class CreatePaxRunnerBundleProvisionFileMojo extends AbstractUsingBundleListMojo {
+
+ private static final String CLASSIFIER = "bundles";
+
+ private static final String TYPE = "pax";
+
+ /**
+ * The output directory.
+ *
+ * @parameter default-value="${project.build.directory}/bundles-pax"
+ */
+ private File outputFile;
+
+ @Override
+ protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ FileWriter out = null;
+ try {
+ out = new FileWriter(outputFile);
+
+ BundleList bundleList = getInitializedBundleList();
+ for (StartLevel level : bundleList.getStartLevels()) {
+ for (Bundle bundle : level.getBundles()) {
+ String line = String.format("mvn:%s/%s/%s@%d\n", bundle.getGroupId(), bundle.getArtifactId(),
+ bundle.getVersion(), level.getStartLevel());
+ out.write(line);
+ }
+ }
+
+ projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to write " + outputFile.getName(), e);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 08/22: SLING-2978 - Create tooling
top-level directory and move maven and ide under it
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 38586987ee867c11523d04c261c3bd246aed00b3
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Wed Jul 24 18:13:22 2013 +0000
SLING-2978 - Create tooling top-level directory and move maven and ide
under it
* moved the maven directory under tooling maven
* adjusted module paths in pom.xml
* updated the scm information in the pom.xml files
* updated the scm information in the README.txt files
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1506645 13f79535-47bb-0310-9956-ffa450edef68
---
README.txt | 2 +-
pom.xml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.txt b/README.txt
index ddcf41e..0df89ae 100644
--- a/README.txt
+++ b/README.txt
@@ -21,7 +21,7 @@ Subversion (http://subversion.tigris.org/) source repository of
the Apache Software Foundation. If you have Subversion installed,
you can checkout the latest source using the following command:
- svn checkout http://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin
+ svn checkout http://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin
See the Subversion documentation for other source control features.
diff --git a/pom.xml b/pom.xml
index 1d1e2eb..3c8a4b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,9 +31,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-launchpad-plugin</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 16/22: SLING-3401 Support multiple
bundles for the jarWebSupport
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit cd47d734ccc4f9b28e6ed5c53730a5877393a373
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Feb 20 11:47:18 2014 +0000
SLING-3401 Support multiple bundles for the jarWebSupport
The solution is to extend the ArtifactDefinition to internally support
a collection of ArtifactDefinitions named "bundles".
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1570154 13f79535-47bb-0310-9956-ffa450edef68
---
.../AbstractLaunchpadStartingMojo.java | 2 +-
.../AbstractUsingBundleListMojo.java | 4 +-
.../maven/projectsupport/ArtifactDefinition.java | 113 +++++++++++++--------
.../LaunchpadPluginLifecycleParticipant.java | 28 ++---
.../maven/projectsupport/PreparePackageMojo.java | 2 +-
.../projectsupport/bundlelist/BaseBundleList.java | 21 ++--
6 files changed, 103 insertions(+), 67 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 3c5e22b..636a470 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -234,6 +234,6 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL
*/
@Override
protected void initBundleList(BundleList bundleList) {
- bundleList.add(jarWebSupport.toBundle());
+ bundleList.add(jarWebSupport.toBundleList());
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
index 146a134..ac6a0ba 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
@@ -255,7 +255,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
// add additional bundles
if (additionalBundles != null) {
for (ArtifactDefinition def : additionalBundles) {
- initializedBundleList.add(def.toBundle());
+ initializedBundleList.add(def.toBundleList());
}
}
@@ -273,7 +273,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
// handle exclusions
if (bundleExclusions != null) {
for (ArtifactDefinition def : bundleExclusions) {
- initializedBundleList.remove(def.toBundle(), false);
+ initializedBundleList.remove(def.toBundleList(), false);
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index 2183c2e..10285dc 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -18,6 +18,9 @@ package org.apache.sling.maven.projectsupport;
import static org.apache.sling.maven.projectsupport.BundleListUtils.nodeValue;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.maven.model.Dependency;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
import org.codehaus.plexus.util.StringUtils;
@@ -49,6 +52,8 @@ public class ArtifactDefinition {
/** The artifact run modes */
private String runModes;
+ private ArtifactDefinition[] bundles;
+
public ArtifactDefinition() {
}
@@ -176,54 +181,80 @@ public class ArtifactDefinition {
*/
public void initDefaults(String groupId, String artifactId, String version,
String type, String classifier, int startLevel) {
- if (this.groupId == null && StringUtils.isNotEmpty(groupId)) {
- this.groupId = groupId;
- }
- if (this.artifactId == null && StringUtils.isNotEmpty(artifactId)) {
- this.artifactId = artifactId;
- }
- if (this.version == null && StringUtils.isNotEmpty(version)) {
- this.version = version;
- }
- if (this.type == null && StringUtils.isNotEmpty(groupId)) {
- this.type = type;
- }
- if (this.classifier == null && StringUtils.isNotEmpty(classifier)) {
- this.classifier = classifier;
- }
- if (this.startLevel == 0) {
- this.startLevel = startLevel;
+ if (this.bundles == null) {
+ if (this.groupId == null && StringUtils.isNotEmpty(groupId)) {
+ this.groupId = groupId;
+ }
+ if (this.artifactId == null && StringUtils.isNotEmpty(artifactId)) {
+ this.artifactId = artifactId;
+ }
+ if (this.version == null && StringUtils.isNotEmpty(version)) {
+ this.version = version;
+ }
+ if (this.type == null && StringUtils.isNotEmpty(groupId)) {
+ this.type = type;
+ }
+ if (this.classifier == null && StringUtils.isNotEmpty(classifier)) {
+ this.classifier = classifier;
+ }
+ if (this.startLevel == 0) {
+ this.startLevel = startLevel;
+ }
+ } else {
+ for (ArtifactDefinition bundle : this.bundles) {
+ bundle.initDefaults(groupId, artifactId, version, type, classifier, startLevel);
+ }
}
}
- public Bundle toBundle() {
- Bundle bnd = new Bundle();
- bnd.setArtifactId(artifactId);
- bnd.setGroupId(groupId);
- bnd.setVersion(version);
- if (type != null) {
- bnd.setType(type);
+ public List<Bundle> toBundleList() {
+ ArrayList<Bundle> bundleList = new ArrayList<Bundle>();
+
+ if (bundles == null) {
+ Bundle bnd = new Bundle();
+ bnd.setArtifactId(artifactId);
+ bnd.setGroupId(groupId);
+ bnd.setVersion(version);
+ if (type != null) {
+ bnd.setType(type);
+ }
+ bnd.setClassifier(classifier);
+ bnd.setStartLevel(startLevel);
+ bundleList.add(bnd);
+ } else {
+ for (ArtifactDefinition bundle : bundles) {
+ bundleList.addAll(bundle.toBundleList());
+ }
}
- bnd.setClassifier(classifier);
- bnd.setStartLevel(startLevel);
- return bnd;
- }
-
- public Dependency toDependency(String scope) {
- Dependency dep = new Dependency();
- dep.setArtifactId(artifactId);
- dep.setGroupId(groupId);
- dep.setVersion(version);
- if (type != null) {
- dep.setType(type);
+
+ return bundleList;
+ }
+
+ public List<Dependency> toDependencyList(String scope) {
+ ArrayList<Dependency> depList = new ArrayList<Dependency>();
+
+ if (bundles == null) {
+ Dependency dep = new Dependency();
+ dep.setArtifactId(artifactId);
+ dep.setGroupId(groupId);
+ dep.setVersion(version);
+ if (type != null) {
+ dep.setType(type);
+ }
+ dep.setClassifier(classifier);
+ dep.setScope(scope);
+ depList.add(dep);
+ } else {
+ for (ArtifactDefinition bundle : bundles) {
+ depList.addAll(bundle.toDependencyList(scope));
+ }
}
- dep.setClassifier(classifier);
- dep.setScope(scope);
- return dep;
+
+ return depList;
}
- public static Dependency toDependency(Bundle bundle, String scope) {
- return new ArtifactDefinition(bundle, 0).toDependency(scope);
+ public static List<Dependency> toDependencyList(Bundle bundle, String scope) {
+ return new ArtifactDefinition(bundle, 0).toDependencyList(scope);
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/LaunchpadPluginLifecycleParticipant.java b/src/main/java/org/apache/sling/maven/projectsupport/LaunchpadPluginLifecycleParticipant.java
index 57dd147..b7dc8d1 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/LaunchpadPluginLifecycleParticipant.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/LaunchpadPluginLifecycleParticipant.java
@@ -5,9 +5,9 @@
* 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
@@ -50,7 +50,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
public class LaunchpadPluginLifecycleParticipant extends AbstractMavenLifecycleParticipant {
private static final String PLUGIN_ID = "maven-launchpad-plugin";
-
+
private static final String PROVIDED = "provided";
@Requirement
@@ -100,43 +100,43 @@ public class LaunchpadPluginLifecycleParticipant extends AbstractMavenLifecycleP
void addDependencies() throws Exception {
readConfiguration();
-
+
addBundleListDependencies();
if (hasPreparePackageExecution()) {
if (includeDefaultBundles && !isCurrentArtifact(project, defaultBundleList)) {
log.debug(String.format("adding default bundle list (%s) to dependencies of project %s", defaultBundleList, project));
- project.getDependencies().add(defaultBundleList.toDependency(PROVIDED));
+ project.getDependencies().addAll(defaultBundleList.toDependencyList(PROVIDED));
}
if (hasJarPackagingExecution()) {
log.debug(String.format("adding jar web support (%s) to dependencies of project %s", jarWebSupport, project));
- project.getDependencies().add(jarWebSupport.toDependency(PROVIDED));
+ project.getDependencies().addAll(jarWebSupport.toDependencyList(PROVIDED));
}
}
}
private void addBundleListDependencies() throws IOException, XmlPullParserException, MojoExecutionException {
BundleList bundleList;
-
+
if (bundleListFile.exists()) {
bundleList = readBundleList(bundleListFile);
} else {
bundleList = new BundleList();
}
-
+
if (additionalBundles != null) {
for (ArtifactDefinition def : additionalBundles) {
- bundleList.add(def.toBundle());
+ bundleList.add(def.toBundleList());
}
}
-
+
interpolateProperties(bundleList, project, session);
-
+
for (StartLevel startLevel : bundleList.getStartLevels()) {
for (Bundle bundle : startLevel.getBundles()) {
log.debug(String.format("adding bundle (%s) from bundle list to dependencies of project %s", bundle, project));
- project.getDependencies().add(ArtifactDefinition.toDependency(bundle, PROVIDED));
+ project.getDependencies().addAll(ArtifactDefinition.toDependencyList(bundle, PROVIDED));
}
}
}
@@ -161,10 +161,10 @@ public class LaunchpadPluginLifecycleParticipant extends AbstractMavenLifecycleP
if (bundleListFileConfig != null) {
bundleListFile = new File(project.getBasedir(), bundleListFileConfig.getValue());
}
-
+
configureAdditionalBundles(configuration);
}
-
+
for (PluginExecution execution : plugin.getExecutions()) {
Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
if (executionConfiguration != null) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 521472d..e5c3612 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -136,7 +136,7 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
@Override
protected void initBundleList(BundleList bundleList) {
if (packaging.equals(JAR)) {
- bundleList.add(jarWebSupport.toBundle());
+ bundleList.add(jarWebSupport.toBundleList());
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
index 1c7bc56..230aa49 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
@@ -39,16 +39,19 @@ public abstract class BaseBundleList {
return null;
}
- public boolean remove(Bundle bundle, boolean compareVersions) {
- for (StartLevel sl : getStartLevels()) {
- if (sl.removeBundle(bundle, compareVersions)) {
- return true;
+ public boolean remove(List<Bundle> bundles, boolean compareVersions) {
+ boolean result = false;
+ for (Bundle bundle : bundles) {
+ for (StartLevel sl : getStartLevels()) {
+ if (sl.removeBundle(bundle, compareVersions)) {
+ result = true;
+ break;
+ }
}
}
- return false;
+ return result;
}
-
/**
* Merge the current bundle list with an additional list.
* @see #add(Bundle)
@@ -69,8 +72,10 @@ public abstract class BaseBundleList {
*
* @param newBnd the bundle to add
*/
- public void add(Bundle newBnd) {
- add(null, newBnd);
+ public void add(List<Bundle> newBnd) {
+ for (Bundle bundle : newBnd) {
+ add(null, bundle);
+ }
}
/**
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 05/22: SLING-2843 : Launchpad plugin
should check if configuration directory exists
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit b032906f26cc72ab5eb2081b4b0cccae16367526
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 29 05:39:40 2013 +0000
SLING-2843 : Launchpad plugin should check if configuration directory exists
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1476892 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/maven/projectsupport/PreparePackageMojo.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 5a541cd..a221434 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -304,12 +304,14 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
}
private void copyConfigurationFiles() throws MojoExecutionException {
- try {
- copyDirectory(this.getConfigDirectory(), new File(getOutputDirectory(), CONFIG_PATH_PREFIX), null, FileUtils.getDefaultExcludes());
- } catch (IOException e) {
- throw new MojoExecutionException("Unable to copy configuration files", e);
+ final File configDir = this.getConfigDirectory();
+ if (configDir.exists() ) {
+ try {
+ copyDirectory(configDir, new File(getOutputDirectory(), CONFIG_PATH_PREFIX), null, FileUtils.getDefaultExcludes());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to copy configuration files", e);
+ }
}
-
}
private void unpack(File source, File destination)
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 21/22: [maven-release-plugin]
prepare release maven-launchpad-plugin-2.3.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 848dfc0106de20539776ca9607ce3c636c23b6cc
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 3 07:30:20 2014 +0000
[maven-release-plugin] prepare release maven-launchpad-plugin-2.3.0
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1573466 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 90eb8f2..f1bdc66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
</parent>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.3.0</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -31,9 +31,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-launchpad-plugin</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.3.0</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.3.0</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.3.0</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 18/22: SLING-3401 : Support multiple
bundles for jarWebSupport Implement toString and provide a way to get the
contained artifact definitions
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit ad4d1ff43307d578c7536df6fa1beecbaf8835e4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 20 13:12:19 2014 +0000
SLING-3401 : Support multiple bundles for jarWebSupport
Implement toString and provide a way to get the contained artifact definitions
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1570182 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/ArtifactDefinition.java | 36 +++++++++++++++++-----
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index 29930a5..f9f6ab3 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -19,6 +19,7 @@ package org.apache.sling.maven.projectsupport;
import static org.apache.sling.maven.projectsupport.BundleListUtils.nodeValue;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.apache.maven.model.Dependency;
@@ -137,12 +138,20 @@ public class ArtifactDefinition {
this.version = version;
}
+ public ArtifactDefinition[] getContainedArtifacts() {
+ return this.bundles;
+ }
+
@Override
public String toString() {
- return "ArtifactDefinition [artifactId=" + artifactId + ", classifier="
- + classifier + ", groupId=" + groupId + ", startLevel="
- + startLevel + ", type=" + type + ", version=" + version
- + ", runModes=" + runModes + "]";
+ if ( this.bundles == null ) {
+ return "ArtifactDefinition [artifactId=" + artifactId + ", classifier="
+ + classifier + ", groupId=" + groupId + ", startLevel="
+ + startLevel + ", type=" + type + ", version=" + version
+ + ", runModes=" + runModes + "]";
+ } else {
+ return "ArtifactDefinition [artifacts=" + Arrays.toString(this.bundles) + "]";
+ }
}
/**
@@ -157,13 +166,26 @@ public class ArtifactDefinition {
* the comma-delimited list
*/
public void initDefaults(String commaDelimitedList) {
- String[] values = commaDelimitedList.split(",");
+ this.initDefaults(commaDelimitedList, ',');
+ }
+
+ /**
+ * Initialize this ArtifactDefinition with a set of default values from a
+ * delimited string. This string must have 6 items in it:
+ * [groupId],[artifactId],[version],[type],[classifier],[startLevel]
+ *
+ * @param valueList the delimited list
+ * @param delimiter the delimiter
+ */
+ public void initDefaults(final String valueList, final char delimiter) {
+ final String delString = "" + delimiter;
+ String[] values = valueList.split(delString);
if (values.length == 0 || values.length % 6 != 0 ) {
throw new IllegalArgumentException(
String
.format(
- "The string %s does not have the correct number of items (a multiple of 6).",
- commaDelimitedList));
+ "The string %s does not have the correct number of items (a multiple of 6) separated by %s",
+ valueList, delString));
}
if ( values.length == 6 ) {
initDefaults(values[0], values[1], values[2], values[3], values[4],
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 12/22: SLING-3205 - factor out
BundleListContentProvider to make it easier to test,
and add tests. No functional changes so far
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit d09a8f04e218ba07c043795c6fc808361227707c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 24 14:22:15 2013 +0000
SLING-3205 - factor out BundleListContentProvider to make it easier to test, and add tests. No functional changes so far
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1535390 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +
.../AbstractLaunchpadStartingMojo.java | 147 ++----------
.../projectsupport/BundleListContentProvider.java | 183 ++++++++++++++
.../BundleListContentProviderTest.java | 265 +++++++++++++++++++++
src/test/resources/test-bundle-list.xml | 76 ++++++
5 files changed, 547 insertions(+), 130 deletions(-)
diff --git a/pom.xml b/pom.xml
index 11ff2af..90eb8f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -220,5 +220,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 2b45cc6..3c5e22b 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -19,33 +19,23 @@ package org.apache.sling.maven.projectsupport;
import static org.apache.felix.framework.util.FelixConstants.LOG_LEVEL_PROP;
import java.io.File;
-import java.io.FileFilter;
import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import org.apache.felix.framework.Logger;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.PropertyUtils;
import org.apache.sling.launchpad.api.LaunchpadContentProvider;
import org.apache.sling.launchpad.base.impl.Sling;
import org.apache.sling.launchpad.base.shared.Notifiable;
import org.apache.sling.launchpad.base.shared.SharedConstants;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
import org.osgi.framework.BundleException;
public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleListMojo implements Notifiable {
@@ -103,129 +93,26 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL
*/
private File resourceProviderRoot;
- private LaunchpadContentProvider resourceProvider = new LaunchpadContentProvider() {
-
- public Iterator<String> getChildren(String path) {
- if (path.equals(BUNDLE_PATH_PREFIX)) {
- final Set<String> levels = new HashSet<String>();
- for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- // we treat the boot level as level 1
- if ( level.getStartLevel() == -1 ) {
- levels.add(BUNDLE_PATH_PREFIX + "/1/");
- } else {
- levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
- }
- }
- return levels.iterator();
- } else if (path.equals("resources/corebundles")) {
- List<String> empty = Collections.emptyList();
- return empty.iterator();
- } else if (path.equals(CONFIG_PATH_PREFIX)) {
- if (getConfigDirectory().exists() && getConfigDirectory().isDirectory()) {
- File[] configFiles = getConfigDirectory().listFiles(new FileFilter() {
-
- public boolean accept(File file) {
- return file.isFile();
- }
- });
-
- List<String> fileNames = new ArrayList<String>();
- for (File cfgFile : configFiles) {
- if (cfgFile.isFile()) {
- fileNames.add(CONFIG_PATH_PREFIX + "/" + cfgFile.getName());
- }
- }
-
- return fileNames.iterator();
-
- } else {
- List<String> empty = Collections.emptyList();
- return empty.iterator();
- }
- } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
- final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
- try {
- final int startLevel = Integer.parseInt(startLevelInfo);
-
- final List<String> bundles = new ArrayList<String>();
- for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
- for (final Bundle bundle : level.getBundles()) {
- final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
- try {
- final Artifact artifact = getArtifact(d);
- bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
- } catch (Exception e) {
- getLog().error("Unable to resolve artifact ", e);
- }
- }
- }
- }
- return bundles.iterator();
+ private LaunchpadContentProvider resourceProvider = new BundleListContentProvider(resourceProviderRoot) {
- } catch (NumberFormatException e) {
- // we ignore this
- }
- } else if (path.equals("resources") ) {
- final Set<String> subDirs = new HashSet<String>();
- subDirs.add(BUNDLE_PATH_PREFIX);
- subDirs.add(CONFIG_PATH_PREFIX);
- subDirs.add("resources/corebundles");
- return subDirs.iterator();
- }
-
- getLog().warn("un-handlable path " + path);
- return null;
+ @Override
+ BundleList getInitializedBundleList() {
+ return AbstractLaunchpadStartingMojo.this.getInitializedBundleList();
}
- public URL getResource(String path) {
- if (path.startsWith(CONFIG_PATH_PREFIX)) {
- File configFile = new File(getConfigDirectory(), path.substring(CONFIG_PATH_PREFIX.length() + 1));
- if (configFile.exists()) {
- try {
- return configFile.toURI().toURL();
- } catch (MalformedURLException e) {
- // ignore this one
- }
- }
- }
-
- File resourceFile = new File(resourceProviderRoot, path);
- if (resourceFile.exists()) {
- try {
- return resourceFile.toURI().toURL();
- } catch (MalformedURLException e) {
- getLog().error("Unable to create URL for file", e);
- return null;
- }
- } else {
- URL fromClasspath = getClass().getResource("/" + path);
- if (fromClasspath != null) {
- return fromClasspath;
- }
-
- try {
- return new URL(path);
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
+ @Override
+ File getConfigDirectory() {
+ return AbstractLaunchpadStartingMojo.this.getConfigDirectory();
}
-
- public InputStream getResourceAsStream(String path) {
- URL res = this.getResource(path);
- if (res != null) {
- try {
- return res.openStream();
- } catch (IOException ioe) {
- // ignore this one
- }
- }
-
- // no resource
- return null;
-
+
+ @Override
+ Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException {
+ return AbstractLaunchpadStartingMojo.this.getArtifact(def);
+ }
+
+ @Override
+ Log getLog() {
+ return AbstractLaunchpadStartingMojo.this.getLog();
}
};
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
new file mode 100644
index 0000000..cfe1c46
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
@@ -0,0 +1,183 @@
+/*
+ * 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.maven.projectsupport;
+
+import static org.apache.sling.maven.projectsupport.AbstractUsingBundleListMojo.BUNDLE_PATH_PREFIX;
+import static org.apache.sling.maven.projectsupport.AbstractUsingBundleListMojo.CONFIG_PATH_PREFIX;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.sling.launchpad.api.LaunchpadContentProvider;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+
+/** LaunchpadContentProvider that provides resources based on a BundleList
+ * and other resources specific to this module.
+ */
+abstract class BundleListContentProvider implements LaunchpadContentProvider {
+
+ private final File resourceProviderRoot;
+
+ BundleListContentProvider(File resourceProviderRoot) {
+ this.resourceProviderRoot = resourceProviderRoot;
+ }
+
+ public Iterator<String> getChildren(String path) {
+ if (path.equals(BUNDLE_PATH_PREFIX)) {
+ final Set<String> levels = new HashSet<String>();
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ // we treat the boot level as level 1
+ if ( level.getStartLevel() == -1 ) {
+ levels.add(BUNDLE_PATH_PREFIX + "/1/");
+ } else {
+ levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
+ }
+ }
+ return levels.iterator();
+ } else if (path.equals("resources/corebundles")) {
+ List<String> empty = Collections.emptyList();
+ return empty.iterator();
+ } else if (path.equals(CONFIG_PATH_PREFIX)) {
+ if (getConfigDirectory().exists() && getConfigDirectory().isDirectory()) {
+ File[] configFiles = getConfigDirectory().listFiles(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isFile();
+ }
+ });
+
+ List<String> fileNames = new ArrayList<String>();
+ for (File cfgFile : configFiles) {
+ if (cfgFile.isFile()) {
+ fileNames.add(CONFIG_PATH_PREFIX + "/" + cfgFile.getName());
+ }
+ }
+
+ return fileNames.iterator();
+
+ } else {
+ List<String> empty = Collections.emptyList();
+ return empty.iterator();
+ }
+ } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
+ final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
+ try {
+ final int startLevel = Integer.parseInt(startLevelInfo);
+
+ final List<String> bundles = new ArrayList<String>();
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
+ for (final Bundle bundle : level.getBundles()) {
+ final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
+ try {
+ final Artifact artifact = getArtifact(d);
+ bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
+ } catch (Exception e) {
+ getLog().error("Unable to resolve artifact ", e);
+ }
+ }
+ }
+ }
+ return bundles.iterator();
+
+ } catch (NumberFormatException e) {
+ // we ignore this
+ }
+ } else if (path.equals("resources") ) {
+ final Set<String> subDirs = new HashSet<String>();
+ subDirs.add(BUNDLE_PATH_PREFIX);
+ subDirs.add(CONFIG_PATH_PREFIX);
+ subDirs.add("resources/corebundles");
+ return subDirs.iterator();
+ }
+
+ getLog().warn("un-handlable path " + path);
+ return null;
+ }
+
+ public URL getResource(String path) {
+ if (path.startsWith(CONFIG_PATH_PREFIX)) {
+ File configFile = new File(getConfigDirectory(), path.substring(CONFIG_PATH_PREFIX.length() + 1));
+ if (configFile.exists()) {
+ try {
+ return configFile.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // ignore this one
+ }
+ }
+ }
+
+ File resourceFile = new File(resourceProviderRoot, path);
+ if (resourceFile.exists()) {
+ try {
+ return resourceFile.toURI().toURL();
+ } catch (MalformedURLException e) {
+ getLog().error("Unable to create URL for file", e);
+ return null;
+ }
+ } else {
+ URL fromClasspath = getClass().getResource("/" + path);
+ if (fromClasspath != null) {
+ return fromClasspath;
+ }
+
+ try {
+ return new URL(path);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ }
+
+ public InputStream getResourceAsStream(String path) {
+ URL res = this.getResource(path);
+ if (res != null) {
+ try {
+ return res.openStream();
+ } catch (IOException ioe) {
+ // ignore this one
+ }
+ }
+
+ // no resource
+ return null;
+ }
+
+ abstract BundleList getInitializedBundleList();
+
+ abstract File getConfigDirectory();
+
+ abstract Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException;
+
+ abstract Log getLog();
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
new file mode 100644
index 0000000..7cd9039
--- /dev/null
+++ b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
@@ -0,0 +1,265 @@
+/*
+ * 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.maven.projectsupport;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.sling.launchpad.api.LaunchpadContentProvider;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Reader;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.Mockito;
+
+/** Test the BundleListContentProvider */
+public class BundleListContentProviderTest {
+ private static BundleList bundleList;
+
+ public static final String TEST_BUNDLE_LIST = "test-bundle-list.xml";
+ public static final int BUNDLES_IN_TEST_BUNDLE_LIST = 11;
+
+ private LaunchpadContentProvider provider;
+ private File resourceProviderRoot;
+ private File resourceProviderFile;
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
+
+ private static final String [] CONFIG_FILES = {
+ "file1.txt",
+ "file2.cfg",
+ "someFile.properties"
+ };
+
+ @BeforeClass
+ public static void parseBundleList() throws Exception {
+ final BundleListXpp3Reader reader = new BundleListXpp3Reader();
+ final InputStream is = BundleListContentProviderTest.class.getClassLoader().getResourceAsStream(TEST_BUNDLE_LIST);
+ assertNotNull("Expecting " + TEST_BUNDLE_LIST + " to be found", is);
+ try {
+ bundleList = reader.read(is);
+ } finally {
+ is.close();
+ }
+ }
+
+ @Before
+ public void setupTemporaryFiles() throws IOException {
+ for(String filename: CONFIG_FILES) {
+ final File f = getConfigFile(filename);
+ f.createNewFile();
+ assertTrue("Expecting temporary config file to have been created: " + f.getAbsolutePath(), f.exists());
+ }
+
+ resourceProviderRoot = new File(tempFolder.getRoot(), "RESOURCE_PROVIDER_ROOT");
+ resourceProviderRoot.mkdirs();
+ resourceProviderFile = new File(resourceProviderRoot, "RP_FILE_" + System.currentTimeMillis());
+ resourceProviderFile.createNewFile();
+ }
+
+ private File getConfigFile(String name) {
+ return new File(tempFolder.getRoot(), name);
+ }
+
+ @Before
+ public void setupProvider() {
+ final Log log = Mockito.mock(Log.class);
+ provider = new BundleListContentProvider(resourceProviderRoot) {
+
+ @Override
+ BundleList getInitializedBundleList() {
+ return bundleList;
+ }
+
+ @Override
+ File getConfigDirectory() {
+ return tempFolder.getRoot();
+ }
+
+ @Override
+ Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException {
+ final Artifact a = Mockito.mock(Artifact.class);
+ final String fakeName = new StringBuilder()
+ .append("/")
+ .append(def.getArtifactId())
+ .append("/")
+ .append(def.getStartLevel())
+ .append("/")
+ .append(def.getRunModes())
+ .toString();
+ Mockito.when(a.getFile()).thenReturn(new File(fakeName));
+ return a;
+ }
+
+ @Override
+ Log getLog() {
+ return log;
+ }
+ };
+ }
+
+ private void assertChildren(String path, String ...expected) {
+ final List<String> kids = new ArrayList<String>();
+ final Iterator<String> it = provider.getChildren(path);
+ if(expected.length == 0) {
+ assertTrue("Expecting no children for " + path, it == null || !it.hasNext());
+ } else {
+ while(it.hasNext()) {
+ kids.add(it.next());
+ }
+ for(String exp : expected) {
+ assertTrue("Expecting " + exp + " in children of " + path + " (result=" + kids + ")", kids.contains(exp));
+ }
+ }
+ assertEquals("Expecting the correct number of children for " + path, expected.length, kids.size());
+ }
+
+ @Test
+ public void testParsedBundlesCount() {
+ int counter = 0;
+ for(StartLevel level : bundleList.getStartLevels()) {
+ counter += level.getBundles().size();
+ }
+ assertEquals(BUNDLES_IN_TEST_BUNDLE_LIST, counter);
+ }
+
+ @Test
+ public void testRoot() {
+ assertChildren("resources",
+ "resources/bundles",
+ "resources/corebundles",
+ "resources/config");
+ }
+
+ @Test
+ public void testBundles() {
+ assertChildren("resources/bundles",
+ "resources/bundles/0/",
+ "resources/bundles/1/",
+ "resources/bundles/5/",
+ "resources/bundles/15/");
+ }
+
+ @Test
+ public void testCoreBundles() {
+ assertChildren("resources/corebundles");
+ }
+
+ @Test
+ public void testConfig() {
+ assertChildren("resources/config",
+ "resources/config/file1.txt",
+ "resources/config/file2.cfg",
+ "resources/config/someFile.properties");
+ }
+
+ @Test
+ public void testBundles0() {
+ assertChildren("resources/bundles/0",
+ "file:/commons-io/0/null",
+ "file:/commons-fileupload/0/null",
+ "file:/commons-collections/0/null",
+ "file:/org.apache.sling.installer.provider.jcr/0/test,dev");
+ }
+
+ @Test
+ public void testBundles1() {
+ assertChildren("resources/bundles/1",
+ "file:/slf4j-api/1/null",
+ "file:/org.apache.sling.commons.log/1/null");
+ }
+
+ @Test
+ public void testBundles5() {
+ assertChildren("resources/bundles/5",
+ "file:/org.apache.sling.extensions.webconsolebranding/5/dev",
+ "file:/org.apache.sling.extensions.webconsolesecurityprovider/5/test");
+ }
+
+ @Test
+ public void testBundles15() {
+ assertChildren("resources/bundles/15",
+ "file:/org.apache.sling.jcr.oak.server/15/oak",
+ "file:/guava/15/jackrabbit",
+ "file:/jsr305/15/oak,jackrabbit");
+ }
+
+ @Test
+ public void testConfigResource() throws Exception {
+ final URL url = provider.getResource("resources/config/file1.txt");
+ assertNotNull("Expecting config resource to be found", url);
+ assertEquals(getConfigFile("file1.txt").toURI().toURL().toExternalForm(), url.toExternalForm());
+ }
+
+ @Test
+ public void testResourceProviderResource() throws Exception {
+ final URL url = provider.getResource(resourceProviderFile.getName());
+ assertNotNull("Expecting resource provider file to be found", url);
+ assertEquals(resourceProviderFile.toURI().toURL().toExternalForm(), url.toExternalForm());
+ }
+
+ @Test
+ public void testClasspathResource() throws Exception {
+ final URL url = provider.getResource(TEST_BUNDLE_LIST);
+ assertNotNull("Expecting classpath resource to be found", url);
+ assertTrue(url.toExternalForm().endsWith(TEST_BUNDLE_LIST));
+ }
+
+ @Test
+ public void testClasspathResourceAsStream() throws Exception {
+ final InputStream is = provider.getResourceAsStream(TEST_BUNDLE_LIST);
+ assertNotNull("Expecting classpath resource stream to be found", is);
+ is.close();
+ }
+
+ @Test
+ public void testNotFoundStream() throws Exception {
+ final InputStream is = provider.getResourceAsStream("resources/config/NOT_HERE.txt");
+ assertNull("Expecting null stream for non-existent resource", is);
+ }
+
+ @Test
+ public void testURLResource() throws Exception {
+ final String urlStr = "http://www.perdu.com";
+ final URL url = provider.getResource(urlStr);
+ assertNotNull("Expecting URL resource to be found", url);
+ assertEquals(new URL(urlStr), url);
+ }
+
+ @Test
+ public void testNullResult() {
+ assertNull(provider.getChildren("/FOO/bar"));
+ }
+}
diff --git a/src/test/resources/test-bundle-list.xml b/src/test/resources/test-bundle-list.xml
new file mode 100644
index 0000000..8c3b87c
--- /dev/null
+++ b/src/test/resources/test-bundle-list.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<bundles>
+ <startLevel level="boot">
+ <!-- bootstrap bundles, must allow the installer core to start -->
+ <bundle>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.4</version>
+ </bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.log</artifactId>
+ <version>3.0.3-SNAPSHOT</version>
+ </bundle>
+ </startLevel>
+
+ <startLevel level="0">
+ <bundle>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </bundle>
+ <bundle>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.2</version>
+ </bundle>
+ <bundle>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.installer.provider.jcr</artifactId>
+ <version>3.1.6</version>
+ <runModes>test,dev</runModes>
+ </bundle>
+ </startLevel>
+
+ <startLevel level="5">
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.extensions.webconsolebranding</artifactId>
+ <version>1.0.0</version>
+ <runModes>dev</runModes>
+ </bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.extensions.webconsolesecurityprovider</artifactId>
+ <version>1.0.0</version>
+ <runModes>test</runModes>
+ </bundle>
+ </startLevel>
+
+ <startLevel level="15">
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.jcr.oak.server</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <runModes>oak</runModes>
+ </bundle>
+ <bundle>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>14.0.1</version>
+ <runModes>jackrabbit</runModes>
+ </bundle>
+ <bundle>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ <version>2.0.0</version>
+ <runModes>oak,jackrabbit</runModes>
+ </bundle>
+ </startLevel>
+</bundles>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 06/22: Correct reactor pom and
update to parent pom 16
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 92f0c296a9f63c569e627ad259cd90709056cf76
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun May 5 14:38:24 2013 +0000
Correct reactor pom and update to parent pom 16
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1479333 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index eb75a6d..bd9f0f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>15</version>
+ <version>16</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 09/22: SLING-3011 - Bind the
launchpad:prepare-package goal to the prepare-package lifecycle phase
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 2ee46340d323bb62b49006c4aa5c0fbff9d5c193
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Aug 12 11:42:02 2013 +0000
SLING-3011 - Bind the launchpad:prepare-package goal to the
prepare-package lifecycle phase
Changed the phase from process-sources to prepare-package.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1513114 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index a221434..521472d 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -41,7 +41,7 @@ import org.codehaus.plexus.util.FileUtils;
*
* @goal prepare-package
* @requiresDependencyResolution test
- * @phase process-sources
+ * @phase prepare-package
* @description initialize a Sling application project
*/
public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 10/22: Update to parent pom 18
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 463b11490d73ab9d50c73a8db7ba7d605ef90f5e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Sep 6 12:15:57 2013 +0000
Update to parent pom 18
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1520554 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3c8a4b6..11ff2af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>17</version>
+ <version>18</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 17/22: SLING-3401 : Support multiple
bundles for jarWebSupport Add support for reading multiple bundles when
directly reading the maven xml (lifecycle participant) and add support to
define several bundles in the dependencies.properties file
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 7b899ed77b67ed33b564b714c3ccf3b76ac25faf
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 20 12:58:47 2014 +0000
SLING-3401 : Support multiple bundles for jarWebSupport
Add support for reading multiple bundles when directly reading the maven xml (lifecycle participant) and add support to define several bundles in the dependencies.properties file
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1570178 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/ArtifactDefinition.java | 40 +++++++++++++++-------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index 10285dc..29930a5 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -67,14 +67,22 @@ public class ArtifactDefinition {
this.runModes = bundle.getRunModes();
}
- public ArtifactDefinition(Xpp3Dom config) {
- this.groupId = nodeValue(config, "groupId", null);
- this.artifactId = nodeValue(config, "artifactId", null);
- this.type = nodeValue(config, "type", null);
- this.version = nodeValue(config, "version", null);
- this.classifier = nodeValue(config, "classifier", null);
- this.startLevel = nodeValue(config, "startLevel", 0);
- this.runModes = nodeValue(config, "runModes", null);
+ public ArtifactDefinition(final Xpp3Dom config) {
+ if ( config.getChild("bundles") != null ) {
+ final Xpp3Dom[] children = config.getChild("bundles").getChildren("bundle");
+ this.bundles = new ArtifactDefinition[children.length];
+ for(int i=0; i<this.bundles.length; i++) {
+ this.bundles[i] = new ArtifactDefinition(children[i]);
+ }
+ } else {
+ this.groupId = nodeValue(config, "groupId", null);
+ this.artifactId = nodeValue(config, "artifactId", null);
+ this.type = nodeValue(config, "type", null);
+ this.version = nodeValue(config, "version", null);
+ this.classifier = nodeValue(config, "classifier", null);
+ this.startLevel = nodeValue(config, "startLevel", 0);
+ this.runModes = nodeValue(config, "runModes", null);
+ }
}
public String getArtifactId() {
@@ -150,15 +158,23 @@ public class ArtifactDefinition {
*/
public void initDefaults(String commaDelimitedList) {
String[] values = commaDelimitedList.split(",");
- if (values.length != 6) {
+ if (values.length == 0 || values.length % 6 != 0 ) {
throw new IllegalArgumentException(
String
.format(
- "The string %s does not have the correct number of items (6).",
+ "The string %s does not have the correct number of items (a multiple of 6).",
commaDelimitedList));
}
- initDefaults(values[0], values[1], values[2], values[3], values[4],
- Integer.valueOf(values[5]));
+ if ( values.length == 6 ) {
+ initDefaults(values[0], values[1], values[2], values[3], values[4],
+ Integer.valueOf(values[5]));
+ }
+ this.bundles = new ArtifactDefinition[values.length / 6];
+ for(int i=0; i<values.length / 6; i++) {
+ this.bundles[i] = new ArtifactDefinition();
+ this.bundles[i].initDefaults(values[i*6 + 0], values[i*6 + 1], values[i*6 + 2], values[i*6 + 3], values[i*6 + 4],
+ Integer.valueOf(values[i*6 + 5]));
+ }
}
/**
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 01/22: [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 maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit b59b3468458f5dc38997ec93713361f680cd2984
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Nov 16 07:50:33 2012 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1410234 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index c0ba955..97a5388 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
</parent>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -31,9 +31,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.2.0</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.2.0</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.2.0</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 11/22: SLING-3142 :
NullPointerException with Java8 in AbstractUsingBundleList
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit c8cd514abd901734235715f7833a6196bdce089a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Oct 4 05:56:14 2013 +0000
SLING-3142 : NullPointerException with Java8 in AbstractUsingBundleList
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1529083 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java | 2 +-
.../sling/maven/projectsupport/AbstractUsingBundleListMojo.java | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index bb27287..2b45cc6 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -300,7 +300,7 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL
File tmp = null;
try {
tmp = File.createTempFile("sling", "props");
- mavenFileFilter.copyFile(propertiesFile, tmp, true, project, null, true,
+ mavenFileFilter.copyFile(propertiesFile, tmp, true, project, Collections.EMPTY_LIST, true,
System.getProperty("file.encoding"), mavenSession);
Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
for (Object key : loadedProps.keySet()) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
index 41e45a4..146a134 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Set;
@@ -408,7 +409,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
File tmp = null;
try {
tmp = File.createTempFile("sling", "props");
- mavenFileFilter.copyFile(propsFile, tmp, true, project, null, true,
+ mavenFileFilter.copyFile(propsFile, tmp, true, project, Collections.EMPTY_LIST, true,
System.getProperty("file.encoding"), mavenSession);
final Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
if ( mode == 0 ) {
@@ -482,7 +483,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
Reader reader = null;
try {
tmp = File.createTempFile("sling", "bootstrap");
- mavenFileFilter.copyFile(bootstrapFile, tmp, true, project, null, true,
+ mavenFileFilter.copyFile(bootstrapFile, tmp, true, project, Collections.EMPTY_LIST, true,
System.getProperty("file.encoding"), mavenSession);
reader = new FileReader(tmp);
final StringBuilder sb = new StringBuilder();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 19/22: SLING-3401 : Support multiple
bundles for jarWebSupport Fix init method
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 9b9ec72ab962a782a65bd70bc898c17bc7574704
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 20 15:42:38 2014 +0000
SLING-3401 : Support multiple bundles for jarWebSupport
Fix init method
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1570236 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/maven/projectsupport/ArtifactDefinition.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index f9f6ab3..d8e38f1 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -190,12 +190,13 @@ public class ArtifactDefinition {
if ( values.length == 6 ) {
initDefaults(values[0], values[1], values[2], values[3], values[4],
Integer.valueOf(values[5]));
- }
- this.bundles = new ArtifactDefinition[values.length / 6];
- for(int i=0; i<values.length / 6; i++) {
- this.bundles[i] = new ArtifactDefinition();
- this.bundles[i].initDefaults(values[i*6 + 0], values[i*6 + 1], values[i*6 + 2], values[i*6 + 3], values[i*6 + 4],
- Integer.valueOf(values[i*6 + 5]));
+ } else {
+ this.bundles = new ArtifactDefinition[values.length / 6];
+ for(int i=0; i<values.length / 6; i++) {
+ this.bundles[i] = new ArtifactDefinition();
+ this.bundles[i].initDefaults(values[i*6 + 0], values[i*6 + 1], values[i*6 + 2], values[i*6 + 3], values[i*6 + 4],
+ Integer.valueOf(values[i*6 + 5]));
+ }
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 20/22: SLING-3416 - Some tests in
o.a.s.m.projectsupport.BundleListContentProviderTest fails on windows
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 3db5aaf67a4c68db0d92c7f0826e025285d1f184
Author: Amit Gupta <am...@apache.org>
AuthorDate: Mon Feb 24 18:08:46 2014 +0000
SLING-3416 - Some tests in o.a.s.m.projectsupport.BundleListContentProviderTest fails on windows
fixing the tests, hopefully these do not break on other platforms now.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1571375 13f79535-47bb-0310-9956-ffa450edef68
---
.../BundleListContentProviderTest.java | 55 +++++++++++++---------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
index 056c018..8041a56 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
@@ -59,6 +60,7 @@ public class BundleListContentProviderTest {
private File resourceProviderFile;
private File configDirectory;
private int logWarningsCount;
+ private String fakeBundlePath;
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@@ -89,17 +91,26 @@ public class BundleListContentProviderTest {
assertTrue("Expecting temporary config file to have been created: " + f.getAbsolutePath(), f.exists());
}
configDirectory = tempFolder.getRoot();
-
+
resourceProviderRoot = new File(tempFolder.getRoot(), "RESOURCE_PROVIDER_ROOT");
resourceProviderRoot.mkdirs();
resourceProviderFile = new File(resourceProviderRoot, "RP_FILE_" + System.currentTimeMillis());
resourceProviderFile.createNewFile();
+ fakeBundlePath = getFakeBundlePath();
}
private File getConfigFile(String name) {
return new File(tempFolder.getRoot(), name);
}
-
+
+ private String getFakeBundlePath() {
+ try {
+ return new File("/FAKE_BUNDLE").toURI().toURL().toExternalForm();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@Before
public void setupProvider() {
final Log log = Mockito.mock(Log.class);
@@ -276,55 +287,55 @@ public class BundleListContentProviderTest {
@Test
public void testInstall0() {
- assertChildren("resources/install/0",
- "file:/FAKE_BUNDLE/commons-io/0/null",
- "file:/FAKE_BUNDLE/commons-fileupload/0/null",
- "file:/FAKE_BUNDLE/commons-collections/0/null");
+ assertChildren("resources/install/0",
+ fakeBundlePath + "/commons-io/0/null",
+ fakeBundlePath + "/commons-fileupload/0/null",
+ fakeBundlePath + "/commons-collections/0/null");
}
@Test
public void testBootstrapBundles() {
- assertChildren("resources/bundles/1",
- "file:/FAKE_BUNDLE/slf4j-api/-1/null",
- "file:/FAKE_BUNDLE/org.apache.sling.commons.log/-1/null");
+ assertChildren("resources/bundles/1",
+ fakeBundlePath + "/slf4j-api/-1/null",
+ fakeBundlePath + "/org.apache.sling.commons.log/-1/null");
}
@Test
public void testInstall5() {
- assertChildren("resources/install/5",
- "file:/FAKE_BUNDLE/five.norunmode/5/null");
+ assertChildren("resources/install/5",
+ fakeBundlePath + "/five.norunmode/5/null");
}
@Test
public void testInstall5Dev() {
- assertChildren("resources/install.dev/5",
- "file:/FAKE_BUNDLE/org.apache.sling.extensions.webconsolebranding/5/dev");
+ assertChildren("resources/install.dev/5",
+ fakeBundlePath + "/org.apache.sling.extensions.webconsolebranding/5/dev");
}
@Test
public void testInstall5Test() {
- assertChildren("resources/install.test/5",
- "file:/FAKE_BUNDLE/org.apache.sling.extensions.webconsolesecurityprovider/5/test");
+ assertChildren("resources/install.test/5",
+ fakeBundlePath + "/org.apache.sling.extensions.webconsolesecurityprovider/5/test");
}
@Test
public void testInstall15() {
assertChildren("resources/install/15",
- "file:/FAKE_BUNDLE/fifteen.norunmode/15/null");
+ fakeBundlePath + "/fifteen.norunmode/15/null");
}
@Test
public void testInstall15Oak() {
- assertChildren("resources/install.oak/15",
- "file:/FAKE_BUNDLE/org.apache.sling.jcr.oak.server/15/oak",
- "file:/FAKE_BUNDLE/jsr305/15/oak,jackrabbit");
+ assertChildren("resources/install.oak/15",
+ fakeBundlePath + "/org.apache.sling.jcr.oak.server/15/oak",
+ fakeBundlePath + "/jsr305/15/oak,jackrabbit");
}
@Test
public void testInstall15Jackrabbit() {
- assertChildren("resources/install.jackrabbit/15",
- "file:/FAKE_BUNDLE/guava/15/jackrabbit",
- "file:/FAKE_BUNDLE/jsr305/15/oak,jackrabbit");
+ assertChildren("resources/install.jackrabbit/15",
+ fakeBundlePath + "/guava/15/jackrabbit",
+ fakeBundlePath + "/jsr305/15/oak,jackrabbit");
}
@Test
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 07/22: Update to 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 maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 7d69536f2d0cfa6f318b20dd6d2b04c24039812d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 19 07:04:15 2013 +0000
Update to latest parent pom
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1504788 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index bd9f0f9..1d1e2eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>16</version>
+ <version>17</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 04/22: Update to latest parent pom
and use latest releases in launchpad
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit f804b578b77824cc474216e5793fe6a2c9a2b72a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Feb 18 08:38:52 2013 +0000
Update to latest parent pom and use latest releases in launchpad
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1447147 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 123d041..eb75a6d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>14</version>
+ <version>15</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 13/22: SLING-3205 - refactor if
statement into more readable methods
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 4468f808655fd55fc78919c32303c5af8541cd5f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 24 14:34:35 2013 +0000
SLING-3205 - refactor if statement into more readable methods
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1535392 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/BundleListContentProvider.java | 136 ++++++++++++---------
.../BundleListContentProviderTest.java | 11 +-
2 files changed, 87 insertions(+), 60 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
index cfe1c46..472ec6c 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
@@ -46,82 +46,100 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
abstract class BundleListContentProvider implements LaunchpadContentProvider {
private final File resourceProviderRoot;
+ private final static List<String> EMPTY_STRING_LIST = Collections.emptyList();
BundleListContentProvider(File resourceProviderRoot) {
this.resourceProviderRoot = resourceProviderRoot;
}
-
- public Iterator<String> getChildren(String path) {
- if (path.equals(BUNDLE_PATH_PREFIX)) {
- final Set<String> levels = new HashSet<String>();
- for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- // we treat the boot level as level 1
- if ( level.getStartLevel() == -1 ) {
- levels.add(BUNDLE_PATH_PREFIX + "/1/");
- } else {
- levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
- }
+
+ private Iterator<String> handleBundlePathRoot(String path) {
+ final Set<String> levels = new HashSet<String>();
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ // we treat the boot level as level 1
+ if ( level.getStartLevel() == -1 ) {
+ levels.add(BUNDLE_PATH_PREFIX + "/1/");
+ } else {
+ levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
}
- return levels.iterator();
- } else if (path.equals("resources/corebundles")) {
- List<String> empty = Collections.emptyList();
- return empty.iterator();
- } else if (path.equals(CONFIG_PATH_PREFIX)) {
- if (getConfigDirectory().exists() && getConfigDirectory().isDirectory()) {
- File[] configFiles = getConfigDirectory().listFiles(new FileFilter() {
+ }
+ return levels.iterator();
+ }
+
+ private Iterator<String> handleConfigPath() {
+ if (getConfigDirectory().exists() && getConfigDirectory().isDirectory()) {
+ File[] configFiles = getConfigDirectory().listFiles(new FileFilter() {
- public boolean accept(File file) {
- return file.isFile();
- }
- });
+ public boolean accept(File file) {
+ return file.isFile();
+ }
+ });
- List<String> fileNames = new ArrayList<String>();
- for (File cfgFile : configFiles) {
- if (cfgFile.isFile()) {
- fileNames.add(CONFIG_PATH_PREFIX + "/" + cfgFile.getName());
- }
+ List<String> fileNames = new ArrayList<String>();
+ for (File cfgFile : configFiles) {
+ if (cfgFile.isFile()) {
+ fileNames.add(CONFIG_PATH_PREFIX + "/" + cfgFile.getName());
}
+ }
- return fileNames.iterator();
+ return fileNames.iterator();
- } else {
- List<String> empty = Collections.emptyList();
- return empty.iterator();
- }
- } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
- final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
- try {
- final int startLevel = Integer.parseInt(startLevelInfo);
-
- final List<String> bundles = new ArrayList<String>();
- for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
- for (final Bundle bundle : level.getBundles()) {
- final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
- try {
- final Artifact artifact = getArtifact(d);
- bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
- } catch (Exception e) {
- getLog().error("Unable to resolve artifact ", e);
- }
+ } else {
+ return EMPTY_STRING_LIST.iterator();
+ }
+ }
+
+ private Iterator<String> handleBundlePathFolder(String path) {
+ final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
+ try {
+ final int startLevel = Integer.parseInt(startLevelInfo);
+
+ final List<String> bundles = new ArrayList<String>();
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
+ for (final Bundle bundle : level.getBundles()) {
+ final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
+ try {
+ final Artifact artifact = getArtifact(d);
+ bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
+ } catch (Exception e) {
+ getLog().error("Unable to resolve artifact ", e);
}
}
}
- return bundles.iterator();
-
- } catch (NumberFormatException e) {
- // we ignore this
}
+ return bundles.iterator();
+
+ } catch (NumberFormatException e) {
+ // we ignore this
+ }
+ return null;
+ }
+
+ private Iterator<String> handleResourcesRoot() {
+ final Set<String> subDirs = new HashSet<String>();
+ subDirs.add(BUNDLE_PATH_PREFIX);
+ subDirs.add(CONFIG_PATH_PREFIX);
+ subDirs.add("resources/corebundles");
+ return subDirs.iterator();
+ }
+
+ public Iterator<String> getChildren(String path) {
+ Iterator<String> result = null;
+ if (path.equals(BUNDLE_PATH_PREFIX)) {
+ result = handleBundlePathRoot(path);
+ } else if (path.equals("resources/corebundles")) {
+ result = EMPTY_STRING_LIST.iterator();
+ } else if (path.equals(CONFIG_PATH_PREFIX)) {
+ result = handleConfigPath();
+ } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
+ result = handleBundlePathFolder(path);
} else if (path.equals("resources") ) {
- final Set<String> subDirs = new HashSet<String>();
- subDirs.add(BUNDLE_PATH_PREFIX);
- subDirs.add(CONFIG_PATH_PREFIX);
- subDirs.add("resources/corebundles");
- return subDirs.iterator();
+ result = handleResourcesRoot();
+ } else {
+ getLog().warn("un-handlable " + getClass().getSimpleName() + " path: " + path);
}
- getLog().warn("un-handlable path " + path);
- return null;
+ return result;
}
public URL getResource(String path) {
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
index 7cd9039..b4c3905 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
@@ -53,6 +53,7 @@ public class BundleListContentProviderTest {
private LaunchpadContentProvider provider;
private File resourceProviderRoot;
private File resourceProviderFile;
+ private File configDirectory;
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@@ -82,6 +83,7 @@ public class BundleListContentProviderTest {
f.createNewFile();
assertTrue("Expecting temporary config file to have been created: " + f.getAbsolutePath(), f.exists());
}
+ configDirectory = tempFolder.getRoot();
resourceProviderRoot = new File(tempFolder.getRoot(), "RESOURCE_PROVIDER_ROOT");
resourceProviderRoot.mkdirs();
@@ -105,7 +107,7 @@ public class BundleListContentProviderTest {
@Override
File getConfigDirectory() {
- return tempFolder.getRoot();
+ return configDirectory;
}
@Override
@@ -186,6 +188,12 @@ public class BundleListContentProviderTest {
}
@Test
+ public void testNonExistentConfigDirectory() {
+ configDirectory = new File("/NON_EXISTENT_" + System.currentTimeMillis());
+ assertChildren("resources/config");
+ }
+
+ @Test
public void testBundles0() {
assertChildren("resources/bundles/0",
"file:/commons-io/0/null",
@@ -262,4 +270,5 @@ public class BundleListContentProviderTest {
public void testNullResult() {
assertNull(provider.getChildren("/FOO/bar"));
}
+
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 15/22: SLING-3205 - avoid confusing
warning on config 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 maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 7458cb66f6236d7bf9d2096ecae00b5b8ed5bb16
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Oct 28 14:07:46 2013 +0000
SLING-3205 - avoid confusing warning on config files
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1536357 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/BundleListContentProvider.java | 21 ++++++++++++++--
.../BundleListContentProviderTest.java | 28 ++++++++++++++++++++++
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
index eb34f54..64442fc 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
@@ -221,6 +221,21 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
return result.iterator();
}
+
+ private Iterator<String> handleConfigSubpath(String path) {
+ // We don't handle config subpaths for now, but do not
+ // warn if we're asked for the children of a file, just
+ // return empty in that case
+ final File f = getConfigFile(path);
+ if(!f.exists()) {
+ getLog().warn("BundleListContentProvider cannot get children of config path: " + path);
+ }
+ return EMPTY_STRING_LIST.iterator();
+ }
+
+ private File getConfigFile(String path) {
+ return new File(getConfigDirectory(), path.substring(CONFIG_PATH_PREFIX.length() + 1));
+ }
public Iterator<String> getChildren(String path) {
Iterator<String> result = null;
@@ -230,6 +245,8 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
result = EMPTY_STRING_LIST.iterator();
} else if (path.equals(CONFIG_PATH_PREFIX)) {
result = handleConfigPath();
+ } else if (path.startsWith(CONFIG_PATH_PREFIX)) {
+ result = handleConfigSubpath(path);
} else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
result = handleBundlesSubfolder(path);
} else if (path.startsWith(INSTALL_PATH_PREFIX)) {
@@ -241,7 +258,7 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
// as our file URLs point to Maven artifacts
result = EMPTY_STRING_LIST.iterator();
} else {
- getLog().warn("BundleListContentProvider cannot handle path: " + path);
+ getLog().warn("BundleListContentProvider cannot get children of path: " + path);
}
return result;
@@ -249,7 +266,7 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
public URL getResource(String path) {
if (path.startsWith(CONFIG_PATH_PREFIX)) {
- File configFile = new File(getConfigDirectory(), path.substring(CONFIG_PATH_PREFIX.length() + 1));
+ final File configFile = getConfigFile(path);
if (configFile.exists()) {
try {
return configFile.toURI().toURL();
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
index 21cbe53..056c018 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
@@ -42,7 +42,10 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.mockito.Matchers;
import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
/** Test the BundleListContentProvider */
public class BundleListContentProviderTest {
@@ -55,6 +58,7 @@ public class BundleListContentProviderTest {
private File resourceProviderRoot;
private File resourceProviderFile;
private File configDirectory;
+ private int logWarningsCount;
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@@ -99,6 +103,18 @@ public class BundleListContentProviderTest {
@Before
public void setupProvider() {
final Log log = Mockito.mock(Log.class);
+ final Answer<Void> countWarningAnswers = new Answer<Void>() {
+
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ logWarningsCount++;
+ return null;
+ }
+
+ };
+ Mockito.doAnswer(countWarningAnswers).when(log).warn(Matchers.any(String.class));
+ Mockito.doAnswer(countWarningAnswers).when(log).warn(Matchers.any(Throwable.class));
+ Mockito.doAnswer(countWarningAnswers).when(log).warn(Matchers.any(String.class), Matchers.any(Throwable.class));
+
provider = new BundleListContentProvider(resourceProviderRoot) {
@Override
@@ -229,6 +245,18 @@ public class BundleListContentProviderTest {
}
@Test
+ public void testConfigFile() {
+ assertChildren("resources/config/file1.txt");
+ assertEquals("Expecting no warnings", 0, logWarningsCount);
+ }
+
+ @Test
+ public void testConfigSubpath() {
+ assertChildren("resources/config/someFolder/someSubFolder");
+ assertEquals("Expecting a warning", 1, logWarningsCount);
+ }
+
+ @Test
public void testNonExistentConfigDirectory() {
configDirectory = new File("/NON_EXISTENT_" + System.currentTimeMillis());
assertChildren("resources/config");
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 14/22: SLING-3205 - provide bundle
resources under resources/install to support run modes
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit cc427a968d59929292ed0c7324fa2a22b7efbe0d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Oct 25 12:21:41 2013 +0000
SLING-3205 - provide bundle resources under resources/install to support run modes
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/maven-launchpad-plugin@1535709 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/BundleListContentProvider.java | 153 ++++++++++++++++---
.../BundleListContentProviderTest.java | 164 +++++++++++++++++----
src/test/resources/test-bundle-list.xml | 10 ++
3 files changed, 276 insertions(+), 51 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
index 472ec6c..eb34f54 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/BundleListContentProvider.java
@@ -26,6 +26,7 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -45,6 +46,10 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
*/
abstract class BundleListContentProvider implements LaunchpadContentProvider {
+ public static final String INSTALL_PATH_PREFIX = "resources/install";
+ public static final int BOOTSTRAP_DEF_START_LEVEL = -1;
+ public static final int ACTUAL_BOOTSTRAP_START_LEVEL = 1;
+
private final File resourceProviderRoot;
private final static List<String> EMPTY_STRING_LIST = Collections.emptyList();
@@ -55,11 +60,10 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
private Iterator<String> handleBundlePathRoot(String path) {
final Set<String> levels = new HashSet<String>();
for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- // we treat the boot level as level 1
- if ( level.getStartLevel() == -1 ) {
- levels.add(BUNDLE_PATH_PREFIX + "/1/");
- } else {
- levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
+ // Include only bootstrap bundles here, with start level 1.
+ // Other bundles go under the install folder, to support run modes
+ if( level.getStartLevel() == BOOTSTRAP_DEF_START_LEVEL) {
+ levels.add(BUNDLE_PATH_PREFIX + "/" + ACTUAL_BOOTSTRAP_START_LEVEL + "/");
}
}
return levels.iterator();
@@ -88,31 +92,53 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
}
}
- private Iterator<String> handleBundlePathFolder(String path) {
+ private Iterator<String> handleBundlesSubfolder(String path) {
+ Iterator<String> result = null;
final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
try {
final int startLevel = Integer.parseInt(startLevelInfo);
+
+ // To be consistent with handleBundlePathRoot, consider only level 1 which
+ // is assigned to bootstrap bundles
+ if(startLevel == ACTUAL_BOOTSTRAP_START_LEVEL) {
+ final List<String> bundles = new ArrayList<String>();
+ addBundles(bundles, ACTUAL_BOOTSTRAP_START_LEVEL, null);
+ addBundles(bundles, BOOTSTRAP_DEF_START_LEVEL, null);
+ result = bundles.iterator();
+ }
- final List<String> bundles = new ArrayList<String>();
- for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
- if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
- for (final Bundle bundle : level.getBundles()) {
- final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
- try {
- final Artifact artifact = getArtifact(d);
- bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
- } catch (Exception e) {
- getLog().error("Unable to resolve artifact ", e);
- }
+ } catch (NumberFormatException e) {
+ getLog().warn("Invalid start level " + startLevelInfo + " in path " + path);
+ }
+
+ return result;
+ }
+
+ private void addBundles(Collection<String> bundles, int startLevel, String runMode) {
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ if(level.getStartLevel() == startLevel) {
+ for (final Bundle bundle : level.getBundles()) {
+ if(!runModeMatches(bundle, runMode)) {
+ continue;
+ }
+ final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
+ try {
+ final Artifact artifact = getArtifact(d);
+ bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
+ } catch (Exception e) {
+ getLog().error("Unable to resolve artifact ", e);
}
}
}
- return bundles.iterator();
-
- } catch (NumberFormatException e) {
- // we ignore this
}
- return null;
+ }
+
+ private boolean runModeMatches(Bundle b, String runMode) {
+ if(runMode == null || runMode.length() == 0) {
+ return b.getRunModes() == null || b.getRunModes().length() == 0;
+ } else {
+ return b.getRunModes() != null && b.getRunModes().contains(runMode);
+ }
}
private Iterator<String> handleResourcesRoot() {
@@ -120,8 +146,81 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
subDirs.add(BUNDLE_PATH_PREFIX);
subDirs.add(CONFIG_PATH_PREFIX);
subDirs.add("resources/corebundles");
+ subDirs.add(INSTALL_PATH_PREFIX);
+
+ // Compute the set of run modes in our bundles
+ final Set<String> runModes = new HashSet<String>();
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ for(Bundle bundle : level.getBundles()) {
+ final String modes = bundle.getRunModes();
+ if(modes != null && modes.length() > 0) {
+ for(String m : modes.split(",")) {
+ runModes.add("." + m);
+ }
+ }
+ }
+ }
+
+ // Add one install subdir per run mode
+ for(String m : runModes) {
+ subDirs.add(INSTALL_PATH_PREFIX + m);
+ }
return subDirs.iterator();
}
+
+ /** Add one folder per child, using given path as prefix, for start
+ * levels which actually provide bundles for the given run mode.
+ */
+ private void addStartLevelSubdirs(Collection<String> children, String path, String runMode) {
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
+ final List<String> bundles = new ArrayList<String>();
+ addBundles(bundles, level.getStartLevel(), runMode);
+ if(!bundles.isEmpty()) {
+ int folderLevel = level.getStartLevel();
+ if(folderLevel== BOOTSTRAP_DEF_START_LEVEL) {
+ folderLevel = ACTUAL_BOOTSTRAP_START_LEVEL;
+ }
+ children.add(path + "/" + folderLevel);
+ }
+ }
+ }
+
+ private Iterator<String> handleInstallPath(String path) {
+ // Path is like
+ // bundles/install.runMode/12
+ // or a subset of that.
+ // Extract optional run mode and start level from that
+ if(path.endsWith("/")) {
+ path = path.substring(0, path.length() - 1);
+ }
+ final String [] parts = path.substring(INSTALL_PATH_PREFIX.length()).split("/");
+ if (parts.length > 2){
+ throw new IllegalStateException("Cannot parse path " + path);
+ }
+ final String runMode = parts[0].length() == 0 ? null : parts[0].substring(1);
+ final String startLevelInfo = parts.length > 1 ? parts[1] : null;
+ Set<String> result = new HashSet<String>();
+
+ if(runMode == null && startLevelInfo == null) {
+ // Root folder: add one subdir per start level that provides bundles
+ addStartLevelSubdirs(result, INSTALL_PATH_PREFIX, null);
+
+ } else if(startLevelInfo == null) {
+ // The root of a run mode folder - one subdir per start
+ // level which actually provides bundles
+ addStartLevelSubdirs(result, path, runMode);
+
+ } else {
+ // A folder that contains bundles
+ try {
+ addBundles(result, Integer.parseInt(startLevelInfo), runMode);
+ } catch (NumberFormatException e) {
+ getLog().warn("Invalid start level info " + startLevelInfo + " in path " + path);
+ }
+ }
+
+ return result.iterator();
+ }
public Iterator<String> getChildren(String path) {
Iterator<String> result = null;
@@ -132,11 +231,17 @@ abstract class BundleListContentProvider implements LaunchpadContentProvider {
} else if (path.equals(CONFIG_PATH_PREFIX)) {
result = handleConfigPath();
} else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
- result = handleBundlePathFolder(path);
+ result = handleBundlesSubfolder(path);
+ } else if (path.startsWith(INSTALL_PATH_PREFIX)) {
+ result = handleInstallPath(path);
} else if (path.equals("resources") ) {
result = handleResourcesRoot();
+ } else if (path.startsWith("file:") ) {
+ // Client looks for files under a file - we have none,
+ // as our file URLs point to Maven artifacts
+ result = EMPTY_STRING_LIST.iterator();
} else {
- getLog().warn("un-handlable " + getClass().getSimpleName() + " path: " + path);
+ getLog().warn("BundleListContentProvider cannot handle path: " + path);
}
return result;
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
index b4c3905..21cbe53 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/BundleListContentProviderTest.java
@@ -27,6 +27,7 @@ import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import org.apache.maven.artifact.Artifact;
@@ -48,7 +49,7 @@ public class BundleListContentProviderTest {
private static BundleList bundleList;
public static final String TEST_BUNDLE_LIST = "test-bundle-list.xml";
- public static final int BUNDLES_IN_TEST_BUNDLE_LIST = 11;
+ public static final int BUNDLES_IN_TEST_BUNDLE_LIST = 13;
private LaunchpadContentProvider provider;
private File resourceProviderRoot;
@@ -114,7 +115,7 @@ public class BundleListContentProviderTest {
Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException {
final Artifact a = Mockito.mock(Artifact.class);
final String fakeName = new StringBuilder()
- .append("/")
+ .append("/FAKE_BUNDLE/")
.append(def.getArtifactId())
.append("/")
.append(def.getStartLevel())
@@ -138,14 +139,17 @@ public class BundleListContentProviderTest {
if(expected.length == 0) {
assertTrue("Expecting no children for " + path, it == null || !it.hasNext());
} else {
+ assertNotNull("Expecting non-null iterator for " + path, it);
while(it.hasNext()) {
kids.add(it.next());
}
for(String exp : expected) {
- assertTrue("Expecting " + exp + " in children of " + path + " (result=" + kids + ")", kids.contains(exp));
+ assertTrue("Expecting " + exp + " in children of " + path + " (result=" + kids + ")",
+ kids.contains(exp));
}
}
- assertEquals("Expecting the correct number of children for " + path, expected.length, kids.size());
+ assertEquals("Expecting the correct number of children for " + path + " (result=" + kids + ")",
+ expected.length, kids.size());
}
@Test
@@ -162,16 +166,53 @@ public class BundleListContentProviderTest {
assertChildren("resources",
"resources/bundles",
"resources/corebundles",
- "resources/config");
+ "resources/config",
+ "resources/install",
+ "resources/install.dev",
+ "resources/install.test",
+ "resources/install.oak",
+ "resources/install.jackrabbit");
}
@Test
public void testBundles() {
assertChildren("resources/bundles",
- "resources/bundles/0/",
- "resources/bundles/1/",
- "resources/bundles/5/",
- "resources/bundles/15/");
+ "resources/bundles/1/");
+ }
+
+ @Test
+ public void testInstall() {
+ assertChildren("resources/install",
+ "resources/install/0",
+ "resources/install/1",
+ "resources/install/5",
+ "resources/install/15");
+ }
+
+ @Test
+ public void testInstallDev() {
+ assertChildren("resources/install.dev",
+ "resources/install.dev/0",
+ "resources/install.dev/5");
+ }
+
+ @Test
+ public void testInstallTest() {
+ assertChildren("resources/install.test",
+ "resources/install.test/0",
+ "resources/install.test/5");
+ }
+
+ @Test
+ public void testInstallOak() {
+ assertChildren("resources/install.oak",
+ "resources/install.oak/15");
+ }
+
+ @Test
+ public void testInstallJackrabbit() {
+ assertChildren("resources/install.jackrabbit",
+ "resources/install.jackrabbit/15");
}
@Test
@@ -194,34 +235,68 @@ public class BundleListContentProviderTest {
}
@Test
- public void testBundles0() {
- assertChildren("resources/bundles/0",
- "file:/commons-io/0/null",
- "file:/commons-fileupload/0/null",
- "file:/commons-collections/0/null",
- "file:/org.apache.sling.installer.provider.jcr/0/test,dev");
+ public void testIgnoredNonBootstrapBundles() {
+ // All these start levels do not provide resources/bundles anymore - moved to resources/install
+ for(int i=0; i <= 30; i++) {
+ if(i == 1) {
+ continue;
+ }
+ final String path ="resources/bundles/" + i;
+ assertNull("Expecting no resources under " + path, provider.getChildren(path));
+ }
+ }
+
+ @Test
+ public void testInstall0() {
+ assertChildren("resources/install/0",
+ "file:/FAKE_BUNDLE/commons-io/0/null",
+ "file:/FAKE_BUNDLE/commons-fileupload/0/null",
+ "file:/FAKE_BUNDLE/commons-collections/0/null");
}
@Test
- public void testBundles1() {
+ public void testBootstrapBundles() {
assertChildren("resources/bundles/1",
- "file:/slf4j-api/1/null",
- "file:/org.apache.sling.commons.log/1/null");
+ "file:/FAKE_BUNDLE/slf4j-api/-1/null",
+ "file:/FAKE_BUNDLE/org.apache.sling.commons.log/-1/null");
+ }
+
+ @Test
+ public void testInstall5() {
+ assertChildren("resources/install/5",
+ "file:/FAKE_BUNDLE/five.norunmode/5/null");
}
@Test
- public void testBundles5() {
- assertChildren("resources/bundles/5",
- "file:/org.apache.sling.extensions.webconsolebranding/5/dev",
- "file:/org.apache.sling.extensions.webconsolesecurityprovider/5/test");
+ public void testInstall5Dev() {
+ assertChildren("resources/install.dev/5",
+ "file:/FAKE_BUNDLE/org.apache.sling.extensions.webconsolebranding/5/dev");
}
@Test
- public void testBundles15() {
- assertChildren("resources/bundles/15",
- "file:/org.apache.sling.jcr.oak.server/15/oak",
- "file:/guava/15/jackrabbit",
- "file:/jsr305/15/oak,jackrabbit");
+ public void testInstall5Test() {
+ assertChildren("resources/install.test/5",
+ "file:/FAKE_BUNDLE/org.apache.sling.extensions.webconsolesecurityprovider/5/test");
+ }
+
+ @Test
+ public void testInstall15() {
+ assertChildren("resources/install/15",
+ "file:/FAKE_BUNDLE/fifteen.norunmode/15/null");
+ }
+
+ @Test
+ public void testInstall15Oak() {
+ assertChildren("resources/install.oak/15",
+ "file:/FAKE_BUNDLE/org.apache.sling.jcr.oak.server/15/oak",
+ "file:/FAKE_BUNDLE/jsr305/15/oak,jackrabbit");
+ }
+
+ @Test
+ public void testInstall15Jackrabbit() {
+ assertChildren("resources/install.jackrabbit/15",
+ "file:/FAKE_BUNDLE/guava/15/jackrabbit",
+ "file:/FAKE_BUNDLE/jsr305/15/oak,jackrabbit");
}
@Test
@@ -271,4 +346,39 @@ public class BundleListContentProviderTest {
assertNull(provider.getChildren("/FOO/bar"));
}
+ @Test
+ public void testAllBundlesFound() {
+ final List<String> allResources = new LinkedList<String>();
+ addRecursively(allResources, "resources");
+ final List<String> bundles = new LinkedList<String>();
+ for(String r : allResources) {
+ if(r.contains("FAKE_BUNDLE")) {
+ bundles.add(r);
+ }
+ }
+
+ // Bundles that have two run modes appear in two folders, we have two of those
+ // with two run modes each
+ final int expected = BUNDLES_IN_TEST_BUNDLE_LIST + 2;
+ assertEquals("Expecting the exact number of test bundles to be found", expected, bundles.size());
+ }
+
+ @Test
+ public void testFile() {
+ assertChildren("file:/something");
+ }
+
+ private void addRecursively(List<String> resources, String path) {
+ if(path.endsWith("/")) {
+ path = path.substring(0, path.length() - 1);
+ }
+ resources.add(path);
+ final Iterator<String> it = provider.getChildren(path);
+ if(it != null) {
+ while(it.hasNext()) {
+ addRecursively(resources, it.next());
+ }
+ }
+ }
+
}
diff --git a/src/test/resources/test-bundle-list.xml b/src/test/resources/test-bundle-list.xml
index 8c3b87c..43b7da5 100644
--- a/src/test/resources/test-bundle-list.xml
+++ b/src/test/resources/test-bundle-list.xml
@@ -51,6 +51,11 @@
<version>1.0.0</version>
<runModes>test</runModes>
</bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>five.norunmode</artifactId>
+ <version>1.0.0</version>
+ </bundle>
</startLevel>
<startLevel level="15">
@@ -72,5 +77,10 @@
<version>2.0.0</version>
<runModes>oak,jackrabbit</runModes>
</bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>fifteen.norunmode</artifactId>
+ <version>1.0.0</version>
+ </bundle>
</startLevel>
</bundles>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.