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 2024/02/09 09:23:47 UTC
(camel) branch main updated: CAMEL-20402: Added unit test
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new c24f985b449 CAMEL-20402: Added unit test
c24f985b449 is described below
commit c24f985b449a7116b80286f82452f0e00064659c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 9 10:23:23 2024 +0100
CAMEL-20402: Added unit test
---
.../org/apache/camel/yaml/out/ModelWriterTest.java | 24 +++++++++++++++++++
core/camel-yaml-io/src/test/resources/route10.yaml | 28 ++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/core/camel-yaml-io/src/test/java/org/apache/camel/yaml/out/ModelWriterTest.java b/core/camel-yaml-io/src/test/java/org/apache/camel/yaml/out/ModelWriterTest.java
index 6aa74d25ec0..9d1009d8d3e 100644
--- a/core/camel-yaml-io/src/test/java/org/apache/camel/yaml/out/ModelWriterTest.java
+++ b/core/camel-yaml-io/src/test/java/org/apache/camel/yaml/out/ModelWriterTest.java
@@ -39,7 +39,9 @@ import org.apache.camel.model.dataformat.CsvDataFormat;
import org.apache.camel.model.language.ConstantExpression;
import org.apache.camel.model.language.HeaderExpression;
import org.apache.camel.model.language.SimpleExpression;
+import org.apache.camel.model.rest.RestDefinition;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.apache.camel.util.IOHelper.stripLineComments;
@@ -297,4 +299,26 @@ public class ModelWriterTest {
Assertions.assertEquals(expected, out);
}
+ @Test
+ @Disabled("CAMEL-20402")
+ public void testRest() throws Exception {
+ StringWriter sw = new StringWriter();
+ ModelWriter writer = new ModelWriter(sw);
+
+ RestDefinition rest = new RestDefinition();
+ rest.verb("get").to("direct:start");
+ writer.writeRestDefinition(rest);
+
+ RouteDefinition route = new RouteDefinition();
+ route.setId("myRoute10");
+ route.setInput(new FromDefinition("direct:start"));
+ SetBodyDefinition sb = new SetBodyDefinition(new SimpleExpression("${body}${body}"));
+ route.addOutput(sb);
+ writer.writeRouteDefinition(route);
+
+ String out = sw.toString();
+ String expected = stripLineComments(Paths.get("src/test/resources/route10.yaml"), "#", true);
+ Assertions.assertEquals(expected, out);
+ }
+
}
diff --git a/core/camel-yaml-io/src/test/resources/route10.yaml b/core/camel-yaml-io/src/test/resources/route10.yaml
new file mode 100644
index 00000000000..93ab1aee290
--- /dev/null
+++ b/core/camel-yaml-io/src/test/resources/route10.yaml
@@ -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.
+#
+
+- rest:
+ get:
+ - to: direct:start
+- route:
+ id: myRoute10
+ from:
+ uri: direct:start
+ steps:
+ - setBody:
+ simple:
+ expression: "${body}${body}"
\ No newline at end of file