Skip to content
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 @@ -12,7 +12,7 @@
},
"properties": {
"name": { "kind": "attribute", "displayName": "Name", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Bean name" },
"language": { "kind": "attribute", "displayName": "Language", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "bean", "groovy", "joor", "language", "mvel", "ognl" ], "deprecated": false, "autowired": false, "secret": false, "description": "The language to use for creating the bean (such as groovy, joor)" },
"script": { "kind": "value", "displayName": "Script", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script to execute that creates the bean. If the script use the prefix resource: such as resource:classpath:com\/foo\/myscript.groovy, resource:file:\/var\/myscript.groovy, then its loaded from the external resource." }
"type": { "kind": "attribute", "displayName": "Type", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What type to use for creating the bean. Can be one of: #class,#type,bean,groovy,joor,language,mvel,ognl. #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean The others are scripting languages that gives more power to create the bean with an inlined code in the script section, such as using groovy." },
"script": { "kind": "value", "displayName": "Script", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such as resource:classpath:com\/foo\/myscript.groovy, resource:file:\/var\/myscript.groovy, then its loaded from the external resource." }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10337,31 +10337,21 @@ Reference to the route templates in the xml dsl.
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
The name of the parameter.
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="required" type="xs:boolean">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
Whether the parameter is required or not. A parameter is required unless this
option is set to false or a default value has been configured. Default value:
false
Parameter name.
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="defaultValue" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
Default value of the parameter. If a default value is provided then the
parameter is implied not to be required.
Parameter default value.
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="description" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
Description of the parameter.
Parameter description.
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.component.kamelet;

import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.http.annotation.Obsolete;
import org.junit.jupiter.api.Test;

public class KameletLocalBeanClassFourTest extends CamelTestSupport {

@Test
public void testOne() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hi John we are going to Moes");

template.sendBody("direct:bar", "John");

assertMockEndpointsSatisfied();
}

// **********************************************
//
// test set-up
//
// **********************************************

@Obsolete
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
routeTemplate("whereTo")
.templateParameter("bar")
.templateBean("myBar")
.type("org.apache.camel.component.kamelet.KameletLocalBeanClassFourTest$MyBar")
.property("bar", "{{bar}}")
.end()
.from("kamelet:source")
// must use {{myBar}} to refer to the local bean
.to("bean:{{myBar}}");

from("direct:bar")
.kamelet("whereTo?bar=Moes")
.to("mock:result");
}
};
}

public static class MyBar {

private String bar;

public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public String where(String name) {
return "Hi " + name + " we are going to " + bar;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.component.kamelet;

import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.http.annotation.Obsolete;
import org.junit.jupiter.api.Test;

public class KameletLocalBeanClassTest extends CamelTestSupport {

@Test
public void testOne() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hi John we are going to Murphys");

template.sendBody("direct:bar", "John");

assertMockEndpointsSatisfied();
}

// **********************************************
//
// test set-up
//
// **********************************************

@Obsolete
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
routeTemplate("whereTo")
.templateBean("myBar", MyBar.class)
.from("kamelet:source")
// must use {{myBar}} to refer to the local bean
.to("bean:{{myBar}}");

from("direct:bar")
.kamelet("whereTo")
.to("mock:result");
}
};
}

public static class MyBar {

private final String bar = "Murphys";

public String where(String name) {
return "Hi " + name + " we are going to " + bar;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.component.kamelet;

import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.http.annotation.Obsolete;
import org.junit.jupiter.api.Test;

public class KameletLocalBeanClassThreeTest extends CamelTestSupport {

@Test
public void testOne() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hi John we are going to Moes");

template.sendBody("direct:bar", "John");

assertMockEndpointsSatisfied();
}

// **********************************************
//
// test set-up
//
// **********************************************

@Obsolete
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
routeTemplate("whereTo")
.templateParameter("bar")
.templateBean("myBar")
.type(MyBar.class)
.property("bar", "{{bar}}")
.end()
.from("kamelet:source")
// must use {{myBar}} to refer to the local bean
.to("bean:{{myBar}}");

from("direct:bar")
.kamelet("whereTo?bar=Moes")
.to("mock:result");
}
};
}

public static class MyBar {

private String bar;

public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public String where(String name) {
return "Hi " + name + " we are going to " + bar;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.component.kamelet;

import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.apache.http.annotation.Obsolete;
import org.junit.jupiter.api.Test;

public class KameletLocalBeanClassTwoTest extends CamelTestSupport {

@Test
public void testOne() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hi John we are going to Murphys");

template.sendBody("direct:bar", "John");

assertMockEndpointsSatisfied();
}

// **********************************************
//
// test set-up
//
// **********************************************

@Obsolete
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
routeTemplate("whereTo")
.templateBean("myBar", "#class:org.apache.camel.component.kamelet.KameletLocalBeanClassTwoTest$MyBar")
.from("kamelet:source")
// must use {{myBar}} to refer to the local bean
.to("bean:{{myBar}}");

from("direct:bar")
.kamelet("whereTo")
.to("mock:result");
}
};
}

public static class MyBar {

private final String bar = "Murphys";

public String where(String name) {
return "Hi " + name + " we are going to " + bar;
}
}

}
Loading