initial commit with apps from course repo
This commit is contained in:
17
camel-timer/.gitignore
vendored
Normal file
17
camel-timer/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
target
|
||||
.idea
|
||||
*.iml
|
||||
*.im
|
||||
*.ipr
|
||||
*.iws
|
||||
overlays
|
||||
.DS_Store
|
||||
.settings
|
||||
*.swp
|
||||
*.log
|
||||
.project
|
||||
.classpath
|
||||
*.fmd
|
||||
.cache
|
||||
dependency-reduced-pom.xml
|
||||
.vagrant/
|
||||
149
camel-timer/pom.xml
Normal file
149
camel-timer/pom.xml
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.redhat.training</groupId>
|
||||
<artifactId>camel-timer</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<name>Red Hat Training :: Fabric8 :: Spring-Boot :: Camel</name>
|
||||
<description>Spring Boot example running a Camel route with Fabric8</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
|
||||
<fabric8.version>2.3.6</fabric8.version>
|
||||
<spring-boot.version>1.5.4.RELEASE</spring-boot.version>
|
||||
<arquillian-cube.version>1.9.0</arquillian-cube.version>
|
||||
<assertj.version>2.4.1</assertj.version>
|
||||
<fabric8.maven.plugin.version>3.1.80.redhat-000019</fabric8.maven.plugin.version>
|
||||
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
|
||||
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-project-bom-camel-spring-boot</artifactId>
|
||||
<version>${fabric8.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.arquillian.cube</groupId>
|
||||
<artifactId>arquillian-cube-bom</artifactId>
|
||||
<version>${arquillian-cube.version}</version>
|
||||
<scope>import</scope>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${assertj.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spark-rest</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian.junit</groupId>
|
||||
<artifactId>arquillian-junit-container</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.arquillian.cube</groupId>
|
||||
<artifactId>arquillian-cube-openshift</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>kubernetes-assertions</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<argLine>-DenableImageStreamDetection=true</argLine>
|
||||
<excludes>
|
||||
<exclude>**/*KT.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${fabric8.maven.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>resource</goal>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
15
camel-timer/src/main/fabric8/deployment.yml
Normal file
15
camel-timer/src/main/fabric8/deployment.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
-
|
||||
resources:
|
||||
requests:
|
||||
cpu: "0.2"
|
||||
# memory: 256Mi
|
||||
limits:
|
||||
cpu: "1.0"
|
||||
# memory: 256Mi
|
||||
env:
|
||||
- name: SPRING_APPLICATION_JSON
|
||||
value: '{"server":{"tomcat":{"max-threads":1}}}'
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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.training.do288.examples;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@ImportResource({"classpath:spring/camel-context.xml"})
|
||||
public class Application extends RouteBuilder {
|
||||
|
||||
// must have a main method spring-boot can run
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
|
||||
from("timer://foo?period=5000")
|
||||
.setBody().constant("Hello World")
|
||||
.log(">>> ${body}");
|
||||
}
|
||||
}
|
||||
15
camel-timer/src/main/resources/application.properties
Normal file
15
camel-timer/src/main/resources/application.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
logging.config=classpath:logback.xml
|
||||
|
||||
# the options from org.apache.camel.spring.boot.CamelConfigurationProperties can be configured here
|
||||
camel.springboot.name=MyCamel
|
||||
|
||||
# lets listen on all ports to ensure we can be invoked from the pod IP
|
||||
server.address=0.0.0.0
|
||||
management.address=0.0.0.0
|
||||
|
||||
# lets use a different management port in case you need to listen to HTTP requests on 8080
|
||||
management.port=8081
|
||||
|
||||
# disable all management enpoints except health
|
||||
endpoints.enabled = false
|
||||
endpoints.health.enabled = true
|
||||
17
camel-timer/src/main/resources/logback.xml
Normal file
17
camel-timer/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
18
camel-timer/src/main/resources/spring/camel-context.xml
Normal file
18
camel-timer/src/main/resources/spring/camel-context.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- You could also define a traditional camel context here -->
|
||||
<!--
|
||||
<camelContext xmlns="http://camel.apache.org/schema/spring">
|
||||
<route>
|
||||
<from uri="timer://foo?period=1000"/>
|
||||
<setBody><simple>Hello World from camel-contex.xml</simple></setBody>
|
||||
<log message=">>> ${body}"/>
|
||||
</route>
|
||||
</camelContext>
|
||||
-->
|
||||
</beans>
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 io.fabric8.tests.integration;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.RunAsClient;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static io.fabric8.kubernetes.assertions.Assertions.assertThat;
|
||||
|
||||
@RunWith(Arquillian.class)
|
||||
@RunAsClient
|
||||
public class KubernetesIntegrationKT {
|
||||
|
||||
@ArquillianResource
|
||||
KubernetesClient client;
|
||||
|
||||
@Test
|
||||
public void testAppProvisionsRunningPods() throws Exception {
|
||||
assertThat(client).deployments().pods().isPodReadyForPeriod();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user