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 2012/05/31 10:43:58 UTC
svn commit: r1344597 - in /camel/trunk:
camel-core/src/test/resources/org/apache/camel/component/validator/dotslash/
camel-core/src/test/resources/org/apache/camel/component/validator/doubleslash/
camel-core/src/test/resources/org/apache/camel/componen...
Author: ningjiang
Date: Thu May 31 08:43:57 2012
New Revision: 1344597
URL: http://svn.apache.org/viewvc?rev=1344597&view=rev
Log:
CAMEL-5321 moved the tests to camel-itest
Added:
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/ValidatorSchemaImportTest.java
camel/trunk/tests/camel-itest/src/test/lib/
camel/trunk/tests/camel-itest/src/test/lib/camel-validator-test-resources.jar
Removed:
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/dotslash/child.xsd
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/dotslash/parent.xsd
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/doubleslash/child.xsd
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/doubleslash/parent.xsd
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/relativeparent/child/child.xsd
camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/relativeparent/parent.xsd
Modified:
camel/trunk/tests/camel-itest/pom.xml
Modified: camel/trunk/tests/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/pom.xml?rev=1344597&r1=1344596&r2=1344597&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/pom.xml (original)
+++ camel/trunk/tests/camel-itest/pom.xml Thu May 31 08:43:57 2012
@@ -305,6 +305,15 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+
+ <!-- for validator tests -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-validator-test-resources</artifactId>
+ <version>${project.version}</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/src/test/lib/camel-validator-test-resources.jar</systemPath>
+ </dependency>
<!-- atomikos XA TX manager -->
<dependency>
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/ValidatorSchemaImportTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/ValidatorSchemaImportTest.java?rev=1344597&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/ValidatorSchemaImportTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/validator/ValidatorSchemaImportTest.java Thu May 31 08:43:57 2012
@@ -0,0 +1,125 @@
+/**
+ * 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.itest.validator;
+
+
+import org.apache.camel.ValidationException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ValidatorSchemaImportTest extends CamelTestSupport {
+
+ protected MockEndpoint validEndpoint;
+ protected MockEndpoint finallyEndpoint;
+ protected MockEndpoint invalidEndpoint;
+
+ /**
+ * Test for the valid schema location
+ * @throws Exception
+ */
+ @Test
+ public void testRelativeParentSchemaImport() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .doTry()
+ .to("validator:org/apache/camel/component/validator/relativeparent/child/child.xsd")
+ .to("mock:valid")
+ .doCatch(ValidationException.class)
+ .to("mock:invalid")
+ .doFinally()
+ .to("mock:finally")
+ .end();
+ }
+ });
+ validEndpoint.expectedMessageCount(1);
+ finallyEndpoint.expectedMessageCount(1);
+
+ template.sendBody("direct:start",
+ "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");
+
+ MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
+ }
+
+ /**
+ * Test for the invalid schema import location.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testDotSlashSchemaImport() throws Exception {
+ this.context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").doTry()
+ .to("validator:org/apache/camel/component/validator/dotslash/child.xsd").to("mock:valid")
+ .doCatch(ValidationException.class).to("mock:invalid").doFinally().to("mock:finally")
+ .end();
+ }
+ });
+ validEndpoint.expectedMessageCount(1);
+ finallyEndpoint.expectedMessageCount(1);
+
+ template
+ .sendBody("direct:start",
+ "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");
+
+ MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
+ }
+
+ /**
+ * Test for the invalid schema import location.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testRelativeDoubleSlashSchemaImport() throws Exception {
+ this.context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").doTry()
+ .to("validator:org/apache/camel/component/validator/doubleslash/child.xsd")
+ .to("mock:valid").doCatch(ValidationException.class).to("mock:invalid").doFinally()
+ .to("mock:finally").end();
+ }
+ });
+ validEndpoint.expectedMessageCount(1);
+ finallyEndpoint.expectedMessageCount(1);
+
+ template
+ .sendBody("direct:start",
+ "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");
+
+ MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
+ }
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ validEndpoint = resolveMandatoryEndpoint("mock:valid", MockEndpoint.class);
+ invalidEndpoint = resolveMandatoryEndpoint("mock:invalid", MockEndpoint.class);
+ finallyEndpoint = resolveMandatoryEndpoint("mock:finally", MockEndpoint.class);
+ }
+}
Added: camel/trunk/tests/camel-itest/src/test/lib/camel-validator-test-resources.jar
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/lib/camel-validator-test-resources.jar?rev=1344597&view=auto
==============================================================================
Files camel/trunk/tests/camel-itest/src/test/lib/camel-validator-test-resources.jar (added) and camel/trunk/tests/camel-itest/src/test/lib/camel-validator-test-resources.jar Thu May 31 08:43:57 2012 differ