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 2019/11/25 15:23:05 UTC

[karaf-cave] branch master updated: [KARAF-6528] Minor update on test coverage

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

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f20036  [KARAF-6528] Minor update on test coverage
     new 4edb677  Merge pull request #35 from jbonofre/KARAF-6528
3f20036 is described below

commit 3f20036de3bdfb43b2d0fcc74b0e5f3c0bf9d751
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Mon Nov 25 15:54:28 2019 +0100

    [KARAF-6528] Minor update on test coverage
---
 .../cave/itest/repository/FeaturesGatewayTest.java | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/itest/src/test/java/org/apache/karaf/cave/itest/repository/FeaturesGatewayTest.java b/itest/src/test/java/org/apache/karaf/cave/itest/repository/FeaturesGatewayTest.java
index 7a1ba0e..47bdbf8 100644
--- a/itest/src/test/java/org/apache/karaf/cave/itest/repository/FeaturesGatewayTest.java
+++ b/itest/src/test/java/org/apache/karaf/cave/itest/repository/FeaturesGatewayTest.java
@@ -27,6 +27,10 @@ import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.stream.Stream;
 
 @RunWith(PaxExam.class)
@@ -61,6 +65,28 @@ public class FeaturesGatewayTest extends KarafTestSupport {
         System.out.println("==== HTTP List ====");
         System.out.println(httpList);
         assertContains("/cave/features-gateway/api", httpList);
+
+        // add camel features in the gateway
+        System.out.println(executeCommand("cave:features-gateway-register mvn:org.apache.camel.karaf/apache-camel/2.24.2/xml/features"));
+        String gatewayList = executeCommand("cave:features-gateway-list");
+        System.out.println(gatewayList);
+        assertContains("mvn:org.apache.camel.karaf/apache-camel/2.24.2/xml/features", gatewayList);
+
+        // get the gateway features XML
+        URL url = new URL("http://localhost:" + getHttpPort() + "/cave/features-gateway-repository");
+        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
+        urlConnection.setDoInput(true);
+        urlConnection.setDoOutput(true);
+        urlConnection.setRequestMethod("GET");
+        StringBuilder builder = new StringBuilder();
+        try (BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) {
+            String line;
+            while ((line = reader.readLine()) != null) {
+                builder.append(line).append("\n");
+            }
+        }
+        System.out.println(builder.toString());
+        assertContains("mvn:org.apache.camel.karaf/apache-camel/2.24.2/xml/features", builder.toString());
     }
 
 }