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

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


The following commit(s) were added to refs/heads/master by this push:
     new f77abed  Bugfix/sling 9518 failing it (#55)
f77abed is described below

commit f77abed5610b4c40102500981aa6fd3f3c4d2b3a
Author: Konrad Windszus <[email protected]>
AuthorDate: Mon Jun 15 07:56:20 2020 +0200

    Bugfix/sling 9518 failing it (#55)
    
    * SING-9518 add failing IT
    
    * several smaller fixes in other ITs
---
 src/it/apis-jar-cnd/invoker.properties             | 17 ++++++++++
 .../pom.xml                                        |  3 +-
 src/it/apis-jar-cnd/src/main/features/main.json    |  8 +++++
 .../verify.bsh                                     | 39 ++++++----------------
 src/it/apis-jar-wrapped-flattened-classes/pom.xml  |  3 +-
 .../apis-jar-wrapped-flattened-classes/verify.bsh  |  4 +--
 src/it/apis-jar-wrapper-bundle/verify.bsh          |  6 ++--
 src/it/apis-jar/pom.xml                            |  4 +--
 8 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/src/it/apis-jar-cnd/invoker.properties 
b/src/it/apis-jar-cnd/invoker.properties
new file mode 100644
index 0000000..4a5809a
--- /dev/null
+++ b/src/it/apis-jar-cnd/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+
+invoker.goals = clean package
+invoker.debug = true
diff --git a/src/it/apis-jar-wrapped-flattened-classes/pom.xml 
b/src/it/apis-jar-cnd/pom.xml
similarity index 94%
copy from src/it/apis-jar-wrapped-flattened-classes/pom.xml
copy to src/it/apis-jar-cnd/pom.xml
index 1ecf87e..e3f4705 100644
--- a/src/it/apis-jar-wrapped-flattened-classes/pom.xml
+++ b/src/it/apis-jar-cnd/pom.xml
@@ -42,8 +42,7 @@
             <filesInclude>**/*.json</filesInclude>
           </selection>
           <includeResources>
-            <includeResource>*.cnd</includeResource>
-            <includeResource>*.tld</includeResource>
+            <includeResource>**/*.cnd</includeResource>
           </includeResources>
         </configuration>
       </plugin>
diff --git a/src/it/apis-jar-cnd/src/main/features/main.json 
b/src/it/apis-jar-cnd/src/main/features/main.json
new file mode 100644
index 0000000..a91c5ea
--- /dev/null
+++ b/src/it/apis-jar-cnd/src/main/features/main.json
@@ -0,0 +1,8 @@
+{
+  "id":"org.apache.sling:slingfeature-maven-plugin-test:1.0.0-SNAPSHOT",
+  "bundles":[
+    {
+      "id":"org.apache.sling:org.apache.sling.i18n:2.5.14"
+    }
+  ]
+}
diff --git a/src/it/apis-jar-wrapper-bundle/verify.bsh 
b/src/it/apis-jar-cnd/verify.bsh
similarity index 53%
copy from src/it/apis-jar-wrapper-bundle/verify.bsh
copy to src/it/apis-jar-cnd/verify.bsh
index d017b0a..0ffd982 100644
--- a/src/it/apis-jar-wrapper-bundle/verify.bsh
+++ b/src/it/apis-jar-cnd/verify.bsh
@@ -26,44 +26,28 @@ import org.codehaus.plexus.util.*;
 
         // base
 
-        File baseApiJar = new File(apisJarDir, 
"slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar");
+        File baseApiJar = new File(apisJarDir, 
"slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-global-apis.jar");
         if (!baseApiJar.exists()) {
             System.out.println("FAILED!");
-            System.out.println("File '" + file + "' not found");
+            System.out.println("File '" + baseApiJar + "' not found");
             return false;
         }
 
         JarFile jarFile = null;
-        try {
-            jarFile = new JarFile(baseApiJar);
-            Manifest manifest= jarFile.getManifest();
-            String exportPackageHeader = 
manifest.getMainAttributes().getValue("Export-Package");
+        // cannot use try..finally due to 
https://github.com/beanshell/beanshell/issues/367
+        jarFile = new JarFile(baseApiJar);
+        Manifest manifest= jarFile.getManifest();
+        String nodeTypes = 
manifest.getMainAttributes().getValue("Sling-Nodetypes");
 
-            if 
(exportPackageHeader.indexOf("com.google.gson.stream;version=\"2.8.4\"") < 0) {
+        for (String expectedEntry : nodeTypes.split(",")) {
+            if (jarFile.getJarEntry(expectedEntry) == null) {
                 System.out.println("FAILED!");
-                System.out.println("Export-Package header '" + 
exportPackageHeader + "' does not contain 
'com.google.gson.stream;version=\"2.8.4\"' in bundle " + file);
-                return false;
-            }
-
-            for (String expectedEntry : new String[] {
-                "com/google/gson/stream/JsonReader.class",
-                "com/google/gson/stream/JsonScope.class",
-                "com/google/gson/stream/JsonToken.class",
-                "com/google/gson/stream/JsonWriter.class",
-                "com/google/gson/stream/MalformedJsonException.class"
-            }) {
-                if (jarFile.getJarEntry(expectedEntry) == null) {
-                    System.out.println("FAILED!");
-                    System.out.println("Entry '" + expectedEntry + "' does not 
exist in bundle " + file);
-                    return false;
-                }
-            }
-        } finally {
-            if (jarFile != null) {
+                System.out.println("Entry '" + expectedEntry + "' does not 
exist in bundle '" + baseApiJar + "' but it is referenced from 
Sling-Nodetypes");
                 jarFile.close();
+                return false;
             }
         }
-
+        jarFile.close();
         return true;
     }
 
@@ -74,4 +58,3 @@ import org.codehaus.plexus.util.*;
         return false;
     }
 
-    return true;
diff --git a/src/it/apis-jar-wrapped-flattened-classes/pom.xml 
b/src/it/apis-jar-wrapped-flattened-classes/pom.xml
index 1ecf87e..e3f4705 100644
--- a/src/it/apis-jar-wrapped-flattened-classes/pom.xml
+++ b/src/it/apis-jar-wrapped-flattened-classes/pom.xml
@@ -42,8 +42,7 @@
             <filesInclude>**/*.json</filesInclude>
           </selection>
           <includeResources>
-            <includeResource>*.cnd</includeResource>
-            <includeResource>*.tld</includeResource>
+            <includeResource>**/*.cnd</includeResource>
           </includeResources>
         </configuration>
       </plugin>
diff --git a/src/it/apis-jar-wrapped-flattened-classes/verify.bsh 
b/src/it/apis-jar-wrapped-flattened-classes/verify.bsh
index a94a0cd..96a4705 100644
--- a/src/it/apis-jar-wrapped-flattened-classes/verify.bsh
+++ b/src/it/apis-jar-wrapped-flattened-classes/verify.bsh
@@ -29,7 +29,7 @@ import org.codehaus.plexus.util.*;
         File baseApiJar = new File(apisJarDir, 
"slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar");
         if (!baseApiJar.exists()) {
             System.out.println("FAILED!");
-            System.out.println("File '" + file + "' not found");
+            System.out.println("File '" + baseApiJar + "' not found");
             return false;
         }
 
@@ -42,7 +42,7 @@ import org.codehaus.plexus.util.*;
 
             if 
(exportPackageHeader.indexOf("org.apache.lucene.analysis.standard") < 0) {
                 System.out.println("FAILED!");
-                System.out.println("Export-Package header '" + 
exportPackageHeader + "' does not contain 'org.apache.lucene.analysis.standard' 
in bundle " + file);
+                System.out.println("Export-Package header '" + 
exportPackageHeader + "' does not contain 'org.apache.lucene.analysis.standard' 
in bundle " + baseApiJar);
                 return false;
             }
 
diff --git a/src/it/apis-jar-wrapper-bundle/verify.bsh 
b/src/it/apis-jar-wrapper-bundle/verify.bsh
index d017b0a..de37f51 100644
--- a/src/it/apis-jar-wrapper-bundle/verify.bsh
+++ b/src/it/apis-jar-wrapper-bundle/verify.bsh
@@ -29,7 +29,7 @@ import org.codehaus.plexus.util.*;
         File baseApiJar = new File(apisJarDir, 
"slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar");
         if (!baseApiJar.exists()) {
             System.out.println("FAILED!");
-            System.out.println("File '" + file + "' not found");
+            System.out.println("File '" + baseApiJar + "' not found");
             return false;
         }
 
@@ -41,7 +41,7 @@ import org.codehaus.plexus.util.*;
 
             if 
(exportPackageHeader.indexOf("com.google.gson.stream;version=\"2.8.4\"") < 0) {
                 System.out.println("FAILED!");
-                System.out.println("Export-Package header '" + 
exportPackageHeader + "' does not contain 
'com.google.gson.stream;version=\"2.8.4\"' in bundle " + file);
+                System.out.println("Export-Package header '" + 
exportPackageHeader + "' does not contain 
'com.google.gson.stream;version=\"2.8.4\"' in bundle " + baseApiJar);
                 return false;
             }
 
@@ -54,7 +54,7 @@ import org.codehaus.plexus.util.*;
             }) {
                 if (jarFile.getJarEntry(expectedEntry) == null) {
                     System.out.println("FAILED!");
-                    System.out.println("Entry '" + expectedEntry + "' does not 
exist in bundle " + file);
+                    System.out.println("Entry '" + expectedEntry + "' does not 
exist in bundle " + baseApiJar);
                     return false;
                 }
             }
diff --git a/src/it/apis-jar/pom.xml b/src/it/apis-jar/pom.xml
index 0f803ea..f9d0d2c 100644
--- a/src/it/apis-jar/pom.xml
+++ b/src/it/apis-jar/pom.xml
@@ -42,8 +42,8 @@
             <filesInclude>**/*.json</filesInclude>
           </selection>
           <includeResources>
-            <includeResource>*.cnd</includeResource>
-            <includeResource>*.tld</includeResource>
+            <includeResource>**/*.cnd</includeResource>
+            <includeResource>**/*.tld</includeResource>
           </includeResources>
           <javadocLinks>
             <javadocLink>https://osgi.org/javadoc/r6/core/</javadocLink>

Reply via email to