You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/02/21 11:12:02 UTC

[camel] branch master updated (87e6ef3 -> 9ccb9cc)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 87e6ef3  CAMEL-12266: Maven plugin for restdsl can now generate xml.
     new ca87845  CAMEL-12266: Maven plugin for restdsl can now generate xml.
     new 9ccb9cc  CAMEL-12266: Add log4j logging

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/it/simple-xml/pom.xml                           |  3 +++
 .../src/main/docs/camel-package-maven-plugin.adoc       |  1 +
 .../camel/maven/generator/swagger/GenerateXmlMojo.java  | 12 +++++++++++-
 tooling/swagger-rest-dsl-generator/pom.xml              | 17 +++++++++++++++++
 .../camel/generator/swagger/RestDslXmlGenerator.java    | 10 ++++++++++
 .../generator/swagger/RestDslXmlGeneratorTest.java      | 10 ++++++++++
 .../src/test/resources/log4j2.properties                |  2 +-
 7 files changed, 53 insertions(+), 2 deletions(-)
 copy {components/camel-blueprint => tooling/swagger-rest-dsl-generator}/src/test/resources/log4j2.properties (95%)

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 01/02: CAMEL-12266: Maven plugin for restdsl can now generate xml.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ca878458def952fc75523b066d9ad8efeac9ee8a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 21 12:09:43 2018 +0100

    CAMEL-12266: Maven plugin for restdsl can now generate xml.
---
 .../camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml   |  3 +++
 .../src/main/docs/camel-package-maven-plugin.adoc            |  1 +
 .../camel/maven/generator/swagger/GenerateXmlMojo.java       | 12 +++++++++++-
 .../apache/camel/generator/swagger/RestDslXmlGenerator.java  | 10 ++++++++++
 .../camel/generator/swagger/RestDslXmlGeneratorTest.java     | 10 ++++++++++
 5 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
index 19b22f4..def5610 100644
--- a/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
+++ b/tooling/maven/camel-restdsl-swagger-plugin/src/it/simple-xml/pom.xml
@@ -45,6 +45,9 @@
             <goals>
               <goal>generate-xml</goal>
             </goals>
+            <configuration>
+              <blueprint>true</blueprint>
+            </configuration>
           </execution>
         </executions>
       </plugin>
diff --git a/tooling/maven/camel-restdsl-swagger-plugin/src/main/docs/camel-package-maven-plugin.adoc b/tooling/maven/camel-restdsl-swagger-plugin/src/main/docs/camel-package-maven-plugin.adoc
index 10bd474..7528863 100644
--- a/tooling/maven/camel-restdsl-swagger-plugin/src/main/docs/camel-package-maven-plugin.adoc
+++ b/tooling/maven/camel-restdsl-swagger-plugin/src/main/docs/camel-package-maven-plugin.adoc
@@ -49,6 +49,7 @@ in the `<configuration>` tag.
 | `specificationUri` | `src/spec/swagger.json` | URI of the Swagger specification, loaded using Swagger's resource loading mechanism, supports filesystem paths, HTTP and classpath resources, by default `src/spec/swagger.json` within the project directory
 | `outputDirectory` | `generated-sources/restdsl-swagger` | Where to place the generated source file, by default `generated-sources/restdsl-swagger` within the project directory
 | `fileName` | `camel-rest.xml` | The name of the XML file as output.
+| `blueprint` | `false` | If enabled generates OSGi Blueprint XML instead of Spring XML.
 | `destinationGenerator` | | Fully qualified class name of the class that implements `org.apache.camel.generator.swagger.DestinationGenerator` interface for customizing destination endpoint
 |========================================
 
diff --git a/tooling/maven/camel-restdsl-swagger-plugin/src/main/java/org/apache/camel/maven/generator/swagger/GenerateXmlMojo.java b/tooling/maven/camel-restdsl-swagger-plugin/src/main/java/org/apache/camel/maven/generator/swagger/GenerateXmlMojo.java
index d18c7ee..4910a16 100644
--- a/tooling/maven/camel-restdsl-swagger-plugin/src/main/java/org/apache/camel/maven/generator/swagger/GenerateXmlMojo.java
+++ b/tooling/maven/camel-restdsl-swagger-plugin/src/main/java/org/apache/camel/maven/generator/swagger/GenerateXmlMojo.java
@@ -26,7 +26,6 @@ import org.apache.camel.generator.swagger.DestinationGenerator;
 import org.apache.camel.generator.swagger.RestDslGenerator;
 import org.apache.camel.generator.swagger.RestDslXmlGenerator;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -45,6 +44,9 @@ public class GenerateXmlMojo extends AbstractGenerateMojo {
     @Parameter(defaultValue = "camel-rest.xml", required = true)
     private String fileName;
 
+    @Parameter(defaultValue = "false")
+    boolean blueprint;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (skip) {
@@ -62,6 +64,14 @@ public class GenerateXmlMojo extends AbstractGenerateMojo {
 
         final RestDslXmlGenerator generator = RestDslGenerator.toXml(swagger);
 
+        System.out.println(blueprint);
+        System.out.println(blueprint);
+        System.out.println(blueprint);
+
+        if (blueprint) {
+            generator.withBlueprint();
+        }
+
         if (ObjectHelper.isNotEmpty(destinationGenerator)) {
             final DestinationGenerator destinationGeneratorObject = createDestinationGenerator();
 
diff --git a/tooling/swagger-rest-dsl-generator/src/main/java/org/apache/camel/generator/swagger/RestDslXmlGenerator.java b/tooling/swagger-rest-dsl-generator/src/main/java/org/apache/camel/generator/swagger/RestDslXmlGenerator.java
index 8afc963..1b1b944 100644
--- a/tooling/swagger-rest-dsl-generator/src/main/java/org/apache/camel/generator/swagger/RestDslXmlGenerator.java
+++ b/tooling/swagger-rest-dsl-generator/src/main/java/org/apache/camel/generator/swagger/RestDslXmlGenerator.java
@@ -23,10 +23,17 @@ import org.apache.camel.model.rest.RestsDefinition;
 
 public class RestDslXmlGenerator extends RestDslGenerator<RestDslXmlGenerator> {
 
+    private boolean blueprint;
+
     RestDslXmlGenerator(final Swagger swagger) {
         super(swagger);
     }
 
+    public RestDslXmlGenerator withBlueprint() {
+        this.blueprint = true;
+        return this;
+    }
+
     public String generate(final CamelContext context) throws Exception {
         final RestDefinitionEmitter emitter = new RestDefinitionEmitter(context);
 
@@ -36,6 +43,9 @@ public class RestDslXmlGenerator extends RestDslGenerator<RestDslXmlGenerator> {
 
         RestsDefinition rests = emitter.result();
         String xml = ModelHelper.dumpModelAsXml(context, rests);
+        if (blueprint) {
+            xml = xml.replace("http://camel.apache.org/schema/spring", "http://camel.apache.org/schema/blueprint");
+        }
         return xml;
     }
 }
diff --git a/tooling/swagger-rest-dsl-generator/src/test/java/org/apache/camel/generator/swagger/RestDslXmlGeneratorTest.java b/tooling/swagger-rest-dsl-generator/src/test/java/org/apache/camel/generator/swagger/RestDslXmlGeneratorTest.java
index 0610b56..fed3779 100644
--- a/tooling/swagger-rest-dsl-generator/src/test/java/org/apache/camel/generator/swagger/RestDslXmlGeneratorTest.java
+++ b/tooling/swagger-rest-dsl-generator/src/test/java/org/apache/camel/generator/swagger/RestDslXmlGeneratorTest.java
@@ -39,6 +39,16 @@ public class RestDslXmlGeneratorTest {
 
         final String xml = RestDslGenerator.toXml(swagger).generate(context);
         assertThat(xml).isNotEmpty();
+        assertThat(xml.contains("http://camel.apache.org/schema/spring"));
+    }
+
+    @Test
+    public void shouldGenerateBlueprintXml() throws Exception {
+        final CamelContext context = new DefaultCamelContext();
+
+        final String xml = RestDslGenerator.toXml(swagger).withBlueprint().generate(context);
+        assertThat(xml).isNotEmpty();
+        assertThat(xml.contains("http://camel.apache.org/schema/blueprint"));
     }
 
     @Test

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 02/02: CAMEL-12266: Add log4j logging

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9ccb9cccae7390669a603705f3320a03a9e6148f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 21 12:11:49 2018 +0100

    CAMEL-12266: Add log4j logging
---
 tooling/swagger-rest-dsl-generator/pom.xml         | 17 +++++++++++++
 .../src/test/resources/log4j2.properties           | 28 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/tooling/swagger-rest-dsl-generator/pom.xml b/tooling/swagger-rest-dsl-generator/pom.xml
index f2eabd9..815b878 100644
--- a/tooling/swagger-rest-dsl-generator/pom.xml
+++ b/tooling/swagger-rest-dsl-generator/pom.xml
@@ -61,6 +61,23 @@
       <version>${assertj-version}</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
 </project>
diff --git a/tooling/swagger-rest-dsl-generator/src/test/resources/log4j2.properties b/tooling/swagger-rest-dsl-generator/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..1ba77d3
--- /dev/null
+++ b/tooling/swagger-rest-dsl-generator/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-swagger-rest-dsl-generator.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.