INTSAMPLES-122: Migrate to Gradle
JIRA: https://jira.springsource.org/browse/INTSAMPLES-122 INTSAMPLES-122: Polishing INTSAMPLES-122: Add generated poms * Upgrade some dependencies INTSAMPLES-122: Cover Java/DSL sample INTSAMPLES-122: Upgrade to SI 4.0.1 & SF 4.0.5 INTSAMPLES-122: Polishing according PR comments Make gradlew executable
This commit is contained in:
committed by
Gary Russell
parent
148e7b52c2
commit
ea3ba21249
@@ -20,56 +20,55 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* An implementation of the Cafe Demo application to demonstrate Spring Integration's
|
||||
* scripting capability. This process expects a command line argument corresponding to the scripting language
|
||||
* to use.
|
||||
*
|
||||
* to use.
|
||||
*
|
||||
* Provides the 'main' method for running the Cafe Demo application. When an
|
||||
* order is placed, the Cafe will send that order to the "orders" channel.
|
||||
* The relevant components are defined within the configuration file
|
||||
* ("cafeDemo.xml").
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
* @author Oleg Zhurakousky
|
||||
* @author David Turanski
|
||||
*/
|
||||
public class CafeDemoApp {
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
List<String> languages = Arrays.asList(new String[]{"groovy","ruby","javascript","python"});
|
||||
if (args.length != 1) {
|
||||
usage();
|
||||
}
|
||||
String lang = args[0];
|
||||
|
||||
|
||||
if (!StringUtils.hasText(lang)){
|
||||
usage();
|
||||
}
|
||||
|
||||
|
||||
lang = lang.toLowerCase();
|
||||
if (!languages.contains(lang)){
|
||||
usage();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an application context and set the active profile to configure the
|
||||
* Create an application context and set the active profile to configure the
|
||||
* corresponding scripting implementation
|
||||
*/
|
||||
|
||||
|
||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext();
|
||||
((ConfigurableEnvironment)ctx.getEnvironment()).setActiveProfiles(lang);
|
||||
ctx.getEnvironment().setActiveProfiles(lang);
|
||||
ctx.setConfigLocation("/META-INF/spring/integration/cafeDemo.xml");
|
||||
ctx.refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void usage() {
|
||||
System.out.println("missing or invalid commannd line argument [groovy,ruby,javascript,python]");
|
||||
System.exit(1);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* 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.
|
||||
@@ -18,14 +18,16 @@ import static org.junit.Assert.assertTrue;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.integration.scripting.ScriptExecutor;
|
||||
import org.springframework.integration.scripting.jsr223.ScriptExecutorFactory;
|
||||
import org.springframework.scripting.support.ResourceScriptSource;
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ScriptTests {
|
||||
@Test
|
||||
@@ -46,6 +48,7 @@ public class ScriptTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testPython() {
|
||||
ScriptExecutor executor = ScriptExecutorFactory.getScriptExecutor("python");
|
||||
Order order = new Order(0);
|
||||
|
||||
Reference in New Issue
Block a user