diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-15 01:10:47 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-15 01:10:47 +0300 |
commit | ee7efdb3ac68829f3f7489097b8264d480421b0a (patch) | |
tree | 5f237a4e9ec76bb4db108a40abb7c730ed0bf67a | |
parent | 474b25d4cf52f43ee086dabd405937ef62520d06 (diff) | |
download | vaadin-framework-ee7efdb3ac68829f3f7489097b8264d480421b0a.tar.gz vaadin-framework-ee7efdb3ac68829f3f7489097b8264d480421b0a.zip |
Made tests compile again (#9299)
-rw-r--r-- | build/build.xml | 51 | ||||
-rw-r--r-- | build/ivy/ivy.xml | 38 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/client-side/com/vaadin/terminal/gwt/client/DateTimeServiceTest.java (renamed from tests/server-side/com/vaadin/tests/server/component/datefield/WeekNumberCalculation.java) | 222 |
3 files changed, 153 insertions, 158 deletions
diff --git a/build/build.xml b/build/build.xml index 0bfa4fbebe..8b22d6f750 100644 --- a/build/build.xml +++ b/build/build.xml @@ -26,12 +26,12 @@ <target name="init-deps" depends="common.init-deps" > <property name="ivy.resolved" value="1" /> - <ivy:resolve file="build/ivy/ivy.xml" resolveid="common" conf="ss.compile, cs.compile, ss.test.compile"/> - <ivy:cachepath pathid="ivy.compile.classpath.server" conf="ss.compile"/> - <ivy:cachepath pathid="ivy.compile.classpath.shared" conf="ss.compile"/> - <ivy:cachepath pathid="ivy.compile.classpath.client" conf="cs.compile"/> - <ivy:cachepath pathid="ivy.compile.classpath.client-compiler" conf="cs.compile"/> - <ivy:cachepath pathid="ivy.compile.classpath.server-tests" conf="ss.test.compile"/> + <ivy:resolve file="build/ivy/ivy.xml" resolveid="common" conf="server.extdep, shared.extdep, client.extdep, client-compiler.extdep, server.tests.extdep,client-compiler.extdep"/> + <ivy:cachepath pathid="ivy.compile.classpath.server" conf="server.extdep"/> + <ivy:cachepath pathid="ivy.compile.classpath.shared" conf="shared.extdep"/> + <ivy:cachepath pathid="ivy.compile.classpath.client" conf="client.extdep"/> + <ivy:cachepath pathid="ivy.compile.classpath.client-compiler" conf="client-compiler.extdep"/> + <ivy:cachepath pathid="ivy.compile.classpath.server-tests" conf="server.tests.extdep"/> <ivy:cachepath pathid="buildhelpers.dependencies" resolveId="buildhelpers" conf="compile" file="build/ivy/buildhelpers-ivy.xml"/> @@ -59,6 +59,11 @@ <property name="jarjar-jar" value="${gwt.tools.lib}/tonicsystems/jarjar-1.0rc8.jar"/> + <!-- GWT --> + <path id="gwt.dev.user.jars"> + <pathelement location="${gwt.user.jar}" /> + <pathelement location="${gwt.dev.jar}" /> + </path> <path id="compile.classpath.server"> <path refid="additional.jar.path" /> <path refid="ivy.compile.classpath.server" /> @@ -69,45 +74,28 @@ </path> <path id="compile.classpath.client"> <path refid="additional.jar.path" /> - <!-- GWT --> - <pathelement location="${gwt.user.jar}" /> - <pathelement location="${gwt.dev.jar}" /> - + <path refid="gwt.dev.user.jars"/> <path refid="ivy.compile.classpath.client" /> </path> <path id="compile.classpath.client-compiler"> <path refid="additional.jar.path" /> - <!-- GWT --> - <pathelement location="${gwt.user.jar}" /> - <pathelement location="${gwt.dev.jar}" /> - + <path refid="gwt.dev.user.jars"/> <path refid="ivy.compile.classpath.client-compiler" /> </path> <path id="compile.classpath.sass"> <path refid="additional.jar.path" /> <path refid="ivy.compile.classpath.server" /> - <!-- GWT --> - <pathelement location="${gwt.user.jar}" /> - <pathelement location="${gwt.dev.jar}" /> + <path refid="gwt.dev.user.jars"/> </path> <path id="compile.classpath.server-tests"> <path refid="additional.jar.path" /> - - <!-- GWT --> - <pathelement location="${gwt.user.jar}" /> - <!-- needed at least for Apache Commons --> - <pathelement location="${gwt.dev.jar}" /> - + <path refid="gwt.dev.user.jars"/> <path refid="ivy.compile.classpath.server-tests" /> </path> <path id="compile.classpath.buildhelpers"> <path refid="additional.jar.path" /> - - <!-- GWT --> - <pathelement location="${gwt.user.jar}" /> - <pathelement location="${gwt.dev.jar}" /> - + <path refid="gwt.dev.user.jars"/> <path refid="buildhelpers.dependencies" /> </path> </target> @@ -633,12 +621,14 @@ </javac> </target> - <target name="compile-tests" depends="compile-server,compile-client"> + <target name="compile-tests" depends="compile-server,compile-client,compile-sass"> <echo>Compiling src (Server and client side JUnit tests)</echo> <!-- Compile server and client side JUnit tests --> <mkdir dir="${result-classes-junit}" /> <javac source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server-tests" destdir="${result-classes-junit}" debug="true" encoding="UTF-8" includeantruntime="false"> + <classpath path="${result-classes-shared}"></classpath> <classpath path="${result-classes-server}"></classpath> + <classpath path="${result-classes-client}"></classpath> <src path="${result-src-junit}"/> </javac> @@ -656,6 +646,9 @@ <javac source="${required.java.version}" target="${required.java.version}" classpathref="compile.classpath.server" destdir="${result-classes-testbench}" debug="true" encoding="UTF-8" includeantruntime="false"> <classpath path="${result-classes-junit}"></classpath> <classpath path="${result-classes-server}"></classpath> + <classpath path="${result-classes-shared}"></classpath> + <classpath path="${result-classes-client}"></classpath> + <classpath refid="gwt.dev.user.jars"/> <src path="${result-src-testbench}"/> </javac> diff --git a/build/ivy/ivy.xml b/build/ivy/ivy.xml index fb94277434..b3cca0d2ca 100644 --- a/build/ivy/ivy.xml +++ b/build/ivy/ivy.xml @@ -3,14 +3,16 @@ xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd"> <info organisation="com.vaadin" module="vaadin"/> - <configurations > - <conf name="ss.compile" extends="cs.compile" description="Server side compilation dependencies" visibility="private"/> - <conf name="cs.compile" description="Client side compilation dependencies" visibility="private"/> - <conf name="ss.test.compile" extends="ss.compile" description="Test compilation dependencies" visibility="private"/> + <configurations> + <conf name="server.extdep" extends="client.extdep" description="Server side compilation dependencies" visibility="private"/> + <conf name="shared.extdep" extends="server.extdep" description="Shared compilation dependencies" visibility="private"/> + <conf name="client.extdep" description="Client side compilation dependencies" visibility="private"/> + <conf name="client-compiler.extdep" description="Client side compilation dependencies" visibility="private"/> + <conf name="server.tests.extdep" extends="server.extdep" description="Test compilation dependencies" visibility="private"/> <conf name="taskdefs" description="Ant task definitions" visibility="private" /> </configurations> <publications /> - <dependencies defaultconf="ss.compile" defaultconfmapping="ss.compile->master"> + <dependencies defaultconf="server.extdep" defaultconfmapping="server.extdep->master"> <!--Servlet API version 2.5 --> <dependency org="javax.servlet" name="servlet-api" rev="2.5" /> @@ -23,31 +25,31 @@ <dependency org="com.google.appengine" name="appengine-api-1.0-sdk" rev="1.2.1" /> <!-- GWT dependencies (validation-api) --> - <dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="cs.compile->master,sources" /> + <dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="client.extdep->master,sources" /> <!-- Test frameworks & related --> - <dependency org="junit" name="junit" rev="4.5" conf="ss.test.compile -> master"/> - <dependency org="org.easymock" name="easymock" rev="3.0" conf="ss.test.compile -> master, runtime(*)"/> - <dependency org="org.hsqldb" name="hsqldb" rev="2.2.6" conf="ss.test.compile -> master, runtime(*)"/> + <dependency org="junit" name="junit" rev="4.5" conf="server.tests.extdep -> master"/> + <dependency org="org.easymock" name="easymock" rev="3.0" conf="server.tests.extdep -> master, runtime(*)"/> + <dependency org="org.hsqldb" name="hsqldb" rev="2.2.6" conf="server.tests.extdep -> master, runtime(*)"/> <!-- Additional libraries used by tests - also included from GWT --> - <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.26" conf="ss.test.compile -> master"/> - <dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.26" conf="ss.test.compile -> master"/> - <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="ss.test.compile -> master"/> - <dependency org="commons-io" name="commons-io" rev="2.3" conf="ss.test.compile -> master"/> - <dependency org="commons-codec" name="commons-codec" rev="1.6" conf="ss.test.compile -> master"/> + <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.26" conf="server.tests.extdep -> master"/> + <dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.26" conf="server.tests.extdep -> master"/> + <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="server.tests.extdep -> master"/> + <dependency org="commons-io" name="commons-io" rev="2.3" conf="server.tests.extdep -> master"/> + <dependency org="commons-codec" name="commons-codec" rev="1.6" conf="server.tests.extdep -> master"/> <!-- Ant tasks --> <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="taskdefs ->master"/> <dependency org="org.apache.maven" name="maven-ant-tasks" rev="2.0.10" conf="taskdefs ->master"/> <!-- Emma --> - <dependency org="emma" name="emma_ant" rev="2.0.5312" conf="ss.test.compile,taskdefs ->master"/> - <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="ss.test.compile,taskdefs ->*"/> + <dependency org="emma" name="emma_ant" rev="2.0.5312" conf="server.tests.extdep,taskdefs ->master"/> + <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="server.tests.extdep,taskdefs ->*"/> <!-- Bean Validation implementation --> - <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" conf="ss.test.compile -> default"/> - <dependency org="org.hibernate" name="hibernate-validator" rev="4.2.0.Final" conf="ss.test.compile -> default"/> + <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" conf="server.tests.extdep -> default"/> + <dependency org="org.hibernate" name="hibernate-validator" rev="4.2.0.Final" conf="server.tests.extdep -> default"/> </dependencies> </ivy-module>
\ No newline at end of file diff --git a/tests/server-side/com/vaadin/tests/server/component/datefield/WeekNumberCalculation.java b/tests/client-side/com/vaadin/terminal/gwt/client/DateTimeServiceTest.java index ae8bc9beae..d0bd9a79c8 100644..100755 --- a/tests/server-side/com/vaadin/tests/server/component/datefield/WeekNumberCalculation.java +++ b/tests/client-side/com/vaadin/terminal/gwt/client/DateTimeServiceTest.java @@ -1,111 +1,111 @@ -package com.vaadin.tests.server.component.datefield; - -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import com.vaadin.terminal.gwt.client.DateTimeService; - -public class WeekNumberCalculation extends TestCase { - - final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000; - - static Map<Date, Integer> isoWeekNumbers = new HashMap<Date, Integer>(); - static { - isoWeekNumbers.put(getDate(2005, 02, 02), 5); - - isoWeekNumbers.put(getDate(2005, 1, 1), 53); - isoWeekNumbers.put(getDate(2005, 1, 2), 53); - isoWeekNumbers.put(getDate(2005, 1, 3), 1); - isoWeekNumbers.put(getDate(2005, 1, 4), 1); - isoWeekNumbers.put(getDate(2005, 1, 5), 1); - isoWeekNumbers.put(getDate(2005, 1, 6), 1); - isoWeekNumbers.put(getDate(2005, 1, 7), 1); - isoWeekNumbers.put(getDate(2005, 1, 8), 1); - isoWeekNumbers.put(getDate(2005, 1, 9), 1); - isoWeekNumbers.put(getDate(2005, 1, 10), 2); - isoWeekNumbers.put(getDate(2005, 12, 31), 52); - isoWeekNumbers.put(getDate(2005, 12, 30), 52); - isoWeekNumbers.put(getDate(2005, 12, 29), 52); - isoWeekNumbers.put(getDate(2005, 12, 28), 52); - isoWeekNumbers.put(getDate(2005, 12, 27), 52); - isoWeekNumbers.put(getDate(2005, 12, 26), 52); - isoWeekNumbers.put(getDate(2005, 12, 25), 51); - isoWeekNumbers.put(getDate(2007, 1, 1), 1); - isoWeekNumbers.put(getDate(2007, 12, 30), 52); - isoWeekNumbers.put(getDate(2007, 12, 31), 1); - isoWeekNumbers.put(getDate(2008, 1, 1), 1); - isoWeekNumbers.put(getDate(2008, 12, 28), 52); - isoWeekNumbers.put(getDate(2008, 12, 29), 1); - isoWeekNumbers.put(getDate(2008, 12, 30), 1); - isoWeekNumbers.put(getDate(2008, 12, 31), 1); - isoWeekNumbers.put(getDate(2009, 1, 1), 1); - isoWeekNumbers.put(getDate(2009, 12, 31), 53); - isoWeekNumbers.put(getDate(2010, 1, 1), 53); - isoWeekNumbers.put(getDate(2010, 1, 2), 53); - isoWeekNumbers.put(getDate(2010, 1, 3), 53); - isoWeekNumbers.put(getDate(2010, 1, 4), 1); - isoWeekNumbers.put(getDate(2010, 1, 5), 1); - isoWeekNumbers.put(getDate(2010, 10, 10), 40); - - } - - /** - * Test all dates from 1990-1992 + some more and see that {@link Calendar} - * calculates the ISO week number like we do. - * - */ - public void testISOWeekNumbers() { - Calendar c = Calendar.getInstance(); - c.set(1990, 1, 1); - long start = c.getTimeInMillis(); - - for (int i = 0; i < 1000; i++) { - Date d = new Date(start + i * MILLISECONDS_PER_DAY); - int expected = getCalendarISOWeekNr(d); - int calculated = DateTimeService.getISOWeekNumber(d); - assertEquals(d + " should be week " + expected, expected, - calculated); - - } - } - - /** - * Verify that special cases are handled correctly by us (and - * {@link Calendar}). - * - */ - public void testSampleISOWeekNumbers() { - for (Date d : isoWeekNumbers.keySet()) { - // System.out.println("Sample: " + d); - int expected = isoWeekNumbers.get(d); - int calculated = DateTimeService.getISOWeekNumber(d); - assertEquals(d + " should be week " + expected - + " (Java Calendar is wrong?)", expected, - getCalendarISOWeekNr(d)); - assertEquals(d + " should be week " + expected, expected, - calculated); - - } - } - - private int getCalendarISOWeekNr(Date d) { - Calendar c = Calendar.getInstance(); - c.setFirstDayOfWeek(Calendar.MONDAY); - c.setMinimalDaysInFirstWeek(4); - c.setTime(d); - - return c.get(Calendar.WEEK_OF_YEAR); - } - - private static Date getDate(int year, int month, int date) { - Calendar c = Calendar.getInstance(); - c.clear(); - c.set(year, month - 1, date); - return c.getTime(); - } - -} +package com.vaadin.terminal.gwt.client;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import com.vaadin.terminal.gwt.client.DateTimeService;
+
+public class DateTimeServiceTest extends TestCase {
+
+ final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
+
+ static Map<Date, Integer> isoWeekNumbers = new HashMap<Date, Integer>();
+ static {
+ isoWeekNumbers.put(getDate(2005, 02, 02), 5);
+
+ isoWeekNumbers.put(getDate(2005, 1, 1), 53);
+ isoWeekNumbers.put(getDate(2005, 1, 2), 53);
+ isoWeekNumbers.put(getDate(2005, 1, 3), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 4), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 5), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 6), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 7), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 8), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 9), 1);
+ isoWeekNumbers.put(getDate(2005, 1, 10), 2);
+ isoWeekNumbers.put(getDate(2005, 12, 31), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 30), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 29), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 28), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 27), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 26), 52);
+ isoWeekNumbers.put(getDate(2005, 12, 25), 51);
+ isoWeekNumbers.put(getDate(2007, 1, 1), 1);
+ isoWeekNumbers.put(getDate(2007, 12, 30), 52);
+ isoWeekNumbers.put(getDate(2007, 12, 31), 1);
+ isoWeekNumbers.put(getDate(2008, 1, 1), 1);
+ isoWeekNumbers.put(getDate(2008, 12, 28), 52);
+ isoWeekNumbers.put(getDate(2008, 12, 29), 1);
+ isoWeekNumbers.put(getDate(2008, 12, 30), 1);
+ isoWeekNumbers.put(getDate(2008, 12, 31), 1);
+ isoWeekNumbers.put(getDate(2009, 1, 1), 1);
+ isoWeekNumbers.put(getDate(2009, 12, 31), 53);
+ isoWeekNumbers.put(getDate(2010, 1, 1), 53);
+ isoWeekNumbers.put(getDate(2010, 1, 2), 53);
+ isoWeekNumbers.put(getDate(2010, 1, 3), 53);
+ isoWeekNumbers.put(getDate(2010, 1, 4), 1);
+ isoWeekNumbers.put(getDate(2010, 1, 5), 1);
+ isoWeekNumbers.put(getDate(2010, 10, 10), 40);
+
+ }
+
+ /**
+ * Test all dates from 1990-1992 + some more and see that {@link Calendar}
+ * calculates the ISO week number like we do.
+ *
+ */
+ public void testISOWeekNumbers() {
+ Calendar c = Calendar.getInstance();
+ c.set(1990, 1, 1);
+ long start = c.getTimeInMillis();
+
+ for (int i = 0; i < 1000; i++) {
+ Date d = new Date(start + i * MILLISECONDS_PER_DAY);
+ int expected = getCalendarISOWeekNr(d);
+ int calculated = DateTimeService.getISOWeekNumber(d);
+ assertEquals(d + " should be week " + expected, expected,
+ calculated);
+
+ }
+ }
+
+ /**
+ * Verify that special cases are handled correctly by us (and
+ * {@link Calendar}).
+ *
+ */
+ public void testSampleISOWeekNumbers() {
+ for (Date d : isoWeekNumbers.keySet()) {
+ // System.out.println("Sample: " + d);
+ int expected = isoWeekNumbers.get(d);
+ int calculated = DateTimeService.getISOWeekNumber(d);
+ assertEquals(d + " should be week " + expected
+ + " (Java Calendar is wrong?)", expected,
+ getCalendarISOWeekNr(d));
+ assertEquals(d + " should be week " + expected, expected,
+ calculated);
+
+ }
+ }
+
+ private int getCalendarISOWeekNr(Date d) {
+ Calendar c = Calendar.getInstance();
+ c.setFirstDayOfWeek(Calendar.MONDAY);
+ c.setMinimalDaysInFirstWeek(4);
+ c.setTime(d);
+
+ return c.get(Calendar.WEEK_OF_YEAR);
+ }
+
+ private static Date getDate(int year, int month, int date) {
+ Calendar c = Calendar.getInstance();
+ c.clear();
+ c.set(year, month - 1, date);
+ return c.getTime();
+ }
+
+}
|