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

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Feb 9 14:27:30 EST 2009


Author: hardy.ferentschik
Date: 2009-02-09 14:27:30 -0500 (Mon, 09 Feb 2009)
New Revision: 15918

Added:
   validator/trunk/tck-utils/src/main/resources/META-INF/services/javax.annotation.processing.Processor
Removed:
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/HtmlTckReportGenerator.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/JSRReference.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessor.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessorFactory.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKReportGenerator.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessorFactory.java
   validator/trunk/tck-utils/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
Modified:
   validator/trunk/hibernate-validator-legacy/pom.xml
   validator/trunk/hibernate-validator/pom.xml
   validator/trunk/pom.xml
   validator/trunk/tck-utils/pom.xml
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/annotations/SpecAssertions.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessor.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageReport.java
   validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/SpecReference.java
   validator/trunk/validation-api/pom.xml
Log:
switched tck-utils to use javax.annotations.processor

Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/hibernate-validator/pom.xml	2009-02-09 19:27:30 UTC (rev 15918)
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>1.0.0-SNAPSHOT</version>
+        <version>4.0.0.Alpha1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -138,4 +138,41 @@
             </plugin>
         </plugins>
     </reporting>
+    <profiles>
+        <profile>
+            <id>tck-audit</id>
+            <activation>
+                <jdk>1.6</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <source>1.6</source>
+                            <target>1.6</target>
+                            <compilerArgument>-proc:none</compilerArgument>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>run-annotation-processor-only</id>
+                                <phase>process-test-resources</phase>
+                                <goals>
+                                    <goal> testCompile</goal>
+                                </goals>
+                                <configuration>
+                                    <compilerArgument>-proc:only</compilerArgument>
+                                    <compilerArguments>
+                                        <s>foo</s>
+                                        <processor>org.hibernate.tck.report.CoverageProcessor</processor>
+                                    </compilerArguments>                                 
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>

Modified: validator/trunk/hibernate-validator-legacy/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/pom.xml	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/hibernate-validator-legacy/pom.xml	2009-02-09 19:27:30 UTC (rev 15918)
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>1.0.0-SNAPSHOT</version>
+        <version>4.0.0.Alpha1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>hibernate-validator-legacy</artifactId>

Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/pom.xml	2009-02-09 19:27:30 UTC (rev 15918)
@@ -6,7 +6,7 @@
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-validator-parent</artifactId>
     <packaging>pom</packaging>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>4.0.0.Alpha1-SNAPSHOT</version>
     <name>Hibernate Validator Parent</name>
     <url>http://localhost/~hardy/</url>
 
@@ -49,7 +49,6 @@
         <module>validation-api</module>
         <module>hibernate-validator</module>
         <module>hibernate-validator-legacy</module>
-        <module>tck-utils</module>
     </modules>
 
     <dependencyManagement>
@@ -57,13 +56,8 @@
             <dependency>
                 <groupId>javax.validation</groupId>
                 <artifactId>validation-api</artifactId>
-                <version>${version}</version>
+                <version>1.0.Beta3-SNAPSHOT</version>
             </dependency>
-            <!--dependency>
-                <groupId>com.google.code.guice</groupId>
-                <artifactId>guice</artifactId>
-                <version>1.0</version>
-            </dependency-->
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
@@ -78,7 +72,7 @@
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>4.4</version>
-            </dependency>
+            </dependency>         
         </dependencies>
     </dependencyManagement>
 
@@ -165,7 +159,7 @@
 
     <scm>
         <connection>scm:https://svn.jboss.org/repos/hibernate/validator/trunk</connection>
-        <url>http://fisheye.jboss.org/browse/Fixme</url>
+        <url>http://fisheye.jboss.org/browse/Hibernate/validator/trunk</url>
     </scm>
 
     <distributionManagement>
@@ -215,10 +209,10 @@
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>taglist-maven-plugin</artifactId>
             </plugin>
-            <!--plugin>
+            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>changelog-maven-plugin</artifactId>
-            </plugin-->
+            </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>changes-maven-plugin</artifactId>

Modified: validator/trunk/tck-utils/pom.xml
===================================================================
--- validator/trunk/tck-utils/pom.xml	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/pom.xml	2009-02-09 19:27:30 UTC (rev 15918)
@@ -67,16 +67,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.4.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <version>1.4.2</version>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.4</version>
@@ -117,6 +107,7 @@
                     <configuration>
                         <source>1.5</source>
                         <target>1.5</target>
+                        <compilerArgument>-proc:none</compilerArgument>
                     </configuration>
                 </plugin>
                 <plugin>

Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/HtmlTckReportGenerator.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/HtmlTckReportGenerator.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/HtmlTckReportGenerator.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,94 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.tck;
-
-import java.util.List;
-
-/**
- * @author Hardy Ferentschik
- */
-public class HtmlTckReportGenerator implements TCKReportGenerator {
-	private final String[] tableHeaders = new String[] { "Section", "Class", "Method", "Note" };
-	private StringBuffer out;
-
-	public String generateReport(List<JSRReference> references) {
-		out = new StringBuffer();
-		writeHeader();
-		writeContents( references );
-		writeFooter();
-		return out.toString();
-	}
-
-	private void writeFooter() {
-		out.append( "</body></html>" );
-	}
-
-	private void writeHeader() {
-		out.append( "<html><head></head><body>" );
-	}
-
-	private void writeTableHeader() {
-		out.append( "<table border=\"1\"><tr>" );
-		for ( String s : tableHeaders ) {
-			out.append( "<th>" ).append( s ).append( "</th>" );
-		}
-		out.append( "</tr>" );
-	}
-
-	private void writeTableFooter() {
-		out.append( "</table>" );
-	}
-
-	private void writeContents(List<JSRReference> references) {
-		writeTableHeader();
-		String currentReference = "";
-		boolean sameReference;
-		String currentClass = "";
-		for ( JSRReference reference : references ) {
-			out.append( "<tr>" );
-
-			if ( currentReference.equals( reference.jsrSectionReference ) ) {
-				sameReference = true;
-				out.append( "<td></td>" );
-			}
-			else {
-				currentReference = reference.jsrSectionReference;
-				sameReference = false;
-				out.append( "<td>" ).append( reference.jsrSectionReference ).append( "</td>" );
-			}
-
-			if ( sameReference && currentClass.equals( reference.className ) ) {
-				out.append( "<td></td>" );
-			}
-			else {
-				currentClass = reference.className;
-				out.append( "<td><a href=\"" )
-						.append( reference.getSourceLink() )
-						.append( "\">" )
-						.append( reference.className )
-						.append( "</a></td>" );
-			}
-
-			out.append( "<td>" ).append( reference.methodName ).append( "</td>" );
-
-			out.append( "<td>" ).append( reference.note ).append( "</td>" );
-			out.append( "</tr>" );
-		}
-		writeTableFooter();
-	}
-}

Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/JSRReference.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/JSRReference.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/JSRReference.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,77 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.tck;
-
-/**
- * @author Hardy Ferentschik
- */
-public class JSRReference implements Comparable {
-	/**
-	 * The JSR  section this instance references.
-	 */
-	String jsrSectionReference;
-
-	/**
-	 * The name of the class which references the JSR.
-	 */
-	String className;
-
-	/**
-	 * The method which references the JSR.
-	 */
-	String methodName;
-
-	/**
-	 * Optional note specified on the specification reference
-	 */
-	String note = "";
-
-	JSRReference(String reference, String className, String methodName) {
-		this.jsrSectionReference = reference;
-		this.className = className;
-		this.methodName = methodName;
-	}
-
-	public String getSourceLink() {
-		StringBuilder builder = new StringBuilder();
-		builder.append( "xref-test/" );
-		builder.append( className.replace( '.', '/' ) );
-		builder.append( ".html" );
-		return builder.toString();
-	}
-
-	public String getJsrSectionReference() {
-		return jsrSectionReference;
-	}
-
-	public String getClassName() {
-		return className;
-	}
-
-	public String getMethodName() {
-		return methodName;
-	}
-
-	public String getNote() {
-		return note;
-	}
-
-	public int compareTo(Object o) {
-		return jsrSectionReference.compareTo( ( ( JSRReference ) o ).jsrSectionReference );
-	}
-}

Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessor.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessor.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessor.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,105 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.tck;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Collections;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import static com.sun.mirror.util.DeclarationVisitors.NO_OP;
-import static com.sun.mirror.util.DeclarationVisitors.getDeclarationScanner;
-import com.sun.mirror.util.SimpleDeclarationVisitor;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-
-/**
- * An APT annotation processor for creating a TCK coverage report.
- *
- * @author Hardy Ferentschik
- */
-public class TCKAnnotationProcessor implements AnnotationProcessor {
-
-	private static final String OUTDIR_OPTION_NAME = "-s";
-	private static final String REPORT_FILE_NAME = "tck.html";
-
-	private final AnnotationProcessorEnvironment env;
-	private final List<JSRReference> references = new ArrayList<JSRReference>();
-	private final File baseDir;
-
-	public TCKAnnotationProcessor(AnnotationProcessorEnvironment annotationProcessorEnvironment) {
-		this.env = annotationProcessorEnvironment;
-		String baseDirName = env.getOptions().get( OUTDIR_OPTION_NAME );
-		baseDir = new File( baseDirName );
-		baseDir.mkdirs();
-	}
-
-	public void process() {
-
-
-		AnnotationTypeDeclaration annType = ( AnnotationTypeDeclaration ) env.getTypeDeclaration(
-				SpecAssertion.class.getCanonicalName()
-		);
-		for ( Declaration d : env.getDeclarationsAnnotatedWith( annType ) ) {
-			d.accept(
-					getDeclarationScanner(
-							new CreateReferenceVisitor(),
-							NO_OP
-					)
-			);
-		}
-
-		Collections.sort( references );
-		TCKReportGenerator generator = new HtmlTckReportGenerator();
-		String report = generator.generateReport( references );
-		writeReportFile( report );
-	}
-
-	private void writeReportFile(String report) {
-		try {
-			File reportFile = new File( baseDir, REPORT_FILE_NAME );
-			BufferedWriter writer = new BufferedWriter( new FileWriter( reportFile ) );
-			writer.write( report );
-			writer.close();
-		}
-		catch ( IOException e ) {
-			System.err.println( "Error writing report." );
-		}
-	}
-
-	private class CreateReferenceVisitor extends SimpleDeclarationVisitor {
-		public void visitMethodDeclaration(MethodDeclaration d) {
-			SpecAssertion annotation = d.getAnnotation( SpecAssertion.class );
-			JSRReference ref = new JSRReference(
-					annotation.section(), d.getDeclaringType().getQualifiedName(), d.getSimpleName()
-			);
-			if ( annotation.note().length() > 0 ) {
-				ref.note = annotation.note();
-			}
-			references.add( ref );
-		}
-	}
-}

Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessorFactory.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessorFactory.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKAnnotationProcessorFactory.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,65 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.tck;
-
-import java.util.Arrays;
-import java.util.Collection;
-import static java.util.Collections.emptySet;
-import static java.util.Collections.unmodifiableCollection;
-import java.util.Set;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecVersion;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class TCKAnnotationProcessorFactory implements AnnotationProcessorFactory {
-
-	// Process any set of annotations
-	private static final Collection<String> supportedAnnotations
-			= unmodifiableCollection(
-			Arrays.asList(
-					SpecAssertion.class.getCanonicalName(),
-					SpecVersion.class.getCanonicalName()
-			)
-	);
-
-	// No supported options
-	private static final Collection<String> supportedOptions = emptySet();
-
-
-	public Collection<String> supportedOptions() {
-		return supportedOptions;
-	}
-
-	public Collection<String> supportedAnnotationTypes() {
-		return supportedAnnotations;
-	}
-
-	public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> annotationTypeDeclarations, AnnotationProcessorEnvironment annotationProcessorEnvironment) {
-		return new TCKAnnotationProcessor( annotationProcessorEnvironment );
-
-	}
-}

Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKReportGenerator.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKReportGenerator.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/TCKReportGenerator.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,29 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.tck;
-
-import java.util.List;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface TCKReportGenerator {
-
-	public String generateReport(List<JSRReference> references);
-
-}

Modified: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/annotations/SpecAssertions.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/annotations/SpecAssertions.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/annotations/SpecAssertions.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -20,11 +20,10 @@
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
+import java.lang.annotation.Annotation;
 
 @Target(ElementType.METHOD)
 @Documented
-public @interface SpecAssertions {
-
+public @interface SpecAssertions  {
 	SpecAssertion[] value();
-
 }
\ No newline at end of file

Modified: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessor.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessor.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessor.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,139 +1,163 @@
 package org.hibernate.tck.report;
 
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+
+import javax.annotation.processing.*;
+import static javax.lang.model.SourceVersion.RELEASE_6;
+import javax.lang.model.element.*;
+import javax.tools.Diagnostic;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.util.DeclarationVisitors;
-import com.sun.mirror.util.SimpleDeclarationVisitor;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecAssertions;
-
 /**
  * Annotation processor for generating TCK coverage report
  *
  * @author Shane Bryzak
+ * @author Hardy Ferentschik
  */
-public class CoverageProcessor implements AnnotationProcessor {
-	private static final String OUTDIR_OPTION_FLAG = "-s";
-	private static final String AUDITFILE_OPTION_FLAG = "-a";
-	private static final String REPORT_FILE_NAME = "coverage.html";
+ at SupportedAnnotationTypes({
+        "org.hibernate.tck.annotations.SpecAssertion", "org.hibernate.tck.annotations.SpecAssertions"
+})
+ at SupportedSourceVersion(RELEASE_6)
+public class CoverageProcessor extends AbstractProcessor {
+    private static final String OUTDIR_OPTION_FLAG = "-s";
+    private static final String AUDITFILE_OPTION_FLAG = "-a";
+    private static final String REPORT_FILE_NAME = "coverage.html";
 
-	private static final String DEFAULT_AUDIT_FILE_NAME = "tck-audit.xml";
+    private static final String DEFAULT_AUDIT_FILE_NAME = "tck-audit.xml";
 
-	private final AnnotationProcessorEnvironment env;
+    private final List<SpecReference> references = new ArrayList<SpecReference>();
 
-	private final List<SpecReference> references = new ArrayList<SpecReference>();
+    private AuditParser auditParser;
 
-	private AuditParser auditParser;
+    private File baseDir;
 
-	private File baseDir;
+    public CoverageProcessor() {
+    }
 
-	public CoverageProcessor(AnnotationProcessorEnvironment env) {
-		this.env = env;
+    public void init(ProcessingEnvironment env) {
+        super.init(env);
 
-		createOutputDir( env );
-		InputStream in = getAuditFileInputStream( env );
+        createOutputDir();
+        InputStream in = getAuditFileInputStream();
 
-		if ( in == null ) {
-			return;
-		}
+        if (in == null) {
+            return;
+        }
 
-		try {
-			auditParser = new AuditParser( in );
-			auditParser.parse();
-		}
-		catch ( Exception e ) {
-			throw new RuntimeException( "Unable to parse audit file." );
-		}
-	}
+        try {
+            auditParser = new AuditParser(in);
+            auditParser.parse();
+        }
+        catch (Exception e) {
+            throw new RuntimeException("Unable to parse audit file.");
+        }
+    }
 
-	private InputStream getAuditFileInputStream(AnnotationProcessorEnvironment env) {
-		InputStream in;
-		String auditFileName = env.getOptions().get( AUDITFILE_OPTION_FLAG );
-		if ( auditFileName == null || auditFileName.length() == 0 ) {
-			env.getMessager()
-					.printNotice( "No audit file specified on the command line. Trying default: " + DEFAULT_AUDIT_FILE_NAME );
-			auditFileName = DEFAULT_AUDIT_FILE_NAME;
-		}
-		try {
-			in = new FileInputStream( auditFileName );
-		}
-		catch ( IOException ex ) {
-			env.getMessager().printWarning( "Unable to open audit file - " + auditFileName );
-			env.getMessager().printWarning( "No report generated" );
-			return null;
-		}
-		return in;
-	}
+    private InputStream getAuditFileInputStream() {
+        InputStream in;
+        String auditFileName = processingEnv.getOptions().get(AUDITFILE_OPTION_FLAG);
+        if (auditFileName == null || auditFileName.length() == 0) {
+            auditFileName = getCurrentWorkingDirectory() + DEFAULT_AUDIT_FILE_NAME;
+            processingEnv.getMessager().printMessage(
+                    Diagnostic.Kind.NOTE,
+                    "No audit file specified on the command line. Trying default: " + auditFileName
+            );
+        }
+        try {
+            in = new FileInputStream(auditFileName);
+        }
+        catch (IOException ex) {
+            processingEnv.getMessager()
+                    .printMessage(Diagnostic.Kind.WARNING, "Unable to open audit file - " + auditFileName);
+            processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "No report generated");
+            return null;
+        }
+        return in;
+    }
 
-	private void createOutputDir(AnnotationProcessorEnvironment env) {
-		String baseDirName = env.getOptions().get( OUTDIR_OPTION_FLAG );
-		baseDir = new File( baseDirName );
-		baseDir.mkdirs();
-	}
 
-	public void process() {
-		if ( auditParser == null ) {
-			return;
-		}
+    private void createOutputDir() {
+        String baseDirName = processingEnv.getOptions().get(OUTDIR_OPTION_FLAG);
 
-		AnnotationTypeDeclaration annotationType = ( AnnotationTypeDeclaration )
-				env.getTypeDeclaration( SpecAssertion.class.getCanonicalName() );
+        // I would like to get the baseDir as property, but it seems that the maven compiler plugin still has issues - http://jira.codehaus.org/browse/MCOMPILER-75
+        if (baseDirName == null) {
+            baseDirName = getCurrentWorkingDirectory() + "target";
+            processingEnv.getMessager().printMessage(
+                    Diagnostic.Kind.NOTE,
+                    "No output directory specided using " + baseDirName + "instead."
+            );
+        }
 
+        baseDir = new File(baseDirName);
+        baseDir.mkdirs();
+    }
 
-		for ( Declaration d : env.getDeclarationsAnnotatedWith( annotationType ) ) {
-			d.accept(
-					DeclarationVisitors.getDeclarationScanner(
-							new CreateReferenceVisitor(), DeclarationVisitors.NO_OP
-					)
-			);
-		}
+    private String getCurrentWorkingDirectory() {
+        return System.getProperty("user.dir") + System.getProperty("file.separator");
+    }
 
-		annotationType = ( AnnotationTypeDeclaration )
-				env.getTypeDeclaration( SpecAssertions.class.getCanonicalName() );
-		for ( Declaration d : env.getDeclarationsAnnotatedWith( annotationType ) ) {
-			d.accept(
-					DeclarationVisitors.getDeclarationScanner(
-							new CreateReferenceVisitor(), DeclarationVisitors.NO_OP
-					)
-			);
-		}
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment) {
 
+        if (auditParser == null) {
+            return true;
+        }
 
-		new CoverageReport( references, auditParser ).writeToFile( new File( baseDir, REPORT_FILE_NAME ) );
-	}
+        for (TypeElement type : annotations) {
+            processAnnoatedMethods(roundEnvironment, type);
+        }
 
-	private class CreateReferenceVisitor extends SimpleDeclarationVisitor {
-		public void visitMethodDeclaration(MethodDeclaration d) {
-			SpecAssertions assertions = d.getAnnotation( SpecAssertions.class );
-			if ( assertions != null ) {
-				for ( SpecAssertion assertion : assertions.value() ) {
-					SpecReference ref = new SpecReference(
-							assertion.section(), assertion.id(),
-							d.getDeclaringType().getSimpleName(), d.getSimpleName()
-					);
-					references.add( ref );
-				}
-			}
+        if (roundEnvironment.processingOver()) {
+            new CoverageReport(references, auditParser).writeToFile(new File(baseDir, REPORT_FILE_NAME));
+        }
+        return true;
+    }
 
-			SpecAssertion assertion = d.getAnnotation( SpecAssertion.class );
-			if ( assertion != null ) {
-				SpecReference ref = new SpecReference(
-						assertion.section(), assertion.id(),
-						d.getDeclaringType().getSimpleName(), d.getSimpleName()
-				);
-				references.add( ref );
-			}
-		}
-	}
+    private void processAnnoatedMethods(RoundEnvironment env, TypeElement annotation) {
+        Set<Element> elements = (Set<Element>) env.getElementsAnnotatedWith(annotation);
+        for (Element element : elements) {
+            processMethod(element);
+        }
+    }
+
+    private void processMethod(Element element) {
+        ExecutableElement methodElement = (ExecutableElement) element;
+        String annotationType = null;
+        for (AnnotationMirror annotationMirror : processingEnv.getElementUtils().getAllAnnotationMirrors(methodElement)) {
+            Map<? extends ExecutableElement, ? extends AnnotationValue> annotationParameters =
+                    processingEnv.getElementUtils().getElementValuesWithDefaults(annotationMirror);
+            annotationType = annotationMirror.getAnnotationType().toString();
+            if (annotationType.equals(SpecAssertions.class.getName())) {
+                List<AnnotationMirror> mirrors = (List<AnnotationMirror>) annotationMirror.getElementValues().values().iterator().next().getValue();
+                for (AnnotationMirror mirror : mirrors) {
+                    createSpecReference(methodElement, processingEnv.getElementUtils().getElementValuesWithDefaults(mirror));
+                }
+            } else if (annotationType.equals(SpecAssertion.class.getName())) {
+                createSpecReference(methodElement, annotationParameters);
+            }
+        }
+    }
+
+    private void createSpecReference(ExecutableElement methodElement, Map<? extends ExecutableElement, ? extends AnnotationValue> annotationParameters) {
+        SpecReference ref = new SpecReference();
+        ref.setClassName(methodElement.getClass().getName());
+        ref.setMethodName(methodElement.getSimpleName().toString());
+        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationParameters.entrySet()) {
+            final String elementKey = entry.getKey().toString();
+            // TODO - is there no better way of doing this?
+            if (elementKey.equals("section()")) {
+                ref.setSection(entry.getValue().toString());
+            } else if (elementKey.equals("id()")) {
+                ref.setAssertion(entry.getValue().toString());
+            }
+        }
+        references.add(ref);
+    }
 }
Deleted: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessorFactory.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessorFactory.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageProcessorFactory.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1,41 +0,0 @@
-package org.hibernate.tck.report;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecAssertions;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-public class CoverageProcessorFactory implements AnnotationProcessorFactory
-{
-   private static final Collection<String> supportedAnnotations = Collections.unmodifiableCollection(
-         Arrays.asList(
-               SpecAssertion.class.getCanonicalName(),
-               SpecAssertions.class.getCanonicalName()
-         )
-   );
-   
-   public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> annotationTypeDeclarations,
-         AnnotationProcessorEnvironment env)
-   {
-      return new CoverageProcessor(env);
-   }
-
-   public Collection<String> supportedAnnotationTypes()
-   {
-      return supportedAnnotations;
-   }
-
-   public Collection<String> supportedOptions()
-   {
-      return null;
-   }
-
-}
Modified: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageReport.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageReport.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/CoverageReport.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -5,249 +5,221 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 /**
  * Generates the TCK spec coverage report
- *  
+ *
  * @author Shane Bryzak
  */
-public class CoverageReport
-{
-   /*
+public class CoverageReport {
+    /*
     * References to the spec assertions made by the tck tests
     */
-   private final Map<String,List<SpecReference>> references;
-   
-   private AuditParser auditParser;
-   
-   public CoverageReport(List<SpecReference> references, AuditParser auditParser)
-   {
-      this.references = new HashMap<String,List<SpecReference>>();
-      
-      for (SpecReference ref : references)
-      {
-         if (!this.references.containsKey(ref.getSection()))
-         {
-            this.references.put(ref.getSection(), new ArrayList<SpecReference>());
-         }
-         
-         this.references.get(ref.getSection()).add(ref);
-      }
-      
-      this.auditParser = auditParser;
-   }
-   
-   public void generate(OutputStream out) throws IOException
-   {
-      writeHeader(out);
-      writeCoverage(out);
-      writeUnmatched(out);
-      writeFooter(out);
-   }
-   
-   private void writeHeader(OutputStream out) throws IOException
-   {
-      StringBuilder sb = new StringBuilder();
-           
-      sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-      sb.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n");
-      sb.append("\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
-      sb.append("<html>\n");
-      sb.append("<head><title>JSR-299 TCK Coverage Report</title>\n");
-      
-      sb.append("<style type=\"text/css\">\n");
-      sb.append("  .code {\n");
-      sb.append("    float: left;\n");
-      sb.append("    font-weight: bold;\n");
-      sb.append("    width: 50px;\n");
-      sb.append("    margin-top: 0px;\n");
-      sb.append("    height: 100%; }\n");
-      sb.append("  .results {\n");
-      sb.append("    margin-left: 50px; }\n");
-      sb.append("  .description {\n");
-      sb.append("    margin-top: 2px;\n");
-      sb.append("    margin-bottom: 2px; }\n");
-      sb.append("  .sectionHeader {\n");
-      sb.append("    font-weight: bold; }\n");
-      sb.append("  .noCoverage {\n");
-      sb.append("    margin-top: 2px;\n");
-      sb.append("    margin-bottom: 2px;\n");
-      sb.append("    font-weight: bold;\n");
-      sb.append("    font-style: italic;\n");
-      sb.append("    color: #ff0000; }\n");
-      sb.append("   .coverageHeader {\n");
-      sb.append("    font-weight: bold;\n");
-      sb.append("    text-decoration: underline;\n");
-      sb.append("    margin-top: 2px;\n");
-      sb.append("    margin-bottom: 2px; }\n");
-      sb.append("  .pass {\n");
-      sb.append("    background-color: #dfd; }\n");
-      sb.append("  .fail {\n");
-      sb.append("    background-color: #fdd; }\n");
-      
-      sb.append("</style>\n");
-      
-      sb.append("</head><body>");
-      sb.append("<h1>JSR-299 TCK Coverage</h1>");
-      sb.append("<h2>");
-      sb.append(auditParser.getVersion());
-      sb.append("</h2>\n");
-      
-      out.write(sb.toString().getBytes());
-   }
-   
-   private void writeCoverage(OutputStream out) throws IOException
-   {      
-      for (String sectionId : auditParser.getSectionIds())
-      {         
-         out.write(("<div class=\"sectionHeader\">Section " + sectionId + " - " + 
-               auditParser.getSectionTitle(sectionId) + "</div>\n").getBytes());
-         
-         List<AuditAssertion> sectionAssertions = auditParser.getAssertionsForSection(sectionId);
-         
-         if (sectionAssertions != null && !sectionAssertions.isEmpty())
-         {            
-            StringBuilder sb = new StringBuilder(); 
-            
-            for (AuditAssertion assertion : sectionAssertions)
-            {
-               List<SpecReference> coverage = getCoverageForAssertion(sectionId, assertion.getId());               
-               
-               sb.append("  <div class=\"" + (coverage.isEmpty() ? "fail" : "pass") + "\">\n");
-               
-               sb.append("    <span class=\"code\">");
-               sb.append(assertion.getId());
-               sb.append(")");
-               sb.append("</span>\n");
-               
-               sb.append("    <div class=\"results\">");
-               sb.append("<p class=\"description\">");
-               sb.append(assertion.getText());
-               sb.append("</p>\n");
-               
-               sb.append("    <div class=\"coverage\">\n");
-               sb.append("      <p class=\"coverageHeader\">Coverage</p>\n");
-                              
-               if (coverage.isEmpty())
-               {
-                  sb.append("        <p class=\"noCoverage\">No tests exist for this assertion</p>\n");
-               }
-               else
-               {
-                  for (SpecReference ref : coverage)
-                  {
-                     sb.append("        <p>");
-                     sb.append(ref.getClassName());
-                     sb.append(".");
-                     sb.append(ref.getMethodName());
-                     sb.append("()");
-                     sb.append("</p>\n");
-                  }
-               }
-               
-               sb.append("    </div>\n  </div>\n</div>");
+    private final Map<String, List<SpecReference>> references;
+
+    private AuditParser auditParser;
+
+    public CoverageReport(List<SpecReference> references, AuditParser auditParser) {
+        this.references = new HashMap<String, List<SpecReference>>();
+
+        for (SpecReference ref : references) {
+            if (!this.references.containsKey(ref.getSection())) {
+                this.references.put(ref.getSection(), new ArrayList<SpecReference>());
             }
-            
-            out.write(sb.toString().getBytes());
-         }
-      }
-   }
-   
-   private void writeUnmatched(OutputStream out) throws IOException
-   {
-      List<SpecReference> unmatched = new ArrayList<SpecReference>();
-      
-      for (String sectionId : references.keySet())
-      {
-         for (SpecReference ref : references.get(sectionId))
-         {
-            if (!auditParser.hasAssertion(ref.getSection(), ref.getAssertion()))
-            {
-               unmatched.add(ref);
+
+            this.references.get(ref.getSection()).add(ref);
+        }
+
+        this.auditParser = auditParser;
+    }
+
+    public void generate(OutputStream out) throws IOException {
+        writeHeader(out);
+        writeCoverage(out);
+        writeUnmatched(out);
+        writeFooter(out);
+    }
+
+    private void writeHeader(OutputStream out) throws IOException {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        sb.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n");
+        sb.append("\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
+        sb.append("<html>\n");
+        sb.append("<head><title>JSR-299 TCK Coverage Report</title>\n");
+
+        sb.append("<style type=\"text/css\">\n");
+        sb.append("  .code {\n");
+        sb.append("    float: left;\n");
+        sb.append("    font-weight: bold;\n");
+        sb.append("    width: 50px;\n");
+        sb.append("    margin-top: 0px;\n");
+        sb.append("    height: 100%; }\n");
+        sb.append("  .results {\n");
+        sb.append("    margin-left: 50px; }\n");
+        sb.append("  .description {\n");
+        sb.append("    margin-top: 2px;\n");
+        sb.append("    margin-bottom: 2px; }\n");
+        sb.append("  .sectionHeader {\n");
+        sb.append("    font-weight: bold; }\n");
+        sb.append("  .noCoverage {\n");
+        sb.append("    margin-top: 2px;\n");
+        sb.append("    margin-bottom: 2px;\n");
+        sb.append("    font-weight: bold;\n");
+        sb.append("    font-style: italic;\n");
+        sb.append("    color: #ff0000; }\n");
+        sb.append("   .coverageHeader {\n");
+        sb.append("    font-weight: bold;\n");
+        sb.append("    text-decoration: underline;\n");
+        sb.append("    margin-top: 2px;\n");
+        sb.append("    margin-bottom: 2px; }\n");
+        sb.append("  .pass {\n");
+        sb.append("    background-color: #dfd; }\n");
+        sb.append("  .fail {\n");
+        sb.append("    background-color: #fdd; }\n");
+
+        sb.append("</style>\n");
+
+        sb.append("</head><body>");
+        sb.append("<h1>JSR-299 TCK Coverage</h1>");
+        sb.append("<h2>");
+        sb.append(auditParser.getVersion());
+        sb.append("</h2>\n");
+
+        out.write(sb.toString().getBytes());
+    }
+
+    private void writeCoverage(OutputStream out) throws IOException {
+        for (String sectionId : auditParser.getSectionIds()) {
+            out.write(("<div class=\"sectionHeader\">Section " + sectionId + " - " +
+                    auditParser.getSectionTitle(sectionId) + "</div>\n").getBytes());
+
+            List<AuditAssertion> sectionAssertions = auditParser.getAssertionsForSection(sectionId);
+
+            if (sectionAssertions != null && !sectionAssertions.isEmpty()) {
+                StringBuilder sb = new StringBuilder();
+
+                for (AuditAssertion assertion : sectionAssertions) {
+                    List<SpecReference> coverage = getCoverageForAssertion(sectionId, assertion.getId());
+
+                    sb.append("  <div class=\"" + (coverage.isEmpty() ? "fail" : "pass") + "\">\n");
+
+                    sb.append("    <span class=\"code\">");
+                    sb.append(assertion.getId());
+                    sb.append(")");
+                    sb.append("</span>\n");
+
+                    sb.append("    <div class=\"results\">");
+                    sb.append("<p class=\"description\">");
+                    sb.append(assertion.getText());
+                    sb.append("</p>\n");
+
+                    sb.append("    <div class=\"coverage\">\n");
+                    sb.append("      <p class=\"coverageHeader\">Coverage</p>\n");
+
+                    if (coverage.isEmpty()) {
+                        sb.append("        <p class=\"noCoverage\">No tests exist for this assertion</p>\n");
+                    } else {
+                        for (SpecReference ref : coverage) {
+                            sb.append("        <p>");
+                            sb.append(ref.getClassName());
+                            sb.append(".");
+                            sb.append(ref.getMethodName());
+                            sb.append("()");
+                            sb.append("</p>\n");
+                        }
+                    }
+
+                    sb.append("    </div>\n  </div>\n</div>");
+                }
+
+                out.write(sb.toString().getBytes());
             }
-         }         
-      }
-      
-      if (unmatched.isEmpty()) return;
-      
-      StringBuilder sb = new StringBuilder();
-      
-      sb.append("<h3>Unmatched tests</h3>\n");
-      sb.append(String.format("<p>The following %d tests do not match any known assertions:</p>", 
-            unmatched.size()));
-            
-      sb.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n");
-      sb.append("  <tr><th>Section</th><th>Assertion</th><th>Test Class</th><th>Test Method</th></tr>\n");
-      
-      for (SpecReference ref : unmatched)
-      {
-         sb.append("<tr>");
-         
-         sb.append("<td>");
-         sb.append(ref.getSection());
-         sb.append("</td>");
+        }
+    }
 
-         sb.append("<td>");
-         sb.append(ref.getAssertion());
-         sb.append("</td>");
-         
-         sb.append("<td>");
-         sb.append(ref.getClassName());
-         sb.append("</td>");
-         
-         sb.append("<td>");
-         sb.append(ref.getMethodName());
-         sb.append("()");
-         sb.append("</td>");
-         
-         sb.append("</tr>");
-      }
-      
-      sb.append("</table>");
-      
-      out.write(sb.toString().getBytes());
-   }
-   
-   private List<SpecReference> getCoverageForAssertion(String sectionId, String assertionId)
-   {
-      List<SpecReference> refs = new ArrayList<SpecReference>();
-      
-      if (references.containsKey(sectionId))
-      {      
-         for (SpecReference ref : references.get(sectionId))
-         {
-            if (ref.getAssertion().equals(assertionId))
-            {
-               refs.add(ref);
+    private void writeUnmatched(OutputStream out) throws IOException {
+        List<SpecReference> unmatched = new ArrayList<SpecReference>();
+
+        for (String sectionId : references.keySet()) {
+            for (SpecReference ref : references.get(sectionId)) {
+                if (!auditParser.hasAssertion(ref.getSection(), ref.getAssertion())) {
+                    unmatched.add(ref);
+                }
             }
-         }
-      }
-      
-      return refs;
-   }
-     
-   private void writeFooter(OutputStream out) throws IOException
-   {
-      out.write("</table>".getBytes());
-      out.write("</body></html>".getBytes());
-   }
-   
-   public void writeToFile(File file)
-   {      
-      try
-      {
-         FileOutputStream out = new FileOutputStream(file);
-         generate(out);
-         out.flush();
-         out.close();
-      }
-      catch (IOException ex)
-      {
-         throw new RuntimeException("Error generating report file", ex);
-      }      
-   }
+        }
+
+        if (unmatched.isEmpty()) return;
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("<h3>Unmatched tests</h3>\n");
+        sb.append(String.format("<p>The following %d tests do not match any known assertions:</p>",
+                unmatched.size()));
+
+        sb.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n");
+        sb.append("  <tr><th>Section</th><th>Assertion</th><th>Test Class</th><th>Test Method</th></tr>\n");
+
+        for (SpecReference ref : unmatched) {
+            sb.append("<tr>");
+
+            sb.append("<td>");
+            sb.append(ref.getSection());
+            sb.append("</td>");
+
+            sb.append("<td>");
+            sb.append(ref.getAssertion());
+            sb.append("</td>");
+
+            sb.append("<td>");
+            sb.append(ref.getClassName());
+            sb.append("</td>");
+
+            sb.append("<td>");
+            sb.append(ref.getMethodName());
+            sb.append("()");
+            sb.append("</td>");
+
+            sb.append("</tr>");
+        }
+
+        sb.append("</table>");
+
+        out.write(sb.toString().getBytes());
+    }
+
+    private List<SpecReference> getCoverageForAssertion(String sectionId, String assertionId) {
+        List<SpecReference> refs = new ArrayList<SpecReference>();
+
+        if (references.containsKey(sectionId)) {
+            for (SpecReference ref : references.get(sectionId)) {
+                if (ref.getAssertion().equals(assertionId)) {
+                    refs.add(ref);
+                }
+            }
+        }
+
+        return refs;
+    }
+
+    private void writeFooter(OutputStream out) throws IOException {
+        out.write("</table>".getBytes());
+        out.write("</body></html>".getBytes());
+    }
+
+    public void writeToFile(File file) {
+        try {
+            FileOutputStream out = new FileOutputStream(file);
+            generate(out);
+            out.flush();
+            out.close();
+        }
+        catch (IOException ex) {
+            throw new RuntimeException("Error generating report file", ex);
+        }
+    }
 }

Modified: validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/SpecReference.java
===================================================================
--- validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/SpecReference.java	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/java/org/hibernate/tck/report/SpecReference.java	2009-02-09 19:27:30 UTC (rev 15918)
@@ -2,41 +2,44 @@
 
 /**
  * Represents the metadata for a single instance of @SpecAssertion
- * 
+ *
  * @author Shane Bryzak
  */
-public class SpecReference
-{
-   private String section;
-   private String assertion;
-   private String className;
-   private String methodName;
-   
-   SpecReference(String section, String assertion, String className, String methodName)
-   {
-      this.section = section;
-      this.assertion = assertion;
-      this.className = className;
-      this.methodName = methodName;
-   }
-   
-   public String getSection()
-   {
-      return section;
-   }
-   
-   public String getAssertion()
-   {
-      return assertion;
-   }
-   
-   public String getClassName()
-   {
-      return className;
-   }
-   
-   public String getMethodName()
-   {
-      return methodName;
-   }
+public class SpecReference {
+    private String section;
+    private String assertion;
+    private String className;
+    private String methodName;
+
+    public void setSection(String section) {
+        this.section = section;
+    }
+
+    public void setAssertion(String assertion) {
+        this.assertion = assertion;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public void setMethodName(String methodName) {
+        this.methodName = methodName;
+    }
+
+    public String getSection() {
+        return section;
+    }
+
+    public String getAssertion() {
+        return assertion;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public String getMethodName() {
+        return methodName;
+    }
 }

Deleted: validator/trunk/tck-utils/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
===================================================================
--- validator/trunk/tck-utils/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/tck-utils/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory	2009-02-09 19:27:30 UTC (rev 15918)
@@ -1 +0,0 @@
-org.hibernate.tck.report.CoverageProcessorFactory
\ No newline at end of file

Added: validator/trunk/tck-utils/src/main/resources/META-INF/services/javax.annotation.processing.Processor
===================================================================
--- validator/trunk/tck-utils/src/main/resources/META-INF/services/javax.annotation.processing.Processor	                        (rev 0)
+++ validator/trunk/tck-utils/src/main/resources/META-INF/services/javax.annotation.processing.Processor	2009-02-09 19:27:30 UTC (rev 15918)
@@ -0,0 +1 @@
+org.hibernate.tck.report.CoverageProcessor
\ No newline at end of file

Modified: validator/trunk/validation-api/pom.xml
===================================================================
--- validator/trunk/validation-api/pom.xml	2009-02-09 18:30:53 UTC (rev 15917)
+++ validator/trunk/validation-api/pom.xml	2009-02-09 19:27:30 UTC (rev 15918)
@@ -3,23 +3,99 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.hibernate</groupId>
-        <artifactId>hibernate-validator-parent</artifactId>
-        <version>1.0.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
+    
     <groupId>javax.validation</groupId>
     <artifactId>validation-api</artifactId>
+    <version>1.0.Beta3-SNAPSHOT</version>
     <packaging>jar</packaging>
     <name>Bean Validation API</name>
+    
+    <description>
+        Bean Validation (JSR-303) API.
+    </description>
+    
+    <developers>
+        <developer>
+            <name>Emmanuel Bernard</name>
+            <email>emmanuel at hibernate.org</email>
+            <organization>JBoss, a division of Red Hat</organization>
+            <url>http://in.relation.to/Bloggers/Emmanuel</url>
+        </developer>
+        <developer>
+            <name>Hardy Ferentschik</name>
+            <email>hferents at redhat.com</email>
+            <organization>JBoss, a division of Red Hat</organization>
+            <url>http://in.relation.to/Bloggers/Hardy</url>
+        </developer>
+    </developers>
+    
+    <repositories>
+        <repository>
+            <id>repository.jboss.org</id>
+            <name>JBoss Repository</name>
+            <url>http://repository.jboss.org/maven2</url>
+        </repository>
+    </repositories>
+    
+    <pluginRepositories>
+        <pluginRepository>
+            <id>repository.jboss.org</id>
+            <name>JBoss Repository</name>
+            <url>http://repository.jboss.org/maven2</url>
+        </pluginRepository>
+    </pluginRepositories>   
+      
+    <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-webdav</artifactId>
+                <version>1.0-beta-2</version>
+            </extension>
+        </extensions>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>2.0.2</version>
+                    <configuration>
+                        <source>1.5</source>
+                        <target>1.5</target>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>attach-sources</id>
+                            <goals>
+                                <goal>jar</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+        
+    <issueManagement>
+        <system>JIRA</system>
+        <url>http://opensource.atlassian.com/projects/hibernate/browse/BVAL</url>
+    </issueManagement>
+    
+    <inceptionYear>2007</inceptionYear>
+    
+    <licenses>
+        <license>
+            <name>Apache License, Version 2.0</name>
+            <url>license.txt</url>
+        </license>
+    </licenses>
+    
+    <scm>
+        <connection>scm:https://svn.jboss.org/repos/hibernate/validator/trunk/validation-api</connection>
+        <url>http://fisheye.jboss.org/browse/Hibernate/validator/trunk/validation-api</url>
+    </scm>    
 
-    <distributionManagement>
-        <site>
-            <id>site</id>
-            <url>file:///Users/hardy/Sites/${artifactId}</url>
-        </site>
-    </distributionManagement>
 </project>




More information about the hibernate-commits mailing list