Skip to content

Commit

Permalink
Merge pull request #371 from gnodet/issue-337
Browse files Browse the repository at this point in the history
Use automatic code formatting, fixes #337
  • Loading branch information
gnodet committed Nov 5, 2019
2 parents 21785c8 + 7af2bf0 commit 87b0cdf
Show file tree
Hide file tree
Showing 126 changed files with 1,533 additions and 1,239 deletions.
269 changes: 269 additions & 0 deletions build/eclipse-formatter-config.xml

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions examples/observability/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>0.3.2-SNAPSHOT</version>
<relativePath>../../poms/bom/pom.xml</relativePath>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -31,6 +31,19 @@
<name>Camel Quarkus :: Examples :: Observability</name>
<description>Camel Quarkus Example :: Observability</description>

<dependencyManagement>
<dependencies>
<!-- Import BOM -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class Routes extends RouteBuilder {
public void configure() throws Exception {
// Invokes a simple greeting endpoint every 10 seconds
from("timer:greeting?period=10s")
.to("netty-http:http://localhost:8099/greeting");
.to("netty-http:http://localhost:8099/greeting");

from("netty-http:0.0.0.0:8099/greeting")
// Random delay to simulate latency
.delay(simple("${random(1000, 5000)}"))
.setBody(constant("Hello From Camel Quarkus!"));
// Random delay to simulate latency
.delay(simple("${random(1000, 5000)}"))
.setBody(constant("Hello From Camel Quarkus!"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> opti
int hits = hitCount.incrementAndGet();

// Flag the check as DOWN on every 5th invocation, else it is UP
if (hits %5 == 0) {
if (hits % 5 == 0) {
builder.down();
} else {
builder.up();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,34 @@ public class ObservabilityTest {
public void metrics() {
// Verify a expected Camel metric is available
given()
.when().accept(ContentType.JSON)
.get("/metrics/application")
.then()
.statusCode(200)
.body(
"'camel.context.status;camelContext=camel-quarkus-observability'", is(1)
);
.when().accept(ContentType.JSON)
.get("/metrics/application")
.then()
.statusCode(200)
.body(
"'camel.context.status;camelContext=camel-quarkus-observability'", is(1));
}

@Test
public void health() {
// Verify liveness
given()
.when().accept(ContentType.JSON)
.get("/health/live")
.then()
.statusCode(200)
.body("status", Matchers.is("UP"),
"checks.name", containsInAnyOrder("camel-liveness-checks", "camel"),
"checks.data.custom-liveness-check", containsInAnyOrder(null, "UP")
);
.when().accept(ContentType.JSON)
.get("/health/live")
.then()
.statusCode(200)
.body("status", Matchers.is("UP"),
"checks.name", containsInAnyOrder("camel-liveness-checks", "camel"),
"checks.data.custom-liveness-check", containsInAnyOrder(null, "UP"));

// Verify readiness
given()
.when().accept(ContentType.JSON)
.get("/health/ready")
.then()
.statusCode(200)
.body("status", Matchers.is("UP"),
"checks.name", containsInAnyOrder("camel-readiness-checks", "camel", "Uptime readiness check"),
"checks.data.custom-readiness-check", containsInAnyOrder(null, "UP")
);
.when().accept(ContentType.JSON)
.get("/health/ready")
.then()
.statusCode(200)
.body("status", Matchers.is("UP"),
"checks.name", containsInAnyOrder("camel-readiness-checks", "camel", "Uptime readiness check"),
"checks.data.custom-readiness-check", containsInAnyOrder(null, "UP"));
}
}
17 changes: 15 additions & 2 deletions examples/rest-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>0.3.2-SNAPSHOT</version>
<relativePath>../../poms/bom/pom.xml</relativePath>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -31,6 +31,19 @@
<name>Camel Quarkus :: Examples :: Rest Json</name>
<description>Camel Quarkus Example :: Rest Json</description>

<dependencyManagement>
<dependencies>
<!-- Import BOM -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import io.quarkus.runtime.annotations.RegisterForReflection;


/**
* A REST entity representing a legume.
*/
Expand Down
30 changes: 15 additions & 15 deletions examples/rest-json/src/main/java/org/acme/rest/json/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ public Routes() {
@Override
public void configure() throws Exception {
from("platform-http:/fruits?httpMethodRestrict=GET,POST")
.choice()
.choice()
.when(simple("${header.CamelHttpMethod} == 'GET'"))
.setBody()
.constant(fruits)
.endChoice()
.setBody()
.constant(fruits)
.endChoice()
.when(simple("${header.CamelHttpMethod} == 'POST'"))
.unmarshal()
.json(JsonLibrary.Jackson, Fruit.class)
.process()
.body(Fruit.class, fruits::add)
.setBody()
.constant(fruits)
.endChoice()
.end()
.marshal().json();
.unmarshal()
.json(JsonLibrary.Jackson, Fruit.class)
.process()
.body(Fruit.class, fruits::add)
.setBody()
.constant(fruits)
.endChoice()
.end()
.marshal().json();

from("platform-http:/legumes?httpMethodRestrict=GET")
.setBody().constant(legumes)
.marshal().json();
.setBody().constant(legumes)
.marshal().json();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
*/
@NativeImageTest
public class RestJsonIT extends RestJsonTest {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,37 @@ public void fruits() {

/* Assert the initial fruits are there */
given()
.when().get("/fruits")
.then()
.statusCode(200)
.body(
"$.size()", is(2),
"name", containsInAnyOrder("Apple", "Pineapple"),
"description", containsInAnyOrder("Winter fruit", "Tropical fruit")
);
.when().get("/fruits")
.then()
.statusCode(200)
.body(
"$.size()", is(2),
"name", containsInAnyOrder("Apple", "Pineapple"),
"description", containsInAnyOrder("Winter fruit", "Tropical fruit"));

/* Add a new fruit */
given()
.body("{\"name\": \"Pear\", \"description\": \"Winter fruit\"}")
.header("Content-Type", "application/json")
.when()
.post("/fruits")
.then()
.statusCode(200)
.body(
"$.size()", is(3),
"name", containsInAnyOrder("Apple", "Pineapple", "Pear"),
"description", containsInAnyOrder("Winter fruit", "Tropical fruit", "Winter fruit")
);
.body("{\"name\": \"Pear\", \"description\": \"Winter fruit\"}")
.header("Content-Type", "application/json")
.when()
.post("/fruits")
.then()
.statusCode(200)
.body(
"$.size()", is(3),
"name", containsInAnyOrder("Apple", "Pineapple", "Pear"),
"description", containsInAnyOrder("Winter fruit", "Tropical fruit", "Winter fruit"));
}

@Test
public void legumes() {
given()
.when().get("/legumes")
.then()
.statusCode(200)
.body("$.size()", is(2),
"name", containsInAnyOrder("Carrot", "Zucchini"),
"description", containsInAnyOrder("Root vegetable, usually orange", "Summer squash"));
.when().get("/legumes")
.then()
.statusCode(200)
.body("$.size()", is(2),
"name", containsInAnyOrder("Carrot", "Zucchini"),
"description", containsInAnyOrder("Root vegetable, usually orange", "Summer squash"));
}

}
17 changes: 15 additions & 2 deletions examples/timer-log-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>0.3.2-SNAPSHOT</version>
<relativePath>../../poms/bom/pom.xml</relativePath>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -31,6 +31,19 @@
<name>Camel Quarkus :: Examples :: Timer Log XML</name>
<description>Camel Quarkus Example :: Timer to Log XML</description>

<dependencyManagement>
<dependencies>
<!-- Import BOM -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
Expand All @@ -16,4 +16,4 @@
*/
package org.acme.timer;

// Added to avoid quarkus-maven-plugin warning about empty source tree
// Added to avoid quarkus-maven-plugin warning about empty source tree
17 changes: 15 additions & 2 deletions examples/timer-log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>0.3.2-SNAPSHOT</version>
<relativePath>../../poms/bom/pom.xml</relativePath>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -31,6 +31,19 @@
<name>Camel Quarkus :: Examples :: Timer Log</name>
<description>Camel Quarkus Example :: Timer to Log</description>

<dependencyManagement>
<dependencies>
<!-- Import BOM -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public class TimerRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:foo?period=1s")
.log("Hello World");
.log("Hello World");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ final class SubstituteCachingServiceDiscovery {
public void setTimeout(long timeout) {
this.timeout = timeout;
this.cache = Caffeine.newBuilder()
.executor(new Executor() {
@Override
public void execute(Runnable command) {
// workaround for https://github.com/quarkusio/quarkus/issues/3300
ForkJoinPool.commonPool().execute(command);
}
})
.expireAfterAccess(timeout, TimeUnit.MILLISECONDS)
.build(delegate::getServices);
.executor(new Executor() {
@Override
public void execute(Runnable command) {
// workaround for https://github.com/quarkusio/quarkus/issues/3300
ForkJoinPool.commonPool().execute(command);
}
})
.expireAfterAccess(timeout, TimeUnit.MILLISECONDS)
.build(delegate::getServices);
}
}

0 comments on commit 87b0cdf

Please sign in to comment.