[seam-commits] Seam SVN: r12276 - in modules/international/trunk: src/main/java and 11 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Mar 25 23:39:36 EDT 2010
Author: lincolnthree
Date: 2010-03-25 23:39:35 -0400 (Thu, 25 Mar 2010)
New Revision: 12276
Added:
modules/international/trunk/src/main/java/org/
modules/international/trunk/src/main/java/org/jboss/
modules/international/trunk/src/main/java/org/jboss/seam/
modules/international/trunk/src/main/java/org/jboss/seam/international/
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZones.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/events/
modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/events/TimeZoneSelectedEvent.java
modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/
modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java
modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java
modules/international/trunk/src/test/jboss-resources/
modules/international/trunk/src/test/jboss-resources/jndi.properties
Removed:
modules/international/trunk/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/InterpolatorTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/LocaleProducerTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/SampleBean.java
modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java
modules/international/trunk/src/test/resources/messages.properties
modules/international/trunk/src/test/resources/org/
modules/international/trunk/src/test/resources/test-suite.xml
Modified:
modules/international/trunk/pom.xml
Log:
This module now builds. Applied Ken's patch.
Modified: modules/international/trunk/pom.xml
===================================================================
--- modules/international/trunk/pom.xml 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/pom.xml 2010-03-26 03:39:35 UTC (rev 12276)
@@ -8,50 +8,46 @@
<version>3.0.0-SNAPSHOT</version>
</parent>
+ <properties>
+ <arquillian.version>1.0.0.Alpha1</arquillian.version>
+ </properties>
+
<artifactId>seam-international</artifactId>
<packaging>jar</packaging>
<version>3.0.0-SNAPSHOT</version>
<name>Seam Internationalization Module</name>
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <suiteXmlFiles>
- <suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
- </suiteXmlFiles>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
<dependencies>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SP1</version>
</dependency>
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <scope>provided</scope>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <scope>provided</scope>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/international/trunk</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/international/trunk</developerConnection>
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,65 @@
+package org.jboss.seam.international.timezone;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.TimeZone;
+
+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
+ * 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
+ * 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>
+ *
+ * @author Peter Hilton, Lunatech Research
+ * @author Dan Allen
+ */
+ at ApplicationScoped
+public class AvailableTimeZones
+{
+ 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() {
+ timeZones = new ArrayList<TimeZone>();
+ final String[] timeZoneIds = TimeZone.getAvailableIDs();
+ 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) {
+ return a.getID().compareTo(b.getID());
+ }
+ });
+ }
+
+ public boolean isWrap() {
+ return wrap;
+ }
+
+ public void setWrap(boolean wrap) {
+ this.wrap = wrap;
+ }
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZone.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,27 @@
+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
+{
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,32 @@
+package org.jboss.seam.international.timezone;
+
+import java.io.Serializable;
+import java.util.TimeZone;
+
+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.
+ *
+ * @author Ken Finnigan
+ */
+
+ at ApplicationScoped
+public class DefaultTimeZoneProducer implements Serializable
+{
+ private static final long serialVersionUID = 6181892144731122500L;
+
+ @Produces @DefaultTimeZone @Named
+ private TimeZone defaultTimeZone;
+
+ @Inject
+ public void init()
+ {
+ defaultTimeZone = TimeZone.getDefault();
+ }
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,104 @@
+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;
+ }
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZones.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZones.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/TimeZones.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,27 @@
+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
+{
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZone.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,27 @@
+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;
+
+/**
+ * User TimeZone
+ *
+ * @author Ken Finnigan
+ */
+ at Target( { METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface UserTimeZone
+{
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,40 @@
+package org.jboss.seam.international.timezone;
+
+import java.io.Serializable;
+import java.util.TimeZone;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+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.
+ *
+ * @author Ken Finnigan
+ */
+
+ at SessionScoped
+public class UserTimeZoneProducer implements Serializable
+{
+ private static final long serialVersionUID = -9008203923830420841L;
+
+ @Produces @UserTimeZone @Named
+ private TimeZone userTimeZone;
+
+ @Inject
+ public void init(@DefaultTimeZone TimeZone defaultTimeZone)
+ {
+ this.userTimeZone = defaultTimeZone;
+ }
+
+ public void afterTimeZoneUpdate(@Observes TimeZoneSelectedEvent event)
+ {
+ this.userTimeZone = TimeZone.getTimeZone(event.getTimeZoneId());
+ }
+}
Added: modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/events/TimeZoneSelectedEvent.java
===================================================================
--- modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/events/TimeZoneSelectedEvent.java (rev 0)
+++ modules/international/trunk/src/main/java/org/jboss/seam/international/timezone/events/TimeZoneSelectedEvent.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,21 @@
+package org.jboss.seam.international.timezone.events;
+
+/**
+ * Event raised when TimeZone selected.
+ *
+ * @author Ken Finnigan
+ */
+public class TimeZoneSelectedEvent
+{
+ private String timeZoneId;
+
+ public TimeZoneSelectedEvent(String timeZoneId)
+ {
+ this.timeZoneId = timeZoneId;
+ }
+
+ public String getTimeZoneId()
+ {
+ return timeZoneId;
+ }
+}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,58 +0,0 @@
-package org.jboss.seam.international;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.ResourceBundle;
-
-import javax.el.CompositeELResolver;
-import javax.enterprise.inject.AnnotationLiteral;
-
-import org.jboss.seam.el.Expressions;
-import org.jboss.seam.el.ExpressionsProducer;
-import org.jboss.seam.resources.DefaultResourceLoader;
-import org.jboss.seam.resources.ResourceLoaderProducer;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.el.WebBeansELResolver;
-import org.jboss.webbeans.log.LoggerProducer;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
- at Artifact
- at Classes({LoggerProducer.class, DefaultResourceLoader.class, ResourceLoaderProducer.class, Expressions.class, ExpressionsProducer.class})
-public class AutoInterpolatedMessagesTest extends AbstractWebBeansTest
-{
- private boolean elResolverInitialized = false;
-
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- if (!elResolverInitialized)
- {
- installWebBeansELResolver();
- }
- }
-
- // FIXME broken
- //@Test
- public void testLoadMessages()
- {
- ResourceBundle messages = getMessages();
- assertEquals(messages.getString("title"), "Hello Seam!");
- assertEquals(messages.getString("tagline"), "We put the rich in Java EE");
- }
-
- private void installWebBeansELResolver()
- {
- Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
- // FIXME wow this is a hack to add a new ELResolver
- //((CompositeELResolver) expressions.getELContext().getELResolver()).add(new WebBeansELResolver());
- elResolverInitialized = true;
- }
-
- private ResourceBundle getMessages()
- {
- return getCurrentManager().getInstanceByType(ResourceBundle.class, new AnnotationLiteral<AutoInterpolatedMessages>() {});
- }
-}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/InterpolatorTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,138 +0,0 @@
-package org.jboss.seam.international;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.el.CompositeELResolver;
-import javax.el.ELContext;
-
-import org.jboss.seam.el.AbstractELResolver;
-import org.jboss.seam.el.Expressions;
-import org.jboss.seam.el.ExpressionsProducer;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.log.LoggerProducer;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * Verify that the {@link Interpolator} properly resolves both EL value
- * expressions and positional substitutions, while also honoring the
- * {@link Locale} returns by the {@link LocalProducer}.
- *
- * @author Dan Allen
- * @see Interpolator
- * @see Expressions
- * @see LocaleProducer
- */
- at Artifact(addCurrentPackage = false)
- at Classes({
- LoggerProducer.class, Interpolator.class, Expressions.class, ExpressionsProducer.class,
- LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class
-})
-public class InterpolatorTest extends AbstractWebBeansTest
-{
- private boolean elResolverInitialized = false;
-
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- if (!elResolverInitialized)
- {
- installTestFixtureELResolver();
- }
- }
-
- // FIXME broken
- // @Test
- public void testValueExpressionInterpolation()
- {
- String result = getInterpolatorInstance().interpolate("Hey #{name}!");
- assertEquals(result, "Hey Dan!");
- }
-
- // FIXME broken
- //@Test
- public void testParameterSubstitution()
- {
- String result = getInterpolatorInstance().interpolate("The two planets between the Earth and the Sun are {0} and {1}.", "Mercury", "Venus");
- assertEquals(result, "The two planets between the Earth and the Sun are Mercury and Venus.");
- }
-
- // FIXME broken
- //@Test(expectedExceptions = IllegalArgumentException.class)
- public void testInterpolateExceedsMaxParameters()
- {
- getInterpolatorInstance().interpolate("doesn't matter", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
- }
-
- // FIXME broken
- //@Test
- public void testMultipleValueExpressionsAndParameters()
- {
- String result = getInterpolatorInstance().interpolate("#{name}, meet {0}. #0, meet #{name}. Everyone, meet {1}.", "Pete", "Gavin");
- assertEquals(result, "Dan, meet Pete. Pete, meet Dan. Everyone, meet Gavin.");
- }
-
- // FIXME broken
- //@Test
- public void testFormatWithProperLocale()
- {
- Locale current = Locale.getDefault();
- try {
- Calendar cal = Calendar.getInstance();
- cal.set(2009, 5, 2);
- Locale.setDefault(Locale.US);
- String result = getInterpolatorInstance().interpolate("On {0,date} there was a disturbance in Java EE.", cal.getTime());
- assertEquals(result, "On Jun 2, 2009 there was a disturbance in Java EE.");
-
- Locale.setDefault(Locale.FRANCE);
- result = getInterpolatorInstance().interpolate("On {0,date} there was a disturbance in Java EE.", cal.getTime());
- assertEquals(result, "On 2 juin 2009 there was a disturbance in Java EE.");
- }
- finally {
- Locale.setDefault(current);
- }
- }
-
- private Interpolator getInterpolatorInstance() {
- return getCurrentManager().getInstanceByType(Interpolator.class);
- }
-
- private void installTestFixtureELResolver()
- {
- Map<Object, Object> fixture = new HashMap<Object, Object>();
- fixture.put("name", "Dan");
- Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
- // FIXME wow this is a hack to add a new EL resolver
- ((CompositeELResolver) expressions.getELContext().getELResolver()).add(new TestFixtureELResolver(fixture));
- elResolverInitialized = true;
- }
-
- public class TestFixtureELResolver extends AbstractELResolver
- {
- private Map<Object, Object> data;
-
- public TestFixtureELResolver(Map<Object, Object> data)
- {
- this.data = data;
- }
-
- @Override
- public Object getValue(ELContext context, Object base, Object property)
- {
- if (base == null && data.containsKey(property))
- {
- context.setPropertyResolved(true);
- return data.get(property);
- }
-
- return null;
- }
- }
-}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/LocaleProducerTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/LocaleProducerTest.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/LocaleProducerTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,53 +0,0 @@
-package org.jboss.seam.international;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertSame;
-
-import java.util.Locale;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * Verify that the default {@link LocalProducer} returns the
- * default locale of the JVM and is produced when {@link Locale}
- * is resolved by JCDI.
- *
- * @author Dan Allen
- */
- at Artifact(addCurrentPackage = false)
- at Classes({LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class})
-public class LocaleProducerTest extends AbstractWebBeansTest
-{
- /**
- * Ensure that the producer method run in standalone
- * mode produces the JVM default locale.
- */
- @Test
- public void testProducerMethodReturnsJvmDefault()
- {
- LocaleResolver resolver = new LocaleResolver();
- Locale result = resolver.getLocale();
- assertNotNull(result);
- assertEquals(result.toString(), Locale.getDefault().toString());
-
- LocaleProducer producer = new LocaleProducer();
- Locale result2 = producer.getLocale(resolver);
- assertSame(result2, result);
- }
-
- /**
- * Ensure that the manager produces the JVM default locale
- * for the type Locale.
- */
- // FIXME broken
- //@Test
- public void testProducesJvmDefault()
- {
- Locale result = getCurrentManager().getInstanceByType(Locale.class);
- assertEquals(result.toString(), Locale.getDefault().toString());
- }
-}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/SampleBean.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/SampleBean.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/SampleBean.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,18 +0,0 @@
-package org.jboss.seam.international;
-
-import javax.inject.Named;
-
-public
- at Named
-class SampleBean
-{
- public String getFeature()
- {
- return "rich";
- }
-
- public String getPlatform()
- {
- return "Java EE";
- }
-}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,64 +0,0 @@
-package org.jboss.seam.international;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jboss.seam.el.Expressions;
-import org.jboss.seam.el.ExpressionsProducer;
-import org.jboss.seam.resources.DefaultResourceLoader;
-import org.jboss.seam.resources.ResourceLoaderProducer;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.log.LoggerProducer;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.testng.annotations.Test;
-
-/**
- * Integration test the StatusMessages bean to ensure that it finds
- * and uses the interpolator and interpolates the message templates.
- *
- * @author Dan Allen
- */
- at Artifact(addCurrentPackage = false)
- at Classes(
-{
- LoggerProducer.class, StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class,
- LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class, MessagesProducer.class,
- DefaultResourceLoader.class, ResourceLoaderProducer.class
-})
-public class StatusMessagesTest extends AbstractWebBeansTest
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- activateConversationContext();
- }
-
- // FIXME broken
- //@Test
- public void testAddGlobalMessageFromTemplateWithInterpolations()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.add("The hole numbers of Amen Corner at #{'Augusta National'} are {0}, {1} and {2}.", 11, 12, 13);
- statusMessages.onBeforeRender();
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- StatusMessage message = statusMessages.getGlobalMessages().get(0);
- assertEquals(message.getSummary(), "The hole numbers of Amen Corner at Augusta National are 11, 12 and 13.");
- }
-
- // TODO test loading messages from resource bundle when resource bundle is ready
-
- private void activateConversationContext()
- {
- // TODO fix
- //ConversationContext.instance().setBeanStore(new ConcurrentHashMapBeanStore());
- //ConversationContext.instance().setActive(true);
- }
-
- private StatusMessages getStatusMessagesInstance()
- {
- return getCurrentManager().getInstanceByType(StatusMessages.class);
- }
-}
Deleted: modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,260 +0,0 @@
-package org.jboss.seam.international;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertSame;
-
-import java.util.List;
-
-import javax.validation.ConstraintDescriptor;
-import javax.validation.ConstraintViolation;
-
-import org.testng.annotations.Test;
-
-/**
- * A set of tests which exercise the StatusMessages as a unit (no external dependencies).
- * These tests focus primarily on the creation and storage of the StatusMessage.
- *
- * @author Dan Allen
- * @see StatusMessages
- */
- at Test(groups = "unit")
-public class StatusMessagesUnitTest
-{
- /**
- * Check that the add() method appends a global message, that the
- * default severity is INFO, and that interpolation is deferred.
- */
- @Test
- public void testAddGlobalMessageFromTemplateWithDefaultSeverity()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.add("Simple message");
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- assertEquals(statusMessages.getKeyedMessages().size(), 0);
- StatusMessage message = statusMessages.getGlobalMessages().get(0);
- assertSame(message.getSeverity(), StatusMessage.Severity.INFO);
- assertFalse(message.isEmpty());
- assertNull(message.getSummary());
- statusMessages.onBeforeRender();
- assertEquals(message.getSummary(), "Simple message");
- assertNull(message.getDetail());
- }
-
- /**
- * Test that separate summary and detail templates can be specified.
- */
- @Test
- public void testAddMessageWithSummaryAndDetail()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.add(StatusMessage.Severity.WARN, null, null, "Summary template", "Detail template");
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- StatusMessage message = statusMessages.getGlobalMessages().get(0);
- assertSame(message.getSeverity(), StatusMessage.Severity.WARN);
- statusMessages.onBeforeRender();
- assertEquals(message.getSummary(), "Summary template");
- assertEquals(message.getDetail(), "Detail template");
- }
-
- /**
- * Test that the severity is processed correctly when adding a global message.
- */
- @Test
- public void testAddGlobalWarningMessageFromTemplate()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.add(StatusMessage.Severity.WARN, "Achtung!");
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- assertSame(statusMessages.getGlobalMessages().get(0).getSeverity(), StatusMessage.Severity.WARN);
- }
-
- /**
- * Test that the addToControl() associates a message with a client id, that the
- * default severity is INFO, and that interpolation is deferred.
- */
- @Test
- public void testAddMessageToControlFromTemplateWithDefaultSeverity()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.addToControl("username", "Available!");
- List<StatusMessage> messages = statusMessages.getKeyedMessages("username");
- assertNotNull(messages);
- assertEquals(messages.size(), 1);
- StatusMessage message = messages.get(0);
- assertSame(message.getSeverity(), StatusMessage.Severity.WARN);
- assertNull(message.getSummary());
- statusMessages.onBeforeRender();
- assertEquals(message.getSummary(), "Available!");
- assertNull(message.getDetail());
- statusMessages.addToControl("username", "Nice choice");
- assertEquals(statusMessages.getKeyedMessages("username").size(), 2);
- }
-
- /**
- * Test that add() can create a global message with severity WARN from the contraint violation message.
- */
- @Test
- public void testAddGlobalMessageFromConstraintViolation()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- ConstraintViolation<Object> violation = new ConstraintViolationStub("Invalid number", "creditCardNumber");
- statusMessages.add(violation);
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- assertEquals(statusMessages.getKeyedMessages().size(), 0);
- StatusMessage message = statusMessages.getGlobalMessages().get(0);
- assertSame(message.getSeverity(), StatusMessage.Severity.WARN);
- statusMessages.onBeforeRender();
- assertEquals(message.getSummary(), "Invalid number");
- }
-
- /**
- * Test that addToControl() can create a message associated with the "client id" that is equivalent to the
- * last path segment of the property path with severity WARN from the contraint violation message.
- */
- @Test
- public void testAddMessageToControlsDynamicallyFromConstraintViolation()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- ConstraintViolation<Object> firstNameViolation = new ConstraintViolationStub("Too short", "firstName");
- ConstraintViolation<Object> lastNameViolation = new ConstraintViolationStub("Too long", "lastName");
- ConstraintViolation<Object> usernameViolation = new ConstraintViolationStub("Already taken", "account.username");
- statusMessages.addToControl(firstNameViolation);
- statusMessages.addToControls(new ConstraintViolation[] { lastNameViolation, usernameViolation });
- assertEquals(statusMessages.getGlobalMessages().size(), 0);
- assertEquals(statusMessages.getKeyedMessages().size(), 3);
- List<StatusMessage> messages = statusMessages.getKeyedMessages("lastName");
- assertNotNull(messages);
- assertEquals(messages.size(), 1);
- assertSame(messages.get(0).getSeverity(), StatusMessage.Severity.WARN);
- assertNotNull(statusMessages.getKeyedMessages("lastName"));
- assertNotNull(statusMessages.getKeyedMessages("username"));
- }
-
- /**
- * Test that the serverity is processed correctly when adding a message to a client id.
- */
- @Test
- public void testAddInfoMessageToControlFromTemplate()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.addToControl("password", StatusMessage.Severity.INFO, "Good strength!");
- List<StatusMessage> messages = statusMessages.getKeyedMessages("password");
- assertNotNull(messages);
- assertEquals(messages.size(), 1);
- assertSame(StatusMessage.Severity.INFO, messages.get(0).getSeverity());
- }
-
- /**
- * Test that global and keyed messages can be cleared separately.
- */
- @Test
- public void testClearMessages()
- {
- StatusMessages statusMessages = getStatusMessagesInstance();
-
- statusMessages.add("An info message");
- statusMessages.add(StatusMessage.Severity.ERROR, "An error message");
- statusMessages.addToControl("username", "Available!");
- statusMessages.addToControl("username", "Nice choice");
- statusMessages.addToControl("password", StatusMessage.Severity.WARN, "Too short");
-
- assertEquals(statusMessages.getGlobalMessages().size(), 2);
- assertEquals(statusMessages.getKeyedMessages().size(), 2);
-
- statusMessages.clearGlobalMessages();
-
- assertEquals(statusMessages.getGlobalMessages().size(), 0);
- assertEquals(statusMessages.getKeyedMessages().size(), 2);
-
- statusMessages.clearKeyedMessages("username");
-
- assertEquals(statusMessages.getKeyedMessages().size(), 1);
- assertNull(statusMessages.getKeyedMessages("username"));
-
- statusMessages.clearKeyedMessages();
-
- assertEquals(statusMessages.getKeyedMessages().size(), 0);
-
- statusMessages.add("An info message");
- statusMessages.addToControl("username", "Nice choice");
-
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- assertEquals(statusMessages.getKeyedMessages().size(), 1);
-
- statusMessages.clear();
-
- assertEquals(statusMessages.getGlobalMessages().size(), 0);
- assertEquals(statusMessages.getKeyedMessages().size(), 0);
- }
-
- private StatusMessages getStatusMessagesInstance()
- {
- return new StatusMessages(new IdentityInterpolator());
- }
-
- // QUESTION should I make this a @Mock Interpolator and use Web Beans to test?
- private class IdentityInterpolator extends Interpolator
- {
- @Override
- public String interpolate(String string, Object... params)
- {
- return string;
- }
- }
-
- private class ConstraintViolationStub implements ConstraintViolation<Object>
- {
- private String message;
- private String propertyPath;
-
- public ConstraintViolationStub(String message, String propertyPath)
- {
- this.message = message;
- this.propertyPath = propertyPath;
- }
-
- public String getMessage()
- {
- return message;
- }
-
- public String getMessageTemplate()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- public Object getRootBean()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- public Object getLeafBean()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- public String getPropertyPath()
- {
- return propertyPath;
- }
-
- public Object getInvalidValue()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- public ConstraintDescriptor<?> getConstraintDescriptor()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- public Class<Object> getRootBeanClass()
- {
- throw new UnsupportedOperationException("Not supported by stub.");
- }
-
- }
-}
Added: modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java (rev 0)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZoneBean.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,24 @@
+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;
+ }
+}
Added: modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java (rev 0)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/AvailableTimeZonesTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,52 @@
+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);
+ }
+}
Added: modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java (rev 0)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/DefaultTimeZoneTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,35 @@
+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);
+ }
+}
Added: modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java
===================================================================
--- modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java (rev 0)
+++ modules/international/trunk/src/test/java/org/jboss/seam/international/timezone/UserTimeZoneTest.java 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,55 @@
+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));
+ }
+}
Added: modules/international/trunk/src/test/jboss-resources/jndi.properties
===================================================================
--- modules/international/trunk/src/test/jboss-resources/jndi.properties (rev 0)
+++ modules/international/trunk/src/test/jboss-resources/jndi.properties 2010-03-26 03:39:35 UTC (rev 12276)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Deleted: modules/international/trunk/src/test/resources/messages.properties
===================================================================
--- modules/international/trunk/src/test/resources/messages.properties 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/resources/messages.properties 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,2 +0,0 @@
-title=Hello Seam!
-tagline=We put the #{sampleBean.feature} in #{sampleBean.platform}
Deleted: modules/international/trunk/src/test/resources/test-suite.xml
===================================================================
--- modules/international/trunk/src/test/resources/test-suite.xml 2010-03-26 01:26:34 UTC (rev 12275)
+++ modules/international/trunk/src/test/resources/test-suite.xml 2010-03-26 03:39:35 UTC (rev 12276)
@@ -1,15 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="Seam International Module Test Suite" verbose="1">
- <test name="Seam International Module - Unit Tests">
- <!--
- <method-selectors>
- <method-selector>
- <selector-class name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector"/>
- </method-selector>
- </method-selectors>
- -->
- <packages>
- <package name="org.jboss.seam.international"/>
- </packages>
- </test>
-</suite>
More information about the seam-commits
mailing list