This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-examples.git
commit ce4f040589c9bd88b544ddb0cf70dd85d90ad147 Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Jan 18 12:09:20 2023 +0100 Move to 4.0.0-SNAPSHOT Signed-off-by: Andrea Cosentino <[email protected]> --- examples/README.adoc | 8 +- examples/loan-broker-cxf/README.adoc | 48 ----- examples/loan-broker-cxf/pom.xml | 167 ----------------- .../BankResponseAggregationStrategy.java | 34 ---- .../java/org/apache/camel/loanbroker/Client.java | 60 ------ .../camel/loanbroker/CreditScoreProcessor.java | 74 -------- .../org/apache/camel/loanbroker/LoanBroker.java | 36 ---- .../org/apache/camel/loanbroker/LoanBrokerWS.java | 27 --- .../apache/camel/loanbroker/ReplyProcessor.java | 35 ---- .../org/apache/camel/loanbroker/bank/Bank.java | 47 ----- .../apache/camel/loanbroker/bank/BankQuote.java | 62 ------- .../org/apache/camel/loanbroker/bank/BankWS.java | 32 ---- .../camel/loanbroker/credit/CreditAgency.java | 37 ---- .../camel/loanbroker/credit/CreditAgencyWS.java | 31 ---- .../src/main/resources/META-INF/LICENSE.txt | 203 --------------------- .../src/main/resources/META-INF/NOTICE.txt | 11 -- .../META-INF/spring/webServiceCamelContext.xml | 112 ------------ .../src/main/resources/loanbroker.properties | 23 --- .../src/main/resources/log4j2.properties | 22 --- .../src/main/resources/logging.properties | 60 ------ .../apache/camel/loanbroker/LoanBrokerWSTest.java | 83 --------- .../src/test/resources/log4j2.properties | 29 --- examples/main-artemis/README.adoc | 49 ----- examples/main-artemis/pom.xml | 125 ------------- .../org/apache/camel/example/MyApplication.java | 36 ---- .../org/apache/camel/example/MyConfiguration.java | 40 ---- .../org/apache/camel/example/MyRouteBuilder.java | 31 ---- .../src/main/resources/application.properties | 49 ----- .../src/main/resources/log4j2.properties | 26 --- .../org/apache/camel/example/MainArtemisTest.java | 101 ---------- examples/pom.xml | 2 - 31 files changed, 1 insertion(+), 1699 deletions(-) diff --git a/examples/README.adoc b/examples/README.adoc index e23dab89..946d4d26 100644 --- a/examples/README.adoc +++ b/examples/README.adoc @@ -11,7 +11,7 @@ View the individual example READMEs for details. == Examples // examples: START -Number of Examples: 75 (0 deprecated) +Number of Examples: 72 (0 deprecated) [width="100%",cols="4,2,4",options="header"] |=== @@ -129,8 +129,6 @@ Number of Examples: 75 (0 deprecated) | link:loadbalancing/README.adoc[Load Balancing] (loadbalancing) | EIP | An example that demonstrate load balancing messaging with mina servers (TCP/IP) -| link:loan-broker-cxf/README.adoc[Loan Broker WebService] (loan-broker-cxf) | EIP | An example that shows the EIP's loan broker demo - | link:resume-api/README.md[Resume Api] (resume-api) | EIP | Multiple Resume API examples | link:transformer-demo/README.adoc[Transformer and Validator Spring XML] (transformer-demo) | Input/Output Type Contract | An example demonstrating declarative transformation and validation along data type declaration using @@ -164,10 +162,6 @@ Number of Examples: 75 (0 deprecated) | link:whatsapp/README.adoc[Whatsapp] (whatsapp) | Social | An example that uses Whatsapp API | link:mapstruct/README.adoc[Mapstruct] (mapstruct) | Transformation | How to use MapStruct for POJO data mapping - -| link:cxf-proxy/README.adoc[CXF Proxy] (cxf-proxy) | WebService | An example which uses Camel to proxy a web service - -| link:cxf-tomcat/README.adoc[CXF Tomcat] (cxf-tomcat) | WebService | An example using Camel CXF (code first) with Apache Tomcat |=== // examples: END diff --git a/examples/loan-broker-cxf/README.adoc b/examples/loan-broker-cxf/README.adoc deleted file mode 100644 index a1f89a0d..00000000 --- a/examples/loan-broker-cxf/README.adoc +++ /dev/null @@ -1,48 +0,0 @@ -== Loan Broker Example with Apache CXF - -=== Introduction - -This example shows how to use Camel to implement the EIP’s loan broker -example, from the EIP book: http://www.enterpriseintegrationpatterns.com/SystemManagementExample.html[Loan Broker System Management]. - -The example use web services for exchanging messages between the client, -credit agency, and the banks. - -=== Build - -You will need to compile this example first: - -.... -$ mvn compile -.... - -=== Run - -.... -$ mvn exec:java -PWS.LoanBroker -.... -and in another terminal session execute -.... -$ mvn exec:java -PWS.Client -.... - -To stop the example hit ctrl+c - -=== Run unit tests - -There are unit tests implemented, which can be run with the following command: - -[source,sh] ----- -$ mvn test ----- - -=== Help and contributions - -If you hit any problem using Camel or have some feedback, then please -https://camel.apache.org/community/support/[let us know]. - -We also love contributors, so -https://camel.apache.org/community/contributing/[get involved] :-) - -The Camel riders! diff --git a/examples/loan-broker-cxf/pom.xml b/examples/loan-broker-cxf/pom.xml deleted file mode 100644 index b28ae6fb..00000000 --- a/examples/loan-broker-cxf/pom.xml +++ /dev/null @@ -1,167 +0,0 @@ -<?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/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.camel.example</groupId> - <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> - </parent> - - <artifactId>camel-example-loan-broker-cxf</artifactId> - <packaging>jar</packaging> - <name>Camel :: Example :: Loan-Broker</name> - <description>An example that shows the EIP's loan broker demo</description> - - <properties> - <category>EIP</category> - <title>Loan Broker WebService</title> - </properties> - - <dependencyManagement> - <dependencies> - <!-- Add Camel BOM --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bom</artifactId> - <version>${camel.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring-xml</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring-main</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-cxf-spring-soap</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-cxf-spring-transport</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http-jetty</artifactId> - <version>${cxf-version}</version> - </dependency> - - <dependency> - <groupId>org.apache.xbean</groupId> - <artifactId>xbean-spring</artifactId> - <version>${xbean-spring-version}</version> - <exclusions> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - - <!-- testing --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring-junit5</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <plugins> - - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <forkCount>1</forkCount> - <reuseForks>false</reuseForks> - </configuration> - </plugin> - - <!-- Allows the example to be run via 'mvn compile exec:java' --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <configuration> - <mainClass>${target.main.class}</mainClass> - <includePluginDependencies>false</includePluginDependencies> - <classpathScope>runtime</classpathScope> - <systemProperties> - <property> - <key>java.util.logging.config.file</key> - <value>logging.properties</value> - </property> - </systemProperties> - </configuration> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>WS.LoanBroker</id> - <properties> - <target.main.class>org.apache.camel.loanbroker.LoanBroker</target.main.class> - </properties> - </profile> - <profile> - <id>WS.Client</id> - <properties> - <target.main.class>org.apache.camel.loanbroker.Client</target.main.class> - </properties> - </profile> - </profiles> - -</project> diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java deleted file mode 100644 index 3383a44b..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java +++ /dev/null @@ -1,34 +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.loanbroker; - -import org.apache.camel.loanbroker.bank.BankQuote; - -//START SNIPPET: aggregating -// This POJO aggregator is supported since Camel 2.12 -public class BankResponseAggregationStrategy { - - public BankQuote aggregate(BankQuote oldQuote, BankQuote newQuote) { - if (oldQuote != null && oldQuote.getRate() <= newQuote.getRate()) { - return oldQuote; - } else { - return newQuote; - } - } - -} -//END SNIPPET: aggregating diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java deleted file mode 100644 index 2d188860..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java +++ /dev/null @@ -1,60 +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.loanbroker; - -import org.apache.camel.util.StopWatch; -import org.apache.cxf.BusFactory; -import org.apache.cxf.frontend.ClientFactoryBean; -import org.apache.cxf.frontend.ClientProxyFactoryBean; - -/** - * The client that will invoke the loan broker service - */ -//START SNIPPET: client -public final class Client { - - //Change the port to the one on which Loan broker is listening. - - private static String url = "http://localhost:9008/loanBroker"; - - private Client() { - } - - public static LoanBrokerWS getProxy(String address) { - // Now we use the simple front API to create the client proxy - ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean(); - ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean(); - clientBean.setAddress(address); - clientBean.setServiceClass(LoanBrokerWS.class); - // just create a new bus for use - clientBean.setBus(BusFactory.newInstance().createBus()); - return (LoanBrokerWS) proxyFactory.create(); - } - - public static void main(String[] args) { - LoanBrokerWS loanBroker = getProxy(url); - - StopWatch watch = new StopWatch(); - String result = loanBroker.getLoanQuote("SSN", 5000.00, 24); - - System.out.println("Took " + watch.taken() + " milliseconds to call the loan broker service"); - System.out.println(result); - } - -} -//END SNIPPET: client - diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java deleted file mode 100644 index 6e636bbe..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java +++ /dev/null @@ -1,74 +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.loanbroker; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.loanbroker.credit.CreditAgencyWS; -import org.apache.cxf.BusFactory; -import org.apache.cxf.frontend.ClientFactoryBean; -import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; - -/** - * Credit score processor. - */ -//START SNIPPET: credit -public class CreditScoreProcessor implements Processor { - private String creditAgencyAddress; - private CreditAgencyWS proxy; - - public CreditScoreProcessor(String address) { - creditAgencyAddress = address; - proxy = getProxy(); - } - - private CreditAgencyWS getProxy() { - // Here we use JaxWs front end to create the proxy - JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); - ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean(); - clientBean.setAddress(creditAgencyAddress); - clientBean.setServiceClass(CreditAgencyWS.class); - clientBean.setBus(BusFactory.getDefaultBus()); - return (CreditAgencyWS) proxyFactory.create(); - } - - @Override - @SuppressWarnings("unchecked") - public void process(Exchange exchange) throws Exception { - List<Object> request = exchange.getIn().getBody(List.class); - - String ssn = (String) request.get(0); - Double amount = (Double) request.get(1); - Integer loanDuration = (Integer) request.get(2); - int historyLength = proxy.getCreditHistoryLength(ssn); - int score = proxy.getCreditScore(ssn); - - // create the invocation message for Bank client - List<Object> bankRequest = new ArrayList<>(); - bankRequest.add(ssn); - bankRequest.add(amount); - bankRequest.add(loanDuration); - bankRequest.add(historyLength); - bankRequest.add(score); - exchange.getOut().setBody(bankRequest); - exchange.getOut().setHeader("operationName", "getQuote"); - } - -} diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java deleted file mode 100644 index 3a34a784..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java +++ /dev/null @@ -1,36 +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.loanbroker; - -import org.apache.camel.spring.Main; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * Main class to run the loan broker server from command line. - */ -public final class LoanBroker { - - private LoanBroker() { - } - - public static void main(String... args) throws Exception { - // create a main which will boot the Spring XML file (default context 'META-INF/spring/*.xml' will be scanned) - Main main = new Main(); - // run and block until Camel is stopped (or JVM terminated) - main.run(); - } -} diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java deleted file mode 100644 index b9fa2a75..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.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. - */ -package org.apache.camel.loanbroker; - -//START SNIPPET: loanBroker - -// This SEI has no @WebService annotation, we use the simple frontend API to create client and server -public interface LoanBrokerWS { - - String getLoanQuote(String ssn, Double loanAmount, Integer loanDuration); - -} -//END SNIPPET: loanBroker diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java deleted file mode 100644 index 18491507..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.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. - */ -package org.apache.camel.loanbroker; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.loanbroker.bank.BankQuote; - -/** - * Processor to set the reply message for the loan broker web service - */ -public class ReplyProcessor implements Processor { - - @Override - public void process(Exchange exchange) throws Exception { - BankQuote quote = exchange.getIn().getBody(BankQuote.class); - - String answer = "The best rate is " + quote.toString(); - exchange.getOut().setBody(answer); - } -} diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java deleted file mode 100644 index ec24038f..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java +++ /dev/null @@ -1,47 +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.loanbroker.bank; - -//START SNIPPET: bankImpl -public class Bank implements BankWS { - private final String bankName; - private final double primeRate; - - public Bank(String name) { - bankName = name; - primeRate = 3.5; - } - - @Override - public String getBankName() { - return bankName; - } - - @Override - public BankQuote getQuote(String ssn, double loanAmount, int loanDuration, int creditHistory, int creditScore) { - Double rate = primeRate + ((double) loanDuration / 12) / 10 + Math.random() * 10 / 10; - // Wait for a while - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // do nothing here - } - return new BankQuote(bankName, ssn, rate); - } - -} -//END SNIPPET: bankImpl diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java deleted file mode 100644 index e0efd99b..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java +++ /dev/null @@ -1,62 +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.loanbroker.bank; - -public class BankQuote { - private String bankName; - private String ssn; - private Double rate; - - public BankQuote() { - } - - public BankQuote(String name, String s, Double r) { - bankName = name; - ssn = s; - rate = r; - } - - public void setBankName(String name) { - bankName = name; - } - - public void setSsn(String s) { - ssn = s; - } - - public void setRate(Double r) { - rate = r; - } - - public String getBankName() { - return bankName; - } - - public String getSsn() { - return ssn; - } - - public Double getRate() { - return rate; - } - - @Override - public String toString() { - return "[ssn:" + ssn + " bank:" + bankName + " rate:" + rate + "]"; - } - -} diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java deleted file mode 100644 index e37659b5..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.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. - */ -package org.apache.camel.loanbroker.bank; - -import javax.jws.WebService; - -//START SNIPPET: bank -// Since we use @WebServices here, please make sure to use JaxWs frontend API create the client and server -@WebService -public interface BankWS { - - String getBankName(); - - BankQuote getQuote(String ssn, double loanAmount, int loanDuration, int creditHistory, int creditScore); - -} -//END SNIPPET: bank - diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java deleted file mode 100644 index 16859b1b..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java +++ /dev/null @@ -1,37 +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.loanbroker.credit; - -import java.util.Random; - -//START SNIPPET: creditAgencyImpl -public class CreditAgency implements CreditAgencyWS { - - private final Random random = new Random(); - - @Override - public int getCreditHistoryLength(String ssn) { - return random.nextInt() * 600 + 300; - } - - @Override - public int getCreditScore(String ssn) { - return random.nextInt() * 19 + 1; - } - -} -//END SNIPPET: creditAgencyImpl diff --git a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java b/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java deleted file mode 100644 index c593fa53..00000000 --- a/examples/loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java +++ /dev/null @@ -1,31 +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.loanbroker.credit; - -import javax.jws.WebService; - -//START SNIPPET: creditAgency -@WebService -public interface CreditAgencyWS { - - int getCreditScore(String ssn); - - int getCreditHistoryLength(String ssn); - -} -//END SNIPPET: creditAgency - diff --git a/examples/loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt b/examples/loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 6b0b1270..00000000 --- a/examples/loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - diff --git a/examples/loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt b/examples/loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt deleted file mode 100644 index 2e215bf2..00000000 --- a/examples/loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt +++ /dev/null @@ -1,11 +0,0 @@ - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Camel distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - Please read the different LICENSE files present in the licenses directory of - this distribution. diff --git a/examples/loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml b/examples/loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml deleted file mode 100644 index b04354ac..00000000 --- a/examples/loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml +++ /dev/null @@ -1,112 +0,0 @@ -<?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. - ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:camel="http://camel.apache.org/schema/spring" - xmlns:cxf="http://camel.apache.org/schema/cxf/jaxws" - xmlns:jaxws="http://cxf.apache.org/jaxws" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd - http://camel.apache.org/schema/cxf/jaxws http://camel.apache.org/schema/cxf/jaxws/camel-cxf.xsd - http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> - - <!-- spring property placeholder, ignore resource not found as the file resource is for unit testing --> - <context:property-placeholder location="classpath:loanbroker.properties,file:target/custom.properties" - ignore-resource-not-found="true"/> - - <!-- web service for credit agency --> - <jaxws:endpoint id="creditAgent" - implementor="org.apache.camel.loanbroker.credit.CreditAgency" - address="http://localhost:${credit_agency.port}/creditAgency"/> - - <bean id="bank1" class="org.apache.camel.loanbroker.bank.Bank"> - <constructor-arg index="0"> - <value>bank1</value> - </constructor-arg> - </bean> - - <bean id="bank2" class="org.apache.camel.loanbroker.bank.Bank"> - <constructor-arg index="0"> - <value>bank2</value> - </constructor-arg> - </bean> - - <bean id="bank3" class="org.apache.camel.loanbroker.bank.Bank"> - <constructor-arg index="0"> - <value>bank3</value> - </constructor-arg> - </bean> - - <!-- web service for the 3 banks --> - <jaxws:endpoint id="bankService1" - implementor="#bank1" - address="http://localhost:${bank1.port}/bank1"/> - - <jaxws:endpoint id="bankService2" - implementor="#bank2" - address="http://localhost:${bank2.port}/bank2"/> - - <jaxws:endpoint id="bankService3" - implementor="#bank3" - address="http://localhost:${bank3.port}/bank3"/> - - - <!-- loan broker web service --> - <cxf:cxfEndpoint id="loanBroker" - address="http://localhost:${loan_broker.port}/loanBroker" - serviceClass="org.apache.camel.loanbroker.LoanBrokerWS"/> - - <!-- Camel --> - <camel:camelContext id="webService"> - - <!-- define endpoints for the banks --> - <camel:endpoint id="bank1WS" - uri="cxf://http://localhost:${bank1.port}/bank1?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/> - <camel:endpoint id="bank2WS" - uri="cxf://http://localhost:${bank2.port}/bank2?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/> - <camel:endpoint id="bank3WS" - uri="cxf://http://localhost:${bank3.port}/bank3?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/> - - <camel:route id="loanBrokerRoute"> - <camel:from uri="cxf:bean:loanBroker"/> - <camel:process ref="creditScoreProcessor"/> - <camel:multicast parallelProcessing="true" aggregationStrategy="bankResponse"> - <camel:to uri="ref:bank1WS"/> - <camel:to uri="ref:bank2WS"/> - <camel:to uri="ref:bank3WS"/> - </camel:multicast> - <camel:process ref="replyProcessor"/> - </camel:route> - </camel:camelContext> - - <!-- processor to calculate credit score --> - <bean id="creditScoreProcessor" class="org.apache.camel.loanbroker.CreditScoreProcessor"> - <constructor-arg index="0" value="http://localhost:${credit_agency.port}/creditAgency"/> - </bean> - - <bean id="replyProcessor" class="org.apache.camel.loanbroker.ReplyProcessor"/> - - <!-- strategy to assemble the bank responses --> - <bean id="bankResponse" class="org.apache.camel.loanbroker.BankResponseAggregationStrategy"/> - -</beans> diff --git a/examples/loan-broker-cxf/src/main/resources/loanbroker.properties b/examples/loan-broker-cxf/src/main/resources/loanbroker.properties deleted file mode 100644 index 127fac61..00000000 --- a/examples/loan-broker-cxf/src/main/resources/loanbroker.properties +++ /dev/null @@ -1,23 +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. -## --------------------------------------------------------------------------- - -# properties for the application -bank1.port=9001 -bank2.port=9002 -bank3.port=9003 -credit_agency.port=9006 -loan_broker.port=9008 diff --git a/examples/loan-broker-cxf/src/main/resources/log4j2.properties b/examples/loan-broker-cxf/src/main/resources/log4j2.properties deleted file mode 100644 index 871e07bb..00000000 --- a/examples/loan-broker-cxf/src/main/resources/log4j2.properties +++ /dev/null @@ -1,22 +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. -## --------------------------------------------------------------------------- -appender.stdout.type=Console -appender.stdout.name=stdout -appender.stdout.layout.type=PatternLayout -appender.stdout.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n -rootLogger.level=INFO -rootLogger.appenderRef.stdout.ref=stdout diff --git a/examples/loan-broker-cxf/src/main/resources/logging.properties b/examples/loan-broker-cxf/src/main/resources/logging.properties deleted file mode 100644 index 4c7f3da4..00000000 --- a/examples/loan-broker-cxf/src/main/resources/logging.properties +++ /dev/null @@ -1,60 +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. -## --------------------------------------------------------------------------- -############################################################ -# Default Logging Configuration File -# -# You can use a different file by specifying a filename -# with the java.util.logging.config.file system property. -# For example java -Djava.util.logging.config.file=myfile -############################################################ -############################################################ -# Global properties -############################################################ -# "handlers" specifies a comma separated list of log Handler -# classes. These handlers will be installed during VM startup. -# Note that these classes must be on the system classpath. -# By default we only configure a ConsoleHandler, which will only -# show messages at the INFO and above levels. -#handlers= java.util.logging.ConsoleHandler -# To also add the FileHandler, use the following line instead. -#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler -# Default global logging level. -# This specifies which kinds of events are logged across -# all loggers. For any given facility this global level -# can be overriden by a facility specific level -# Note that the ConsoleHandler also has a separate level -# setting to limit messages printed to the console. -.level=WARNING -############################################################ -# Handler specific properties. -# Describes specific configuration info for Handlers. -############################################################ -# default file output is in user's home directory. -java.util.logging.FileHandler.pattern=%h/java%u.log -java.util.logging.FileHandler.limit=50000 -java.util.logging.FileHandler.count=1 -java.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter -# Limit the message that are printed on the console to INFO and above. -java.util.logging.ConsoleHandler.level=WARNING -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -############################################################ -# Facility specific properties. -# Provides extra control for each logger. -############################################################ -# For example, set the com.xyz.foo logger to only log SEVERE -# messages: -#com.xyz.foo.level = SEVERE diff --git a/examples/loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java b/examples/loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java deleted file mode 100644 index f740c502..00000000 --- a/examples/loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java +++ /dev/null @@ -1,83 +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.loanbroker; - -import java.io.File; -import java.io.FileOutputStream; - -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -class LoanBrokerWSTest extends CamelSpringTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(LoanBrokerWSTest.class); - - private static String url; - - @BeforeAll - public static void setupFreePort() throws Exception { - // find a free port number, and write that in the custom.properties file - // which we will use for the unit tests, to avoid port number in use problems - int port = AvailablePortFinder.getNextAvailable(); - String bank1 = "bank1.port=" + port; - port = AvailablePortFinder.getNextAvailable(); - String bank2 = "bank2.port=" + port; - port = AvailablePortFinder.getNextAvailable(); - String bank3 = "bank3.port=" + port; - port = AvailablePortFinder.getNextAvailable(); - String credit = "credit_agency.port=" + port; - port = AvailablePortFinder.getNextAvailable(); - String loan = "loan_broker.port=" + port; - - File custom = new File("target/custom.properties"); - FileOutputStream fos = new FileOutputStream(custom); - fos.write(bank1.getBytes()); - fos.write("\n".getBytes()); - fos.write(bank2.getBytes()); - fos.write("\n".getBytes()); - fos.write(bank3.getBytes()); - fos.write("\n".getBytes()); - fos.write(credit.getBytes()); - fos.write("\n".getBytes()); - fos.write(loan.getBytes()); - fos.write("\n".getBytes()); - fos.close(); - - url = "http://localhost:" + port + "/loanBroker"; - } - - @Test - void testInvocation() throws Exception { - LoanBrokerWS loanBroker = Client.getProxy(url); - String result = loanBroker.getLoanQuote("SSN", 1000.54, 10); - LOG.info("Result: {}", result); - assertTrue(result.startsWith("The best rate is [ssn:SSN bank:bank")); - } - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("/META-INF/spring/webServiceCamelContext.xml"); - } -} diff --git a/examples/loan-broker-cxf/src/test/resources/log4j2.properties b/examples/loan-broker-cxf/src/test/resources/log4j2.properties deleted file mode 100644 index ffbd1cbe..00000000 --- a/examples/loan-broker-cxf/src/test/resources/log4j2.properties +++ /dev/null @@ -1,29 +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. -## --------------------------------------------------------------------------- - -appender.file.type=File -appender.file.name=file -appender.file.fileName=target/camel-example-loan-broker-test.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 - diff --git a/examples/main-artemis/README.adoc b/examples/main-artemis/README.adoc deleted file mode 100644 index 9426d1eb..00000000 --- a/examples/main-artemis/README.adoc +++ /dev/null @@ -1,49 +0,0 @@ -== Camel Example Main Artemis - -This example shows how to run Camel standalone via the built-in Main class. -The example requires a running Apache ActiveMQ Artemis broker running. - -The example also demonstrates how you can configure the Camel application -via Camel built-in dependency-injection that supports binding via the -`@BindToRegistry`, `@BeanInject` and `@PropertyInject` annotations. - -Also notice how you can configure Camel in the `application.properties` file. - -=== Build - -You will need to compile this example first: - -[source,sh] ----- -$ mvn compile ----- - -=== How to run - -First install https://activemq.apache.org/components/artemis/[Apache ActiveMQ Artemis] -and create a broker, such as `mybroker`, and create the admin user as `admin` as username -and `admin` as password: - -[source,sh] ----- -$ bin/artemis create mybroker -$ cd mybroker -$ bin/artemis run ----- - -Then you can run this example using - -[source,sh] ----- -$ mvn camel:run ----- - -=== Help and contributions - -If you hit any problem using Camel or have some feedback, then please -https://camel.apache.org/community/support/[let us know]. - -We also love contributors, so -https://camel.apache.org/community/contributing/[get involved] :-) - -The Camel riders! diff --git a/examples/main-artemis/pom.xml b/examples/main-artemis/pom.xml deleted file mode 100644 index d1fe9ac1..00000000 --- a/examples/main-artemis/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ -<?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/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.camel.example</groupId> - <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> - </parent> - - <artifactId>camel-example-main-artemis</artifactId> - <packaging>jar</packaging> - <name>Camel :: Example :: Main :: ActiveMQ Artemis</name> - <description>An example for showing standalone Camel with ActiveMQ Artemis</description> - - <properties> - <category>Messaging</category> - </properties> - - <dependencyManagement> - <dependencies> - <!-- Add Camel BOM --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bom</artifactId> - <version>${camel.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-main</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-jms</artifactId> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-jms-client</artifactId> - <version>${activemq-artemis-version}</version> - </dependency> - - <!-- logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jul</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <!-- for testing --> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-jms-server</artifactId> - <version>${activemq-artemis-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-main-junit5</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-maven-plugin</artifactId> - <version>${camel.version}</version> - <configuration> - <logClasspath>false</logClasspath> - <mainClass>org.apache.camel.example.MyApplication</mainClass> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/examples/main-artemis/src/main/java/org/apache/camel/example/MyApplication.java b/examples/main-artemis/src/main/java/org/apache/camel/example/MyApplication.java deleted file mode 100644 index 31197dc0..00000000 --- a/examples/main-artemis/src/main/java/org/apache/camel/example/MyApplication.java +++ /dev/null @@ -1,36 +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.example; - -import org.apache.camel.main.Main; - -/** - * Main class that boot the Camel application - */ -public final class MyApplication { - - private MyApplication() { - } - - public static void main(String[] args) throws Exception { - // use Camels Main class - Main main = new Main(MyApplication.class); - // now keep the application running until the JVM is terminated (ctrl + c or sigterm) - main.run(args); - } - -} diff --git a/examples/main-artemis/src/main/java/org/apache/camel/example/MyConfiguration.java b/examples/main-artemis/src/main/java/org/apache/camel/example/MyConfiguration.java deleted file mode 100644 index 10dad689..00000000 --- a/examples/main-artemis/src/main/java/org/apache/camel/example/MyConfiguration.java +++ /dev/null @@ -1,40 +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.example; - -import org.apache.camel.CamelConfiguration; -import org.apache.camel.Configuration; - -/** - * Class to configure the Camel application. - */ -@Configuration -public class MyConfiguration implements CamelConfiguration { - - /** - * Creates the Artemis JMS ConnectionFactory and bind it to the Camel registry - * so we can do auto-wiring on the Camel JMS component. - * See more details in the application.properties file. - */ -// @BindToRegistry -// public ConnectionFactory myArtemisClient(@PropertyInject("artemisBroker") String brokerUrl) { -// ActiveMQConnectionFactory cf = new ActiveMQJMSConnectionFactory(brokerUrl); -// cf.setUser("admin"); -// cf.setPassword("admin"); -// return cf; -// } -} diff --git a/examples/main-artemis/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/main-artemis/src/main/java/org/apache/camel/example/MyRouteBuilder.java deleted file mode 100644 index 5a172795..00000000 --- a/examples/main-artemis/src/main/java/org/apache/camel/example/MyRouteBuilder.java +++ /dev/null @@ -1,31 +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.example; - -import org.apache.camel.builder.RouteBuilder; - -public class MyRouteBuilder extends RouteBuilder { - - @Override - public void configure() { - from("timer:foo?period={{myPeriod}}") - .transform(constant("Hello World")) - .to("jms:queue:cheese"); - - from("jms:queue:cheese").to("log:cheese"); - } -} diff --git a/examples/main-artemis/src/main/resources/application.properties b/examples/main-artemis/src/main/resources/application.properties deleted file mode 100644 index a3afdee9..00000000 --- a/examples/main-artemis/src/main/resources/application.properties +++ /dev/null @@ -1,49 +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. -## --------------------------------------------------------------------------- - -# here you can configure options on camel main -# https://camel.apache.org/components/next/others/main.html -camel.main.name = MyCamelJmsClient -camel.main.jmx-enabled = false - -# enable tracing -### camel.main.tracing = true - -# you can configure whether OS environment should override (=2 which is default) or as fallback (=1) -### camel.component.properties.environment-variable-mode=1 - -# setup JMS component with connection to ActiveMQ Artemis broker -camel.component.jms.connection-factory.user=admin -camel.component.jms.connection-factory.password=admin -camel.component.jms.connection-factory.brokerURL=tcp://localhost:61616 -camel.component.jms.connection-factory=#class:org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory - -# in case you want to use Spring's CachingConnectionFactory, you can configure it as follows: -### camel.component.jms.connectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory -### camel.component.jms.connection-factory.session-cache-size=5 -### camel.component.jms.connection-factory.target-connection-factory=#class:org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory -### camel.component.jms.connection-factory.target-connection-factory.user=admin -### camel.component.jms.connection-factory.target-connection-factory.password=admin -### camel.component.jms.connection-factory.target-connection-factory.brokerURL=tcp://localhost:61616 - -# this is used if you enable the @BindToRegistry in MyConfiguration class to auto-wire -# the Artemis JMS ConnectionFactory via Java source code -# the url to the Artemis Broker -### artemisBroker=tcp://localhost:61616 - -# properties used in the route -myPeriod = 3000 diff --git a/examples/main-artemis/src/main/resources/log4j2.properties b/examples/main-artemis/src/main/resources/log4j2.properties deleted file mode 100644 index c63f8616..00000000 --- a/examples/main-artemis/src/main/resources/log4j2.properties +++ /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. -## --------------------------------------------------------------------------- - -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.out.ref = out - -logger.camel-main.name = org.apache.camel.main -logger.camel-main.level = INFO diff --git a/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java b/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java deleted file mode 100644 index eafe4c17..00000000 --- a/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java +++ /dev/null @@ -1,101 +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.example; - -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; -import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; -import org.apache.camel.builder.NotifyBuilder; -import org.apache.camel.component.jms.JmsComponent; -import org.apache.camel.component.jms.JmsConfiguration; -import org.apache.camel.main.MainConfigurationProperties; -import org.apache.camel.spi.Registry; -import org.apache.camel.test.main.junit5.CamelMainTestSupport; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.apache.camel.util.PropertiesHelper.asProperties; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A unit test checking that Camel can send and consume messages to/from Apache ActiveMQ Artemis. - */ -class MainArtemisTest extends CamelMainTestSupport { - - private static ActiveMQServer SERVER; - - @BeforeAll - static void init() throws Exception { - Configuration config = new ConfigurationImpl(); - config.addAcceptorConfiguration("tcp", "tcp://localhost:61616"); - config.setJournalDirectory("target/artemis-data/journal"); - config.setBindingsDirectory("target/artemis-data/bindings"); - config.setLargeMessagesDirectory("target/artemis-data/largemessages"); - config.setSecurityEnabled(false); - SERVER = new ActiveMQServerImpl(config); - SERVER.start(); - } - - @AfterAll - static void destroy() throws Exception { - if (SERVER != null) { - SERVER.stop(); - } - } - - @Override - protected Properties useOverridePropertiesWithPropertiesComponent() { - return asProperties("myPeriod", Integer.toString(500)); - } - - @Override - protected void bindToRegistry(Registry registry) throws Exception { - // Sets up the Artemis core protocol connection factory - ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); - - JmsConfiguration configuration = new JmsConfiguration(); - configuration.setConnectionFactory(connectionFactory); - - // connect to ActiveMQ Artemis JMS broker - registry.bind("jms", new JmsComponent(configuration)); - } - - @Test - void should_distribute_orders() { - - NotifyBuilder notify = new NotifyBuilder(context) - .whenCompleted(1).wereSentTo("jms:queue:cheese") - .and().whenCompleted(1).from("jms:queue:gadget") - .create(); - - assertTrue( - notify.matches(20, TimeUnit.SECONDS), "1 message should be exchanged" - ); - } - - @Override - protected void configure(MainConfigurationProperties configuration) { - configuration.addConfiguration(MyConfiguration.class); - configuration.addRoutesBuilder(MyRouteBuilder.class); - } -} diff --git a/examples/pom.xml b/examples/pom.xml index 1e4af65a..306671f9 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -111,10 +111,8 @@ <module>kamelet-main</module> <module>kamelet-sql</module> <module>kotlin</module> - <module>loan-broker-cxf</module> <module>loadbalancing</module> <module>main</module> - <module>main-artemis</module> <module>main-endpointdsl</module> <module>main-health</module> <module>main-joor</module>
