Browse Source

Initial commit.

pull/1/head
Andrea Tarocchi 8 years ago
parent
commit
e9801a8f16
  1. 30
      .gitignore
  2. 224
      .openshiftio/application.yaml
  3. 87
      README.adoc
  4. 215
      pom.xml
  5. 16
      src/main/java/com/redhat/fuse/boosters/rest/http/Application.java
  6. 43
      src/main/java/com/redhat/fuse/boosters/rest/http/CamelRouter.java
  7. 26
      src/main/java/com/redhat/fuse/boosters/rest/http/Greetings.java
  8. 16
      src/main/java/com/redhat/fuse/boosters/rest/http/GreetingsService.java
  9. 16
      src/main/java/com/redhat/fuse/boosters/rest/http/GreetingsServiceImpl.java
  10. 21
      src/main/java/com/redhat/fuse/boosters/rest/http/IndexRootMapper.java
  11. BIN
      src/main/resources/META-INF/resources/favicon.ico
  12. 31
      src/main/resources/META-INF/resources/rest-http-index.html
  13. 9
      src/main/resources/application.properties
  14. 8
      src/main/resources/log4j2.properties
  15. 31
      src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestTest.java

30
.gitignore vendored

@ -0,0 +1,30 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
target/
.idea/
*.iml
.vscode/
.classpath
.project
.settings/

224
.openshiftio/application.yaml

@ -0,0 +1,224 @@
apiVersion: v1
kind: Template
metadata:
name: launchpad-builder-fuse-rest-http-booster
annotations:
description: This template creates a Build Configuration using an S2I builder.
tags: instant-app
parameters:
- name: SOURCE_REPOSITORY_URL
description: The source URL for the application
displayName: Source URL
required: true
- name: SOURCE_REPOSITORY_REF
description: The branch name for the application
displayName: Source Branch
value: master
required: true
- name: SOURCE_REPOSITORY_DIR
description: The location within the source repo of the application
displayName: Source Directory
value: .
required: true
- name: ARTIFACT_COPY_ARGS
description: Syntax to be used to copy uberjar files to the target directory
displayName: Copy Args
value: '*-exec.jar'
required: true
- name: GITHUB_WEBHOOK_SECRET
description: A secret string used to configure the GitHub webhook.
displayName: GitHub Webhook Secret
required: true
from: '[a-zA-Z0-9]{40}'
generate: expression
- name: MAVEN_MIRROR_URL
description: Maven Nexus Repository to be used during build phase
displayName:
required: false
objects:
- apiVersion: v1
kind: ImageStream
metadata:
name: fis-java-openshift
spec:
tags:
- name: "1.0"
annotations:
description: JBoss Fuse Integration Services 1.0 Java S2I images.
iconClass: icon-jboss
supports: 'jboss-fuse:6.2.1,java:8,xpaas:1.2'
tags: 'builder,jboss-fuse,java,xpaas,hidden'
version: '1.0'
from:
kind: DockerImage
name: 'registry.access.redhat.com/jboss-fuse-6/fis-java-openshift:1.0'
- name: "2.0"
annotations:
description: JBoss Fuse Integration Services 2.0 Java S2I images.
iconClass: icon-jboss
supports: 'jboss-fuse:6.3.0,java:8,xpaas:1.2'
tags: 'builder,jboss-fuse,java,xpaas'
version: '2.0'
from:
kind: DockerImage
name: 'registry.access.redhat.com/jboss-fuse-6/fis-java-openshift:2.0'
- apiVersion: v1
kind: ImageStream
metadata:
name: fuse-rest-http-booster
spec: {}
- apiVersion: v1
kind: BuildConfig
metadata:
name: fuse-rest-http-booster
labels:
app: fuse-rest-http-booster
group: com.redhat.fuse.boosters
provider: fabric8
spec:
output:
to:
kind: ImageStreamTag
name: fuse-rest-http-booster:latest
postCommit: {}
resources: {}
runPolicy: Serial
source:
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
#contextDir: ${SOURCE_REPOSITORY_DIR}
type: Git
strategy:
sourceStrategy:
env:
- name: BUILD_LOGLEVEL
value: '5'
- name: MAVEN_ARGS_APPEND
value: "-pl ${SOURCE_REPOSITORY_DIR}"
- name: ARTIFACT_DIR
value: "${SOURCE_REPOSITORY_DIR}/target"
- name: MAVEN_MIRROR_URL
value: "${MAVEN_MIRROR_URL}"
- name: ARTIFACT_COPY_ARGS
value: "${ARTIFACT_COPY_ARGS}"
forcePull: true
from:
kind: ImageStreamTag
name: fis-java-openshift:2.0
incremental: true
type: Source
triggers:
- github:
secret: ${GITHUB_WEBHOOK_SECRET}
type: GitHub
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
- apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/port: "9779"
prometheus.io/scrape: "true"
labels:
expose: "true"
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
name: fuse-rest-http-booster
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
name: fuse-rest-http-booster
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
strategy:
rollingParams:
timeoutSeconds: 3600
type: Rolling
template:
metadata:
labels:
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: fuse-rest-http-booster:latest
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 180
name: fuse-rest-http-booster
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 9779
name: prometheus
protocol: TCP
- containerPort: 8778
name: jolokia
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 10
securityContext:
privileged: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- fuse-rest-http-booster
from:
kind: ImageStreamTag
name: fuse-rest-http-booster:latest
type: ImageChange
- apiVersion: v1
kind: Route
metadata:
labels:
app: fuse-rest-http-booster
provider: fabric8
group: com.redhat.fuse.boosters
name: fuse-rest-http-booster
spec:
port:
targetPort: 8080
to:
kind: Service
name: fuse-rest-http-booster

87
README.adoc

@ -0,0 +1,87 @@
:launchURL: https://developers.redhat.com/launch
= REST API Level 0 - Fuse Booster
== Overview
The REST API Level 0 mission shows how to map business operations to a remote procedure call endpoint over HTTP using a REST framework. This corresponds to Level 0 in the Richardson Maturity Model.
Creating an HTTP endpoint using REST and its underlying principles to define your API lets you quickly prototype and design the API flexibly.
This booster introduces the mechanics of interacting with a remote (exposed by <strong>Apache Camel</strong>) service using the HTTP protocol. It allows you to:
. Execute an HTTP GET request on `api/greetings/{name}`` endpoint; using the url parameter `{name}` and producing a response in JSON format with a payload of Hello, $name! with $name replaced by the value of the url parameter used into the request.
. Browse the api's Swagger page.
== Deployment options
This booster can run in the following modes:
* Standalone on your machine
* Single-node OpenShift cluster
* OpenShift Online at link:{launchURL}[]
The most effective way to demonstrate the booster is to deploy and run the project on OpenShift.
For more details about running this booster 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].
IMPORTANT: This booster requires Java 8 JDK or greater and Maven 3.3.x or greater.
== Running the booster standalone on your machine
You can run this booster as a standalone project on your local machine:
. Download the project and extract the archive on your local filesystem.
. Build the project:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ cd PROJECT_DIR
$ mvn clean package
----
. then run the services as follows:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ mvn spring-boot:run
----
. Visit link:http://localhost:8080[] and follow the instructions on that page.
== Running the booster on a single-node OpenShift cluster
If you have a single-node 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 booster there.
A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
To deploy your booster to a running single-node OpenShift cluster:
. Download the project and extract the archive on your local filesystem.
. Log in to your OpenShift cluster:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ oc login -u developer -p developer
----
. Create a new OpenShift project for the booster:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ oc new-project MY_PROJECT_NAME
----
. Build and deploy the project to the OpenShift cluster:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ mvn clean -DskipTests fabric8:deploy -Popenshift
----
. In your browser, navigate to the `MY_PROJECT_NAME` project in the OpenShift console.
Wait until you can see that the pod for the `fuse-rest-http-booster` application has started up.
. Just above the entry for the `fuse-rest-http-booster` application on the `Overview` page, there is a URL of the form `http://fuse-rest-http-booster-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io`.
Click on the URL to access the greetings service application and follow the instructions on that page.
== Running the booster on OpenShift Online
You can deploy the circuit breaker booster directly to OpenShift Online when you create the project at link:{launchURL}[].
. Visit link:{launchURL}[].
. At the *Deployment step*, select *Use OpenShift Online*.
. Follow the on-screen instructions to create a new *REST API Level 0* project using the *Fuse* runtime.
NOTE: As part of the process of creating this booster, link:{launchURL}[] sets up a project with a CI/CD deployment of this booster. You can see the status of this deployment in your Single-node OpenShift Cluster or OpenShift Online Web Console.

215
pom.xml

@ -0,0 +1,215 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.fuse.boosters</groupId>
<artifactId>fuse-rest-http-booster</artifactId>
<version>7.0.0.redhat-SNAPSHOT</version>
<name>Fuse :: Boosters :: Rest HTTP</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>1.5.12.RELEASE</spring-boot.version>
<camel.version>2.21.0</camel.version>
<!-- versions of Maven plugins -->
<fmp.version>3.5.33</fmp.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-dependencies</artifactId>
<version>${camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- spring-boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.33</version>
</dependency>
<!-- camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-java-starter</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fmp.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Core plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<classifier>exec</classifier>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>openshift</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

16
src/main/java/com/redhat/fuse/boosters/rest/http/Application.java

@ -0,0 +1,16 @@
package com.redhat.fuse.boosters.rest.http;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
/**
* Main method to start the application.
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

43
src/main/java/com/redhat/fuse/boosters/rest/http/CamelRouter.java

@ -0,0 +1,43 @@
package com.redhat.fuse.boosters.rest.http;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;
import org.springframework.stereotype.Component;
/**
* A simple Camel REST DSL route that implement the greetings service.
*
*/
@Component
public class CamelRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
// @formatter:off
restConfiguration()
.apiContextPath("/api-doc")
.apiProperty("api.title", "Greeting REST API")
.apiProperty("api.version", "1.0")
.apiProperty("cors", "true")
.apiProperty("base.path", "camel/")
.apiProperty("api.path", "/")
.apiProperty("host", "")
// .apiProperty("schemes", "")
.apiContextRouteId("doc-api")
.component("servlet")
.bindingMode(RestBindingMode.json);
rest("/greetings/").description("Greeting to {name}")
.get("/{name}").outType(Greetings.class)
.route().routeId("greeting-api")
.to("direct:greetingsImpl");
from("direct:greetingsImpl").description("Greetings REST service implementation route")
.streamCaching()
.to("bean:greetingsService?method=getGreetings");
// @formatter:on
}
}

26
src/main/java/com/redhat/fuse/boosters/rest/http/Greetings.java

@ -0,0 +1,26 @@
package com.redhat.fuse.boosters.rest.http;
/**
* Greetings entity
*
*/
public class Greetings {
private String greetings;
public Greetings() {
}
public Greetings(String greetings) {
this.greetings = greetings;
}
public String getGreetings() {
return greetings;
}
public void setGreetings(String greetings) {
this.greetings = greetings;
}
}

16
src/main/java/com/redhat/fuse/boosters/rest/http/GreetingsService.java

@ -0,0 +1,16 @@
package com.redhat.fuse.boosters.rest.http;
/**
* Service interface for name service.
*
*/
public interface GreetingsService {
/**
* Generate Greetings
*
* @return a string greetings
*/
Greetings getGreetings( String name);
}

16
src/main/java/com/redhat/fuse/boosters/rest/http/GreetingsServiceImpl.java

@ -0,0 +1,16 @@
package com.redhat.fuse.boosters.rest.http;
import org.apache.camel.Header;
import org.springframework.stereotype.Service;
@Service("greetingsService")
public class GreetingsServiceImpl implements GreetingsService {
private static final String THE_GREETINGS = "Hello, ";
@Override
public Greetings getGreetings(@Header("name") String name ) {
return new Greetings( THE_GREETINGS + name );
}
}

21
src/main/java/com/redhat/fuse/boosters/rest/http/IndexRootMapper.java

@ -0,0 +1,21 @@
package com.redhat.fuse.boosters.rest.http;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@ComponentScan
public class IndexRootMapper extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/rest-http-index.html");
}
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
// registry.addViewController("/").setStatusCode(HttpStatus.PERMANENT_REDIRECT).setViewName("redirect:/webjars/swagger-ui/index.html?url=/camel/api-doc&validatorUrl=");
// }
}

BIN
src/main/resources/META-INF/resources/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

31
src/main/resources/META-INF/resources/rest-http-index.html

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Rest Http Mission - Red Hat Fuse</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
</head>
<body>
<div class="container">
<div>
<h1>Rest Http Mission - Red Hat Fuse</h1>
<p class="lead">
The REST API Level 0 mission shows how to map business operations to a remote procedure call endpoint over HTTP using a REST framework. This corresponds to Level 0 in the Richardson Maturity Model.
Creating an HTTP endpoint using REST and its underlying principles to define your API lets you quickly prototype and design the API flexibly.
</p>
<p class="lead">
This booster introduces the mechanics of interacting with a remote (exposed by <strong>Apache Camel</strong>) service using the HTTP protocol. It allows you to:
<dl>
<dt class="lead"><strong>Execute an HTTP GET request on api/greetings/{name} endpoint:</strong></dt>
<dd class="lead"><a class="btn btn-info" href="/camel/greetings/Jacopo" target="_blank">api/greetings/{name}</a> this uses the url parameter <code>{name}</code> and produce a response in JSON format with a payload of Hello, $name! with $name replaced by the value of the url parameter used into the request.</dd>
<dt class="lead"><strong>Browse the api's Swagger page:</strong></dt>
<dd class="lead"><a class="btn btn-info" href="/webjars/swagger-ui/index.html?url=/camel/api-doc&validatorUrl=" target="_blank">Api Swagger page</a> this displays the swagger-ui for the rest api.</dd>
</dl>
</p>
</div>
</div>
</body>
</html>

9
src/main/resources/application.properties

@ -0,0 +1,9 @@
server.port=8080
# disable all management enpoints except health
endpoints.enabled = false
endpoints.health.enabled = true
management.health.defaults.enabled=false
camel.health.enabled=false
camel.health.indicator.enabled=true

8
src/main/resources/log4j2.properties

@ -0,0 +1,8 @@
appender.stdout.type = Console
appender.stdout.name = stdout
appender.stdout.layout.type = PatternLayout
appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
logger.zipkin.name = org.apache.camel.zipkin
logger.zipkin.level = DEBUG
rootLogger.level = DEBUG
rootLogger.appenderRef.stdout.ref = stdout

31
src/test/java/com/redhat/fuse/boosters/rest/http/HttpRequestTest.java

@ -0,0 +1,31 @@
package com.redhat.fuse.boosters.rest.http;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class HttpRequestTest {
@LocalServerPort
private int port;
@Autowired
private TestRestTemplate restTemplate;
@Test
public void greetingsShouldReturnFallbackMessage() throws Exception {
Assert.assertEquals( "Hello, jacopo", this.restTemplate.getForObject("http://localhost:" + port + "/camel/greetings/jacopo", Greetings.class).getGreetings());
}
@Test
public void healthShouldReturnOkMessage() throws Exception {
Assert.assertEquals( "{\"status\":\"UP\"}", this.restTemplate.getForObject("http://localhost:" + port + "/health", String.class));
}
}
Loading…
Cancel
Save