checkstyle MutableException
checkstyle EmptyBlock checkstyle fixRightCurly Script checkstyle EmptyStatement checkstyle RightCurly checkstyle TailingWhite checkstyle NeedBraces Fix the line separator in the `fixRightCurly.gradle`
This commit is contained in:
committed by
Artem Bilan
parent
c0b19e61b5
commit
842aded9a4
@@ -24,7 +24,7 @@ import org.w3c.dom.Node;
|
||||
/**
|
||||
* Converter for creating XML {@link Document}, {@link Node} or {@link Source}
|
||||
* instances from other types (e.g. String).
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public interface XmlPayloadConverter {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Parser for the <xpath-router/> element.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -55,7 +55,7 @@ public class XPathRouterParser extends AbstractRouterParser {
|
||||
BeanDefinition beanDefinition = this.xpathParser.parse((Element) xPathExpressionNodes.item(0), parserContext);
|
||||
xpathRouterBuilder.addConstructorArgValue(beanDefinition);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
xpathRouterBuilder.addConstructorArgReference(xPathExpressionRef);
|
||||
}
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(xpathRouterBuilder, element, "converter");
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Parser for the 'xpath-transformer' element.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.xml.transform.Result;
|
||||
/**
|
||||
* Factory to create a {@link Result} possibly taking into account the
|
||||
* provided message payload instance.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public interface ResultFactory {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Provides {@link org.springframework.integration.xml.result.ResultFactory} that
|
||||
* will return {@link javax.xml.transform.Result}, possibly taking into account
|
||||
* Provides {@link org.springframework.integration.xml.result.ResultFactory} that
|
||||
* will return {@link javax.xml.transform.Result}, possibly taking into account
|
||||
* payload instance.
|
||||
*/
|
||||
package org.springframework.integration.xml.result;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Provides XML message routers.
|
||||
* Provides XML message routers.
|
||||
*/
|
||||
package org.springframework.integration.xml.router;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.xml.xpath.XPathExpression;
|
||||
* Boolean XPath testing {@link MessageSelector}. Requires an XPathExpression
|
||||
* which can be evaluated using {@link XPathExpression#evaluateAsBoolean(Node)}.
|
||||
* Supports payloads of type {@link Document} or {@link String}.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelector {
|
||||
@@ -37,7 +37,7 @@ public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelecto
|
||||
/**
|
||||
* Create a boolean testing XPath {@link MessageSelector} supporting
|
||||
* multiple namespaces.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
* @param namespaces Map of namespaces where the keys are namespace prefixes
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelecto
|
||||
|
||||
/**
|
||||
* Create a boolean testing XPath {@link MessageSelector} supporting a single namespace.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
* @param prefix namespace prefix
|
||||
* @param namespace namespace URI
|
||||
@@ -58,7 +58,7 @@ public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelecto
|
||||
|
||||
/**
|
||||
* Create a boolean testing XPath {@link MessageSelector} with no namespace support.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
*/
|
||||
public BooleanTestXPathMessageSelector(String expression) {
|
||||
@@ -68,7 +68,7 @@ public class BooleanTestXPathMessageSelector extends AbstractXPathMessageSelecto
|
||||
/**
|
||||
* Create a boolean testing XPath {@link MessageSelector} using the
|
||||
* provided {@link XPathExpression}.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression
|
||||
*/
|
||||
public BooleanTestXPathMessageSelector(XPathExpression expression) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.xml.xpath.XPathExpression;
|
||||
/**
|
||||
* XPath {@link MessageSelector} that tests if a provided String value
|
||||
* matches a given Regular Expression.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
|
||||
|
||||
/**
|
||||
* Creates a selector which attempts to match the given regex and supports multiple namespaces.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
* @param namespaces Map of namespaces where the keys are namespace prefixes
|
||||
* @param regex regular expression to match
|
||||
@@ -53,7 +53,7 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
|
||||
|
||||
/**
|
||||
* Creates a selector which attempts to match the given regex and supports a single namespace.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
* @param prefix namespace prefix
|
||||
* @param namespace namespace URI
|
||||
@@ -66,8 +66,8 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a non-namespaced selector which attempts to match the given regex.
|
||||
*
|
||||
* Creates a non-namespaced selector which attempts to match the given regex.
|
||||
*
|
||||
* @param expression XPath expression as a String
|
||||
* @param regex regular expression to match
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
|
||||
/**
|
||||
* Creates a selector which attempts to match the given regex against the evaluation result
|
||||
* of the provided {@link XPathExpression}.
|
||||
*
|
||||
*
|
||||
* @param expression XPath expression
|
||||
* @param regex regular expression to match
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Provides XML-centric {@link org.springframework.integration.core.MessageSelector}
|
||||
* implementations.
|
||||
* Provides XML-centric {@link org.springframework.integration.core.MessageSelector}
|
||||
* implementations.
|
||||
*/
|
||||
package org.springframework.integration.xml.selector;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.messaging.MessagingException;
|
||||
/**
|
||||
* {@link SourceFactory} implementation which supports creation of a {@link DOMSource}
|
||||
* from a {@link Document}, {@link File} or {@link String} payload.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.xml.transform.StringSource;
|
||||
/**
|
||||
* {@link SourceFactory} implementation which supports creation of a {@link StringSource}
|
||||
* from a {@link Document}, {@link File} or {@link String} payload
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Provides various {@link org.springframework.integration.xml.source.SourceFactory}
|
||||
* implementations.
|
||||
* Provides various {@link org.springframework.integration.xml.source.SourceFactory}
|
||||
* implementations.
|
||||
*/
|
||||
package org.springframework.integration.xml.source;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Provides implementations of
|
||||
* Provides implementations of
|
||||
* {@link org.springframework.integration.splitter.AbstractMessageSplitter}.
|
||||
*/
|
||||
package org.springframework.integration.xml.splitter;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.xml.transform.StringResult;
|
||||
/**
|
||||
* Creates a {@link Document} from a {@link Result} payload. Supports
|
||||
* {@link DOMResult} and {@link StringResult} implementations.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class ResultToDocumentTransformer implements ResultTransformer {
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.xml.transform.StringResult;
|
||||
/**
|
||||
* Converts the passed {@link Result} to an instance of {@link String}.
|
||||
* Supports {@link StringResult} and {@link DOMResult}
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.integration.xml.source.SourceFactory;
|
||||
/**
|
||||
* Transforms the payload to a {@link Source} using a {@link SourceFactory}.
|
||||
* Defaults to using a {@link DomSourceFactory} if an alternative is not provided.
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class SourceCreatingTransformer extends AbstractPayloadTransformer<Object, Source> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Provides XPath supporting classes.
|
||||
* Provides XPath supporting classes.
|
||||
*/
|
||||
package org.springframework.integration.xml.xpath;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.oxm.XmlMappingException;
|
||||
import org.springframework.xml.transform.StringSource;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -23,11 +23,11 @@ import org.springframework.integration.xml.transformer.ResultTransformer;
|
||||
public class StubResultTransformer implements ResultTransformer {
|
||||
|
||||
Object toReturn;
|
||||
|
||||
|
||||
public StubResultTransformer(Object toReturn){
|
||||
this.toReturn = toReturn;
|
||||
}
|
||||
|
||||
|
||||
public Object transformResult(Result res) {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.oxm.Unmarshaller;
|
||||
import org.springframework.oxm.XmlMappingException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.core.io.Resource;
|
||||
public class TestXmlApplicationContext extends AbstractXmlApplicationContext {
|
||||
|
||||
private final Resource[] resources;
|
||||
|
||||
|
||||
public TestXmlApplicationContext(String ... xmlStrings){
|
||||
resources = new Resource[xmlStrings.length];
|
||||
for (int i = 0 ; i < xmlStrings.length; i++) {
|
||||
@@ -35,7 +35,7 @@ public class TestXmlApplicationContext extends AbstractXmlApplicationContext {
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Resource[] getConfigResources() {
|
||||
return resources;
|
||||
@@ -44,20 +44,20 @@ public class TestXmlApplicationContext extends AbstractXmlApplicationContext {
|
||||
private static class TestResource extends AbstractResource{
|
||||
|
||||
String xmlString;
|
||||
|
||||
|
||||
TestResource(String xmlString){
|
||||
this.xmlString = xmlString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
|
||||
return new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ public class XPathExpressionParserTests {
|
||||
|
||||
try {
|
||||
getXPathExpression(xmlDoc.toString());
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertTrue(e.getCause() instanceof SAXParseException);
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +101,8 @@ public class XPathExpressionParserTests {
|
||||
|
||||
try {
|
||||
getXPathExpression(xmlDoc.toString());
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertEquals("It is not valid to specify both, the namespace attributes ('ns-prefix' and 'ns-uri') and the 'namespace-map' attribute.", e.getCause().getMessage());
|
||||
return;
|
||||
}
|
||||
@@ -117,7 +119,8 @@ public class XPathExpressionParserTests {
|
||||
.append("</si-xml:xpath-expression>");
|
||||
try {
|
||||
getXPathExpression(xmlDoc.toString());
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertEquals("It is not valid to specify both, the namespace attributes ('ns-prefix' and 'ns-uri') and the 'map' sub-element.", e.getCause().getMessage());
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +138,8 @@ public class XPathExpressionParserTests {
|
||||
.append("<util:map id='myNamespaces'><entry key='ns1' value='www.example.org' /></util:map>");
|
||||
try {
|
||||
getXPathExpression(xmlDoc.toString());
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertEquals("It is not valid to specify both, the 'namespace-map' attribute and the 'map' sub-element.", e.getCause().getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.integration.xml.util.XmlTestUtil;
|
||||
import org.springframework.xml.xpath.XPathExpression;
|
||||
import org.springframework.xml.xpath.XPathExpressionFactory;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class XPathRouterTests {
|
||||
@@ -45,7 +45,7 @@ public class XPathRouterTests {
|
||||
assertEquals("Wrong number of channels returned", 1, channelNames.length);
|
||||
assertEquals("Wrong channel name", "one", channelNames[0]);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void simpleSingleAttributeAsString() throws Exception {
|
||||
@@ -57,10 +57,10 @@ public class XPathRouterTests {
|
||||
assertEquals("Wrong number of channels returned", 1, channelNames.length);
|
||||
assertEquals("Wrong channel name", "one", channelNames[0]);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void simpleRootNode() throws Exception {
|
||||
public void simpleRootNode() throws Exception {
|
||||
Document doc = XmlTestUtil.getDocumentForString("<doc><foo>oleg</foo><bar>bang</bar></doc>");
|
||||
XPathExpression expression = XPathExpressionFactory.createXPathExpression("name(./node())");
|
||||
XPathRouter router = new XPathRouter(expression);
|
||||
@@ -81,15 +81,15 @@ public class XPathRouterTests {
|
||||
assertEquals("Wrong channel name", "bOne", channelNames[0]);
|
||||
assertEquals("Wrong channel name", "bTwo", channelNames[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
/*
|
||||
* Will return only one (the first node text in the collection), since
|
||||
* Will return only one (the first node text in the collection), since
|
||||
* the evaluation return type use is String (not NODESET)
|
||||
* This test is just for sanity and the reminder that setting 'evaluateAsNode'
|
||||
* to 'false' would still result in no exception but result will most likely be
|
||||
* to 'false' would still result in no exception but result will most likely be
|
||||
* not what is expected.
|
||||
*/
|
||||
public void multipleNodeValuesAsString() throws Exception {
|
||||
@@ -116,7 +116,7 @@ public class XPathRouterTests {
|
||||
assertEquals("bob",channelNames[0]);
|
||||
assertEquals("dave",channelNames[1]);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSimpleDocType() throws Exception {
|
||||
Document doc = XmlTestUtil.getDocumentForString("<doc type='one' />");
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
@XmlType @XmlRootElement(name="person")
|
||||
public class JaxbAnnotatedPerson {
|
||||
|
||||
|
||||
@XmlElement(name="firstname")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
@@ -32,9 +32,9 @@ public class JaxbAnnotatedPerson {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String firstName;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,20 +41,20 @@ import org.springframework.xml.transform.StringSource;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
public class JaxbMarshallingIntegrationTests extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
|
||||
@Autowired @Qualifier("marshallIn")
|
||||
MessageChannel marshallIn;
|
||||
|
||||
|
||||
@Autowired @Qualifier("marshallOut")
|
||||
PollableChannel marshalledOut;
|
||||
|
||||
|
||||
@Autowired @Qualifier("unmarshallIn")
|
||||
MessageChannel unmarshallIn;
|
||||
|
||||
|
||||
@Autowired @Qualifier("unmarshallOut")
|
||||
PollableChannel unmarshallOut;
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testMarshalling() throws Exception{
|
||||
@@ -68,7 +68,7 @@ public class JaxbMarshallingIntegrationTests extends AbstractJUnit4SpringContext
|
||||
assertEquals("Wrong name for root element ", "person",doc.getDocumentElement().getLocalName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testUnmarshalling() throws Exception{
|
||||
@@ -79,8 +79,8 @@ public class JaxbMarshallingIntegrationTests extends AbstractJUnit4SpringContext
|
||||
assertTrue("Not a Person ", res.getPayload() instanceof JaxbAnnotatedPerson);
|
||||
JaxbAnnotatedPerson person = (JaxbAnnotatedPerson)res.getPayload();
|
||||
assertEquals("Worng firstname", "bob", person.getFirstName());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user