Author: akarpe Date: Fri Oct 15 15:57:36 2010 New Revision: 1022980 URL: http://svn.apache.org/viewvc?rev=1022980&view=rev Log: CAMEL-3197 Added Spring Unit tests for Weighted RoundRobin and Random Load Balancing
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java (with props) camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java (with props) camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml (with props) camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml (with props) Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java?rev=1022980&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java (added) +++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java Fri Oct 15 15:57:36 2010 @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.camel.spring.processor; + +import org.apache.camel.CamelContext; +import org.apache.camel.processor.RandomLoadBalanceTest; +import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; + +public class SpringWeightedRandomLoadBalanceTest extends RandomLoadBalanceTest { + + protected CamelContext createCamelContext() throws Exception { + return createSpringCamelContext(this, "org/apache/camel/spring/processor/weightedRandomLoadBalance.xml"); + } + +} \ No newline at end of file Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRandomLoadBalanceTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java?rev=1022980&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java (added) +++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java Fri Oct 15 15:57:36 2010 @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.camel.spring.processor; + +import org.apache.camel.CamelContext; +import org.apache.camel.processor.RandomLoadBalanceTest; +import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; + +public class SpringWeightedRoundRobinLoadBalanceTest extends RandomLoadBalanceTest { + + protected CamelContext createCamelContext() throws Exception { + return createSpringCamelContext(this, "org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml"); + } + +} \ No newline at end of file Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringWeightedRoundRobinLoadBalanceTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml?rev=1022980&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml (added) +++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml Fri Oct 15 15:57:36 2010 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd + "> + + <!-- START SNIPPET: example --> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start"/> + <loadBalance> + <weighted roundRobin="false" distributionRatio="4 2 1"/> + <to uri="mock:x"/> + <to uri="mock:y"/> + <to uri="mock:z"/> + </loadBalance> + </route> + </camelContext> + <!-- END SNIPPET: example --> + +</beans> Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml?rev=1022980&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml (added) +++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml Fri Oct 15 15:57:36 2010 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd + "> + + <!-- START SNIPPET: example --> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start"/> + <loadBalance> + <weighted roundRobin="true" distributionRatio="4 2 1"/> + <to uri="mock:x"/> + <to uri="mock:y"/> + <to uri="mock:z"/> + </loadBalance> + </route> + </camelContext> + <!-- END SNIPPET: example --> + +</beans> Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml ------------------------------------------------------------------------------ svn:eol-style = native