INT-946,added failure tests, polished xsd
This commit is contained in:
@@ -934,7 +934,7 @@
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:any processContents="strict" namespace="##other" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:any processContents="strict" namespace="##local" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element ref="poller" />
|
||||
</xsd:choice>
|
||||
<xsd:attributeGroup ref="inputOutputChannelGroup"/>
|
||||
@@ -959,7 +959,7 @@
|
||||
|
||||
<xsd:complexType name="chain-type">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:any processContents="strict" namespace="##other" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:any processContents="strict" namespace="##local" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
||||
<xsd:element name="service-activator" type="expressionOrInnerEndpointDefinitionAware"/>
|
||||
<xsd:element name="splitter" type="expressionOrInnerEndpointDefinitionAware"/>
|
||||
@@ -981,6 +981,7 @@
|
||||
<xsd:element name="object-to-string-transformer" type="specialized-transformer-type"/>
|
||||
<xsd:element name="object-to-map-transformer" type="specialized-transformer-type"/>
|
||||
<xsd:element name="map-to-object-transformer" type="map-to-object-transformer-type"/>
|
||||
<xsd:element ref="beans:bean"/>
|
||||
|
||||
<xsd:element name="chain" type="chain-type"/>
|
||||
</xsd:choice>
|
||||
@@ -1045,6 +1046,7 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<!-- <xsd:attribute name="ref" type="xsd:string" />-->
|
||||
<xsd:attribute name="trigger" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -1578,7 +1580,7 @@
|
||||
|
||||
<xsd:complexType name="specialized-transformer-type">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:any processContents="strict" namespace="##other" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:any processContents="strict" namespace="##local" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element ref="poller" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package org.springframework.integration.config.xml;
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class ChainElementsFailureTests {
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainServiceActivator() throws Exception {
|
||||
this.bootStrap("service-activator");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainAggregator() throws Exception {
|
||||
this.bootStrap("aggregator");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainChain() throws Exception {
|
||||
this.bootStrap("chain");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainDelayer() throws Exception {
|
||||
this.bootStrap("delayer");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainFilter() throws Exception {
|
||||
this.bootStrap("filter");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainGateway() throws Exception {
|
||||
this.bootStrap("gateway");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainHeaderEnricher() throws Exception {
|
||||
this.bootStrap("header-enricher");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainHeaderFilter() throws Exception {
|
||||
this.bootStrap("header-filter");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainHeaderValueRouter() throws Exception {
|
||||
this.bootStrap("header-value-router");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainTransformer() throws Exception {
|
||||
this.bootStrap("transformer");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainRouter() throws Exception {
|
||||
this.bootStrap("router");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainSplitter() throws Exception {
|
||||
this.bootStrap("splitter");
|
||||
}
|
||||
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void chainResequencer() throws Exception {
|
||||
this.bootStrap("resequencer");
|
||||
}
|
||||
|
||||
|
||||
private ApplicationContext bootStrap(String configProperty) throws Exception {
|
||||
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
|
||||
pfb.setLocation(new ClassPathResource("org/springframework/integration/config/xml/chain-elements-config.properties"));
|
||||
pfb.afterPropertiesSet();
|
||||
Properties prop = pfb.getObject();
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(prop.getProperty("xmlheader")).append(prop.getProperty(configProperty)).append(prop.getProperty("xmlfooter"));
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(buffer.toString().getBytes());
|
||||
GenericApplicationContext ac = new GenericApplicationContext();
|
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ac);
|
||||
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
|
||||
reader.loadBeanDefinitions(new InputStreamResource(stream));
|
||||
ac.refresh();
|
||||
return ac;
|
||||
}
|
||||
|
||||
public static class Sampleservice {
|
||||
public String echo(String value){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
xmlheaders=\
|
||||
<?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" \
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd \
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
xmlfooter= </beans>
|
||||
|
||||
service-activator=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:service-activator input-channel="fail"> \
|
||||
<bean class="org.springframework.integration.config.xml.ChainElementsFailureTests$Sampleservice"/> \
|
||||
</int:service-activator> \
|
||||
</int:chain>
|
||||
|
||||
aggregator=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:aggregator input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
chain=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:chain input-channel="fail"> \
|
||||
<int:aggregator/> \
|
||||
</int:chain> \
|
||||
</int:chain>
|
||||
|
||||
delayer=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:delayer default-delay="1000" input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
filter=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:filter input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
gateway=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:gateway input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
header-enricher=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:header-enricher input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
header-filter=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:header-filter input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
header-value-router=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:header-value-router input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
transformer=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:transformer input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
router=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:router input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
splitter=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:splitter input-channel="fail"/> \
|
||||
</int:chain>
|
||||
|
||||
resequencer=\
|
||||
<int:chain input-channel="input"> \
|
||||
<int:resequencer input-channel="fail"/> \
|
||||
</int:chain>
|
||||
Reference in New Issue
Block a user