[cai18n-dev] [GIT] Compiler assisted internalization library branch, master, updated. a0ec2890e80cdde734f81be242b5a23ff3cd147c

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Wed Aug 26 23:33:59 CEST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Compiler assisted internalization library".

The branch, master has been updated
       via  a0ec2890e80cdde734f81be242b5a23ff3cd147c (commit)
      from  b522d133160c1fa486bfc3021b856ec088e57a9f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=cai18n.git;a=commit;h=a0ec2890e80cdde734f81be242b5a23ff3cd147c
http://github.com/ceki/cai18n/commit/a0ec2890e80cdde734f81be242b5a23ff3cd147c

commit a0ec2890e80cdde734f81be242b5a23ff3cd147c
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Wed Aug 26 23:31:51 2009 +0200

    annotation extraction does not quite work

diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java b/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
index 73119e0..776bf19 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
+++ b/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
@@ -25,7 +25,7 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-
+ 
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
 public @interface LocaleNames {
diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/ResourceBundleName.java b/cai18n-api/src/main/java/ch/qos/cai18n/ResourceBundleName.java
index 449aebd..e1e8b3c 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/ResourceBundleName.java
+++ b/cai18n-api/src/main/java/ch/qos/cai18n/ResourceBundleName.java
@@ -30,4 +30,4 @@ import java.lang.annotation.Target;
 @Target(ElementType.TYPE)
 public @interface ResourceBundleName {
   String value();
-}
+} 
diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/util/AnnotationExtractor.java b/cai18n-api/src/main/java/ch/qos/cai18n/util/AnnotationExtractor.java
index e8bff49..fc051dd 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/util/AnnotationExtractor.java
+++ b/cai18n-api/src/main/java/ch/qos/cai18n/util/AnnotationExtractor.java
@@ -42,8 +42,10 @@ public class AnnotationExtractor {
   }
 
   static public <E extends Enum<?>> String[] getLocaleNames(Class<E> enumClass) {
+    System.out.println("xx****enumClass="+enumClass.getName());
     LocaleNames localeNamesAnnotation = (LocaleNames) enumClass
         .getAnnotation(LocaleNames.class);
+    System.out.println("localeNamesAnnotation="+localeNamesAnnotation);
     if (localeNamesAnnotation == null) {
       return null;
     }
diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java b/cai18n-api/src/test/java/ch/qos/cai18n/AllCai18nTest.java
similarity index 79%
copy from cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
copy to cai18n-api/src/test/java/ch/qos/cai18n/AllCai18nTest.java
index 73119e0..0047679 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
+++ b/cai18n-api/src/test/java/ch/qos/cai18n/AllCai18nTest.java
@@ -19,15 +19,16 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+
 package ch.qos.cai18n;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+ 
+ at RunWith(Suite.class)
+ at SuiteClasses({ch.qos.cai18n.util.PackageTest.class,
+  ch.qos.cai18n.sample.PackageTest.class})
+public class AllCai18nTest {
 
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.TYPE)
-public @interface LocaleNames {
-  String[] value();
 }
diff --git a/cai18n-api/src/test/java/ch/qos/cai18n/util/AnnatationExtractorTest.java b/cai18n-api/src/test/java/ch/qos/cai18n/util/AnnotationExtractorTest.java
similarity index 95%
rename from cai18n-api/src/test/java/ch/qos/cai18n/util/AnnatationExtractorTest.java
rename to cai18n-api/src/test/java/ch/qos/cai18n/util/AnnotationExtractorTest.java
index 9766236..5d7efb2 100644
--- a/cai18n-api/src/test/java/ch/qos/cai18n/util/AnnatationExtractorTest.java
+++ b/cai18n-api/src/test/java/ch/qos/cai18n/util/AnnotationExtractorTest.java
@@ -29,7 +29,7 @@ import java.util.Arrays;
 import org.junit.Test;
 
 
-public class AnnatationExtractorTest {
+public class AnnotationExtractorTest {
 
   @Test
   public void resourcceBundleName() {
diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java b/cai18n-api/src/test/java/ch/qos/cai18n/util/PackageTest.java
similarity index 77%
copy from cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
copy to cai18n-api/src/test/java/ch/qos/cai18n/util/PackageTest.java
index 73119e0..128dfc0 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/LocaleNames.java
+++ b/cai18n-api/src/test/java/ch/qos/cai18n/util/PackageTest.java
@@ -19,15 +19,14 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-package ch.qos.cai18n;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+package ch.qos.cai18n.util;
 
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.TYPE)
-public @interface LocaleNames {
-  String[] value();
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+ at RunWith(Suite.class)
+ at SuiteClasses( { AnnotationExtractorTest.class })
+public class PackageTest {
 }
diff --git a/maven-cai18n-plugin-smoke/pom.xml b/maven-cai18n-plugin-smoke/pom.xml
index 3c7acf4..45a1215 100644
--- a/maven-cai18n-plugin-smoke/pom.xml
+++ b/maven-cai18n-plugin-smoke/pom.xml
@@ -29,15 +29,15 @@
 				<version>${project.version}</version>
 				<executions>
 					<execution>
-						<id>colors</id>
+						<id>countries</id>
 						<phase>verify</phase>
 						<goals>
-							<goal>verify</goal>
+							<goal>vv</goal>
 						</goals>
-						<configuration>
-							<enumClasses>
-								<enumClass>ch.qos.cai18n.smoke.Countries</enumClass>
-							</enumClasses>
+            <configuration>
+              <enumTypes>
+                <enumType>ch.qos.cai18n.smoke.Countries</enumType>
+              </enumTypes>
 						</configuration>
 					</execution>
 				</executions>
diff --git a/maven-cai18n-plugin-smoke/src/main/java/ch/qos/cai18n/smoke/Countries.java b/maven-cai18n-plugin-smoke/src/main/java/ch/qos/cai18n/smoke/Countries.java
index 01bd269..48f97a1 100644
--- a/maven-cai18n-plugin-smoke/src/main/java/ch/qos/cai18n/smoke/Countries.java
+++ b/maven-cai18n-plugin-smoke/src/main/java/ch/qos/cai18n/smoke/Countries.java
@@ -1,5 +1,10 @@
 package ch.qos.cai18n.smoke;
 
+import ch.qos.cai18n.LocaleNames;
+import ch.qos.cai18n.ResourceBundleName;
+
+ at ResourceBundleName("countries")
+ at LocaleNames({"en", "fr"})
 public enum Countries {
    CH, 
    CN,
diff --git a/maven-cai18n-plugin-smoke/src/main/resources/ch/qos/cai18n/smoke/Countries_en.properties b/maven-cai18n-plugin-smoke/src/main/resources/countries_en.properties
similarity index 100%
rename from maven-cai18n-plugin-smoke/src/main/resources/ch/qos/cai18n/smoke/Countries_en.properties
rename to maven-cai18n-plugin-smoke/src/main/resources/countries_en.properties
diff --git a/maven-cai18n-plugin-smoke/src/main/resources/ch/qos/cai18n/smoke/Countries_fr.properties b/maven-cai18n-plugin-smoke/src/main/resources/countries_fr.properties
similarity index 100%
rename from maven-cai18n-plugin-smoke/src/main/resources/ch/qos/cai18n/smoke/Countries_fr.properties
rename to maven-cai18n-plugin-smoke/src/main/resources/countries_fr.properties
diff --git a/maven-cai18n-plugin/pom.xml b/maven-cai18n-plugin/pom.xml
index 3e937a6..bcafd58 100644
--- a/maven-cai18n-plugin/pom.xml
+++ b/maven-cai18n-plugin/pom.xml
@@ -14,7 +14,7 @@
   <groupId>ch.qos.cai18n.plugins</groupId>
   <artifactId>maven-cai18n-plugin</artifactId>
 
-  <!--<version>0.0-SNAPSHOT</version>-->
+  <version>0.0-SNAPSHOT</version>
 
   <packaging>maven-plugin</packaging>
 
@@ -33,18 +33,6 @@
       <artifactId>cai18n-api</artifactId>      
     </dependency>
 
-    
-    <dependency>
-      <groupId>org.apache.maven.plugins</groupId>
-      <artifactId>maven-compiler-plugin</artifactId>
-      <version>2.0.2</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.mojo</groupId>
-      <artifactId>exec-maven-plugin</artifactId>
-      <version>1.1</version>
-    </dependency>
  
     <dependency>
       <groupId>junit</groupId>
diff --git a/maven-cai18n-plugin/src/main/java/ch/qos/cai18n/VerifyMojo.java b/maven-cai18n-plugin/src/main/java/ch/qos/cai18n/VerifyMojo.java
index a685f6f..5839535 100644
--- a/maven-cai18n-plugin/src/main/java/ch/qos/cai18n/VerifyMojo.java
+++ b/maven-cai18n-plugin/src/main/java/ch/qos/cai18n/VerifyMojo.java
@@ -40,7 +40,7 @@ import ch.qos.cai18n.verifier.MessageCodeVerifier;
 /**
  * Verifies resources bundles
  * 
- * 
+ * @goal vv
  * @phase verify
  * @requiresProject true
  */
@@ -52,11 +52,10 @@ public class VerifyMojo extends AbstractMojo {
       + "#missingEnumClass";
 
   /**
-   * @parameter alias="enumClass"
+   * @parameter
    * @required
    */
-  private String[] enumClassStrArray;
-
+  private String[] enumTypes;
 
   /**
    * The directory for compiled classes.
@@ -70,15 +69,14 @@ public class VerifyMojo extends AbstractMojo {
   ClassLoader classLoader;
 
   public void execute() throws MojoExecutionException, MojoFailureException {
-
-    System.out.println("outputDir=" + outputDirectory);
-    if (enumClassStrArray == null) {
+    if (enumTypes == null) {
       throw new MojoFailureException(
           "<enumClass> must be specified. Please see " + MISSING_ENUM_CLASS);
     }
-    for(String enumClassAsStr: enumClassStrArray) {
-      Class<? extends Enum<?>> enumClass = loadEnumClass(enumClassAsStr);  
-      getLog().info("Checking codes for enum class ["+enumClassAsStr+"]");
+    for (String enumTypeAsStr : enumTypes) {
+      Class<? extends Enum<?>> enumClass = loadEnumClass(enumTypeAsStr);
+      System.out.println("***enumClass=" + enumClass.getName());
+      getLog().info("Checking codes for enum class [" + enumTypeAsStr + "]");
       checkAllLocales(enumClass);
     }
   }
@@ -86,11 +84,11 @@ public class VerifyMojo extends AbstractMojo {
   public void checkAllLocales(Class<? extends Enum<?>> enumClass)
       throws MojoFailureException {
     String enumClassAsStr = enumClass.getName();
-    
+
     String[] localeNameArray = AnnotationExtractor.getLocaleNames(enumClass);
     if (localeNameArray == null || localeNameArray.length == 0) {
       String errMsg = "Missing @LocaleNames annotation in enum ["
-          + enumClass.getClass().getName() + "]";
+          + enumClassAsStr + "]";
       getLog().error(errMsg);
       throw new MojoFailureException(errMsg);
     }
@@ -107,14 +105,17 @@ public class VerifyMojo extends AbstractMojo {
                 + "] for locale [" + locale + "]");
       } else {
         failure = true;
-        getLog().error("FAILURE during verification of resource bundle for locale ["+locale+"] enum class ["+enumClassAsStr+"]");
+        getLog().error(
+            "FAILURE during verification of resource bundle for locale ["
+                + locale + "] enum class [" + enumClassAsStr + "]");
         for (Cai18nError s : errorList) {
           getLog().error(s.toString());
         }
       }
     }
-    if(failure) {
-      throw new MojoFailureException("FAIL Verification of ["+enumClassAsStr+"] codes.");
+    if (failure) {
+      throw new MojoFailureException("FAIL Verification of [" + enumClassAsStr
+          + "] codes.");
     }
   }
 

-----------------------------------------------------------------------

Summary of changes:
 .../src/main/java/ch/qos/cai18n/LocaleNames.java   |    2 +-
 .../java/ch/qos/cai18n/ResourceBundleName.java     |    2 +-
 .../ch/qos/cai18n/util/AnnotationExtractor.java    |    2 +
 .../PackageTest.java => AllCai18nTest.java}        |   10 ++++--
 ...actorTest.java => AnnotationExtractorTest.java} |    2 +-
 .../qos/cai18n/{sample => util}/PackageTest.java   |    4 +-
 maven-cai18n-plugin-smoke/pom.xml                  |   12 ++++----
 .../main/java/ch/qos/cai18n/smoke/Countries.java   |    5 +++
 ...tries_en.properties => countries_en.properties} |    0
 ...tries_fr.properties => countries_fr.properties} |    0
 maven-cai18n-plugin/pom.xml                        |   14 +--------
 .../src/main/java/ch/qos/cai18n/VerifyMojo.java    |   31 ++++++++++---------
 12 files changed, 41 insertions(+), 43 deletions(-)
 copy cai18n-api/src/test/java/ch/qos/cai18n/{sample/PackageTest.java => AllCai18nTest.java} (87%)
 rename cai18n-api/src/test/java/ch/qos/cai18n/util/{AnnatationExtractorTest.java => AnnotationExtractorTest.java} (95%)
 copy cai18n-api/src/test/java/ch/qos/cai18n/{sample => util}/PackageTest.java (90%)
 rename maven-cai18n-plugin-smoke/src/main/resources/{ch/qos/cai18n/smoke/Countries_en.properties => countries_en.properties} (100%)
 rename maven-cai18n-plugin-smoke/src/main/resources/{ch/qos/cai18n/smoke/Countries_fr.properties => countries_fr.properties} (100%)


hooks/post-receive
-- 
Compiler assisted internalization library



More information about the cal10n-dev mailing list