sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [sling-scriptingbundle-maven-plugin] 03/17: Register services using extended bundles bundlecontext and only register for required methods.
Date Mon, 10 Dec 2018 12:01:08 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 3123bcb6f706ce22ccc6a86d5e174cc2b927724c
Author: Karl Pauls <pauls@apache.org>
AuthorDate: Mon Apr 16 15:45:20 2018 +0200

    Register services using extended bundles bundlecontext and only register for required
methods.
---
 .../sling/scripting/maven/plugin/ScriptingMavenPlugin.java    | 11 +++++++----
 .../scripting/maven/plugin/ScriptingMavenPluginTest.java      |  6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPlugin.java
b/src/main/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPlugin.java
index 701cd70..1a49bcb 100644
--- a/src/main/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPlugin.java
+++ b/src/main/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPlugin.java
@@ -114,7 +114,10 @@ public class ScriptingMavenPlugin extends AbstractMojo
                     }
                 }
             }
-            capability += ";sling.resourceType.extensions:List<String>=\"" + script.extension.replace("\"",
"\\\"") + "\"";
+            if (script.extension != null)
+            {
+                capability += ";sling.resourceType.extensions:List<String>=\"" + script.extension.replace("\"",
"\\\"") + "\"";
+            }
 
             if (script.method != null)
             {
@@ -177,14 +180,14 @@ public class ScriptingMavenPlugin extends AbstractMojo
         {
             result.extension = result.name.substring(idx + 1);
             result.name = result.name.substring(0, idx);
-            if (result.extension.isEmpty())
+            if (result.extension.isEmpty() || result.extension.equalsIgnoreCase("html"))
             {
-                result.extension = "html";
+                result.extension = null;
             }
         }
         else
         {
-            result.extension = "html";
+            result.extension = null;
         }
 
         idx = result.name.indexOf('.');
diff --git a/src/test/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPluginTest.java
b/src/test/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPluginTest.java
index e6a4262..b6ec709 100644
--- a/src/test/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPluginTest.java
+++ b/src/test/java/org/apache/sling/scripting/maven/plugin/ScriptingMavenPluginTest.java
@@ -49,7 +49,7 @@ public class ScriptingMavenPluginTest
         Assert.assertNull("1.0.0", script.version);
         Assert.assertEquals("foo", script.name);
         Assert.assertNull(script.method);
-        Assert.assertEquals("html", script.extension);
+        Assert.assertNull(script.extension);
         Assert.assertNull(script.scriptExtension);
     }
 
@@ -64,7 +64,7 @@ public class ScriptingMavenPluginTest
         Assert.assertEquals("1.2.0", script.version);
         Assert.assertEquals("", script.name);
         Assert.assertEquals("POST", script.method);
-        Assert.assertEquals("html", script.extension);
+        Assert.assertNull(script.extension);
         Assert.assertEquals("jsp", script.scriptExtension);
     }
 
@@ -79,7 +79,7 @@ public class ScriptingMavenPluginTest
         Assert.assertEquals("1.2.0", script.version);
         Assert.assertEquals("",script.name);
         Assert.assertEquals("POST", script.method);
-        Assert.assertEquals("html", script.extension);
+        Assert.assertNull(script.extension);
         Assert.assertNull(script.scriptExtension);
     }
 }


Mime
View raw message