commit 6f2f4bae23b32463d04215c4ac875943933ee0a4 Author: Oleg Zhurakousky Date: Thu Sep 16 08:26:04 2010 -0400 INT-1380, moved Loan Broker sample to new git repo diff --git a/case-studies/loan-broker/.classpath b/case-studies/loan-broker/.classpath new file mode 100644 index 00000000..f42fb64c --- /dev/null +++ b/case-studies/loan-broker/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/case-studies/loan-broker/.gitignore b/case-studies/loan-broker/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/case-studies/loan-broker/.gitignore @@ -0,0 +1 @@ +/target diff --git a/case-studies/loan-broker/.project b/case-studies/loan-broker/.project new file mode 100644 index 00000000..7b2c9338 --- /dev/null +++ b/case-studies/loan-broker/.project @@ -0,0 +1,29 @@ + + + loan-broker + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/case-studies/loan-broker/.springBeans b/case-studies/loan-broker/.springBeans new file mode 100644 index 00000000..15608f30 --- /dev/null +++ b/case-studies/loan-broker/.springBeans @@ -0,0 +1,13 @@ + + + 1 + + + + + + + + + + diff --git a/case-studies/loan-broker/README.txt b/case-studies/loan-broker/README.txt new file mode 100644 index 00000000..f8757693 --- /dev/null +++ b/case-studies/loan-broker/README.txt @@ -0,0 +1,21 @@ +The Loan Broker sample is distributed as a valid Eclipse/Maven project, so you can run it in two ways. + +Maven (command line): +1. Execute 'mvn install' + You should see output that looks similar to this: + . . . . . + INFO : org.springframework.integration.loanbroker.demo.LoanBrokerDemo - + ********* Best Quote: + ====== Loan Quote ===== + Lender: StubBank-11 + Loan amount: $270,279 + Quotation Date: Fri Mar 12 02:19:35 EST 2010 + Expiration Date: Tue Mar 16 02:19:35 EDT 2010 + Term: 17 years + Rate: 5.9092593% + ======================= + . . . . . + +Eclipse/STS (with m2eclipse plug-in) +1. Import project into Eclipse/STS. If the m2eclipse plugin is installed, the dependencies will be downloaded automatically. +2. Run the 'org.springframework.integration.samples.loanbroker.demo.LoanBrokerDemo' class located in 'src/test/java'. diff --git a/case-studies/loan-broker/pom.xml b/case-studies/loan-broker/pom.xml new file mode 100644 index 00000000..3dcd2d03 --- /dev/null +++ b/case-studies/loan-broker/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + org.springframework.integration.samples + loan-broker + 2.0.0 + Spring Integration Loan Broker Sample + + 2.0.0.M7 + 1.1.1 + 1.2.15 + 4.7 + + + + commons-logging + commons-logging + ${commons-logging.version} + + + log4j + log4j + ${log4j.version} + + + org.springframework.integration + spring-integration-ip + ${spring.integration.version} + + + + junit + junit + ${junit.version} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*Demo.java + + + + + + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + + diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.java new file mode 100644 index 00000000..38820a09 --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.java @@ -0,0 +1,42 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker; + +import java.util.List; + +import org.springframework.integration.samples.loanbroker.domain.LoanQuote; +import org.springframework.integration.samples.loanbroker.domain.LoanRequest; + +/** + * POJI Gateway that connects method invocations to the request-channel. + * This completely isolates the developer from Spring Integration API details. + * + * @author Oleg Zhurakousky + */ +public interface LoanBrokerGateway { + + /** + * Will return the best {@link LoanQuote} for the given request. + */ + public LoanQuote getBestLoanQuote(LoanRequest loanRequest); + + /** + * Will return all {@link LoanQuote}s for the given request. + */ + public List getAllLoanQuotes(LoanRequest loanRequest); + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.java new file mode 100644 index 00000000..f1f0bed5 --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.java @@ -0,0 +1,53 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.springframework.integration.Message; +import org.springframework.integration.samples.loanbroker.domain.LoanQuote; + +/** + * Aggregates {@link LoanQuote}s based on the value of the 'RESPONSE_TYPE' message header. + * When only the best quote is desired, the 'RESPONSE_TYPE' header should have a value + * of 'BEST'. In this example, that value is set by the 'gateway' when the + * {@link LoanBrokerGateway#getBestLoanQuote(org.springframework.integration.samples.loanbroker.domain.LoanRequest)} + * method is invoked by the client. + * + * @author Oleg Zhurakousky + */ +public class LoanQuoteAggregator { + + /** + * Aggregates LoanQuote Messages to return a single reply Message. + * + * @param messages Messages received from upstream lenders. + * @return the best {@link LoanQuote} if the 'RESPONSE_TYPE' header value is 'BEST' else all quotes + */ + public Object aggregateQuotes(List> messages) { + ArrayList payloads = new ArrayList(messages.size()); + for (Message message : messages) { + payloads.add(message.getPayload()); + } + Collections.sort(payloads); + String responseType = messages.get(0).getHeaders().get("RESPONSE_TYPE", String.class); + return ("BEST".equals(responseType)) ? payloads.get(0) : payloads; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Address.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Address.java new file mode 100644 index 00000000..11f6fa6f --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Address.java @@ -0,0 +1,61 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.domain; + +/** + * @author Oleg Zhurakousky + */ +public class Address { + + private String street; + private String zip; + private String city; + private String state; + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/CreditScore.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/CreditScore.java new file mode 100644 index 00000000..a026ee8d --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/CreditScore.java @@ -0,0 +1,43 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.domain; + +/** + * @author Oleg Zhurakousky + */ +public class CreditScore { + + private final int score; + private String creditHistory; + + public CreditScore(int score){ + this.score = score; + } + + public String getCreditHistory() { + return creditHistory; + } + + public void setCreditHistory(String creditHistory) { + this.creditHistory = creditHistory; + } + + public int getScore() { + return score; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Customer.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Customer.java new file mode 100644 index 00000000..6cc11247 --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/Customer.java @@ -0,0 +1,52 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.domain; + +/** + * @author Oleg Zhurakousky + */ +public class Customer { + + private String firstName; + private String lastName; + private Address address; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanQuote.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanQuote.java new file mode 100644 index 00000000..4c687b3a --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanQuote.java @@ -0,0 +1,103 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.domain; + +import java.text.DecimalFormat; +import java.util.Date; + +/** + * @author Oleg Zhurakousky + */ +public class LoanQuote implements Comparable{ + + private String lender; + private Date quoteDate; + private Date expirationDate; + private double amount; + private int term; + private float rate; + + public String getLender() { + return lender; + } + + public void setLender(String lender) { + this.lender = lender; + } + + public Date getQuoteDate() { + return quoteDate; + } + + public void setQuoteDate(Date quoteDate) { + this.quoteDate = quoteDate; + } + + public Date getExpirationDate() { + return expirationDate; + } + + public void setExpirationDate(Date expirationDate) { + this.expirationDate = expirationDate; + } + + public double getAmount() { + return amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public int getTerm() { + return term; + } + + public void setTerm(int term) { + this.term = term; + } + + public float getRate() { + return rate; + } + + public void setRate(float rate) { + this.rate = rate; + } + + public String toString(){ + return "\n====== Loan Quote =====\n" + + "Lender: " + this.lender + "\n" + + "Loan amount: " + new DecimalFormat("$###,###.###").format(this.amount) + "\n" + + "Quote Date: " + this.quoteDate + "\n" + + "Expiration Date: " + this.expirationDate + "\n" + + "Term: " + this.term + " years" + "\n" + + "Rate: " + this.rate + "%\n" + + "=======================\n"; + } + + public int compareTo(LoanQuote other) { + if (this.rate > other.rate) { + return 1; + } + else if (this.rate < other.rate) { + return -1; + } + return 0; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanRequest.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanRequest.java new file mode 100644 index 00000000..e77667d4 --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/domain/LoanRequest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.domain; + +/** + * @author Oleg Zhurakousky + */ +public class LoanRequest { + + private Customer customer; + private float loanAmount; + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public float getLoanAmount() { + return loanAmount; + } + + public void setLoanAmount(float loanAmount) { + this.loanAmount = loanAmount; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/BankStub.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/BankStub.java new file mode 100644 index 00000000..3ba62a5e --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/BankStub.java @@ -0,0 +1,48 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.stubs; + +import java.util.Calendar; +import java.util.Random; + +import org.springframework.integration.samples.loanbroker.domain.LoanQuote; +import org.springframework.integration.samples.loanbroker.domain.LoanRequest; + +/** + * @author Oleg Zhurakousky + */ +public class BankStub { + + /** + * @param loanRequest the loan request + * @return a LoanQuote for the given request + */ + public LoanQuote quote(LoanRequest loanRequest) { + Calendar calendar = Calendar.getInstance(); + LoanQuote loanQuote = new LoanQuote(); + Random random = new Random(); + loanQuote.setQuoteDate(calendar.getTime()); + calendar.add(Calendar.DAY_OF_YEAR, random.nextInt(25)); + loanQuote.setExpirationDate(calendar.getTime()); + loanQuote.setRate(random.nextFloat() + 5); + loanQuote.setTerm(10 + random.nextInt(10)); + loanQuote.setAmount(250000 + random.nextInt(40000)); + loanQuote.setLender("StubBank-" + random.nextInt(30)); + return loanQuote; + } + +} diff --git a/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.java b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.java new file mode 100644 index 00000000..1a8dd015 --- /dev/null +++ b/case-studies/loan-broker/src/main/java/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.java @@ -0,0 +1,44 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.stubs; + +import java.util.Random; + +import org.apache.log4j.Logger; + +import org.springframework.integration.samples.loanbroker.domain.CreditScore; +import org.springframework.integration.samples.loanbroker.domain.LoanRequest; + +/** + * @author Oleg Zhurakousky + */ +public class CreditBureauStub { + + private static Logger logger = Logger.getLogger(CreditBureauStub.class); + + /** + * @param loanRequest the loan request + * @return the CreditScore for the given loan request + */ + public CreditScore getCreditScore(LoanRequest loanRequest){ + Random random = new Random(); + int creditScore = 700 + random.nextInt(150); + logger.info("Credit Score: " + creditScore); + return new CreditScore(creditScore); + } + +} diff --git a/case-studies/loan-broker/src/main/resources/bank-channel-mappings-config.xml b/case-studies/loan-broker/src/main/resources/bank-channel-mappings-config.xml new file mode 100644 index 00000000..8269ec2f --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/bank-channel-mappings-config.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker-multicast.xml b/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker-multicast.xml new file mode 100644 index 00000000..bb8b2142 --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker-multicast.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker.xml b/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker.xml new file mode 100644 index 00000000..5a0ddf44 --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/bootstrap-config/stubbed-loan-broker.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/case-studies/loan-broker/src/main/resources/loan-broker-config.xml b/case-studies/loan-broker/src/main/resources/loan-broker-config.xml new file mode 100644 index 00000000..55055a27 --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/loan-broker-config.xml @@ -0,0 +1,37 @@ + + + + + +
+ + + + + +
+ + + + + + + + + + + diff --git a/case-studies/loan-broker/src/main/resources/shark-detector-config.xml b/case-studies/loan-broker/src/main/resources/shark-detector-config.xml new file mode 100644 index 00000000..1edbaf88 --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/shark-detector-config.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/src/main/resources/stub-services-config.xml b/case-studies/loan-broker/src/main/resources/stub-services-config.xml new file mode 100644 index 00000000..da820455 --- /dev/null +++ b/case-studies/loan-broker/src/main/resources/stub-services-config.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.java b/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.java new file mode 100644 index 00000000..bf3f3918 --- /dev/null +++ b/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.java @@ -0,0 +1,57 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.demo; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.junit.Test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.samples.loanbroker.LoanBrokerGateway; +import org.springframework.integration.samples.loanbroker.domain.Customer; +import org.springframework.integration.samples.loanbroker.domain.LoanQuote; +import org.springframework.integration.samples.loanbroker.domain.LoanRequest; + +/** + * @author Oleg Zhurakousky + */ +public class LoanBrokerDemo { + + private static Logger logger = Logger.getLogger(LoanBrokerDemo.class); + + public static void main(String[] args) { + new LoanBrokerDemo().runDemo(); + } + + @Test + public void runDemo() { + ApplicationContext context = new ClassPathXmlApplicationContext("bootstrap-config/stubbed-loan-broker.xml"); + LoanBrokerGateway broker = context.getBean("loanBrokerGateway", LoanBrokerGateway.class); + LoanRequest loanRequest = new LoanRequest(); + loanRequest.setCustomer(new Customer()); + LoanQuote loan = broker.getBestLoanQuote(loanRequest); + logger.info("\n********* Best Quote: " + loan); + List loanQuotes = broker.getAllLoanQuotes(loanRequest); + logger.info("\n********* All Quotes: "); + for (LoanQuote loanQuote : loanQuotes) { + logger.info(loanQuote); + } + } + +} diff --git a/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.java b/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.java new file mode 100644 index 00000000..baaa84f6 --- /dev/null +++ b/case-studies/loan-broker/src/test/java/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.java @@ -0,0 +1,54 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * 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. + */ + +package org.springframework.integration.samples.loanbroker.demo; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.junit.Test; + +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.samples.loanbroker.LoanBrokerGateway; +import org.springframework.integration.samples.loanbroker.domain.Customer; +import org.springframework.integration.samples.loanbroker.domain.LoanQuote; +import org.springframework.integration.samples.loanbroker.domain.LoanRequest; + +/** + * @author Gary Russell + */ +public class LoanBrokerSharkDetectorDemo { + + private static Logger logger = Logger.getLogger(LoanBrokerSharkDetectorDemo.class); + + @Test + public void testUdpMulticast() { + ConfigurableApplicationContext context = + new ClassPathXmlApplicationContext("bootstrap-config/stubbed-loan-broker-multicast.xml"); + LoanBrokerGateway broker = context.getBean("loanBrokerGateway", LoanBrokerGateway.class); + LoanRequest loanRequest = new LoanRequest(); + loanRequest.setCustomer(new Customer()); + LoanQuote loan = broker.getBestLoanQuote(loanRequest); + logger.info("\n********* Best Quote: " + loan); + List loanQuotes = broker.getAllLoanQuotes(loanRequest); + logger.info("\n********* All Quotes: "); + for (LoanQuote loanQuote : loanQuotes) { + logger.info(loanQuote); + } + } + +} diff --git a/case-studies/loan-broker/src/test/resources/log4j.xml b/case-studies/loan-broker/src/test/resources/log4j.xml new file mode 100644 index 00000000..3dc98d8d --- /dev/null +++ b/case-studies/loan-broker/src/test/resources/log4j.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/target/classes/bank-channel-mappings-config.xml b/case-studies/loan-broker/target/classes/bank-channel-mappings-config.xml new file mode 100644 index 00000000..8269ec2f --- /dev/null +++ b/case-studies/loan-broker/target/classes/bank-channel-mappings-config.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker-multicast.xml b/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker-multicast.xml new file mode 100644 index 00000000..bb8b2142 --- /dev/null +++ b/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker-multicast.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker.xml b/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker.xml new file mode 100644 index 00000000..5a0ddf44 --- /dev/null +++ b/case-studies/loan-broker/target/classes/bootstrap-config/stubbed-loan-broker.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/case-studies/loan-broker/target/classes/loan-broker-config.xml b/case-studies/loan-broker/target/classes/loan-broker-config.xml new file mode 100644 index 00000000..55055a27 --- /dev/null +++ b/case-studies/loan-broker/target/classes/loan-broker-config.xml @@ -0,0 +1,37 @@ + + + + + +
+ + + + + +
+ + + + + + + + + + + diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.class new file mode 100644 index 00000000..7581f14d Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanBrokerGateway.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.class new file mode 100644 index 00000000..a80d0139 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/LoanQuoteAggregator.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Address.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Address.class new file mode 100644 index 00000000..48ad2161 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Address.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/CreditScore.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/CreditScore.class new file mode 100644 index 00000000..6d2338c4 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/CreditScore.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Customer.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Customer.class new file mode 100644 index 00000000..3a71e2e6 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/Customer.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanQuote.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanQuote.class new file mode 100644 index 00000000..8fc6f5b5 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanQuote.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanRequest.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanRequest.class new file mode 100644 index 00000000..8a2f42a5 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/domain/LoanRequest.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/BankStub.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/BankStub.class new file mode 100644 index 00000000..4bb19502 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/BankStub.class differ diff --git a/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.class b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.class new file mode 100644 index 00000000..3d9d06a6 Binary files /dev/null and b/case-studies/loan-broker/target/classes/org/springframework/integration/samples/loanbroker/stubs/CreditBureauStub.class differ diff --git a/case-studies/loan-broker/target/classes/shark-detector-config.xml b/case-studies/loan-broker/target/classes/shark-detector-config.xml new file mode 100644 index 00000000..1edbaf88 --- /dev/null +++ b/case-studies/loan-broker/target/classes/shark-detector-config.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/target/classes/stub-services-config.xml b/case-studies/loan-broker/target/classes/stub-services-config.xml new file mode 100644 index 00000000..da820455 --- /dev/null +++ b/case-studies/loan-broker/target/classes/stub-services-config.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/case-studies/loan-broker/target/loan-broker-2.0.0.BUILD-SNAPSHOT.jar b/case-studies/loan-broker/target/loan-broker-2.0.0.BUILD-SNAPSHOT.jar new file mode 100644 index 00000000..9b3d37bc Binary files /dev/null and b/case-studies/loan-broker/target/loan-broker-2.0.0.BUILD-SNAPSHOT.jar differ diff --git a/case-studies/loan-broker/target/maven-archiver/pom.properties b/case-studies/loan-broker/target/maven-archiver/pom.properties new file mode 100644 index 00000000..4fe56fc8 --- /dev/null +++ b/case-studies/loan-broker/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sat Sep 04 08:22:17 EDT 2010 +version=2.0.0.BUILD-SNAPSHOT +groupId=org.springframework.integration.samples +artifactId=loan-broker diff --git a/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerDemo.xml b/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerDemo.xml new file mode 100644 index 00000000..f2340558 --- /dev/null +++ b/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerDemo.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerSharkDetectorDemo.xml b/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerSharkDetectorDemo.xml new file mode 100644 index 00000000..866faaac --- /dev/null +++ b/case-studies/loan-broker/target/surefire-reports/TEST-org.springframework.integration.samples.loanbroker.demo.LoanBrokerSharkDetectorDemo.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/target/test-classes/log4j.xml b/case-studies/loan-broker/target/test-classes/log4j.xml new file mode 100644 index 00000000..3dc98d8d --- /dev/null +++ b/case-studies/loan-broker/target/test-classes/log4j.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.class b/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.class new file mode 100644 index 00000000..c1625a20 Binary files /dev/null and b/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerDemo.class differ diff --git a/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.class b/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.class new file mode 100644 index 00000000..078ff3bf Binary files /dev/null and b/case-studies/loan-broker/target/test-classes/org/springframework/integration/samples/loanbroker/demo/LoanBrokerSharkDetectorDemo.class differ