001: /*
002: Mdarad-Toolobox is a collection of tools for Architected RAD
003: (Rapid Application Development) based on an MDA approach.
004: The toolbox contains frameworks and generators for many environments
005: (JAVA, J2EE, Hibernate, .NET, C++, etc.) which allow to generate
006: applications from a design Model
007: Copyright (C) 2004-2005 Elapse Technologies Inc.
008:
009: This library is free software; you can redistribute it and/or
010: modify it under the terms of the GNU General Public
011: License as published by the Free Software Foundation; either
012: version 2.1 of the License, or (at your option) any later version.
013:
014: This library is distributed in the hope that it will be useful,
015: but WITHOUT ANY WARRANTY; without even the implied warranty of
016: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: General Public License for more details.
018:
019: You should have received a copy of the GNU General Public
020: License along with this library; if not, write to the Free Software
021: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022: */
023:
024: package org.mdarad.framework.test;
025:
026: import java.net.URI;
027: import java.util.Calendar;
028: import java.util.Currency;
029: import java.util.Date;
030: import java.util.HashMap;
031: import java.util.Locale;
032: import java.util.Map;
033: import java.util.TimeZone;
034:
035: import junit.framework.TestCase;
036:
037: import org.dataisland.primitives.datatype.Blob;
038: import org.dataisland.primitives.datatype.Money;
039: import org.dataisland.primitives.format.DateDataIslandFormat;
040:
041: public class AbstractTestCase extends TestCase {
042: //primitives
043: public static final String DEFAULT_STRING = "s";
044: public static final char DEFAULT_CHAR = 'c';
045: public static final boolean DEFAULT_BOOLEAN = false;
046: public static final short DEFAULT_SHORT = 12;
047: public static final int DEFAULT_INT = 23;
048: public static final float DEFAULT_FLOAT = 34.0f;
049: public static final double DEFAULT_DOUBLE = 45.0;
050: public static final long DEFAULT_LONG = 56;
051:
052: //wrappers
053: public static final Integer DEFAULT_INT_OBJECT = new Integer(
054: DEFAULT_INT);
055: public static final Long DEFAULT_LONG_OBJECT = new Long(
056: DEFAULT_LONG);
057: public static final Short DEFAULT_SHORT_OBJECT = new Short(
058: DEFAULT_SHORT);
059: public static final Float DEFAULT_FLOAT_OBJECT = new Float(
060: DEFAULT_FLOAT);
061: public static final Double DEFAULT_DOUBLE_OBJECT = new Double(
062: DEFAULT_DOUBLE);
063: public static final Boolean DEFAULT_BOOLEAN_OBJECT = new Boolean(
064: DEFAULT_BOOLEAN);
065: public static final Character DEFAULT_CHAR_OBJECT = new Character(
066: DEFAULT_CHAR);
067:
068: //common
069: public static final Date DEFAULT_DATE;
070: public static final TimeZone DEFAULT_TIMEZONE = TimeZone
071: .getDefault();
072: public static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
073: public static final Currency DEFAULT_CURRENCY = Currency
074: .getInstance("CAD");
075:
076: //dataisland
077: public static final Blob DEFAULT_BLOB;
078: public static final String DEFAULT_HYPERTEXT = "<b><strong>Mdarad</strong></b>";
079: public static final Money DEFAULT_MONEY;
080: public static final String DEFAULT_TEXT = "Mdarad-Toolbox stands for 'Model Driven Architected Rapid Application Development' Toolbox. It is a combination of MDA and ARAD. In other words, it is a collection of tools used to generate end to end applications from a simple modeling diagram (UML and such).";
081: public static final URI DEFAULT_URI = URI
082: .create("http://www.mdarad.org");;
083:
084: public static final float DELTA_FLOAT = 0.00001f;
085: public static final double DELAT_DOUBLE = 0.00001;
086:
087: static {
088: Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
089: calendar.setTimeInMillis(0);
090: calendar.set(Calendar.YEAR, 1978);
091: calendar.set(Calendar.MONTH, 4);
092: calendar.set(Calendar.DAY_OF_MONTH, 4);
093: calendar.set(Calendar.HOUR_OF_DAY, 0);
094: DEFAULT_DATE = calendar.getTime();
095:
096: DEFAULT_BLOB = new Blob();
097: DEFAULT_BLOB.setFileName("test.jpg");
098: DEFAULT_BLOB.setContent("test".getBytes());
099: DEFAULT_BLOB.setContentType("image");
100:
101: DEFAULT_MONEY = new Money();
102: DEFAULT_MONEY.setAmount(new Double(1000.0d));
103: DEFAULT_MONEY.setCurrency(DEFAULT_CURRENCY);
104: }
105:
106: protected void setUp() throws Exception {
107: super .setUp();
108: }
109:
110: protected void tearDown() throws Exception {
111: super .tearDown();
112: }
113:
114: public static void assertEquals(float expected, float actual) {
115: assertEquals(expected, actual, DELTA_FLOAT);
116: }
117:
118: public static void assertEquals(double expected, double actual) {
119: assertEquals(expected, actual, DELAT_DOUBLE);
120: }
121:
122: }
|