Mainly Checkstyle Violation Fixes

* Upgrade to Checkstyle `7.1`
* Relax `RequireThis` rule a bit. Right now it does the effort only in case of overlapping. See https://github.com/checkstyle/checkstyle/issues/2362 for more info
* Enable some annotation rules and provide fixes for violations
* Enable `tabs indents` rule. This was the biggest fix in this PR
* Resolve `TODO` in the `MessagingMethodInvokerHelper` and fix tests to meet `IllegalStateException` now

Remain Checkstyle version `6.16.1` and reinstate `RequireThis` rule

The latest Checkstyle has a bug with local scope variables if they have the same names as property.

Revert some literals splitting

Fix some line length exceeding and code style
This commit is contained in:
Artem Bilan
2016-09-01 17:23:55 -04:00
committed by Gary Russell
parent 22b7187784
commit 12fb590b95
172 changed files with 2116 additions and 2007 deletions

View File

@@ -41,6 +41,7 @@ import org.springframework.util.xml.DomUtils;
*
*/
public abstract class AbstractScriptParser extends AbstractSingleBeanDefinitionParser {
protected static final String LOCATION_ATTRIBUTE = "location";
protected static final String REFRESH_CHECK_DELAY_ATTRIBUTE = "refresh-check-delay";
@@ -122,7 +123,7 @@ public abstract class AbstractScriptParser extends AbstractSingleBeanDefinitionP
}
private ManagedMap<String, Object> buildVariablesMap(final Element element, final ParserContext parserContext,
List<Element> variableElements) {
List<Element> variableElements) {
@SuppressWarnings("serial")
ManagedMap<String, Object> variableMap = new ManagedMap<String, Object>() {

View File

@@ -38,10 +38,12 @@ import org.springframework.scripting.support.StaticScriptSource;
*
*/
public class PythonScriptExecutorTests {
ScriptExecutor executor;
@Before
public void init() {
executor = new PythonScriptExecutor();
executor = new PythonScriptExecutor();
}
@Test
@@ -49,8 +51,8 @@ public class PythonScriptExecutorTests {
Object obj = executor.executeScript(new StaticScriptSource("3+4"));
assertEquals(7, obj);
obj = executor.executeScript(new StaticScriptSource("'hello,world'"));
assertEquals("hello,world", obj);
obj = executor.executeScript(new StaticScriptSource("'hello,world'"));
assertEquals("hello,world", obj);
}
@Test
@@ -62,16 +64,16 @@ public class PythonScriptExecutorTests {
@Test
public void test2() {
Object obj = executor.executeScript(new StaticScriptSource("def foo(y):\n\tx=y\n\treturn y\nz=foo(2)"));
Object obj = executor.executeScript(new StaticScriptSource("def foo(y):\n\tx=y\n\treturn y\nz=foo(2)"));
assertEquals(2, obj);
}
@Test
public void test3() {
ScriptSource source =
new ResourceScriptSource(
new ClassPathResource("/org/springframework/integration/scripting/jsr223/test3.py"));
Object obj = executor.executeScript(source);
new ResourceScriptSource(
new ClassPathResource("/org/springframework/integration/scripting/jsr223/test3.py"));
Object obj = executor.executeScript(source);
PyTuple tuple = (PyTuple) obj;
assertEquals(1, tuple.get(0));
}
@@ -79,11 +81,11 @@ public class PythonScriptExecutorTests {
@Test
public void test3WithVariables() {
ScriptSource source =
new ResourceScriptSource(
new ClassPathResource("/org/springframework/integration/scripting/jsr223/test3.py"));
new ResourceScriptSource(
new ClassPathResource("/org/springframework/integration/scripting/jsr223/test3.py"));
HashMap<String, Object> variables = new HashMap<String, Object>();
variables.put("foo", "bar");
Object obj = executor.executeScript(source, variables);
Object obj = executor.executeScript(source, variables);
PyTuple tuple = (PyTuple) obj;
assertNotNull(tuple);
assertEquals(1, tuple.get(0));