From 48442ea7be20a2ec0f9a9dac59c0b24840f2f71e Mon Sep 17 00:00:00 2001 From: Andrea Tarocchi Date: Sat, 4 Aug 2018 14:59:44 +0200 Subject: [PATCH] Added integration test for launcher template. --- pom.xml | 44 +++++++++++++++ .../boosters/rest/http/HttpRequestKT.java | 54 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestKT.java diff --git a/pom.xml b/pom.xml index 79fe83b..ab7389b 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,10 @@ 3.5.40 + + + 1.17.1 + 1.4.0.Final @@ -36,6 +40,13 @@ pom import + + org.arquillian.cube + arquillian-cube-bom + ${arquillian.cube.version} + import + pom + @@ -104,6 +115,28 @@ camel-test test + + org.arquillian.cube + arquillian-cube-requirement + test + + + org.arquillian.cube + arquillian-cube-openshift + + + org.apache.httpcomponents + httpclient-osgi + + + test + + + org.jboss.arquillian.junit + arquillian-junit-standalone + ${arquillian.version} + test + @@ -127,6 +160,17 @@ 1.8 + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + true + + + **/*KT.java + + + org.springframework.boot spring-boot-maven-plugin diff --git a/src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestKT.java b/src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestKT.java new file mode 100644 index 0000000..965220a --- /dev/null +++ b/src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestKT.java @@ -0,0 +1,54 @@ +/* + * Copyright 2005-2016 Red Hat, Inc. + * + * Red Hat 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. + */ + +package com.redhat.fuse.boosters.rest.http; + +import io.fabric8.kubernetes.api.model.v4_0.HasMetadata; +import io.fabric8.openshift.clnt.v4_0.OpenShiftClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.HashMap; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +@RunWith(Arquillian.class) +public class HttpRequestKT { + + @ArquillianResource + OpenShiftClient client; + + @Test + public void test_at_least_one_pod() throws Exception { + File template = new File(".openshiftio/application.yaml"); + assertTrue(template.exists()); + HashMap templateParameters = new HashMap(){ + {put("SOURCE_REPOSITORY_URL","https://github.com/jboss-fuse/fuse-rest-http-booster");} + }; + List resources = client.templates().load(template).process(templateParameters).getItems(); + + for(HasMetadata res : resources){ + client.resource(res).createOrReplace(); + } + + assertEquals("fuse-rest-http-booster", client.buildConfigs().list().getItems().get(0).getMetadata().getName()); + } +}