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 2022/07/01 10:33:00 UTC

[sling-feature-launcher-maven-plugin] branch master updated (e0e1dd4 -> 4f40833)

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

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git


    from e0e1dd4  Bump httpclient from 4.5.12 to 4.5.13 in /src/it/simple-it
     new 4caee24  SLING-11378 - Execution fails if no launcher arguments are defined
     new 4f40833  SLING-11378 - Execution fails if no launcher arguments are defined

The 2 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.


Summary of changes:
 src/it/{simple-it => empty-config-it}/pom.xml      | 82 +---------------------
 .../src/main/features/model.json                   |  0
 .../{simple-it => empty-config-it}/verify.groovy   |  0
 .../sling/maven/feature/launcher/Launch.java       |  2 +-
 .../maven/feature/launcher/LauncherArguments.java  |  2 +-
 .../sling/maven/feature/launcher/StartMojo.java    |  9 ++-
 6 files changed, 9 insertions(+), 86 deletions(-)
 copy src/it/{simple-it => empty-config-it}/pom.xml (51%)
 copy src/it/{simple-it => empty-config-it}/src/main/features/model.json (100%)
 copy src/it/{simple-it => empty-config-it}/verify.groovy (100%)


[sling-feature-launcher-maven-plugin] 02/02: SLING-11378 - Execution fails if no launcher arguments are defined

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git

commit 4f40833e8ccf421709768c462582c94f36841e46
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Jul 1 12:25:55 2022 +0200

    SLING-11378 - Execution fails if no launcher arguments are defined
    
    Add an IT that verifies an empty config does not trigger any errors.
---
 src/it/empty-config-it/pom.xml                     | 84 ++++++++++++++++++++++
 .../empty-config-it/src/main/features/model.json   | 14 ++++
 src/it/empty-config-it/verify.groovy               | 21 ++++++
 3 files changed, 119 insertions(+)

diff --git a/src/it/empty-config-it/pom.xml b/src/it/empty-config-it/pom.xml
new file mode 100644
index 0000000..4ec73dd
--- /dev/null
+++ b/src/it/empty-config-it/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.sling</groupId>
+    <artifactId>empty-config-it</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <description>An IT verifying that passing an empty config triggers no errors.</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>slingfeature-maven-plugin</artifactId>
+                <version>1.3.6</version>
+                <extensions>true</extensions>
+                <!-- TODO - seems we can't attach non-aggregates -->
+                <configuration>
+                    <aggregates>
+                        <aggregate>
+                            <classifier>main</classifier>
+                            <filesInclude>model.json</filesInclude>
+                        </aggregate>
+                    </aggregates>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>attach-features</goal>
+                            <goal>aggregate-features</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>@project.groupId@</groupId>
+                <artifactId>@project.artifactId@</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <launches>
+                        <launch>
+                            <id>model</id>
+                            <feature>
+                                <groupId>org.apache.sling</groupId>
+                                <artifactId>empty-config-it</artifactId>
+                                <version>1.0-SNAPSHOT</version>
+                                <classifier>main</classifier>
+                                <type>slingosgifeature</type>
+                            </feature>
+                            <startTimeoutSeconds>180</startTimeoutSeconds>
+                        </launch>
+                    </launches>
+                    <toLaunch>
+                    </toLaunch>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>start</goal>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/src/it/empty-config-it/src/main/features/model.json b/src/it/empty-config-it/src/main/features/model.json
new file mode 100644
index 0000000..ee05e71
--- /dev/null
+++ b/src/it/empty-config-it/src/main/features/model.json
@@ -0,0 +1,14 @@
+{
+  "id":"${project.groupId}:${project.artifactId}:model:${project.version}",
+  "bundles": [
+    "org.apache.felix/org.apache.felix.scr/2.1.20",
+    "org.apache.felix/org.apache.felix.log/1.2.2",
+    "org.apache.felix/org.apache.felix.configadmin/1.9.16",
+    "org.osgi/org.osgi.util.promise/1.1.1",
+    "org.osgi/org.osgi.util.function/1.1.0",
+    "org.osgi/org.osgi.util.converter/1.0.1",
+    "org.apache.commons/commons-lang3/3.9",
+    "org.apache.felix/org.apache.felix.http.jetty/4.0.16",
+    "org.apache.felix/org.apache.felix.http.servlet-api/1.1.2"
+  ]
+}
\ No newline at end of file
diff --git a/src/it/empty-config-it/verify.groovy b/src/it/empty-config-it/verify.groovy
new file mode 100644
index 0000000..e9b7465
--- /dev/null
+++ b/src/it/empty-config-it/verify.groovy
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+File touchFile = new File( basedir, "build.log" );
+
+assert touchFile.isFile()


[sling-feature-launcher-maven-plugin] 01/02: SLING-11378 - Execution fails if no launcher arguments are defined

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git

commit 4caee2462fb769349258c7f8cf9e29604c2eab51
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Jun 10 17:21:50 2022 +0200

    SLING-11378 - Execution fails if no launcher arguments are defined
    
    Add default values to some fields to prevent NPEs.
---
 .../java/org/apache/sling/maven/feature/launcher/Launch.java     | 2 +-
 .../apache/sling/maven/feature/launcher/LauncherArguments.java   | 2 +-
 .../java/org/apache/sling/maven/feature/launcher/StartMojo.java  | 9 ++++-----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java b/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
index d3a2fa7..a0c3d10 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
@@ -31,7 +31,7 @@ public class Launch {
 
     private String id;
     private Dependency feature;
-    private LauncherArguments launcherArguments;
+    private LauncherArguments launcherArguments = new LauncherArguments();
     private int startTimeoutSeconds = 30;
     private boolean skip = false;
     private Map<String,String> environmentVariables = new HashMap<>();
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java b/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
index 07617fd..3693172 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
@@ -23,7 +23,7 @@ import java.util.Map;
 
 public class LauncherArguments {
 
-    private String[] vmOptions = null;
+    private String[] vmOptions = new String[0];
     private Map<String, String> frameworkProperties = new HashMap<>();
     private Map<String, String> variables = new HashMap<>();
     
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
index b25849e..6676dc7 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
@@ -96,6 +96,7 @@ public class StartMojo extends AbstractMojo {
     @Component
     private ProcessTracker processes;
     
+    @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
 
         Artifact launcherArtifact = new DefaultArtifact("org.apache.sling:org.apache.sling.feature.launcher:" + featureLauncherVersion);
@@ -133,11 +134,9 @@ public class StartMojo extends AbstractMojo {
                 args.add(javahome + File.separatorChar + "bin" + File.separatorChar + "java");
                 // SLING-9994 - if any extra vm options were supplied, apply them here
                 String[] vmOptions = launch.getLauncherArguments().getVmOptions();
-                if (vmOptions != null) {
-                    for (String vmOption : vmOptions) {
-                        if (vmOption != null && !vmOption.isEmpty()) {
-                            args.add(vmOption);
-                        }
+                for (String vmOption : vmOptions) {
+                    if (vmOption != null && !vmOption.isEmpty()) {
+                        args.add(vmOption);
                     }
                 }
                 args.add("-jar");