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 2022/03/16 06:30:01 UTC

[camel] branch main updated: CAMEL-17569: camel-jbang and java-dsl: Support loading camel configuration classes, and servicies (BindToRegistry).

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 cc9d988  CAMEL-17569: camel-jbang and java-dsl: Support loading camel configuration classes, and servicies (BindToRegistry).
cc9d988 is described below

commit cc9d98853fbcb297ff48a965b2b1299531eb65de
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 16 07:29:05 2022 +0100

    CAMEL-17569: camel-jbang and java-dsl: Support loading camel configuration classes, and servicies (BindToRegistry).
---
 .../dsl/java/joor/JavaMainBindToRegistryTest.java  | 43 ---------------------
 .../dsl/java/joor/JavaMainConfigurationTest.java   | 43 ---------------------
 .../camel/dsl/java/joor/JavaMainConverterTest.java | 45 ----------------------
 .../src/test/resources/routes/MyConfiguration.java | 32 ---------------
 .../resources/routes/MyConfigurationRoute.java     | 26 -------------
 .../src/test/resources/routes/MyConverter.java     | 35 -----------------
 .../test/resources/routes/MyConverterRoute.java    | 27 -------------
 7 files changed, 251 deletions(-)

diff --git a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainBindToRegistryTest.java b/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainBindToRegistryTest.java
deleted file mode 100644
index 6eef942..0000000
--- a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainBindToRegistryTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.dsl.java.joor;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.main.Main;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-public class JavaMainBindToRegistryTest {
-
-    @Test
-    public void testMainBindToRegistry() throws Exception {
-        Main main = new Main();
-        main.configure().withRoutesIncludePattern("routes/MyEchoRoute.java,routes/MyEcho.java");
-        main.start();
-
-        CamelContext camelContext = main.getCamelContext();
-        assertNotNull(camelContext);
-
-        String out = main.getCamelTemplate().requestBody("direct:start", "Hello", String.class);
-        assertEquals("HelloHello", out);
-
-        main.stop();
-    }
-
-}
diff --git a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConfigurationTest.java b/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConfigurationTest.java
deleted file mode 100644
index 98b71a9..0000000
--- a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConfigurationTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.dsl.java.joor;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.main.Main;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-public class JavaMainConfigurationTest {
-
-    @Test
-    public void testMainConfiguration() throws Exception {
-        Main main = new Main();
-        main.configure().withRoutesIncludePattern("routes/MyConfigurationRoute.java,routes/MyConfiguration.java");
-        main.start();
-
-        CamelContext camelContext = main.getCamelContext();
-        assertNotNull(camelContext);
-
-        String out = main.getCamelTemplate().requestBody("direct:start", "Hello", String.class);
-        assertEquals("Hello Donald", out);
-
-        main.stop();
-    }
-
-}
diff --git a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConverterTest.java b/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConverterTest.java
deleted file mode 100644
index 38beeec..0000000
--- a/dsl/camel-java-joor-dsl/src/test/java/org/apache/camel/dsl/java/joor/JavaMainConverterTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.dsl.java.joor;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.dsl.java.joor.support.MyUser;
-import org.apache.camel.main.Main;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-public class JavaMainConverterTest {
-
-    @Test
-    public void testMainConverter() throws Exception {
-        Main main = new Main();
-        main.configure().withRoutesIncludePattern("routes/MyConverterRoute.java,routes/MyConverter.java");
-        main.start();
-
-        CamelContext camelContext = main.getCamelContext();
-        assertNotNull(camelContext);
-
-        MyUser out = main.getCamelTemplate().requestBody("direct:start", "Donald", MyUser.class);
-        assertEquals("Donald", out.getName());
-        assertEquals(42, out.getAge());
-
-        main.stop();
-    }
-
-}
diff --git a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfiguration.java b/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfiguration.java
deleted file mode 100644
index ffcf6ac..0000000
--- a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfiguration.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-import org.apache.camel.BindToRegistry;
-import org.apache.camel.Configuration;
-import org.apache.camel.dsl.java.joor.support.MyUser;
-
-@Configuration
-public class MyConfiguration {
-
-    @BindToRegistry
-    public MyUser user() {
-        MyUser user = new MyUser();
-        user.setName("Donald");
-        user.setAge(42);
-        return user;
-    }
-
-}
\ No newline at end of file
diff --git a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfigurationRoute.java b/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfigurationRoute.java
deleted file mode 100644
index 3313d6d..0000000
--- a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConfigurationRoute.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-import org.apache.camel.builder.RouteBuilder;
-
-public class MyConfigurationRoute extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        from("direct:start")
-                .setBody().simple("${body} ${bean:user.name}");
-    }
-}
\ No newline at end of file
diff --git a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverter.java b/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverter.java
deleted file mode 100644
index 7c8921b..0000000
--- a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-import org.apache.camel.Converter;
-
-import org.apache.camel.dsl.java.joor.support.MyUser;
-
-@Converter
-public final class MyConverter {
-
-    private MyConverter() {
-    }
-
-    @Converter
-    public static MyUser toMyUser(String s) {
-        MyUser user = new MyUser();
-        user.setName(s);
-        user.setAge(42);
-        return user;
-    }
-
-}
\ No newline at end of file
diff --git a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverterRoute.java b/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverterRoute.java
deleted file mode 100644
index 637e488..0000000
--- a/dsl/camel-java-joor-dsl/src/test/resources/routes/MyConverterRoute.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.dsl.java.joor.support.MyUser;
-
-public class MyConverterRoute extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        from("direct:start")
-                .convertBodyTo(MyUser.class);
-    }
-}
\ No newline at end of file