Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 88242 invoked from network); 8 Nov 2010 09:18:34 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Nov 2010 09:18:34 -0000 Received: (qmail 75170 invoked by uid 500); 8 Nov 2010 09:19:06 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 75117 invoked by uid 500); 8 Nov 2010 09:19:04 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 75109 invoked by uid 99); 8 Nov 2010 09:19:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 09:19:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 09:19:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 86A34238890B; Mon, 8 Nov 2010 09:17:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1032501 - in /camel/trunk: platforms/karaf/features/ tests/camel-itest-osgi/ tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/ tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/ tests/came... Date: Mon, 08 Nov 2010 09:17:47 -0000 To: commits@camel.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101108091747.86A34238890B@eris.apache.org> Author: ningjiang Date: Mon Nov 8 09:17:45 2010 New Revision: 1032501 URL: http://svn.apache.org/viewvc?rev=1032501&view=rev Log: CAMEL-3227 added the Camel-bean-validator OSGi test with thanks to Johan Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java (with props) camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java (with props) camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java (with props) camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java (with props) camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java (with props) camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml (with props) camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml (with props) Modified: camel/trunk/platforms/karaf/features/pom.xml camel/trunk/tests/camel-itest-osgi/pom.xml Modified: camel/trunk/platforms/karaf/features/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/pom.xml?rev=1032501&r1=1032500&r2=1032501&view=diff ============================================================================== --- camel/trunk/platforms/karaf/features/pom.xml (original) +++ camel/trunk/platforms/karaf/features/pom.xml Mon Nov 8 09:17:45 2010 @@ -108,7 +108,7 @@ 1.0_1 9.1.0.1_3 2.8.0_1 - 1.5.0 + 1.6-SNAPSHOT 2.1 1.1.2 1.13.1_2 Modified: camel/trunk/tests/camel-itest-osgi/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=1032501&r1=1032500&r2=1032501&view=diff ============================================================================== --- camel/trunk/tests/camel-itest-osgi/pom.xml (original) +++ camel/trunk/tests/camel-itest-osgi/pom.xml Mon Nov 8 09:17:45 2010 @@ -209,7 +209,11 @@ org.apache.felix.configadmin test - + + org.apache.camel + camel-bean-validator + test + org.apache.camel camel-cxf Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java Mon Nov 8 09:17:45 2010 @@ -0,0 +1,92 @@ +/** + * 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.osgi.bean.validator; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.JUnit4TestRunner; +import org.ops4j.pax.swissbox.tinybundles.dp.Constants; + +import static org.ops4j.pax.exam.CoreOptions.equinox; +import static org.ops4j.pax.exam.CoreOptions.felix; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.provision; +import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile; +import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures; +import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory; +import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle; +import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd; + +@RunWith(JUnit4TestRunner.class) +public class BeanValidatorTest extends OSGiIntegrationTestSupport { + + @Test + public void testBeanValidatorRoute() throws Exception { + Exchange exchange = template.request("bean-validator://x", new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(createCar("BMW", "DD-AB-123")); + } + }); + + assertNotNull(exchange); + } + + @Test + public void validateShouldSuccessWithExpliciteDefaultGroup() throws Exception { + Exchange exchange = template.request("bean-validator://x?group=javax.validation.groups.Default", new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(createCar("BMW", "DD-AB-123")); + } + }); + + assertNotNull(exchange); + } + + Car createCar(String manufacturer, String licencePlate) { + return new CarWithAnnotations(manufacturer, licencePlate); + } + + @Configuration + public static Option[] configure() { + Option[] options = options( + // install the spring dm profile + profile("spring.dm").version("1.2.0"), + // this is how you set the default log level when using pax logging (logProfile) + org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), + + // using the features to install the camel components + scanFeatures(getCamelKarafFeatureUrl(), "camel-core", "camel-test", "camel-bean-validator"), + + //workingDirectory("target/paxrunner/"), + //provision(newBundle() + // .add("META-INF/validation.xml", BeanValidatorTest.class.getClassLoader().getResource("META-INF/validation.xml")) + // .add("constraints-car.xml", BeanValidatorTest.class.getClassLoader().getResource("constraints-car.xml")) + // .set(Constants.BUNDLE_SYMBOLICNAME, "validation-fragment") + // .set(Constants.FRAGMENT_HOST, "org.apache.servicemix.specs.jsr303-api-1.0.0") + // .build(withBnd())), + + felix(), equinox()); + + return options; + } +} \ No newline at end of file Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java Mon Nov 8 09:17:45 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.itest.osgi.bean.validator; + +public interface Car { + + String getManufacturer(); + + void setManufacturer(String manufacturer); + + String getLicensePlate(); + + void setLicensePlate(String licensePlate); +} Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java Mon Nov 8 09:17:45 2010 @@ -0,0 +1,53 @@ +/** + * 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.osgi.bean.validator; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + + +public class CarWithAnnotations implements Car { + + @NotNull + private String manufacturer; + + @NotNull + @Size(min = 5, max = 14, groups = OptionalChecks.class) + private String licensePlate; + + public CarWithAnnotations(String manufacturer, String licencePlate) { + this.manufacturer = manufacturer; + this.licensePlate = licencePlate; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getLicensePlate() { + return licensePlate; + } + + public void setLicensePlate(String licensePlate) { + this.licensePlate = licensePlate; + } +} Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java Mon Nov 8 09:17:45 2010 @@ -0,0 +1,46 @@ +/** + * 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.osgi.bean.validator; + +public class CarWithoutAnnotations implements Car { + + private String manufacturer; + + private String licensePlate; + + public CarWithoutAnnotations(String manufacturer, String licencePlate) { + this.manufacturer = manufacturer; + this.licensePlate = licencePlate; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getLicensePlate() { + return licensePlate; + } + + public void setLicensePlate(String licensePlate) { + this.licensePlate = licensePlate; + } +} Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java Mon Nov 8 09:17:45 2010 @@ -0,0 +1,21 @@ +/** + * 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.osgi.bean.validator; + +public interface OptionalChecks { +} Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml Mon Nov 8 09:17:45 2010 @@ -0,0 +1,27 @@ + + + + + org.hibernate.validator.HibernateValidator + org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator + org.hibernate.validator.engine.resolver.DefaultTraversableResolver + org.hibernate.validator.engine.ConstraintValidatorFactoryImpl + /constraints-car.xml + + \ No newline at end of file Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/META-INF/validation.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml?rev=1032501&view=auto ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml (added) +++ camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml Mon Nov 8 09:17:45 2010 @@ -0,0 +1,39 @@ + + + + org.apache.camel.itest.osgi.bean.validator + + + + + + + + + + + + org.apache.camel.itest.osgi.bean.validator.OptionalChecks + + 5 + 14 + + + + \ No newline at end of file Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/constraints-car.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml