You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2017/09/12 08:42:28 UTC

[1/2] karaf git commit: [KARAF-4417] Display a summary for the verify goal

Repository: karaf
Updated Branches:
  refs/heads/master e1f0db079 -> 0064e6fb2


[KARAF-4417] Display a summary for the verify goal


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/aeff7f2f
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/aeff7f2f
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/aeff7f2f

Branch: refs/heads/master
Commit: aeff7f2f27d29bf115091928270d44ad80a5faf6
Parents: 7454bbc
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Sep 12 09:22:33 2017 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Sep 12 09:22:33 2017 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/tooling/VerifyMojo.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/aeff7f2f/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
index 5ed7522..3d008c9 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
@@ -37,6 +37,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -331,20 +332,23 @@ public class VerifyMojo extends MojoSupport {
         for (String fmk : framework) {
             properties.put("feature.framework." + fmk, fmk);
         }
-        List<Exception> failures = new ArrayList<>();
+        Set<String> successes = new LinkedHashSet<>();
+        Set<String> ignored = new LinkedHashSet<>();
+        Map<String, Exception> failures = new LinkedHashMap<>();
         for (Feature feature : featuresToTest) {
+            String id = feature.getId();
             try {
-                String id = feature.getName() + "/" + feature.getVersion();
                 verifyResolution(new CustomDownloadManager(resolver, executor),
                                  repositories, Collections.singleton(id), properties);
+                successes.add(id);
                 getLog().info("Verification of feature " + id + " succeeded");
             } catch (Exception e) {
-                if (e.getCause() instanceof ResolutionException) {
+                if (e.getCause() instanceof ResolutionException || !getLog().isDebugEnabled()) {
                     getLog().warn(e.getMessage());
                 } else {
                     getLog().warn(e);
                 }
-                failures.add(e);
+                failures.put(id, e);
                 if ("first".equals(fail)) {
                     throw e;
                 }
@@ -353,9 +357,11 @@ public class VerifyMojo extends MojoSupport {
                 Set<String> ids = new LinkedHashSet<>();
                 ids.add(feature.getId());
                 ids.addAll(cond.getCondition());
+                String cid = String.join("+", ids);
                 try {
                     verifyResolution(manager, repositories, ids, properties);
-                    getLog().info("Verification of feature " + ids + " succeeded");
+                    successes.add(cid);
+                    getLog().info("Verification of feature " + cid + " succeeded");
                 } catch (Exception e) {
                     if (ignoreMissingConditions && e.getCause() instanceof ResolutionException) {
                         boolean ignore = true;
@@ -366,25 +372,31 @@ public class VerifyMojo extends MojoSupport {
                                     && cond.getCondition().contains(req.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE).toString()));
                         }
                         if (ignore) {
-                            getLog().warn("Feature resolution failed for " + ids
+                            ignored.add(cid);
+                            getLog().warn("Feature resolution failed for " + cid
                                     + "\nMessage: " + e.getCause().getMessage());
                             continue;
                         }
                     }
-                    if (e.getCause() instanceof ResolutionException) {
+                    if (e.getCause() instanceof ResolutionException || !getLog().isDebugEnabled()) {
                         getLog().warn(e.getMessage());
                     } else {
                         getLog().warn(e);
                     }
-                    failures.add(e);
+                    failures.put(cid, e);
                     if ("first".equals(fail)) {
                         throw e;
                     }
                 }
             }
         }
+        int nb = successes.size() + ignored.size() + failures.size();
+        getLog().info("Features verified: " + nb + ", failures: " + failures.size() + ", ignored: " + ignored.size());
+        if (!failures.isEmpty()) {
+            getLog().info("Failures: " + String.join(", ", failures.keySet()));
+        }
         if ("end".equals(fail) && !failures.isEmpty()) {
-            throw new MojoExecutionException("Verification failures", new MultiException("Verification failures", failures));
+            throw new MojoExecutionException("Verification failures", new MultiException("Verification failures", new ArrayList<>(failures.values())));
         }
     }
 


[2/2] karaf git commit: [KARAF-4417] This closes #358

Posted by jb...@apache.org.
[KARAF-4417] This closes #358


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/0064e6fb
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/0064e6fb
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/0064e6fb

Branch: refs/heads/master
Commit: 0064e6fb25b5c1d6107eec7434bc8ed743ece1a0
Parents: e1f0db0 aeff7f2
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Sep 12 10:42:19 2017 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Sep 12 10:42:19 2017 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/tooling/VerifyMojo.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------