├── src
├── main
│ ├── jkube
│ │ ├── configmap.yml
│ │ └── deployment.yml
│ ├── resources
│ │ ├── k8s
│ │ │ ├── configmap.yml
│ │ │ ├── queue.yaml
│ │ │ ├── rbac-binding.yaml
│ │ │ ├── user.yaml
│ │ │ ├── rbac.yaml
│ │ │ └── address_space.yaml
│ │ ├── logback.xml
│ │ ├── data
│ │ │ ├── order5.xml
│ │ │ ├── order1.xml
│ │ │ ├── order2.xml
│ │ │ ├── order4.xml
│ │ │ └── order3.xml
│ │ ├── application.properties
│ │ └── spring
│ │ │ └── camel-context.xml
│ └── java
│ │ └── io
│ │ └── fabric8
│ │ └── quickstarts
│ │ └── camel
│ │ └── amq
│ │ ├── OrderGenerator.java
│ │ ├── Application.java
│ │ └── AMQPConfiguration.java
└── test
│ ├── resources
│ ├── cm-amq-protocol.json
│ ├── cm-amq-config.json
│ ├── kubernetesTest.properties
│ └── amq.json
│ └── java
│ └── io
│ └── fabric8
│ └── quickstarts
│ └── camel
│ └── amq
│ ├── support
│ ├── KubernetesTestSetup.java
│ ├── KubernetesTestUtil.java
│ ├── KubernetesTestDeployer.java
│ └── KubernetesTestConfig.java
│ └── KubernetesIntegrationKT.java
├── .gitignore
├── configuration
└── settings.xml
├── README.adoc
├── LICENSE.md
└── pom.xml
/src/main/jkube/configmap.yml:
--------------------------------------------------------------------------------
1 | metadata:
2 | name: spring-boot-camel-amq-protocol
3 | data:
4 | service.protocol: amqps
--------------------------------------------------------------------------------
/src/main/resources/k8s/configmap.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: spring-boot-camel-amq-protocol
5 | data:
6 | service.protocol: amqps
--------------------------------------------------------------------------------
/src/main/resources/k8s/queue.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: enmasse.io/v1beta1
2 | kind: Address
3 | metadata:
4 | name: spring-boot-camel-amq.orders
5 | spec:
6 | address: incomingOrders
7 | type: queue
8 | plan: standard-small-queue
9 |
--------------------------------------------------------------------------------
/src/test/resources/cm-amq-protocol.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "ConfigMap",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "spring-boot-camel-amq-protocol"
6 | },
7 | "data": {
8 | "service.protocol": "amqp"
9 | }
10 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | .idea
3 | *.iml
4 | *.im
5 | *.ipr
6 | *.iws
7 | overlays
8 | .DS_Store
9 | .settings
10 | *.swp
11 | *.log
12 | .project
13 | .classpath
14 | *.fmd
15 | .cache
16 | dependency-reduced-pom.xml
17 | kube-cluster/kubernetes
18 | apps/modifiedFabric8.json
19 | git-clones
20 | .vscode/
--------------------------------------------------------------------------------
/src/test/resources/cm-amq-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "ConfigMap",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "spring-boot-camel-amq-config"
6 | },
7 | "data": {
8 | "service.host": "broker-amq-amqp",
9 | "service.port.amqp": "5672",
10 | "service.port.amqps": "5671"
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/src/main/resources/k8s/rbac-binding.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: rbac.authorization.k8s.io/v1
2 | kind: RoleBinding
3 | metadata:
4 | name: rbac-binding
5 | roleRef:
6 | apiGroup: rbac.authorization.k8s.io
7 | kind: Role
8 | name: rbac
9 | subjects:
10 | - kind: ServiceAccount
11 | name: address-space-controller
12 | namespace: enmasse-infra
13 |
--------------------------------------------------------------------------------
/src/main/resources/k8s/user.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: user.enmasse.io/v1beta1
2 | kind: MessagingUser
3 | metadata:
4 | name: spring-boot-camel-amq.client
5 | spec:
6 | username: user1
7 | authentication:
8 | type: password
9 | password: dGVzdA==
10 | authorization:
11 | - addresses: ["incomingOrders","topic*"]
12 | operations: ["send", "recv"]
13 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/k8s/rbac.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: rbac.authorization.k8s.io/v1
2 | kind: Role
3 | metadata:
4 | name: rbac
5 | rules:
6 | - apiGroups: [ "" ]
7 | resources: [ "configmaps" ]
8 | verbs: [ "create" ]
9 | - apiGroups: [ "" ]
10 | resources: [ "configmaps" ]
11 | resourceNames: [ "spring-boot-camel-amq-config" ]
12 | verbs: [ "get", "update", "patch" ]
13 |
--------------------------------------------------------------------------------
/src/main/resources/k8s/address_space.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: enmasse.io/v1beta1
2 | kind: AddressSpace
3 | metadata:
4 | name: spring-boot-camel-amq
5 | spec:
6 | type: standard
7 | plan: standard-unlimited
8 | endpoints:
9 | - name: messaging
10 | service: messaging
11 | expose:
12 | type: route
13 | routeServicePort: amqps
14 | routeTlsTermination: passthrough
15 | exports:
16 | - kind: ConfigMap
17 | name: spring-boot-camel-amq-config
18 | cert:
19 | provider: openshift
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/resources/data/order5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Erie Zoo
7 | Erie
8 | US
9 |
10 |
11 | 2012-03-05
12 |
13 |
14 |
15 |
16 | Elk
17 |
18 | 50
19 |
20 |
21 |
22 | Elephant
23 |
24 | 5
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/resources/data/order1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Antwerp Zoo
7 | Antwerp
8 | BE
9 |
10 |
11 | 2012-03-01
12 |
13 |
14 |
15 |
16 | Aardvark
17 |
18 | 1
19 |
20 |
21 |
22 | Alpaca
23 |
24 | 10
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/resources/data/order2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Bristol Zoo Gardens
7 | Bristol
8 | UK
9 |
10 |
11 | 2012-03-02
12 |
13 |
14 |
15 |
16 | Badger
17 |
18 | 2
19 |
20 |
21 |
22 | Bee
23 |
24 | 200
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/resources/data/order4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Dartmoor Zoological Park
7 | Devon
8 | UK
9 |
10 |
11 | 2012-03-04
12 |
13 |
14 |
15 |
16 | Dinosaur
17 |
18 | 4
19 |
20 |
21 |
22 | Dragonfly
23 |
24 | 40
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Binding health checks to an internal port
2 | management.server.port=8081
3 |
4 | # disable all management enpoints except health
5 | management.endpoints.enabled-by-default=false
6 | management.endpoint.health.enabled=true
7 |
8 | logging.config=classpath:logback.xml
9 |
10 | # The name of the Camel app
11 | camel.springboot.name=CamelAMQ
12 |
13 | # Keeps the application alive
14 | camel.springboot.main-run-controller=true
15 |
16 | # Ampq connection configuration ("amqp.host" is overridden in Openshift using src/main/fabric8/deployment.yml)
17 | amq-camel.serviceName=FILL_ME
18 | amq-camel.servicePort=443
19 | amq-camel.parameters=transport.trustAll=true&transport.verifyHost=false&amqp.idleTimeout=120000&amqp.saslMechanisms=PLAIN
20 | amq-camel.username=user1
21 | amq-camel.password=test
22 | amq-camel.protocol=amqp
--------------------------------------------------------------------------------
/src/main/resources/data/order3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Columbus Zoo and Aquarium
7 | Columbus
8 | US
9 |
10 |
11 | 2012-03-03
12 |
13 |
14 |
15 |
16 | Camel
17 |
18 |
19 | 100
20 |
21 |
22 |
23 | Crocodile
24 |
25 | 1
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/main/jkube/deployment.yml:
--------------------------------------------------------------------------------
1 | spec:
2 | template:
3 | spec:
4 | containers:
5 | -
6 | resources:
7 | requests:
8 | cpu: "0.2"
9 | memory: 256Mi
10 | limits:
11 | cpu: "1.0"
12 | memory: 256Mi
13 | env:
14 | - name: AMQ_CAMEL_SERVICE_NAME
15 | valueFrom:
16 | configMapKeyRef:
17 | name: spring-boot-camel-amq-config
18 | key: service.host
19 | - name: AMQ_CAMEL_SERVICE_PORT_AMQPS
20 | valueFrom:
21 | configMapKeyRef:
22 | name: spring-boot-camel-amq-config
23 | key: service.port.amqps
24 | - name: AMQ_CAMEL_SERVICE_PORT_AMQP
25 | valueFrom:
26 | configMapKeyRef:
27 | name: spring-boot-camel-amq-config
28 | key: service.port.amqp
29 | - name: AMQ_CAMEL_PARAMETERS
30 | value: transport.trustAll=true&transport.verifyHost=false&amqp.idleTimeout=120000&amqp.saslMechanisms=PLAIN
31 | - name: AMQ_CAMEL_PROTOCOL
32 | valueFrom:
33 | configMapKeyRef:
34 | name: spring-boot-camel-amq-protocol
35 | key: service.protocol
--------------------------------------------------------------------------------
/src/test/resources/kubernetesTest.properties:
--------------------------------------------------------------------------------
1 | ####
2 |
3 | ### Use current namespace instead creating a new one. Default false
4 | #kt.namespace.use.current
5 |
6 | ### Use the namespace specified in this property instead creating a new one.
7 | #kt.namespace.use.existing
8 |
9 | ### Delete the namespace at the end of the test. Default true
10 | #kt.namespace.destroy.enabled
11 |
12 | ### Use the namespace prefix specified in this property in this property
13 | ### instead the default one "ktest"
14 | #kt.namespace.prefix
15 |
16 | ### Install the resources loaded from the specified file path.
17 | ### Default: target/classes/META-INF/jkube/openshift.yml
18 | #kt.resource.file.path
19 |
20 | ### The master URI used to login to Kubernetes/Openshift cluster. Autodetected if empty.
21 | #kubernetes.master
22 |
23 | ### The username used to login to Kubernetes/Openshift cluster. Autodetected if empty
24 | #kubernetes.username
25 |
26 | ### The password used to login to Kubernetes/Openshift cluster. Autodetected if empty
27 | #kubernetes.password
28 |
29 | ### How much second the client wait until the newly created resource is ready. Default 60
30 | #kubernetes.timeout
31 |
32 | ### Comma separated list of resources file paths to load and deploy before testing.
33 | kt.env.dependencies=src/test/resources/amq.json,src/test/resources/cm-amq-config.json,src/test/resources/cm-amq-protocol.json
34 |
--------------------------------------------------------------------------------
/src/main/java/io/fabric8/quickstarts/camel/amq/OrderGenerator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2005-2015 Red Hat, Inc.
3 | *
4 | * Red Hat licenses this file to you under the Apache License, version
5 | * 2.0 (the "License"); you may not use this file except in compliance
6 | * with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 | * implied. See the License for the specific language governing
14 | * permissions and limitations under the License.
15 | */
16 | package io.fabric8.quickstarts.camel.amq;
17 |
18 | import org.apache.camel.CamelContext;
19 | import org.springframework.stereotype.Component;
20 |
21 | import java.io.InputStream;
22 | import java.util.Random;
23 |
24 | /**
25 | * To generate random orders
26 | */
27 | @Component
28 | public class OrderGenerator {
29 |
30 | private int count = 1;
31 | private Random random = new Random();
32 |
33 | public InputStream generateOrder(CamelContext camelContext) {
34 | int number = random.nextInt(5) + 1;
35 |
36 | String name = "data/order" + number + ".xml";
37 |
38 | return camelContext.getClassResolver().loadResourceAsStream(name);
39 | }
40 |
41 | public String generateFileName() {
42 | return "order" + count++ + ".xml";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/java/io/fabric8/quickstarts/camel/amq/support/KubernetesTestSetup.java:
--------------------------------------------------------------------------------
1 | package io.fabric8.quickstarts.camel.amq.support;
2 |
3 | import io.fabric8.kubernetes.client.KubernetesClient;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestDeployer.deleteNamespace;
8 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestDeployer.deploy;
9 |
10 |
11 | public class KubernetesTestSetup {
12 |
13 | protected static Logger LOG = LoggerFactory.getLogger(KubernetesTestSetup.class);
14 |
15 | private KubernetesTestConfig config;
16 |
17 | private KubernetesClient client;
18 |
19 | public KubernetesTestSetup(KubernetesTestConfig config) {
20 | this.config = config;
21 | this.client = config.getClient();
22 | }
23 |
24 | public void setUp() {
25 | LOG.info("Doing setup...");
26 | deploy(client, config);
27 | LOG.info("setup done.");
28 | }
29 |
30 | public void tearDown() {
31 | LOG.info("Doing teardown...");
32 | if(config.isShouldDestroyNamespace()) {
33 | deleteNamespace(client, config);
34 | client.rbac()
35 | .roleBindings()
36 | .inNamespace(config.getMainNamespace())
37 | .withLabels(config.getKtestLabels())
38 | .delete();
39 | }else{
40 | LOG.info("Nothing to do!");
41 | }
42 | LOG.info("Teardown done.");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/io/fabric8/quickstarts/camel/amq/Application.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2005-2016 Red Hat, Inc.
3 | *
4 | * Red Hat licenses this file to you under the Apache License, version
5 | * 2.0 (the "License"); you may not use this file except in compliance
6 | * with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 | * implied. See the License for the specific language governing
14 | * permissions and limitations under the License.
15 | */
16 | package io.fabric8.quickstarts.camel.amq;
17 |
18 | import org.apache.activemq.jms.pool.PooledConnectionFactory;
19 | import org.apache.camel.component.amqp.AMQPComponent;
20 | import org.apache.qpid.jms.JmsConnectionFactory;
21 | import org.slf4j.Logger;
22 | import org.slf4j.LoggerFactory;
23 | import org.springframework.boot.SpringApplication;
24 | import org.springframework.boot.autoconfigure.SpringBootApplication;
25 | import org.springframework.context.annotation.Bean;
26 | import org.springframework.context.annotation.ImportResource;
27 |
28 | /**
29 | * The Spring-boot main class.
30 | */
31 | @SpringBootApplication
32 | @ImportResource({"classpath:spring/camel-context.xml"})
33 | public class Application {
34 |
35 | Logger log = LoggerFactory.getLogger(Application.class);
36 |
37 |
38 | public static void main(String[] args) {
39 | SpringApplication.run(Application.class, args);
40 | }
41 |
42 | @Bean(name = "amqp-component")
43 | AMQPComponent amqpComponent(AMQPConfiguration config) {
44 |
45 | String protocol = config.getProtocol();
46 |
47 | String port = "amqps".equals(protocol) ? config.getServicePort_amqps(): config.getServicePort_amqp();
48 |
49 | String remoteURI = String.format(protocol+"://%s:%s?%s", config.getServiceName(), port, config.getParameters());
50 |
51 | JmsConnectionFactory qpid = new JmsConnectionFactory(config.getUsername(), config.getPassword(), remoteURI);
52 |
53 | PooledConnectionFactory factory = new PooledConnectionFactory();
54 | factory.setConnectionFactory(qpid);
55 |
56 | return new AMQPComponent(factory);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/io/fabric8/quickstarts/camel/amq/KubernetesIntegrationKT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2016 Red Hat, Inc.
3 | *
4 | * Red Hat licenses this file to you under the Apache License, version
5 | * 2.0 (the "License"); you may not use this file except in compliance
6 | * with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 | * implied. See the License for the specific language governing
14 | * permissions and limitations under the License.
15 | */
16 |
17 | package io.fabric8.quickstarts.camel.amq;
18 |
19 | import io.fabric8.kubernetes.api.model.Pod;
20 | import io.fabric8.kubernetes.api.model.PodList;
21 | import io.fabric8.kubernetes.client.KubernetesClient;
22 | import io.fabric8.quickstarts.camel.amq.support.KubernetesTestConfig;
23 | import io.fabric8.quickstarts.camel.amq.support.KubernetesTestSetup;
24 | import org.junit.Assert;
25 | import org.junit.Test;
26 | import org.slf4j.Logger;
27 | import org.slf4j.LoggerFactory;
28 |
29 | import java.util.concurrent.TimeUnit;
30 |
31 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestConfig.createConfig;
32 |
33 | public class KubernetesIntegrationKT {
34 |
35 | private static Logger LOG = LoggerFactory.getLogger(KubernetesIntegrationKT.class);
36 |
37 |
38 | @Test
39 | public void testAppProvisionsRunningPods() {
40 | KubernetesTestConfig config = createConfig();
41 | KubernetesTestSetup testSetup = new KubernetesTestSetup(config);
42 |
43 | try {
44 | testSetup.setUp();
45 | KubernetesClient client = config.getClient();
46 | PodList podList = client.pods().inNamespace(config.getNamespace()).list();
47 |
48 | if (podList.getItems().isEmpty()) {
49 | Assert.fail("No pods found in namespace "+ config.getNamespace());
50 | }
51 |
52 | for (Pod pod : podList.getItems()) {
53 | try {
54 | if (!pod.getMetadata().getName().endsWith("build") && !pod.getMetadata().getName().endsWith("deploy")) {
55 | client.resource(pod)
56 | .inNamespace(config.getNamespace())
57 | .waitUntilReady(config.getKubernetesTimeout(), TimeUnit.SECONDS);
58 | LOG.info("Pod {} is in state: {}",pod.getMetadata().getName(),pod.getStatus().getPhase());
59 | }
60 | } catch (InterruptedException e) {
61 | Assert.fail("Timeout reached waiting for pod " + pod.getMetadata().getName());
62 | }
63 | }
64 | } finally {
65 | testSetup.tearDown();
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/resources/spring/camel-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
35 |
36 |
37 |
38 |
39 | /order/customer/country = 'UK'
40 |
41 |
42 |
43 |
44 | /order/customer/country = 'US'
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/main/java/io/fabric8/quickstarts/camel/amq/AMQPConfiguration.java:
--------------------------------------------------------------------------------
1 | package io.fabric8.quickstarts.camel.amq;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | /**
8 | * Configuration parameters filled in from application.properties and overridden using env variables on Openshift.
9 | */
10 | @Configuration
11 | @ConfigurationProperties(prefix = "amq-camel")
12 | public class AMQPConfiguration {
13 |
14 | /**
15 | * AMQ service name
16 | */
17 | private String serviceName;
18 |
19 | /**
20 | * AMQ service port
21 | */
22 | private Integer port;
23 |
24 | /**
25 | * AMQ username
26 | */
27 | private String username;
28 |
29 | /**
30 | * AMQ password
31 | */
32 | private String password;
33 |
34 | /**
35 | * AMQ service port AMQP
36 | */
37 | @Value("${AMQ_CAMEL_SERVICE_PORT_AMQP}")
38 | private String servicePortAMQP;
39 |
40 | /**
41 | * AMQ service port AMQPS
42 | */
43 | @Value("${AMQ_CAMEL_SERVICE_PORT_AMQPS}")
44 | private String servicePortAMQPS;
45 |
46 | /**
47 | * AMQ parameters
48 | */
49 | private String parameters;
50 |
51 | /**
52 | * AMQ protocol (amqp or amqps)
53 | */
54 | private String protocol;
55 |
56 | public AMQPConfiguration() {
57 | }
58 |
59 | public String getServiceName() {
60 | return serviceName;
61 | }
62 |
63 | public void setServiceName(String servicename) {
64 | this.serviceName = servicename;
65 | }
66 |
67 | public Integer getPort() {
68 | return port;
69 | }
70 |
71 | public void setPort(Integer port) {
72 | this.port = port;
73 | }
74 |
75 | public String getUsername() {
76 | return username;
77 | }
78 |
79 | public void setUsername(String username) {
80 | this.username = username;
81 | }
82 |
83 | public String getPassword() {
84 | return password;
85 | }
86 |
87 | public void setPassword(String password) {
88 | this.password = password;
89 | }
90 |
91 |
92 | public String getServicePort_amqp() {
93 | return servicePortAMQP;
94 | }
95 |
96 | public void setServicePortAMQP(String servicePortAMQP) {
97 | this.servicePortAMQPS = servicePortAMQP;
98 | }
99 |
100 | public String getServicePort_amqps() {
101 | return servicePortAMQPS;
102 | }
103 |
104 | public void setServicePortAMQPS(String servicePortAMQPS) {
105 | this.servicePortAMQP = servicePortAMQPS;
106 | }
107 |
108 | public String getParameters() {
109 | return parameters;
110 | }
111 |
112 | public void setParameters(String parameters) {
113 | this.parameters = parameters;
114 | }
115 |
116 | public String getProtocol() {
117 | return protocol;
118 | }
119 |
120 | public void setProtocol(String protocol) {
121 | this.protocol = protocol;
122 | }
123 |
124 |
125 | @Override
126 | public String toString() {
127 | return "AMQPConfiguration{" +
128 | "serviceName='" + serviceName + '\'' +
129 | ", port=" + port +
130 | ", username='" + username + '\'' +
131 | ", password='" + password + '\'' +
132 | ", servicePortAmqp='" + servicePortAMQP + '\'' +
133 | ", servicePortAmqps='" + servicePortAMQPS + '\'' +
134 | ", parameters='" + parameters + '\'' +
135 | ", protocol='" + protocol + '\'' +
136 | '}';
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/src/test/java/io/fabric8/quickstarts/camel/amq/support/KubernetesTestUtil.java:
--------------------------------------------------------------------------------
1 | package io.fabric8.quickstarts.camel.amq.support;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.w3c.dom.Document;
6 | import org.w3c.dom.Node;
7 | import org.xml.sax.SAXException;
8 |
9 | import javax.xml.parsers.DocumentBuilder;
10 | import javax.xml.parsers.DocumentBuilderFactory;
11 | import javax.xml.parsers.ParserConfigurationException;
12 | import javax.xml.xpath.XPath;
13 | import javax.xml.xpath.XPathConstants;
14 | import javax.xml.xpath.XPathExpression;
15 | import javax.xml.xpath.XPathExpressionException;
16 | import javax.xml.xpath.XPathFactory;
17 | import java.io.File;
18 | import java.io.IOException;
19 | import java.io.InputStream;
20 | import java.util.Arrays;
21 | import java.util.Collection;
22 | import java.util.List;
23 | import java.util.Map;
24 |
25 | public class KubernetesTestUtil {
26 |
27 | protected static Logger LOG = LoggerFactory.getLogger(KubernetesTestUtil.class);
28 |
29 |
30 | public static boolean isNullOrEmpty(String s) {
31 | return s == null || s.isEmpty();
32 | }
33 |
34 | public static boolean isNullOrEmpty(Collection s) {
35 | return s == null || s.isEmpty();
36 | }
37 |
38 |
39 | public static boolean isNullOrEmpty(Object [] s) {
40 | return s == null || s.length == 0;
41 | }
42 |
43 | public static boolean isNotNullOrEmpty(String s) {
44 | return !isNullOrEmpty(s);
45 | }
46 |
47 | public static boolean isNotNullOrEmpty(Collection s) {
48 | return !isNullOrEmpty(s);
49 | }
50 |
51 | public static InputStream getResourceFileAsStream(String fileName) {
52 | return KubernetesTestUtil.class.getClassLoader().getResourceAsStream(fileName);
53 | }
54 |
55 | public static void failNotDeployed(){
56 | String errorMessage = "Error loading resource file. Be sure to run `mvn oc:deploy` before running this integration test.";
57 | LOG.error(errorMessage);
58 | throw new RuntimeException(errorMessage);
59 | }
60 |
61 | public static String getStringProperty(String name, Map map) {
62 | return getStringProperty(name, map, null);
63 | }
64 | public static String getStringProperty(String name, Map map, String defaultValue) {
65 | if (map.containsKey(name) && isNotNullOrEmpty(map.get(name))) {
66 | defaultValue = map.get(name);
67 | }
68 | return defaultValue;
69 | }
70 |
71 | public static List getArrayListStringProperty(String name, Map map) {
72 | if (map.containsKey(name) && isNotNullOrEmpty(map.get(name))) {
73 | return Arrays.asList(map.get(name).split(","));
74 | }
75 | return null;
76 | }
77 |
78 | public static int getIntProperty(String name, Map map, int defaultValue) {
79 | if (map.containsKey(name) && isNotNullOrEmpty(map.get(name))) {
80 | return Integer.parseInt(map.get(name));
81 | }
82 | return defaultValue;
83 | }
84 |
85 | public static Boolean getBooleanProperty(String name, Map map, Boolean defaultValue) {
86 | if (map.containsKey(name) && isNotNullOrEmpty(map.get(name))) {
87 | defaultValue = Boolean.parseBoolean(map.get(name));
88 | }
89 | return defaultValue;
90 | }
91 |
92 | public static String getArtifactId() throws ParserConfigurationException, IOException, SAXException, XPathExpressionException {
93 |
94 | DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
95 | domFactory.setNamespaceAware(true);
96 |
97 | DocumentBuilder builder = domFactory.newDocumentBuilder();
98 | Document doc = builder.parse(new File("./pom.xml"));
99 | XPath xpath = XPathFactory.newInstance().newXPath();
100 |
101 | XPathExpression expr = xpath.compile("/*[local-name() = 'project']/*[local-name() = 'artifactId']/text()");
102 | Node result = (Node) expr.evaluate(doc, XPathConstants.NODE);
103 | String artifactId = result.getTextContent();
104 | LOG.info("Detected artifactId: {}", artifactId);
105 | return artifactId;
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/configuration/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | fusesource.repo
32 |
33 |
34 | maven.central
35 | Maven Central
36 | https://repo1.maven.org/maven2
37 |
38 | false
39 |
40 |
41 | true
42 | never
43 |
44 |
45 |
46 | redhat.ga
47 | Red Hat General Availability Repository
48 | https://maven.repository.redhat.com/ga
49 |
50 | false
51 |
52 |
53 | true
54 | never
55 |
56 |
57 |
58 | redhat.earlyaccess
59 | Red Hat General Early Access Repository
60 | https://maven.repository.redhat.com/earlyaccess
61 |
62 | false
63 |
64 |
65 | true
66 | never
67 |
68 |
69 |
70 | fusesource.m2
71 | FuseSource Community Release Repository
72 | https://repo.fusesource.com/nexus/content/groups/public
73 |
74 | false
75 |
76 |
77 | true
78 | never
79 |
80 |
81 |
82 | fusesource.ea
83 | FuseSource Community Early Access Release Repository
84 | https://repo.fusesource.com/nexus/content/groups/ea
85 |
86 | false
87 |
88 |
89 | true
90 | never
91 |
92 |
93 |
94 |
95 |
96 | maven.central
97 | Maven Central
98 | https://repo1.maven.org/maven2
99 |
100 | false
101 |
102 |
103 | true
104 | never
105 |
106 |
107 |
108 | redhat.ga
109 | Red Hat General Availability Repository
110 | https://maven.repository.redhat.com/ga
111 |
112 | false
113 |
114 |
115 | true
116 | never
117 |
118 |
119 |
120 | redhat.earlyaccess
121 | Red Hat General Early Access Repository
122 | https://maven.repository.redhat.com/earlyaccess
123 |
124 | false
125 |
126 |
127 | true
128 | never
129 |
130 |
131 |
132 | fusesource.m2
133 | FuseSource Community Release Repository
134 | https://repo.fusesource.com/nexus/content/groups/public
135 |
136 | false
137 |
138 |
139 | true
140 | never
141 |
142 |
143 |
144 | fusesource.ea
145 | FuseSource Community Early Access Release Repository
146 | https://repo.fusesource.com/nexus/content/groups/ea
147 |
148 | false
149 |
150 |
151 | true
152 | never
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | fusesource.repo
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/src/test/resources/amq.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "List",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "amq-test",
6 | "annotations": {
7 | "description": "An ActiveMQ Broker for Tests."
8 | }
9 | },
10 | "items": [
11 | {
12 | "kind": "ImageStream",
13 | "apiVersion": "image.openshift.io/v1",
14 | "metadata": {
15 | "name": "jboss-amq-710",
16 | "annotations": {
17 | "openshift.io/display-name": "Red Hat JBoss A-MQ 7.10"
18 | }
19 | },
20 | "spec": {
21 | "tags": [
22 | {
23 | "name": "1.3",
24 | "annotations": {
25 | "description": "JBoss A-MQ 7.10 broker image.",
26 | "iconClass": "icon-jboss",
27 | "tags": "messaging,amq,jboss",
28 | "openshift.io/display-name": "Red Hat JBoss A-MQ 7.10"
29 | },
30 | "from": {
31 | "kind": "DockerImage",
32 | "name": "registry.redhat.io/amq7/amq-broker-rhel8:7.10"
33 | }
34 | }
35 | ]
36 | }
37 | },
38 | {
39 | "kind": "Service",
40 | "apiVersion": "v1",
41 | "spec": {
42 | "ports": [
43 | {
44 | "port": 5672,
45 | "targetPort": 5672,
46 | "name": "amqp"
47 | },
48 | {
49 | "port": 5671,
50 | "targetPort": 5671,
51 | "name": "amqps"
52 | }
53 | ],
54 | "selector": {
55 | "deploymentConfig": "broker-amq"
56 | }
57 | },
58 | "metadata": {
59 | "name": "broker-amq-amqp",
60 | "labels": {
61 | "application": "broker"
62 | },
63 | "annotations": {
64 | "description": "The broker's AMQP port."
65 | }
66 | }
67 | },
68 | {
69 | "kind": "DeploymentConfig",
70 | "apiVersion": "apps.openshift.io/v1",
71 | "metadata": {
72 | "name": "broker-amq",
73 | "labels": {
74 | "application": "broker"
75 | }
76 | },
77 | "spec": {
78 | "strategy": {
79 | "type": "Rolling",
80 | "rollingParams": {
81 | "maxSurge": 0
82 | }
83 | },
84 | "triggers": [
85 | {
86 | "type": "ImageChange",
87 | "imageChangeParams": {
88 | "automatic": true,
89 | "containerNames": [
90 | "broker-amq"
91 | ],
92 | "from": {
93 | "kind": "ImageStreamTag",
94 | "name": "jboss-amq-710:1.3"
95 | }
96 | }
97 | },
98 | {
99 | "type": "ConfigChange"
100 | }
101 | ],
102 | "replicas": 1,
103 | "selector": {
104 | "deploymentConfig": "broker-amq"
105 | },
106 | "template": {
107 | "metadata": {
108 | "name": "broker-amq",
109 | "labels": {
110 | "deploymentConfig": "broker-amq",
111 | "application": "broker"
112 | }
113 | },
114 | "spec": {
115 | "terminationGracePeriodSeconds": 60,
116 | "containers": [
117 | {
118 | "name": "broker-amq",
119 | "image": "jboss-amq-710",
120 | "imagePullPolicy": "Always",
121 | "readinessProbe": {
122 | "exec": {
123 | "command": [
124 | "/bin/bash",
125 | "-c",
126 | "/opt/amq/bin/readinessProbe.sh"
127 | ]
128 | }
129 | },
130 | "ports": [
131 | {
132 | "name": "jolokia",
133 | "containerPort": 8778,
134 | "protocol": "TCP"
135 | },
136 | {
137 | "name": "amqp",
138 | "containerPort": 5672,
139 | "protocol": "TCP"
140 | },
141 | {
142 | "name": "amqps",
143 | "containerPort": 5671,
144 | "protocol": "TCP"
145 | }
146 | ],
147 | "env": [
148 | {
149 | "name": "AMQ_USER",
150 | "value": "user1"
151 | },
152 | {
153 | "name": "AMQ_PASSWORD",
154 | "value": "test"
155 | },
156 | {
157 | "name": "AMQ_TRANSPORTS",
158 | "value": "amqp"
159 | },
160 | {
161 | "name": "AMQ_STORAGE_USAGE_LIMIT",
162 | "value": "100 gb"
163 | }
164 | ]
165 | }
166 | ]
167 | }
168 | }
169 | }
170 | }
171 | ]
172 | }
173 |
--------------------------------------------------------------------------------
/src/test/java/io/fabric8/quickstarts/camel/amq/support/KubernetesTestDeployer.java:
--------------------------------------------------------------------------------
1 | package io.fabric8.quickstarts.camel.amq.support;
2 |
3 | import io.fabric8.kubernetes.api.model.HasMetadata;
4 | import io.fabric8.kubernetes.api.model.Namespace;
5 | import io.fabric8.kubernetes.api.model.NamespaceBuilder;
6 | import io.fabric8.kubernetes.api.model.rbac.RoleBinding;
7 | import io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder;
8 | import io.fabric8.kubernetes.api.model.rbac.Subject;
9 | import io.fabric8.kubernetes.api.model.rbac.SubjectBuilder;
10 | import io.fabric8.kubernetes.client.KubernetesClient;
11 | import io.fabric8.kubernetes.client.KubernetesClientException;
12 | import io.fabric8.kubernetes.client.Watch;
13 | import io.fabric8.kubernetes.client.Watcher;
14 | import io.fabric8.openshift.api.model.ImageLookupPolicy;
15 | import io.fabric8.openshift.api.model.ImageStream;
16 | import org.slf4j.Logger;
17 | import org.slf4j.LoggerFactory;
18 |
19 | import java.io.FileInputStream;
20 | import java.io.IOException;
21 | import java.io.InputStream;
22 | import java.util.Arrays;
23 | import java.util.List;
24 | import java.util.concurrent.CountDownLatch;
25 | import java.util.concurrent.TimeUnit;
26 | import java.util.function.Predicate;
27 | import java.util.stream.Collectors;
28 |
29 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.failNotDeployed;
30 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.isNotNullOrEmpty;
31 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.isNullOrEmpty;
32 | import static java.util.concurrent.TimeUnit.SECONDS;
33 |
34 | public class KubernetesTestDeployer {
35 |
36 | private final static Logger LOG = LoggerFactory.getLogger(KubernetesTestDeployer.class);
37 |
38 | private final static Predicate supportReadiness =
39 | resource -> Arrays.asList("Node", "Deployment", "ReplicaSet", "StatefulSet", "Pod", "DeploymentConfig", "ReplicationController")
40 | .contains(resource.getKind());
41 |
42 | public static void deploy(KubernetesClient client, KubernetesTestConfig config) {
43 | createNamespace(client, config);
44 |
45 | // deploy dependencies
46 | if (isNotNullOrEmpty(config.getDependencies())) {
47 | LOG.info("Deploy dependencies from file {}", config.getImageStreamFilePath());
48 | for (String dependency : config.getDependencies()) {
49 | deployFromFile(client, config, dependency);
50 | }
51 | }
52 |
53 | String sourceNamespace = config.getMainNamespace();
54 | LOG.info("Deploy RoleBinding ");
55 | createRoleBinding(client, sourceNamespace, config);
56 | LOG.info("Deploy ImageStreams from file {}", config.getImageStreamFilePath());
57 | createImageStream(client, config);
58 | // deploy resources
59 | LOG.info("Deploy resources from file {}", config.getResourceFilePath());
60 | deployFromFile(client, config, config.getResourceFilePath());
61 | }
62 |
63 |
64 | private static void deployFromFile(KubernetesClient client, KubernetesTestConfig config, String resourcesFilePath) {
65 | if (isNullOrEmpty(resourcesFilePath)) {
66 | failNotDeployed();
67 | }
68 | LOG.info("Loading resources file: " + resourcesFilePath);
69 | List resourceList = null;
70 |
71 | try (InputStream resources = new FileInputStream(resourcesFilePath)) {
72 | resourceList = client.load(resources).get();
73 | } catch (IOException e) {
74 | LOG.error("Problem loading resources file {}", resourcesFilePath);
75 | failNotDeployed();
76 | }
77 |
78 | List deployedResourceList = client.resourceList(resourceList)
79 | .inNamespace(config.getNamespace())
80 | .createOrReplace();
81 |
82 | LOG.info("Waiting for reources to be ready");
83 | deployedResourceList.stream()
84 | .filter(supportReadiness)
85 | .forEach(resource -> {
86 | try {
87 | client.resource(resource)
88 | .inNamespace(config.getNamespace())
89 | .waitUntilReady(config.getKubernetesTimeout(), SECONDS);
90 | } catch (InterruptedException e) {
91 | LOG.error("Timeout reached waiting for "+resource.getKind()+" with name "+resource.getMetadata().getName()+" to be ready");
92 | failNotDeployed();
93 | }
94 | });
95 | LOG.info("Reources are ready Now");
96 | }
97 |
98 | private static void createRoleBinding(KubernetesClient client, String sourceNamespace, KubernetesTestConfig config) {
99 |
100 | String targetNamespace = config.getNamespace();
101 |
102 | Subject subject = new SubjectBuilder()
103 | .withName("default")
104 | .withKind("ServiceAccount")
105 | .withNamespace(targetNamespace)
106 | .build();
107 |
108 | RoleBindingBuilder roleBindingBuilder = new RoleBindingBuilder();
109 | RoleBinding roleBinding = roleBindingBuilder
110 | .withKind("RoleBinding")
111 | .withApiVersion("rbac.authorization.k8s.io/v1")
112 | .withNewMetadata()
113 | .withName("ktest-system:image-puller")
114 | .withNamespace(sourceNamespace)
115 | .withLabels(config.getKtestLabels())
116 | .endMetadata()
117 | .withSubjects(subject)
118 | .withNewRoleRef()
119 | .withApiGroup("rbac.authorization.k8s.io")
120 | .withKind("ClusterRole")
121 | .withName("system:image-puller")
122 | .endRoleRef()
123 | .build();
124 |
125 | client.rbac().roleBindings().inNamespace(sourceNamespace).createOrReplace(roleBinding);
126 | }
127 |
128 | private static void createNamespace(KubernetesClient client, KubernetesTestConfig config) {
129 | if (config.isUseExistingNamespace()) {
130 | return;
131 | }
132 | Namespace ns = new NamespaceBuilder().withNewMetadata().withName(config.getNamespace()).endMetadata().build();
133 | client.namespaces().create(ns);
134 | LOG.info("Namespace " + config.getNamespace() + " created.");
135 | }
136 |
137 |
138 | public static void deleteNamespace(KubernetesClient
139 | client, KubernetesTestConfig config) {
140 | final CountDownLatch isWatchClosed = new CountDownLatch(1);
141 | Watch watch = client.namespaces().withName(config.getNamespace()).watch(new Watcher() {
142 | @Override
143 | public void eventReceived(Action action, Namespace resource) {
144 | if (action.equals(Action.DELETED)) {
145 | LOG.debug("Deleted event for namespace {} received", config.getNamespace());
146 | isWatchClosed.countDown();
147 | }
148 | }
149 | @Override
150 | public void onClose(KubernetesClientException cause) {
151 | isWatchClosed.countDown();
152 | }
153 | });
154 | try {
155 | if (config.isShouldDestroyNamespace()) {
156 | client.namespaces().withName(config.getNamespace()).delete();
157 | LOG.info("Waiting for namespace deletion " + config.getNamespace() + " ...");
158 | isWatchClosed.await(config.getKubernetesTimeout(), TimeUnit.SECONDS);
159 | LOG.info("Namespace - " + config.getNamespace() + " deleted.");
160 | }
161 | } catch (InterruptedException e) {
162 | isWatchClosed.countDown();
163 | watch.close();
164 | throw new RuntimeException("Timeout reached while waiting for namespace deletion.");
165 | }
166 | }
167 |
168 | private static void createImageStream(KubernetesClient client, KubernetesTestConfig config) {
169 | try (InputStream imageStreamFile = new FileInputStream(config.getImageStreamFilePath())) {
170 | List result = client.load(imageStreamFile).get();
171 | result = result.stream().peek(
172 | x -> {
173 | if (x instanceof ImageStream) {
174 | ((ImageStream) x).getSpec()
175 | .setLookupPolicy(new ImageLookupPolicy(true));
176 | }
177 | }
178 | ).collect(Collectors.toList());
179 |
180 | client.resourceList(result)
181 | .inNamespace(config.getNamespace())
182 | .createOrReplace();
183 | } catch (IOException e) {
184 | failNotDeployed();
185 | }
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/src/test/java/io/fabric8/quickstarts/camel/amq/support/KubernetesTestConfig.java:
--------------------------------------------------------------------------------
1 | package io.fabric8.quickstarts.camel.amq.support;
2 |
3 | import io.fabric8.kubernetes.client.Config;
4 | import io.fabric8.kubernetes.client.ConfigBuilder;
5 | import io.fabric8.kubernetes.client.DefaultKubernetesClient;
6 | import io.fabric8.kubernetes.client.KubernetesClient;
7 | import org.xml.sax.SAXException;
8 |
9 | import javax.xml.parsers.ParserConfigurationException;
10 | import javax.xml.xpath.XPathExpressionException;
11 | import java.io.IOException;
12 | import java.io.InputStream;
13 | import java.nio.file.Files;
14 | import java.nio.file.Paths;
15 | import java.util.HashMap;
16 | import java.util.List;
17 | import java.util.Map;
18 | import java.util.Optional;
19 | import java.util.Properties;
20 | import java.util.UUID;
21 | import java.util.function.Predicate;
22 | import java.util.regex.Pattern;
23 | import java.util.stream.Collectors;
24 | import java.util.stream.Stream;
25 |
26 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.failNotDeployed;
27 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getArrayListStringProperty;
28 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getArtifactId;
29 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getBooleanProperty;
30 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getIntProperty;
31 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getResourceFileAsStream;
32 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.getStringProperty;
33 | import static io.fabric8.quickstarts.camel.amq.support.KubernetesTestUtil.isNullOrEmpty;
34 | import static java.util.Collections.singletonMap;
35 | import static java.util.Objects.nonNull;
36 |
37 |
38 | public class KubernetesTestConfig {
39 |
40 |
41 | public static final String NAMESPACE_USE_CURRENT = "kt.namespace.use.current";
42 | public static final String NAMESPACE_TO_USE = "kt.namespace.use.existing";
43 | public static final String NAMESPACE_DESTROY_ENABLED = "kt.namespace.destroy.enabled";
44 | public static final String NAMESPACE_PREFIX = "kt.namespace.prefix";
45 | public static final String RESOUCE_FILE_PATH = "kt.resource.file.path";
46 | public static final String KUBERNETES_MASTER = "kubernetes.master";
47 | public static final String KUBERNETES_USERNAME = "kubernetes.username";
48 | public static final String KUBERNETES_PASSWORD = "kubernetes.password";
49 | public static final String KUBERNETES_TIMEOUT = "kubernetes.timeout";
50 |
51 | public static final int DEFAULT_KUBERNETES_TIMEOUT = 300;
52 | public static final String ENV_DEPENDENCIES = "kt.env.dependencies";
53 | public static final String DEFAULT_NAMESPACE_PREFIX = "ktest";
54 |
55 | public static final String TARGET_DIR_PATH = System.getProperty("basedir", ".") + "/target";
56 | public static final String DEFAULT_RESOUCE_FILE_PATH = TARGET_DIR_PATH + "/classes/META-INF/jkube/openshift.yml";
57 |
58 | public static final String TEST_PROPERTIES_FILE = "kubernetesTest.properties";
59 |
60 |
61 | private final Properties systemPropertiesVars = System.getProperties();
62 |
63 | private boolean shouldDestroyNamespace = false;
64 |
65 | private boolean useExistingNamespace = true;
66 |
67 | private String namespace;
68 |
69 | private String resourceFilePath;
70 |
71 | private String imageStreamFilePath;
72 |
73 | private List dependencies;
74 |
75 | private String kubernetesMaster;
76 |
77 | private String kubernetesUsername;
78 |
79 | private String kubernetesPassword;
80 |
81 | private KubernetesClient kubeClient;
82 |
83 | private int kubernetesTimeout;
84 |
85 | private String mainNamespace;
86 |
87 | private Map ktestLabels = singletonMap("scope","ktest");
88 |
89 | private KubernetesTestConfig() {
90 | }
91 |
92 | public static KubernetesTestConfig createConfig() {
93 | KubernetesTestConfig config = new KubernetesTestConfig();
94 | config.loadConfiguration();
95 | return config;
96 | }
97 |
98 | public KubernetesClient getClient() {
99 | if (kubeClient == null) {
100 | if (isNullOrEmpty(kubernetesMaster)) {
101 | kubeClient = new DefaultKubernetesClient();
102 | }else {
103 | Config config = new ConfigBuilder()
104 | .withMasterUrl(kubernetesMaster)
105 | .withUsername(kubernetesUsername)
106 | .withPassword(kubernetesPassword)
107 | .build();
108 | kubeClient = new DefaultKubernetesClient(config);
109 | }
110 | }
111 | return kubeClient;
112 | }
113 |
114 | private void loadConfiguration() {
115 |
116 | Properties prop = new Properties();
117 |
118 | try (InputStream input = getResourceFileAsStream(TEST_PROPERTIES_FILE)) {
119 | // load a properties file
120 | if(nonNull(input)) {
121 | prop.load(input);
122 | }
123 | } catch (IOException e) {
124 | throw new RuntimeException(e);
125 | }
126 |
127 | prop.putAll(systemPropertiesVars);
128 |
129 | Map testConfig = prop.entrySet().stream().collect(
130 | Collectors.toMap(
131 | e -> String.valueOf(e.getKey()),
132 | e -> String.valueOf(e.getValue()),
133 | (prev, next) -> next,
134 | HashMap::new)
135 | );
136 | String artifactId = null;
137 | try{
138 | artifactId = getArtifactId();
139 | } catch (XPathExpressionException | ParserConfigurationException |IOException| SAXException e) {
140 | failNotDeployed();
141 | }
142 |
143 | namespace = generateNamespaceName(testConfig);
144 |
145 | resourceFilePath = getStringProperty(RESOUCE_FILE_PATH, testConfig, DEFAULT_RESOUCE_FILE_PATH);
146 |
147 | imageStreamFilePath = TARGET_DIR_PATH + "/" + artifactId + "-is.yml" ;
148 |
149 | dependencies = getArrayListStringProperty(ENV_DEPENDENCIES, testConfig);
150 |
151 | kubernetesMaster = getStringProperty(KUBERNETES_MASTER, testConfig, null);
152 |
153 | kubernetesUsername = getStringProperty(KUBERNETES_USERNAME, testConfig, null);
154 |
155 | kubernetesPassword = getStringProperty(KUBERNETES_PASSWORD, testConfig, null);
156 |
157 | kubernetesTimeout = getIntProperty(KUBERNETES_TIMEOUT,testConfig,DEFAULT_KUBERNETES_TIMEOUT);
158 |
159 | shouldDestroyNamespace = getBooleanProperty(NAMESPACE_DESTROY_ENABLED, testConfig, true);
160 |
161 | mainNamespace = extractMainNamespaceName(imageStreamFilePath);
162 | }
163 |
164 |
165 | private String generateNamespaceName(Map config) {
166 | String sessionId = UUID.randomUUID().toString().split("-")[0];
167 | String namespace = getBooleanProperty(NAMESPACE_USE_CURRENT, config, false)
168 | ? new ConfigBuilder().build().getNamespace()
169 | : getStringProperty(NAMESPACE_TO_USE, config, null);
170 | if (isNullOrEmpty(namespace)) {
171 | namespace = getStringProperty(NAMESPACE_PREFIX, config, DEFAULT_NAMESPACE_PREFIX) + "-" + sessionId;
172 | shouldDestroyNamespace = true;
173 | useExistingNamespace = false;
174 | }
175 | return namespace;
176 | }
177 |
178 | private String extractMainNamespaceName(String imageStreamFilePath){
179 | Pattern pattern = Pattern.compile("\\s*\"namespace\"\\s*:\\s*\"[a-z0-9]([-a-z0-9]*[a-z0-9])?\".*");
180 | Predicate namespacePredicate = pattern.asPredicate();
181 |
182 | Optional mainNamespace = Optional.empty();
183 |
184 | try (Stream stream = Files.lines(Paths.get(imageStreamFilePath))) {
185 | mainNamespace = stream
186 | .filter(namespacePredicate)
187 | .map(x->pattern.matcher(x).group(1)).findFirst();
188 | }catch (IOException e) {
189 | failNotDeployed();
190 | }
191 | return mainNamespace.orElseGet(() -> new DefaultKubernetesClient().getNamespace());
192 | }
193 |
194 |
195 | // Getter
196 |
197 |
198 | public String getNamespace() {
199 | return namespace;
200 | }
201 |
202 | public String getResourceFilePath() {
203 | return resourceFilePath;
204 | }
205 |
206 | public List getDependencies() {
207 | return dependencies;
208 | }
209 |
210 | public boolean isUseExistingNamespace() {
211 | return useExistingNamespace;
212 | }
213 |
214 | public boolean isShouldDestroyNamespace() {
215 | return shouldDestroyNamespace;
216 | }
217 |
218 | public int getKubernetesTimeout() {
219 | return kubernetesTimeout;
220 | }
221 |
222 | public Map getKtestLabels() {
223 | return ktestLabels;
224 | }
225 |
226 | public String getImageStreamFilePath() {
227 | return imageStreamFilePath;
228 | }
229 |
230 | public String getMainNamespace() {
231 | return mainNamespace;
232 | }
233 | }
--------------------------------------------------------------------------------
/README.adoc:
--------------------------------------------------------------------------------
1 | == Spring-Boot, Camel and AMQ QuickStart
2 |
3 | This quickstart demonstrates how to connect a Spring-Boot application AMQ Broker and use JMS messaging between two Camel routes using Kubernetes or OpenShift.
4 |
5 | In this example we will use two containers, one container to run as an AMQ Broker instance, and another as a client to the broker, where the Camel routes are running.
6 |
7 | This quickstart requires AMQ Broker to have been deployed and running first. To install AMQ Broker into OpenShift or Kubernetes follow https://access.redhat.com/documentation/en-us/red_hat_amq/2020.q4/html/deploying_amq_broker_on_openshift/assembly-br-planning-a-deployment_broker-ocp[documentation].
8 |
9 | Quickstart uses the _standard address space_ and requires standard authentication. For address space and queue definition _standard-small-queue_, _standard_unlimited_ plans are used, therefore make sure you have also installed example plans, roles and standard authentication service.
10 |
11 | The application utilizes the Spring http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/ImportResource.html[`@ImportResource`] annotation to load a Camel Context definition via a _src/main/resources/spring/camel-context.xml_ file on the classpath.
12 |
13 | IMPORTANT: This quickstart can run in 2 modes: standalone on your machine and on Kubernetes / OpenShift Cluster. Quickstart requires Java 8 or Java 11 (`fuse-java-openshift-jdk11-rhel8` image is used to build in Java 11).
14 |
15 | == Deployment options
16 |
17 | You can run this quickstart in the following modes:
18 |
19 | * Kubernetes / Single-node OpenShift cluster
20 | * Standalone on your machine
21 |
22 | The most effective way to run this quickstart is to deploy and run the project on OpenShift.
23 |
24 | For more details about running this quickstart on a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the link:http://appdev.openshift.io/docs/spring-boot-runtime.html[Spring Boot Runtime Guide].
25 |
26 | == Running the Quickstart on a single-node Kubernetes/OpenShift cluster
27 |
28 | IMPORTANT: You need to run this example on Container Development Kit 3.3 or OpenShift 3.7.
29 | Both of these products have suitable Fuse images pre-installed.
30 | If you run it in an environment where those images are not preinstalled follow the steps described in <>.
31 |
32 | A single-node Kubernetes/OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
33 |
34 | If you have a single-node Kubernetes/OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, link:http://appdev.openshift.io/docs/minishift-installation.html[installed and running], you can deploy your quickstart there.
35 |
36 | . Log in to your OpenShift cluster:
37 | +
38 | [source,bash,options="nowrap",subs="attributes+"]
39 | ----
40 | $ oc login -u developer -p developer
41 | ----
42 |
43 | . Create a new OpenShift project for the quickstart:
44 | +
45 | [source,bash,options="nowrap",subs="attributes+"]
46 | ----
47 | $ oc new-project MY_PROJECT_NAME
48 | ----
49 |
50 | . Change the directory to the folder that contains the extracted quickstart application (for example, `my_openshift/spring-boot-camel-amq`) :
51 | +
52 | [source,bash,options="nowrap",subs="attributes+"]
53 | ----
54 | $ cd my_openshift/spring-boot-camel-amq
55 | ----
56 |
57 | . Before running the quickstart, you need to configure AMQ Broker (to create user and queue - both as an admin). Run the following commands to apply configuration files:
58 |
59 | +
60 | [source,bash,options="nowrap",subs="attributes+"]
61 | ----
62 | $ oc login -u system:admin
63 | $ oc apply -f src/main/resources/k8s
64 | ----
65 |
66 | . Build and deploy the project to the OpenShift cluster:
67 | +
68 | [source,bash,options="nowrap",subs="attributes+"]
69 | ----
70 | $ mvn clean -DskipTests oc:deploy -Popenshift
71 | ----
72 |
73 | . In your browser, navigate to the `MY_PROJECT_NAME` project in the OpenShift console.
74 | Wait until you can see that the pod for the `spring-boot-camel-amq` has started up.
75 |
76 | . On the project's `Overview` page, navigate to the details page deployment of the `spring-boot-camel-amq` application: `https://OPENSHIFT_IP_ADDR:8443/console/project/MY_PROJECT_NAME/browse/rc/spring-boot-camel-amq-NUMBER_OF_DEPLOYMENT?tab=details`.
77 |
78 | . Switch to tab `Logs` and then see the messages sent by Camel.
79 |
80 |
81 | [#single-node-without-preinstalled-images]
82 | === Running the Quickstart on a single-node Kubernetes/OpenShift cluster without preinstalled images
83 |
84 | A single-node Kubernetes/OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
85 |
86 | If you have a single-node Kubernetes/OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, link:http://appdev.openshift.io/docs/minishift-installation.html[installed and running], you can deploy your quickstart there.
87 |
88 |
89 | . Log in to your OpenShift cluster:
90 | +
91 | [source,bash,options="nowrap",subs="attributes+"]
92 | ----
93 | $ oc login -u developer -p developer
94 | ----
95 |
96 | . Create a new OpenShift project for the quickstart:
97 | +
98 | [source,bash,options="nowrap",subs="attributes+"]
99 | ----
100 | $ oc new-project MY_PROJECT_NAME
101 | ----
102 |
103 | . Configure Red Hat Container Registry authentication (if it is not configured).
104 | Follow https://access.redhat.com/documentation/en-us/red_hat_fuse/7.13/html-single/fuse_on_openshift_guide/index#configure-container-registry[documentation].
105 |
106 | . Import base images in your newly created project (MY_PROJECT_NAME):
107 | +
108 | [source,bash,options="nowrap",subs="attributes+"]
109 | ----
110 | $ oc import-image fuse-java-openshift:1.13 --from=registry.redhat.io/fuse7/fuse-java-openshift-rhel8:1.13 --confirm
111 | ----
112 |
113 | . Change the directory to the folder that contains the extracted quickstart application (for example, `my_openshift/spring-boot-camel-amq`) :
114 | +
115 | [source,bash,options="nowrap",subs="attributes+"]
116 | ----
117 | $ cd my_openshift/spring-boot-camel-amq
118 | ----
119 |
120 | . Before running the quickstart, you need to configure AMQ Broker (to create user and queue - both as an admin). Run the following commands to apply configuration files:
121 |
122 | +
123 | [source,bash,options="nowrap",subs="attributes+"]
124 | ----
125 | $ oc login -u system:admin
126 | $ oc apply -f src/main/resources/k8s
127 | ----
128 | . Wait until address space is ready:
129 | +
130 | [source,bash,options="nowrap",subs="attributes+"]
131 | ----
132 | $ oc get addressspace karaf-camel-amq -o jsonpath={.status.isReady}
133 | ----
134 |
135 | . Build and deploy the project to the OpenShift cluster:
136 | +
137 | [source,bash,options="nowrap",subs="attributes+"]
138 | ----
139 | $ mvn clean -DskipTests oc:deploy -Popenshift -Djkube.generator.fromMode=istag -Djkube.generator.from=MY_PROJECT_NAME/fuse-java-openshift:1.13
140 | ----
141 |
142 | . In your browser, navigate to the `MY_PROJECT_NAME` project in the OpenShift console.
143 | Wait until you can see that the pod for the `spring-boot-camel-amq` has started up.
144 |
145 | . On the project's `Overview` page, navigate to the details page deployment of the `spring-boot-camel-amq` application: `https://OPENSHIFT_IP_ADDR:8443/console/project/MY_PROJECT_NAME/browse/rc/spring-boot-camel-amq-NUMBER_OF_DEPLOYMENT?tab=details`.
146 |
147 | . Switch to tab `Logs` and then see the messages sent by Camel:
148 | ----
149 | ...
150 | 2021-03-05 10:12:54,502 | INFO | ile://work/jms/input | file-to-jms-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Receiving order order166.xml
151 | 2021-03-05 10:12:54,526 | INFO | umer[incomingOrders] | jms-cbr-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Sending order order166.xml to the UK
152 | 2021-03-05 10:12:54,527 | INFO | umer[incomingOrders] | jms-cbr-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Done processing order166.xml
153 | 2021-03-05 10:12:59,527 | INFO | ile://work/jms/input | file-to-jms-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Receiving order order167.xml
154 | 2021-03-05 10:12:59,556 | INFO | umer[incomingOrders] | jms-cbr-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Sending order order167.xml to the UK
155 | 2021-03-05 10:12:59,557 | INFO | umer[incomingOrders] | jms-cbr-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Done processing order167.xml
156 | 2021-03-05 10:13:04,558 | INFO | ile://work/jms/input | file-to-jms-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Receiving order order168.xml
157 | 2021-03-05 10:13:04,568 | INFO | umer[incomingOrders] | jms-cbr-route | 126 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Sending order order168.xml to the US
158 | ...
159 | ----
160 |
161 | == Running the quickstart standalone on your machine
162 |
163 | To run this quickstart as a standalone project on your local machine:
164 |
165 | . You need to have a running instance of AMQ Broker with messaging user `user1:test` and queue `incomingOrders`.
166 | +
167 | You can use AMQ Broker instance from previous steps. You need to configure the `src/main/resources/application.properties` file in order to
168 | use the correct remote instance of AMQ Broker.
169 | +
170 | Get remote url of AMQ Broker instance by running the following command:
171 |
172 | +
173 | [source,bash,options="nowrap",subs="attributes+"]
174 | ----
175 | $ oc get addressspace spring-boot-camel-amq -o jsonpath={.status.endpointStatuses[?(@.name==\'messaging\')].externalHost}
176 | ----
177 | +
178 | Fill this value into `src/main/resources/application.properties` instead of `FILL_ME`.
179 |
180 | . Download the project and extract the archive on your local filesystem.
181 | . Build the project:
182 | +
183 | [source,bash,options="nowrap",subs="attributes+"]
184 | ----
185 | $ cd PROJECT_DIR
186 | $ mvn clean package
187 | ----
188 | . Run the service:
189 |
190 | +
191 | [source,bash,options="nowrap",subs="attributes+"]
192 | ----
193 | $ mvn spring-boot:run
194 | ----
195 | . See the messages sent by Camel.
196 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
21 |
22 | 4.0.0
23 |
24 | io.fabric8.quickstarts
25 | spring-boot-camel-amq
26 | 1.0-SNAPSHOT
27 |
28 | Fabric8 :: Quickstarts :: Spring Boot :: Camel and EnMasse
29 | Spring Boot example running a Camel route connecting to EnMasse
30 |
31 |
32 | UTF-8
33 | UTF-8
34 |
35 |
36 | 7.12.0.fuse-7_12_0-00016-redhat-00001
37 | 1.13
38 |
39 |
40 | 3.7.0
41 | 2.22.2
42 |
43 |
44 |
45 |
46 |
47 | org.jboss.redhat-fuse
48 | fuse-springboot-bom
49 | ${fuse.bom.version}
50 | pom
51 | import
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | org.springframework.boot
60 | spring-boot-starter-actuator
61 |
62 |
63 | org.springframework.boot
64 | spring-boot-starter-web
65 |
66 |
67 | org.springframework.boot
68 | spring-boot-starter-tomcat
69 |
70 |
71 |
72 |
73 | org.springframework.boot
74 | spring-boot-starter-undertow
75 |
76 |
77 | org.springframework.boot
78 | spring-boot-configuration-processor
79 | true
80 |
81 |
82 |
83 |
84 | org.apache.camel
85 | camel-spring-boot-starter
86 |
87 |
88 |
89 | org.apache.camel
90 | camel-amqp-starter
91 |
92 |
93 |
94 | org.apache.activemq
95 | activemq-jms-pool
96 |
97 |
98 |
99 |
100 | junit
101 | junit
102 | test
103 |
104 |
105 |
106 | io.fabric8
107 | kubernetes-model
108 | test
109 |
110 |
111 |
112 | io.fabric8
113 | kubernetes-client
114 | test
115 |
116 |
117 |
118 | io.fabric8
119 | openshift-client
120 | 4.6.2
121 | test
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | src/test/resources
130 | true
131 |
132 |
133 |
134 |
135 |
136 | org.apache.maven.plugins
137 | maven-compiler-plugin
138 | ${maven-compiler-plugin.version}
139 |
140 | 1.8
141 | 1.8
142 |
143 |
144 |
145 | org.apache.maven.plugins
146 | maven-surefire-plugin
147 | ${maven-surefire-plugin.version}
148 | true
149 |
150 | 3
151 |
152 | **/*KT.java
153 |
154 |
155 |
156 |
157 |
158 | org.jboss.redhat-fuse
159 | spring-boot-maven-plugin
160 | ${fuse.bom.version}
161 |
162 |
163 |
164 | repackage
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 | itest
176 |
177 | src/test/fabric8
178 |
179 |
180 |
181 | openshift
182 |
183 | registry.redhat.io/fuse7/fuse-java-openshift-rhel8:${docker.image.version}
184 |
185 |
186 |
187 |
188 | org.jboss.redhat-fuse
189 | openshift-maven-plugin
190 | ${fuse.bom.version}
191 |
192 |
193 |
194 | resource
195 | build
196 | apply
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 | com.company
206 | Red_Hat
207 |
208 |
209 | rht.prod_name
210 | Red_Hat_Integration
211 |
212 |
213 | rht.prod_ver
214 | 7.13.0
215 |
216 |
217 | rht.comp
218 | spring-boot-camel-amq
219 |
220 |
221 | rht.comp_ver
222 | ${fuse.bom.version}
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 | java11
234 |
235 | registry.redhat.io/fuse7/fuse-java-openshift-jdk11-rhel8:${docker.image.version}
236 |
237 |
238 | [11,17)
239 |
240 |
241 |
242 | java17
243 |
244 | registry.redhat.io/fuse7/fuse-java-openshift-jdk17-rhel8:${docker.image.version}
245 |
246 |
247 | [17,)
248 |
249 |
250 |
251 |
252 |
253 |
254 | redhat-ga-repository
255 | https://maven.repository.redhat.com/ga
256 |
257 | true
258 |
259 |
260 | false
261 |
262 |
263 |
264 | redhat-ea-repository
265 | https://maven.repository.redhat.com/earlyaccess/all
266 |
267 | true
268 |
269 |
270 | false
271 |
272 |
273 |
274 |
275 |
276 |
277 | redhat-ga-repository
278 | https://maven.repository.redhat.com/ga
279 |
280 | true
281 |
282 |
283 | false
284 |
285 |
286 |
287 | redhat-ea-repository
288 | https://maven.repository.redhat.com/earlyaccess/all
289 |
290 | true
291 |
292 |
293 | false
294 |
295 |
296 |
297 |
298 |
299 |
--------------------------------------------------------------------------------