INTSAMPLES-35 - Stored Procedure Sample for Derby
For reference see: https://jira.springsource.org/browse/INTSAMPLES-35
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import org.springframework.integration.model.CoffeeBeverage;
|
||||
import org.springframework.integration.service.CoffeeService;
|
||||
|
||||
|
||||
/**
|
||||
* Starts the Spring Context and will initialize the Spring Integration routes.
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public final class Main {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
|
||||
|
||||
private static final String LINE = "\n=========================================================";
|
||||
private static final String NEWLINE = "\n ";
|
||||
|
||||
private Main() { }
|
||||
|
||||
/**
|
||||
* Load the Spring Integration Application Context
|
||||
*
|
||||
* @param args - command line arguments
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
|
||||
LOGGER.info(LINE
|
||||
+ LINE
|
||||
+ "\n Welcome to Spring Integration Coffee Database! "
|
||||
+ NEWLINE
|
||||
+ "\n For more information please visit: "
|
||||
+ "\n http://www.springsource.org/spring-integration "
|
||||
+ NEWLINE
|
||||
+ LINE );
|
||||
|
||||
final AbstractApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml");
|
||||
|
||||
context.registerShutdownHook();
|
||||
|
||||
final Scanner scanner = new Scanner(System.in);
|
||||
|
||||
final CoffeeService service = context.getBean(CoffeeService.class);
|
||||
|
||||
LOGGER.info(LINE
|
||||
+ NEWLINE
|
||||
+ "\n Please press 'q + Enter' to quit the application. "
|
||||
+ NEWLINE
|
||||
+ LINE);
|
||||
|
||||
System.out.print("Please enter 'list' and press <enter> to get a list of coffees.");
|
||||
System.out.print("Enter a coffee id, e.g. '1' and press <enter> to get a description.\n\n");
|
||||
|
||||
while (!scanner.hasNext("q")) {
|
||||
|
||||
String input = scanner.nextLine();
|
||||
|
||||
if ("list".equalsIgnoreCase(input)) {
|
||||
List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();
|
||||
|
||||
for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
|
||||
System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
|
||||
coffeeBeverage.getName()));
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("Retrieving coffee information...");
|
||||
String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));
|
||||
|
||||
System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
|
||||
System.out.print("To try again, please enter another coffee beaverage and press <enter>:\n\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOGGER.info("Exiting application...bye.");
|
||||
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.jdbc.storedproc.derby;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public final class DerbyStoredProcedures {
|
||||
|
||||
private DerbyStoredProcedures() {
|
||||
}
|
||||
|
||||
public static void findCoffee(int coffeeId, String[] coffeeDescription)
|
||||
throws SQLException {
|
||||
Connection connection = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
connection = DriverManager.getConnection("jdbc:default:connection");
|
||||
String sql = "SELECT * FROM COFFEE_BEVERAGES WHERE ID = ? ";
|
||||
statement = connection.prepareStatement(sql);
|
||||
statement.setLong(1, coffeeId);
|
||||
|
||||
ResultSet resultset = statement.executeQuery();
|
||||
resultset.next();
|
||||
coffeeDescription[0] = resultset.getString("COFFEE_DESCRIPTION");
|
||||
|
||||
} finally {
|
||||
JdbcUtils.closeStatement(statement);
|
||||
JdbcUtils.closeConnection(connection);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void findAllCoffeeBeverages(ResultSet[] coffeeBeverages)
|
||||
throws SQLException {
|
||||
|
||||
Connection connection = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
connection = DriverManager.getConnection("jdbc:default:connection");
|
||||
String sql = "SELECT * FROM COFFEE_BEVERAGES";
|
||||
statement = connection.prepareStatement(sql);
|
||||
coffeeBeverages[0] = statement.executeQuery();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public class CoffeeBeverage {
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
/** Default Constructor */
|
||||
public CoffeeBeverage() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param name
|
||||
* @param description
|
||||
*/
|
||||
public CoffeeBeverage(Integer id, String name, String description) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime
|
||||
* result
|
||||
+ ((this.description == null) ? 0 : this.description.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.name == null) ? 0 : this.name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CoffeeBeverage other = (CoffeeBeverage) obj;
|
||||
|
||||
if (this.description == null) {
|
||||
|
||||
if (other.description != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (!this.description.equals(other.description)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.name == null) {
|
||||
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("CoffeeBeverage [id=").append(this.id).append(", name=")
|
||||
.append(this.name).append(", description=")
|
||||
.append(this.description).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.integration.annotation.Payload;
|
||||
import org.springframework.integration.model.CoffeeBeverage;
|
||||
|
||||
|
||||
/**
|
||||
* Provides access to the Coffee Database Services.
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface CoffeeService {
|
||||
|
||||
/**
|
||||
* Find the description for a provided coffee beverage.
|
||||
*
|
||||
* @param Id of the coffee beverage
|
||||
* @return The the description of the coffee beverage
|
||||
*/
|
||||
String findCoffeeBeverage(Integer input);
|
||||
|
||||
/**
|
||||
* Find the description for a provided coffee beverage.
|
||||
*
|
||||
* @return Collection of coffee beverages
|
||||
*/
|
||||
@Payload("new java.util.Date()")
|
||||
List<CoffeeBeverage> findAllCoffeeBeverages();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.support;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.integration.model.CoffeeBeverage;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public class CoffeBeverageMapper implements RowMapper<CoffeeBeverage> {
|
||||
|
||||
public CoffeeBeverage mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return new CoffeeBeverage(rs.getInt("ID"), rs.getString("COFFEE_NAME"), rs.getString("COFFEE_DESCRIPTION"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="classpath:derby-stored-procedures.sql"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int:channel id="findCoffeeProcedureRequestChannel"/>
|
||||
<int:channel id="findAllProcedureRequestChannel"/>
|
||||
|
||||
<int:gateway id="gateway" default-request-timeout="5000"
|
||||
default-reply-timeout="5000"
|
||||
service-interface="org.springframework.integration.service.CoffeeService">
|
||||
<int:method name="findCoffeeBeverage" request-channel="findCoffeeProcedureRequestChannel" />
|
||||
<int:method name="findAllCoffeeBeverages" request-channel="findAllProcedureRequestChannel" />
|
||||
</int:gateway>
|
||||
|
||||
<int-jdbc:stored-proc-outbound-gateway id="outbound-gateway-storedproc-find-coffee" data-source="dataSource"
|
||||
request-channel="findCoffeeProcedureRequestChannel" skip-undeclared-results="true"
|
||||
stored-procedure-name="FIND_COFFEE"
|
||||
expect-single-result="true">
|
||||
<int-jdbc:parameter name="COFFEE_NAME" expression="payload" />
|
||||
</int-jdbc:stored-proc-outbound-gateway>
|
||||
|
||||
<int-jdbc:stored-proc-outbound-gateway id="outbound-gateway-storedproc-find-all" data-source="dataSource"
|
||||
request-channel="findAllProcedureRequestChannel" expect-single-result="true"
|
||||
stored-procedure-name="FIND_ALL_COFFEE_BEVERAGES">
|
||||
<int-jdbc:returning-resultset name="coffeeBeverages" row-mapper="org.springframework.integration.support.CoffeBeverageMapper"/>
|
||||
</int-jdbc:stored-proc-outbound-gateway>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,14 @@
|
||||
drop table COFFEE_BEVERAGES;
|
||||
drop PROCEDURE FIND_COFFEE;
|
||||
drop PROCEDURE FIND_ALL_COFFEE_BEVERAGES;
|
||||
|
||||
create table COFFEE_BEVERAGES(ID INTEGER NOT NULL CONSTRAINT COFFEE_BEVERAGES_PK PRIMARY KEY, COFFEE_NAME varchar(100), COFFEE_DESCRIPTION varchar(200));
|
||||
|
||||
INSERT INTO COFFEE_BEVERAGES (ID, COFFEE_NAME, COFFEE_DESCRIPTION) VALUES (1, 'Espresso', 'Espressos keep developers going in the morning. There are never enough of them.');
|
||||
INSERT INTO COFFEE_BEVERAGES (ID, COFFEE_NAME, COFFEE_DESCRIPTION) VALUES (2, 'Cappuccino', 'For the finer moments. Wrap your espresso in a tasty layer of foam.');
|
||||
INSERT INTO COFFEE_BEVERAGES (ID, COFFEE_NAME, COFFEE_DESCRIPTION) VALUES (3, 'Mocha', 'Mmmmh, chocolate.');
|
||||
INSERT INTO COFFEE_BEVERAGES (ID, COFFEE_NAME, COFFEE_DESCRIPTION) VALUES (4, 'Latte', 'If you are more into milk than into foam.');
|
||||
|
||||
CREATE PROCEDURE FIND_COFFEE( IN COFFEE_NAME INTEGER, OUT COFFEE_DESCRIPTION VARCHAR(100)) PARAMETER STYLE JAVA LANGUAGE JAVA EXTERNAL NAME 'org.springframework.integration.jdbc.storedproc.derby.DerbyStoredProcedures.findCoffee';
|
||||
CREATE PROCEDURE FIND_ALL_COFFEE_BEVERAGES() PARAMETER STYLE JAVA LANGUAGE JAVA MODIFIES SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.springframework.integration.jdbc.storedproc.derby.DerbyStoredProcedures.findAllCoffeeBeverages';
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<root>
|
||||
<level value="INFO" />
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.model.CoffeeBeverage;
|
||||
import org.springframework.integration.service.CoffeeService;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CoffeeServiceFindAllTest {
|
||||
|
||||
@Test
|
||||
public void testFindCoffee() {
|
||||
final ApplicationContext context
|
||||
= new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
|
||||
CoffeeServiceFindAllTest.class);
|
||||
|
||||
final CoffeeService service = context.getBean(CoffeeService.class);
|
||||
|
||||
List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();
|
||||
|
||||
assertTrue(coffeeBeverages.size() == 4);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.service.CoffeeService;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CoffeeServiceFindCoffeeTest {
|
||||
|
||||
@Test
|
||||
public void testFindCoffee() {
|
||||
final ApplicationContext context
|
||||
= new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
|
||||
CoffeeServiceFindCoffeeTest.class);
|
||||
|
||||
final CoffeeService service = context.getBean(CoffeeService.class);
|
||||
|
||||
String description = service.findCoffeeBeverage(3);
|
||||
|
||||
assertEquals("Mmmmh, chocolate.", description);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* Verify that the Spring Integration Application Context starts successfully.
|
||||
*/
|
||||
public class CoffeeServiceStartupTest {
|
||||
|
||||
@Test
|
||||
public void testStartupOfSpringInegrationContext() throws Exception{
|
||||
final ApplicationContext context
|
||||
= new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
|
||||
CoffeeServiceStartupTest.class);
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user