[hibernate-commits] Hibernate SVN: r19001 - in validator/trunk: hibernate-validator and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Mar 15 16:36:49 EDT 2010


Author: hardy.ferentschik
Date: 2010-03-15 16:36:48 -0400 (Mon, 15 Mar 2010)
New Revision: 19001

Added:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupsTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Try.java
Modified:
   validator/trunk/hibernate-validator/pom.xml
   validator/trunk/pom.xml
Log:
HV-267 added maven-bundle-plugin to generate OSGi manifest entries

Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml	2010-03-15 14:16:44 UTC (rev 19000)
+++ validator/trunk/hibernate-validator/pom.xml	2010-03-15 20:36:48 UTC (rev 19001)
@@ -113,6 +113,40 @@
                 </configuration>
             </plugin>
             <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile>${pom.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            javax.persistence.*;version="[2.0.0,3.0.0)";resolution:=optional,
+                            javax.validation.*;version="[1.0.0,2.0.0)",
+                            javax.xml.*;version="0",
+                            org.xml.sax.*;version="0",
+                            org.slf4j.*;version="[1.5.6,2.0.0)"
+                        </Import-Package>
+                        <Export-Package>org.hibernate.validator.*;version="${pom.version}"</Export-Package>
+                    </instructions>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>bundle-manifest</id>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>manifest</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupsTest.java (from rev 18807, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ElementDescriptorTest.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupsTest.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupsTest.java	2010-03-15 20:36:48 UTC (rev 19001)
@@ -0,0 +1,45 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.
+*/
+package org.hibernate.validator.engine.groups;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.TestUtil;
+
+import static org.hibernate.validator.util.TestUtil.assertCorrectConstraintViolationMessages;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GroupsTest {
+
+	@Test
+	public void testGroupInheritance() {
+		Validator validator = TestUtil.getValidator();
+		Try tryMe = new Try();
+		tryMe.field2 = "foo";
+		tryMe.field3 = "bar";
+
+		Set<ConstraintViolation<Try>> violations = validator.validate( tryMe, Try.GlobalCheck.class );
+		//assertCorrectConstraintViolationMessages(violations, "field1");
+	}
+}
\ No newline at end of file

Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Try.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Try.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Try.java	2010-03-15 20:36:48 UTC (rev 19001)
@@ -0,0 +1,51 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.
+*/
+package org.hibernate.validator.engine.groups;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Try {
+	@NotNull(message = "field1", groups = BaseComponent.class)
+	public String field1;
+
+	@NotNull(message = "field2", groups = Component.class)
+	public String field2;
+
+	@NotNull(message = "field3", groups = OtherComponent.class)
+	public String field3;
+
+
+	public interface BaseComponent {
+	}
+
+	public interface Component extends BaseComponent {
+	}
+
+	public interface OtherComponent {
+	}
+
+	@GroupSequence({ Component.class, OtherComponent.class })
+	public interface GlobalCheck {
+	}
+}
+
+


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Try.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml	2010-03-15 14:16:44 UTC (rev 19000)
+++ validator/trunk/pom.xml	2010-03-15 20:36:48 UTC (rev 19001)
@@ -279,6 +279,11 @@
                     <artifactId>maven-cli-plugin</artifactId>
                     <version>0.6.3.CR2</version>
                 </plugin>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>2.0.1</version>
+                </plugin>    
             </plugins>
         </pluginManagement>
     </build>



More information about the hibernate-commits mailing list