Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full yaml dsl #80 #84

Merged
merged 5 commits into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ public void process(MavenProject project, CamelCatalog catalog, Map<String, Came
artifacts.put(artifact.getArtifactId(), artifact);
}

// ************************
//
// camel-k-runtime-knative
//
// ************************

{
CamelArtifact artifact = new CamelArtifact();
artifact.setGroupId("org.apache.camel.k");
artifact.setArtifactId("camel-k-runtime-knative");
artifact.addDependency("org.apache.camel.k", "camel-k-runtime-yaml");
artifact.addDependency("org.apache.camel.k", "camel-knative");
artifact.addDependency("org.apache.camel.k", "camel-knative-http");
artifact.addDependency("org.apache.camel", "camel-netty4-http");

artifacts.put(artifact.getArtifactId(), artifact);
}

// ************************
//
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class CataloProcessor3Test extends AbstractCataloProcessorTest {

public class CatalogProcessor3Test extends AbstractCataloProcessorTest {
@Test
public void testAcceptHyphen(){
CatalogProcessor_3_x cp3 = new CatalogProcessor_3_x();
Expand Down Expand Up @@ -108,6 +107,20 @@ public void testArtifactsEnrichment(){
d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-servlet")
);
});
assertThat(artifactMap.get("camel-k-runtime-knative")).satisfies(a -> {
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative")
);
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative-http")
);
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-runtime-yaml")
);
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http")
);
});

assertThat(artifactMap.get("camel-knative")).satisfies(a -> {
assertThat(a.getDependencies()).anyMatch(
Expand Down
17 changes: 11 additions & 6 deletions camel-k-runtime-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@
<dependencyManagement>
<dependencies>
<!-- camel-k -->
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-maven-plugin</artifactId>
Expand Down Expand Up @@ -132,12 +142,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative-http</artifactId>
<artifactId>camel-k-runtime-knative</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
</dependencies>

<build>
<defaultGoal>exec:java</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</dependencies>

<build>
<defaultGoal>exec:java</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
105 changes: 105 additions & 0 deletions camel-k-runtime-examples/camel-k-runtime-example-yaml/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one or more
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

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<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.k</groupId>
<artifactId>camel-k-runtime-examples</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>camel-k-runtime-example-yaml</artifactId>

<dependencies>

<!-- ****************************** -->
<!-- -->
<!-- RUNTIME -->
<!-- -->
<!-- ****************************** -->

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-jvm</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-groovy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>
</dependencies>

<build>
<defaultGoal>exec:java</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.apache.camel.k.jvm.Application</mainClass>
<classpathScope>runtime</classpathScope>
<systemProperties>
<systemProperty>
<key>camel.k.conf</key>
<value>${project.basedir}/src/main/resources/application.properties</value>
</systemProperty>
<systemProperty>
<key>camel.k.routes</key>
<value>file:${project.basedir}/src/main/resources/routes.yaml</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.example;

public class Event {
private String id;
private String message;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Logging
#
logging.level.org.apache.camel.k = DEBUG

#
# Camel
#
camel.context.stream-caching = true

#
# Camel REST
#
camel.context.rest-configuration.component = servlet

#
# Camel K
#
customizer.servletregistration.enabled = true
customizer.servletregistration.path = /*
customizer.servlet.enabled = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

- id: "rest"
group: "routes"
rest:
verb: "post"
uri: "/api/route"
accepts: "text/plain"
binding-mode: "off"
steps:
- convert-body:
type: "java.lang.String"
- to:
uri: "log:in"
- choice:
when:
- simple: "${body.contains(\",\")}"
steps:
- split:
tokenizer: ","
steps:
- set-body:
simple: "${body.toUpperCase()}"
- to:
uri: "log:contains-1"
- simple: "${body.contains(\";\")}"
steps:
- split:
tokenizer: ";"
steps:
- set-body:
simple: "${body.toLowerCase()}"
- to:
uri: "log:contains2"
- marshal:
json: {}
- convert-body:
type: "java.lang.String"
- to:
uri: "log:out"
- id: "flow"
group: "routes"
rest:
verb: "post"
uri: "/api/flow"
accepts: "text/plain"
binding-mode: "off"
steps:
- convert-body:
type: "java.lang.String"
- to:
uri: "log:in"
- filter:
simple: "${body.contains(\",\")}"
- split:
tokenizer: ";"
- set-body:
simple: "${body.toLowerCase()}"
- to:
uri: "log:out"
- id: "rest+flow"
group: "routes"
rest:
verb: "post"
uri: "/api/floute"
accepts: "text/plain"
binding-mode: "off"
steps:
- convert-body:
type: "java.lang.String"
- to:
uri: "log:in"
- choice:
when:
- simple: "${body.contains(\",\")}"
steps:
- split:
tokenizer: ","
- set-body:
simple: "${body.toUpperCase()}"
- to:
uri: "log:contains-1"
- simple: "${body.contains(\";\")}"
steps:
- split:
tokenizer: ";"
- set-body:
simple: "${body.toLowerCase()}"
- to:
uri: "log:contains2"
1 change: 1 addition & 0 deletions camel-k-runtime-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<modules>
<module>camel-k-runtime-example-servlet</module>
<module>camel-k-runtime-example-health</module>
<module>camel-k-runtime-example-yaml</module>
</modules>

</project>
Loading