[seam-commits] Seam SVN: r12670 - in modules/international/trunk: api/src/main/java/org/jboss/seam/international/timezone and 5 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Apr 30 16:47:59 EDT 2010


Author: kenfinni
Date: 2010-04-30 16:47:56 -0400 (Fri, 30 Apr 2010)
New Revision: 12670

Added:
   modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java
   modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/
Removed:
   modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java
   modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/
Modified:
   modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
   modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
   modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java
   modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java
Log:
SEAMINTL-1 - Updates to TimeZone handling to use joda-time, forwarding class, resolved available timezone list being modifiable

Copied: modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java (from rev 12663, modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java)
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java	                        (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifier used with Events to signify either a TimeZone or Locale has changed.
+ * 
+ * @author Ken Finnigan
+ */
+ at Target( { PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Changed
+{
+
+}

Deleted: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java	2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.international.timezone;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Change TimeZone of the User.
- * 
- * @author Ken Finnigan
- */
- at Target( { PARAMETER, FIELD })
- at Retention(RUNTIME)
- at Documented
- at Qualifier
-public @interface Changed
-{
-
-}

Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java	                        (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.timezone;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.joda.time.DateTimeZone;
+
+/**
+ * Delegating TimeZone.
+ * 
+ * @author Ken Finnigan
+ */
+public abstract class ForwardingTimeZone extends DateTimeZone
+{
+   /**
+    * Abstract getter for the delegate
+    * 
+    * @return The delegate
+    */
+   protected abstract DateTimeZone delegate();
+
+   protected ForwardingTimeZone(String id)
+   {
+      super(id);
+   }
+
+   @Override
+   public long convertLocalToUTC(long instantLocal, boolean strict)
+   {
+      return delegate().convertLocalToUTC(instantLocal, strict);
+   }
+
+   @Override
+   public long convertUTCToLocal(long instantUTC)
+   {
+      return delegate().convertUTCToLocal(instantUTC);
+   }
+
+   @Override
+   public String getName(long instant, Locale locale)
+   {
+      return delegate().getName(instant, locale);
+   }
+
+   @Override
+   public String getNameKey(long instant)
+   {
+      return delegate().getNameKey(instant);
+   }
+
+   @Override
+   public int getOffset(long instant)
+   {
+      return delegate().getOffset(instant);
+   }
+
+   @Override
+   public int getOffsetFromLocal(long instantLocal)
+   {
+      return delegate().getOffsetFromLocal(instantLocal);
+   }
+
+   @Override
+   public String getShortName(long instant, Locale locale)
+   {
+      return delegate().getShortName(instant, locale);
+   }
+
+   @Override
+   public int getStandardOffset(long instant)
+   {
+      return delegate().getStandardOffset(instant);
+   }
+
+   @Override
+   public boolean isFixed()
+   {
+      return delegate().isFixed();
+   }
+
+   @Override
+   public boolean isStandardOffset(long instant)
+   {
+      return delegate().isStandardOffset(instant);
+   }
+
+   @Override
+   public long nextTransition(long instant)
+   {
+      return delegate().nextTransition(instant);
+   }
+
+   @Override
+   public long previousTransition(long instant)
+   {
+      return delegate().previousTransition(instant);
+   }
+
+   @Override
+   public TimeZone toTimeZone()
+   {
+      return delegate().toTimeZone();
+   }
+
+   /**
+    * Compares an object with the delegate
+    * 
+    * @return True if equals, false otherwise
+    */
+   @Override
+   public boolean equals(Object obj)
+   {
+      return delegate().equals(obj);
+   }
+
+   /**
+    * Gets the hash code of the delegate
+    * 
+    * @return The hash code
+    */
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+
+   /**
+    * Returns a string representation
+    * 
+    * @return The string representation
+    */
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+}

Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java	2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -25,12 +25,14 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
-import java.util.TimeZone;
+import java.util.Set;
 
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Produces;
 
+import org.joda.time.DateTimeZone;
+
 /**
  * <p>
  * Seam component that provides a list of time zones, limited to time zones with
@@ -57,39 +59,38 @@
 {
    private static final String TIMEZONE_ID_PREFIXES = "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
 
-   private boolean wrap = true;
-
    @Produces
-   private List<TimeZone> timeZones = null;
+   private List<ForwardingTimeZone> timeZones = null;
 
+   @SuppressWarnings("unchecked")
    @PostConstruct
    public void init()
    {
-      timeZones = new ArrayList<TimeZone>();
-      final String[] timeZoneIds = TimeZone.getAvailableIDs();
-      for (final String id : timeZoneIds)
+      timeZones = new ArrayList<ForwardingTimeZone>();
+      final Set timeZoneIds = DateTimeZone.getAvailableIDs();
+      for (Object object : timeZoneIds)
       {
+         String id = (String) object;
          if (id.matches(TIMEZONE_ID_PREFIXES))
          {
-            timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
+            final DateTimeZone dtz = DateTimeZone.forID(id);
+            timeZones.add(new ForwardingTimeZone(id)
+            {
+               @Override
+               protected DateTimeZone delegate()
+               {
+                  return dtz;
+               }
+            });
          }
       }
-      Collections.sort(timeZones, new Comparator<TimeZone>()
+      Collections.sort(timeZones, new Comparator<ForwardingTimeZone>()
       {
-         public int compare(final TimeZone a, final TimeZone b)
+         public int compare(final ForwardingTimeZone a, final ForwardingTimeZone b)
          {
             return a.getID().compareTo(b.getID());
          }
       });
+      timeZones = Collections.unmodifiableList(timeZones);
    }
-
-   public boolean isWrap()
-   {
-      return wrap;
-   }
-
-   public void setWrap(boolean wrap)
-   {
-      this.wrap = wrap;
-   }
 }

Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java	2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -22,13 +22,16 @@
 package org.jboss.seam.international.timezone;
 
 import java.io.Serializable;
-import java.util.TimeZone;
 
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
 import javax.inject.Named;
 
+import org.joda.time.DateTimeZone;
+import org.slf4j.Logger;
+
 /**
  * Default TimeZone of the application. If configuration of the default TimeZone
  * is found that will be used, otherwise the JVM default TimeZone otherwise.
@@ -41,13 +44,46 @@
 {
    private static final long serialVersionUID = 6181892144731122500L;
 
+   String defaultTimeZoneId;
+
+   @Inject
+   Logger log;
+
    @Produces
    @Named
-   private TimeZone defaultTimeZone;
+   private DateTimeZone defaultTimeZone = null;
 
    @PostConstruct
    public void init()
    {
-      defaultTimeZone = TimeZone.getDefault();
+      if (null != defaultTimeZoneId)
+      {
+         try
+         {
+            DateTimeZone dtz = DateTimeZone.forID(defaultTimeZoneId);
+            defaultTimeZone = constructTimeZone(dtz);
+         }
+         catch (IllegalArgumentException e)
+         {
+            log.warn("Default TimeZone Id of " + defaultTimeZoneId + " was not found");
+         }
+      }
+      if (null == defaultTimeZone)
+      {
+         DateTimeZone dtz = DateTimeZone.getDefault();
+         defaultTimeZone = constructTimeZone(dtz);
+      }
    }
+
+   private ForwardingTimeZone constructTimeZone(final DateTimeZone dtz)
+   {
+      return new ForwardingTimeZone(dtz.getID())
+      {
+         @Override
+         protected DateTimeZone delegate()
+         {
+            return dtz;
+         }
+      };
+   }
 }

Deleted: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java	2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.international.timezone;
-
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * A wrapper around a TimeZone that provides a more convenience interface to
- * access the time zone information in the UI, in particular in the options of a
- * select menu.
- * 
- * @author Dan Allen
- */
-public class TimeZoneWrapper extends TimeZone
-{
-   private static final long serialVersionUID = 8504687846433050650L;
-
-   private static final int MILLISECONDS_PER_HOUR = 1000 * 60 * 60;
-
-   private TimeZone timeZone;
-
-   public TimeZoneWrapper(TimeZone tz)
-   {
-      timeZone = tz;
-      setID(tz.getID());
-   }
-
-   @Override
-   public void setID(String id)
-   {
-      super.setID(id);
-      timeZone = TimeZone.getTimeZone(id);
-   }
-
-   public String getId()
-   {
-      return timeZone.getID();
-   }
-
-   public String getLabel()
-   {
-      StringBuilder label = new StringBuilder(50);
-      label.append(getId().replace("_", " "));
-      label.append(" (UTC");
-      label.append(timeZone.getRawOffset() > 0 ? "+" : "-");
-      if (Math.abs(timeZone.getRawOffset()) < MILLISECONDS_PER_HOUR * 10)
-      {
-         label.append("0");
-      }
-      label.append(Math.abs(timeZone.getRawOffset()) / MILLISECONDS_PER_HOUR);
-      label.append(":00)");
-      return label.toString();
-   }
-
-   public TimeZone getTimeZone()
-   {
-      return timeZone;
-   }
-
-   @Override
-   public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis)
-   {
-      return timeZone.getOffset(era, year, month, day, dayOfWeek, millis);
-   }
-
-   @Override
-   public void setRawOffset(int offset)
-   {
-      timeZone.setRawOffset(offset);
-   }
-
-   @Override
-   public int getRawOffset()
-   {
-      return timeZone.getRawOffset();
-   }
-
-   @Override
-   public boolean useDaylightTime()
-   {
-      return timeZone.useDaylightTime();
-   }
-
-   @Override
-   public boolean inDaylightTime(Date date)
-   {
-      return timeZone.inDaylightTime(date);
-   }
-
-   @Override
-   public Object clone()
-   {
-      return timeZone.clone();
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj == null)
-      {
-         return false;
-      }
-      if (getClass() != obj.getClass())
-      {
-         return false;
-      }
-      final TimeZoneWrapper other = (TimeZoneWrapper) obj;
-      if (timeZone != other.timeZone && (timeZone == null || !timeZone.equals(other.timeZone)))
-      {
-         return false;
-      }
-      return true;
-   }
-
-   @Override
-   public int hashCode()
-   {
-      int hash = 7;
-      hash = 79 * hash + (timeZone != null ? timeZone.hashCode() : 0);
-      return hash;
-   }
-}

Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java	2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -22,7 +22,6 @@
 package org.jboss.seam.international.timezone;
 
 import java.io.Serializable;
-import java.util.TimeZone;
 
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
@@ -30,6 +29,9 @@
 import javax.inject.Inject;
 import javax.inject.Named;
 
+import org.jboss.seam.international.Changed;
+import org.joda.time.DateTimeZone;
+
 /**
  * TimeZone for a User Session. Defaults to the TimeZone within DefaultTimeZone
  * and is altered when it receives the TimeZoneSelectedEvent.
@@ -45,15 +47,15 @@
    @Produces
    @UserTimeZone
    @Named
-   private TimeZone userTimeZone;
+   private DateTimeZone userTimeZone;
 
    @Inject
-   public void init(TimeZone defaultTimeZone)
+   public void init(DateTimeZone defaultTimeZone)
    {
       this.userTimeZone = defaultTimeZone;
    }
 
-   public void changeTimeZone(@Observes @Changed TimeZone tz)
+   public void changeTimeZone(@Observes @Changed DateTimeZone tz)
    {
       this.userTimeZone = tz;
    }

Added: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java	                        (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,292 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.seam.international.test;
+
+import org.slf4j.Logger;
+import org.slf4j.Marker;
+
+/**
+ * Provide a completely empty logger implementation for Unit Tests. This entire
+ * class is a no-op; it does <i>nothing</i>.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class MockLogger implements Logger
+{
+
+   public void debug(final String arg0)
+   {
+   }
+
+   public void debug(final String arg0, final Object arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public void error(final String arg0)
+   {
+   }
+
+   public void error(final String arg0, final Object arg1)
+   {
+   }
+
+   public void error(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void error(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void error(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public String getName()
+   {
+      return null;
+   }
+
+   public void info(final String arg0)
+   {
+   }
+
+   public void info(final String arg0, final Object arg1)
+   {
+   }
+
+   public void info(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void info(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void info(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public boolean isDebugEnabled()
+   {
+      return false;
+   }
+
+   public boolean isDebugEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isErrorEnabled()
+   {
+      return false;
+   }
+
+   public boolean isErrorEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isInfoEnabled()
+   {
+      return false;
+   }
+
+   public boolean isInfoEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isTraceEnabled()
+   {
+      return false;
+   }
+
+   public boolean isTraceEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isWarnEnabled()
+   {
+      return false;
+   }
+
+   public boolean isWarnEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public void trace(final String arg0)
+   {
+   }
+
+   public void trace(final String arg0, final Object arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public void warn(final String arg0)
+   {
+   }
+
+   public void warn(final String arg0, final Object arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+}

Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone (from rev 12663, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test)

Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java	2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,25 +19,26 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
 
 import java.util.List;
-import java.util.TimeZone;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 
+import org.joda.time.DateTimeZone;
+
 @ApplicationScoped
 public class AvailableTimeZoneBean
 {
    @Inject
-   private List<TimeZone> timeZones;
+   private List<DateTimeZone> timeZones;
 
    public AvailableTimeZoneBean()
    {
    }
 
-   public List<TimeZone> getAvailTimeZones()
+   public List<DateTimeZone> getAvailTimeZones()
    {
       return timeZones;
    }

Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java	2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,10 +19,9 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
 
 import java.util.List;
-import java.util.TimeZone;
 
 import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
@@ -30,11 +29,12 @@
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.international.timezone.AvailableTimeZones;
-import org.jboss.seam.international.timezone.TimeZoneWrapper;
+import org.jboss.seam.international.timezone.ForwardingTimeZone;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,19 +45,19 @@
    @Deployment
    public static JavaArchive createTestArchive()
    {
-      return Archives.create("availabletimezonetest.jar", JavaArchive.class).addClasses(AvailableTimeZones.class, AvailableTimeZoneBean.class, TimeZoneWrapper.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+      return Archives.create("availabletimezonetest.jar", JavaArchive.class).addClasses(AvailableTimeZones.class, AvailableTimeZoneBean.class, ForwardingTimeZone.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
    }
 
    @Inject
    Instance<AvailableTimeZoneBean> availBean;
    @Inject
-   List<TimeZone> timeZones;
+   List<DateTimeZone> timeZones;
 
    @Test
    public void testAvailableTimeZonesProducerViaBean()
    {
       Assert.assertNotNull(availBean);
-      List<TimeZone> list = availBean.get().getAvailTimeZones();
+      List<DateTimeZone> list = availBean.get().getAvailTimeZones();
       Assert.assertNotNull(list);
       Assert.assertTrue(!list.isEmpty());
       Assert.assertTrue(list.size() > 0);

Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java	2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,19 +19,19 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
 
-import java.util.TimeZone;
-
 import javax.inject.Inject;
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.test.MockLogger;
 import org.jboss.seam.international.timezone.DefaultTimeZoneProducer;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -42,11 +42,11 @@
    @Deployment
    public static JavaArchive createTestArchive()
    {
-      return Archives.create("defaulttimezonetest.jar", JavaArchive.class).addClasses(DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+      return Archives.create("defaulttimezonetest.jar", JavaArchive.class).addClasses(MockLogger.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
    }
 
    @Inject
-   TimeZone timeZone;
+   DateTimeZone timeZone;
 
    @Test
    public void testDefaultTimeZoneProducerDirect()

Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java	2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java	2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,17 +19,16 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
 
-import java.util.TimeZone;
-
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.international.timezone.Changed;
+import org.jboss.seam.international.Changed;
+import org.jboss.seam.international.test.MockLogger;
 import org.jboss.seam.international.timezone.DefaultTimeZoneProducer;
 import org.jboss.seam.international.timezone.UserTimeZone;
 import org.jboss.seam.international.timezone.UserTimeZoneProducer;
@@ -37,6 +36,7 @@
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,20 +47,20 @@
    @Deployment
    public static JavaArchive createTestArchive()
    {
-      return Archives.create("usertimezonetest.jar", JavaArchive.class).addClasses(UserTimeZoneProducer.class, UserTimeZone.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+      return Archives.create("usertimezonetest.jar", JavaArchive.class).addClasses(MockLogger.class, UserTimeZoneProducer.class, UserTimeZone.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
    }
 
    @Inject
    @UserTimeZone
-   TimeZone timeZone;
+   DateTimeZone timeZone;
 
    @Inject
    @Changed
-   Event<TimeZone> timeZoneEvent;
+   Event<DateTimeZone> timeZoneEvent;
 
    @Inject
    @UserTimeZone
-   Instance<TimeZone> timeZoneSource;
+   Instance<DateTimeZone> timeZoneSource;
 
    @Test
    public void testUserTimeZoneProducerDirect()
@@ -71,11 +71,11 @@
    @Test
    public void testUserTimeZoneEvent()
    {
-      TimeZone tijuana = TimeZone.getTimeZone("America/Tijuana");
+      DateTimeZone tijuana = DateTimeZone.forID("America/Tijuana");
       Assert.assertNotNull(timeZone);
       Assert.assertFalse(timeZone.equals(tijuana));
       timeZoneEvent.fire(tijuana);
-      TimeZone tz = timeZoneSource.get();
+      DateTimeZone tz = timeZoneSource.get();
       Assert.assertNotNull(tz);
       Assert.assertTrue(tz.equals(tijuana));
    }



More information about the seam-commits mailing list