[seam-commits] Seam SVN: r12507 - in modules/international/trunk: impl/src/main/java/org/jboss/seam/international/timezone and 2 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Apr 15 16:59:19 EDT 2010
Author: kenfinni
Date: 2010-04-15 16:59:16 -0400 (Thu, 15 Apr 2010)
New Revision: 12507
Added:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java
Removed:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/TimeZones.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/events/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java
Modified:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java
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/TimeZoneWrapper.java
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
Log:
SEAMINTL-1 - Refactored code based on Pete's suggestions. Added copyright headers
Added: 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 (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -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.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
+{
+
+}
Deleted: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,27 +0,0 @@
-package org.jboss.seam.international.timezone;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Default Application TimeZone
- *
- * @author Ken Finnigan
- */
- at Target( { METHOD, PARAMETER, FIELD })
- at Retention(RUNTIME)
- at Documented
- at Qualifier
- at Inherited
-public @interface DefaultTimeZone
-{
-}
Deleted: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/TimeZones.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/TimeZones.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/TimeZones.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,27 +0,0 @@
-package org.jboss.seam.international.timezone;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Qualifier for Time Zones
- *
- * @author Ken Finnigan
- */
- at Target( { METHOD, PARAMETER, FIELD })
- at Retention(RUNTIME)
- at Documented
- at Qualifier
- at Inherited
-public @interface TimeZones
-{
-}
Modified: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,3 +1,24 @@
+/*
+ * 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;
@@ -14,7 +35,7 @@
/**
* User TimeZone
- *
+ *
* @author Ken Finnigan
*/
@Target( { METHOD, PARAMETER, FIELD })
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-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,3 +1,24 @@
+/*
+ * 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.ArrayList;
@@ -6,60 +27,69 @@
import java.util.List;
import java.util.TimeZone;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
/**
- * <p>Seam component that provides a list of time zones, limited to time zones
- * with IDs in the form Continent/Place, excluding deprecated three-letter time
- * zone IDs. The time zones returned have a fixed offset from UTC, which takes
+ * <p>
+ * Seam component that provides a list of time zones, limited to time zones with
+ * IDs in the form Continent/Place, excluding deprecated three-letter time zone
+ * IDs. The time zones returned have a fixed offset from UTC, which takes
* daylight savings time into account. For example, Europe/Amsterdam is UTC+1;
- * in winter this is GMT+1 and in summer GMT+2.</p>
- *
- * <p>The time zone objects returned are wrapped in an implementation of
- * TimeZone that provides a more friendly interface for accessing the time zone
+ * in winter this is GMT+1 and in summer GMT+2.
+ * </p>
+ *
+ * <p>
+ * The time zone objects returned are wrapped in an implementation of TimeZone
+ * that provides a more friendly interface for accessing the time zone
* information. In particular, this type provides a more bean-friend property
* for the time zone id (id than ID) and provides a convenience property named
* label that formats the time zone for display in the UI. This wrapper can be
- * disabled by setting the component property wrap to false.</p>
- *
+ * disabled by setting the component property wrap to false.
+ * </p>
+ *
* @author Peter Hilton, Lunatech Research
* @author Dan Allen
*/
@ApplicationScoped
public class AvailableTimeZones
{
- private static final String TIMEZONE_ID_PREFIXES =
- "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
+ private static final String TIMEZONE_ID_PREFIXES = "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
private boolean wrap = true;
@Produces
- @TimeZones
private List<TimeZone> timeZones = null;
-
- @Inject
- public void init() {
+
+ @PostConstruct
+ public void init()
+ {
timeZones = new ArrayList<TimeZone>();
final String[] timeZoneIds = TimeZone.getAvailableIDs();
- for (final String id : timeZoneIds) {
- if (id.matches(TIMEZONE_ID_PREFIXES)) {
+ for (final String id : timeZoneIds)
+ {
+ if (id.matches(TIMEZONE_ID_PREFIXES))
+ {
timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
}
}
- Collections.sort(timeZones, new Comparator<TimeZone>() {
- public int compare(final TimeZone a, final TimeZone b) {
+ Collections.sort(timeZones, new Comparator<TimeZone>()
+ {
+ public int compare(final TimeZone a, final TimeZone b)
+ {
return a.getID().compareTo(b.getID());
}
});
}
- public boolean isWrap() {
+ public boolean isWrap()
+ {
return wrap;
}
- public void setWrap(boolean 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-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,3 +1,24 @@
+/*
+ * 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.io.Serializable;
@@ -3,14 +24,13 @@
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;
/**
- * Default TimeZone of the application. If configuration of the default
- * TimeZone is found that will be used, otherwise the JVM default TimeZone
- * otherwise.
- *
+ * Default TimeZone of the application. If configuration of the default TimeZone
+ * is found that will be used, otherwise the JVM default TimeZone otherwise.
+ *
* @author Ken Finnigan
*/
@@ -21,10 +41,11 @@
{
private static final long serialVersionUID = 6181892144731122500L;
- @Produces @DefaultTimeZone @Named
+ @Produces
+ @Named
private TimeZone defaultTimeZone;
- @Inject
+ @PostConstruct
public void init()
{
defaultTimeZone = TimeZone.getDefault();
Modified: 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-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,3 +1,24 @@
+/*
+ * 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;
@@ -5,9 +26,9 @@
/**
* 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.
- *
+ * 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
@@ -18,85 +39,102 @@
private TimeZone timeZone;
- public TimeZoneWrapper(TimeZone tz) {
+ public TimeZoneWrapper(TimeZone tz)
+ {
timeZone = tz;
setID(tz.getID());
}
@Override
- public void setID(String id) {
+ public void setID(String id)
+ {
super.setID(id);
timeZone = TimeZone.getTimeZone(id);
}
- public String getId() {
+ public String getId()
+ {
return timeZone.getID();
}
- public String getLabel() {
+ 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) {
+ if (Math.abs(timeZone.getRawOffset()) < MILLISECONDS_PER_HOUR * 10)
+ {
label.append("0");
}
- label.append(Math.abs(timeZone.getRawOffset())/MILLISECONDS_PER_HOUR);
+ label.append(Math.abs(timeZone.getRawOffset()) / MILLISECONDS_PER_HOUR);
label.append(":00)");
return label.toString();
}
- public TimeZone getTimeZone() {
+ public TimeZone getTimeZone()
+ {
return timeZone;
}
@Override
- public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
+ 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) {
+ public void setRawOffset(int offset)
+ {
timeZone.setRawOffset(offset);
}
@Override
- public int getRawOffset() {
+ public int getRawOffset()
+ {
return timeZone.getRawOffset();
}
@Override
- public boolean useDaylightTime() {
+ public boolean useDaylightTime()
+ {
return timeZone.useDaylightTime();
}
@Override
- public boolean inDaylightTime(Date date) {
+ public boolean inDaylightTime(Date date)
+ {
return timeZone.inDaylightTime(date);
}
@Override
- public Object clone() {
+ public Object clone()
+ {
return timeZone.clone();
}
@Override
- public boolean equals(Object obj) {
- if (obj == null) {
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
return false;
}
- if (getClass() != obj.getClass()) {
+ if (getClass() != obj.getClass())
+ {
return false;
}
final TimeZoneWrapper other = (TimeZoneWrapper) obj;
- if (timeZone != other.timeZone && (timeZone == null || !timeZone.equals(other.timeZone))) {
+ if (timeZone != other.timeZone && (timeZone == null || !timeZone.equals(other.timeZone)))
+ {
return false;
}
return true;
}
@Override
- public int hashCode() {
+ 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-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,3 +1,24 @@
+/*
+ * 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.io.Serializable;
@@ -9,13 +30,10 @@
import javax.inject.Inject;
import javax.inject.Named;
-import org.jboss.seam.international.timezone.events.TimeZoneSelectedEvent;
-
/**
- * TimeZone for a User Session. Defaults to the TimeZone within
- * DefaultTimeZone and is altered when it receives the
- * TimeZoneSelectedEvent.
- *
+ * TimeZone for a User Session. Defaults to the TimeZone within DefaultTimeZone
+ * and is altered when it receives the TimeZoneSelectedEvent.
+ *
* @author Ken Finnigan
*/
@@ -24,17 +42,19 @@
{
private static final long serialVersionUID = -9008203923830420841L;
- @Produces @UserTimeZone @Named
+ @Produces
+ @UserTimeZone
+ @Named
private TimeZone userTimeZone;
@Inject
- public void init(@DefaultTimeZone TimeZone defaultTimeZone)
+ public void init(TimeZone defaultTimeZone)
{
this.userTimeZone = defaultTimeZone;
}
- public void afterTimeZoneUpdate(@Observes TimeZoneSelectedEvent event)
+ public void changeTimeZone(@Observes @Changed TimeZone tz)
{
- this.userTimeZone = TimeZone.getTimeZone(event.getTimeZoneId());
+ this.userTimeZone = tz;
}
}
Deleted: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,24 +0,0 @@
-package org.jboss.seam.international.timezone;
-
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
- at ApplicationScoped
-public class AvailableTimeZoneBean
-{
- @Inject
- @TimeZones
- private List<TimeZone> timeZones;
-
- public AvailableTimeZoneBean()
- {
- }
-
- public List<TimeZone> getAvailTimeZones()
- {
- return timeZones;
- }
-}
Deleted: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,52 +0,0 @@
-package org.jboss.seam.international.timezone;
-
-import java.util.List;
-import java.util.TimeZone;
-
-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.events.TimeZoneSelectedEvent;
-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.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class AvailableTimeZonesTest
-{
- @Deployment
- public static JavaArchive createTestArchive()
- {
- return Archives.create("availabletimezonetest.jar", JavaArchive.class).addClasses(AvailableTimeZones.class, AvailableTimeZoneBean.class, TimeZoneWrapper.class, TimeZoneSelectedEvent.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
- }
-
- @Inject
- Instance<AvailableTimeZoneBean> availBean;
- @Inject
- @TimeZones
- List<TimeZone> timeZones;
-
- @Test
- public void testAvailableTimeZonesProducerViaBean()
- {
- Assert.assertNotNull(availBean);
- List<TimeZone> list = availBean.get().getAvailTimeZones();
- Assert.assertNotNull(list);
- Assert.assertTrue(!list.isEmpty());
- Assert.assertTrue(list.size() > 0);
- }
-
- @Test
- public void testAvailableTimeZonesProducerDirect()
- {
- Assert.assertNotNull(timeZones);
- Assert.assertTrue(!timeZones.isEmpty());
- Assert.assertTrue(timeZones.size() > 0);
- }
-}
Deleted: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,35 +0,0 @@
-package org.jboss.seam.international.timezone;
-
-import java.util.TimeZone;
-
-import javax.inject.Inject;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-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.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class DefaultTimeZoneTest
-{
- @Deployment
- public static JavaArchive createTestArchive()
- {
- return Archives.create("defaulttimezonetest.jar", JavaArchive.class).addClasses(DefaultTimeZoneProducer.class, DefaultTimeZone.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
- }
-
- @Inject
- @DefaultTimeZone
- TimeZone timeZone;
-
- @Test
- public void testDefaultTimeZoneProducerDirect()
- {
- Assert.assertNotNull(timeZone);
- }
-}
Deleted: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java 2010-04-15 20:12:47 UTC (rev 12506)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -1,55 +0,0 @@
-package org.jboss.seam.international.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.events.TimeZoneSelectedEvent;
-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.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class UserTimeZoneTest
-{
- @Deployment
- public static JavaArchive createTestArchive()
- {
- return Archives.create("usertimezonetest.jar", JavaArchive.class).addClasses(UserTimeZoneProducer.class, UserTimeZone.class, TimeZoneSelectedEvent.class, DefaultTimeZone.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
- }
-
- @Inject
- @UserTimeZone
- TimeZone timeZone;
- @Inject
- Event<TimeZoneSelectedEvent> timeZoneEvent;
- @Inject
- @UserTimeZone
- Instance<TimeZone> timeZoneSource;
-
- @Test
- public void testUserTimeZoneProducerDirect()
- {
- Assert.assertNotNull(timeZone);
- }
-
- @Test
- public void testUserTimeZoneEvent()
- {
- TimeZone tijuana = TimeZone.getTimeZone("America/Tijuana");
- Assert.assertNotNull(timeZone);
- Assert.assertFalse(timeZone.equals(tijuana));
- timeZoneEvent.fire(new TimeZoneSelectedEvent("America/Tijuana"));
- TimeZone tz = timeZoneSource.get();
- Assert.assertNotNull(tz);
- Assert.assertTrue(tz.equals(tijuana));
- }
-}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java (from rev 12505, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java)
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -0,0 +1,44 @@
+/*
+ * 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.test;
+
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class AvailableTimeZoneBean
+{
+ @Inject
+ private List<TimeZone> timeZones;
+
+ public AvailableTimeZoneBean()
+ {
+ }
+
+ public List<TimeZone> getAvailTimeZones()
+ {
+ return timeZones;
+ }
+}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java (from rev 12505, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java)
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -0,0 +1,73 @@
+/*
+ * 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.test;
+
+import java.util.List;
+import java.util.TimeZone;
+
+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.AvailableTimeZones;
+import org.jboss.seam.international.timezone.TimeZoneWrapper;
+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.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class AvailableTimeZonesTest
+{
+ @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"));
+ }
+
+ @Inject
+ Instance<AvailableTimeZoneBean> availBean;
+ @Inject
+ List<TimeZone> timeZones;
+
+ @Test
+ public void testAvailableTimeZonesProducerViaBean()
+ {
+ Assert.assertNotNull(availBean);
+ List<TimeZone> list = availBean.get().getAvailTimeZones();
+ Assert.assertNotNull(list);
+ Assert.assertTrue(!list.isEmpty());
+ Assert.assertTrue(list.size() > 0);
+ }
+
+ @Test
+ public void testAvailableTimeZonesProducerDirect()
+ {
+ Assert.assertNotNull(timeZones);
+ Assert.assertTrue(!timeZones.isEmpty());
+ Assert.assertTrue(timeZones.size() > 0);
+ }
+}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java (from rev 12505, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java)
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -0,0 +1,56 @@
+/*
+ * 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.test;
+
+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.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.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class DefaultTimeZoneTest
+{
+ @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"));
+ }
+
+ @Inject
+ TimeZone timeZone;
+
+ @Test
+ public void testDefaultTimeZoneProducerDirect()
+ {
+ Assert.assertNotNull(timeZone);
+ }
+}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java (from rev 12505, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java)
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java 2010-04-15 20:59:16 UTC (rev 12507)
@@ -0,0 +1,82 @@
+/*
+ * 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.test;
+
+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.timezone.DefaultTimeZoneProducer;
+import org.jboss.seam.international.timezone.UserTimeZone;
+import org.jboss.seam.international.timezone.UserTimeZoneProducer;
+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.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class UserTimeZoneTest
+{
+ @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"));
+ }
+
+ @Inject
+ @UserTimeZone
+ TimeZone timeZone;
+
+ @Inject
+ @Changed
+ Event<TimeZone> timeZoneEvent;
+
+ @Inject
+ @UserTimeZone
+ Instance<TimeZone> timeZoneSource;
+
+ @Test
+ public void testUserTimeZoneProducerDirect()
+ {
+ Assert.assertNotNull(timeZone);
+ }
+
+ @Test
+ public void testUserTimeZoneEvent()
+ {
+ TimeZone tijuana = TimeZone.getTimeZone("America/Tijuana");
+ Assert.assertNotNull(timeZone);
+ Assert.assertFalse(timeZone.equals(tijuana));
+ timeZoneEvent.fire(tijuana);
+ TimeZone tz = timeZoneSource.get();
+ Assert.assertNotNull(tz);
+ Assert.assertTrue(tz.equals(tijuana));
+ }
+}
More information about the seam-commits
mailing list