You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/09/21 11:10:55 UTC
svn commit: r999282 - in /camel/trunk/components/camel-spring/src/test:
java/org/apache/camel/spring/config/ java/org/apache/camel/spring/scan/
resources/org/apache/camel/spring/config/
Author: ningjiang
Date: Tue Sep 21 09:10:55 2010
New Revision: 999282
URL: http://svn.apache.org/viewvc?rev=999282&view=rev
Log:
CAMEL-2543 Added unit test for it
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml (with props)
Modified:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java?rev=999282&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java Tue Sep 21 09:10:55 2010
@@ -0,0 +1,40 @@
+/**
+ * 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.config;
+
+import org.apache.camel.impl.DefaultPackageScanClassResolver;
+import org.apache.camel.spi.PackageScanClassResolver;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class DefaultPackageResolverConfigureTest extends SpringTestSupport {
+
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/PackageResolverTest.xml");
+ }
+
+ public void testSetAcceptableSchema() throws Exception {
+ DefaultPackageScanClassResolver resolver = (DefaultPackageScanClassResolver)context.getPackageScanClassResolver();
+ assertNotNull(resolver);
+ // just check the accept schema
+ assertTrue("We should accept the test:!", resolver.isAcceptableScheme("test://test"));
+ assertTrue("We should accept the test2:!", resolver.isAcceptableScheme("test2://test"));
+
+ }
+
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DefaultPackageResolverConfigureTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java?rev=999282&r1=999281&r2=999282&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java Tue Sep 21 09:10:55 2010
@@ -39,6 +39,13 @@ public class DefaultPackageScanClassReso
annotations.add(org.apache.camel.spring.scan.ScannableOne.class);
annotations.add(org.apache.camel.spring.scan.ScannableTwo.class);
}
+
+ public void testAccepableSchema() {
+ assertTrue("We should not accept the test by default!", resolver.isAcceptableScheme("test://test"));
+ resolver.setAcceptableSchemes("test:;test2:");
+ assertTrue("We should accept the test:!", resolver.isAcceptableScheme("test://test"));
+ assertTrue("We should accept the test2:!", resolver.isAcceptableScheme("test2://test"));
+ }
public void testFindByAnnotationWithoutExtraFilters() {
Set<Class<?>> scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableOne.class, scanPackage);
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml?rev=999282&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml Tue Sep 21 09:10:55 2010
@@ -0,0 +1,36 @@
+<?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"
+ 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
+ ">
+
+ <bean id="myPackageResolver" class="org.apache.camel.impl.DefaultPackageScanClassResolver" >
+ <property name="AcceptableSchemes" value="test:;test2:"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/PackageResolverTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml