You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2002/05/13 08:07:10 UTC
cvs commit: jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/valueparam InvalidValueParamTest.java
prickett 02/05/12 23:07:09
Modified: periodicity build.properties build.xml
periodicity/conf/build build.db.properties
build.jars.properties
periodicity/src/java/org/apache/commons/periodicity/test
ParamTests.java
periodicity/src/java/org/apache/commons/periodicity/test/usertype
ValidUserTypeTest.java
Added: periodicity/src/java/org/apache/commons/periodicity/test/altrep
InvalidAltRepTest.java
periodicity/src/java/org/apache/commons/periodicity/test/dirparam
InvalidDirParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/encodingparam
InvalidEncodingParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/freebusyparam
InvalidFreeBusyParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/participation
InvalidParticipationParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/rangeparam
InvalidRangeParamTest.java ValidRangeParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/relatedparam
InvalidRelatedParamTest.java
ValidRelatedParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/relationship
InvalidRelationshipTest.java
periodicity/src/java/org/apache/commons/periodicity/test/roleparam
InvalidRoleParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/rsvpparam
InvalidRsvpParamTest.java
periodicity/src/java/org/apache/commons/periodicity/test/usertype
InvalidUserTypeTest.java
periodicity/src/java/org/apache/commons/periodicity/test/valueparam
InvalidValueParamTest.java
Log:
Minor build file changes by Jeff Prickett
Major additions to the test suite by Mike George
Added testing for Invalid parameter values where applicable.
Revision Changes Path
1.7 +3 -3 jakarta-commons-sandbox/periodicity/build.properties
Index: build.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/build.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- build.properties 9 Apr 2002 09:59:30 -0000 1.6
+++ build.properties 13 May 2002 06:07:08 -0000 1.7
@@ -23,7 +23,7 @@
# Default: none
# -------------------------------------------------------------------
-database=mysql
+database=postgresql
# --------------------------------------------------------------------
#
@@ -31,7 +31,7 @@
#
# --------------------------------------------------------------------
-databaseUser = root
+databaseUser=neighbor
# --------------------------------------------------------------------
#
@@ -39,7 +39,7 @@
#
# --------------------------------------------------------------------
-databasePassword =
+databasePassword=neighbor
# --------------------------------------------------------------------
#
1.23 +32 -7 jakarta-commons-sandbox/periodicity/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/build.xml,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- build.xml 9 Apr 2002 09:59:30 -0000 1.22
+++ build.xml 13 May 2002 06:07:08 -0000 1.23
@@ -36,6 +36,7 @@
<pathelement location="${tdk.jar}"/>
<pathelement location="${torque.jar}"/>
<pathelement location="${turbine.jar}"/>
+ <pathelement location="${periodicity.tasks.jar}"/>
</path>
<target name="mv-src">
@@ -143,6 +144,7 @@
todir="${build.war}/WEB-INF/lib"/>
<copy file="./conf/turbine/TurbineResources.properties"
todir="${build.war}/WEB-INF/conf"/>
+ <antcall target="create-${database}-torque-properties"/>
<copy file="./conf/tomcat/web.xml"
todir="${build.war}/WEB-INF"/>
<copy file="${tdk.home}/Default.vm"
@@ -160,7 +162,19 @@
</copy>
<jar jarfile="${build.dir}/${project}.war"
basedir="${build.war}"/>
- </target>
+ </target>
+
+ <target name="create-mysql-torque-properties">
+ <taskdef name="torque-props"
+ classname="org.apache.commons.periodicity.ant.CustomizeTorquePropsTask">
+ <classpath refid="classpath"/>
+ </taskdef>
+ <torque-props original="./conf/torque/torque.properties"
+ custom="${build.war}/WEB-INF/conf/Torque.properties"
+ user="${databaseUser}" password="${databasePassword}"
+ url="${mysql.databaseUrl}"
+ driver="${mysql.databaseDriver}"/>
+ </target>
<target name="war-build-fast" depends="core">
<antcall target="war-no-build-fast"/>
@@ -227,8 +241,24 @@
<antcall target="update-jars"/>
<antcall target="update-id-xml"/>
<antcall target="update-tdk-templates"/>
+ <antcall target="build-periodicity-ant-tasks"/>
</target>
+ <target name="build-periodicity-ant-tasks">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.dest}"/>
+ <mkdir dir="${build.src}"/>
+ <copy todir="${build.src}">
+ <fileset dir="${src.java.dir}/org/apache/commons/periodicity/ant">
+ </fileset>
+ </copy>
+ <javac srcdir="${build.dir}" destdir="${build.dest}" debug="${debug}">
+ <classpath refid="classpath"/>
+ </javac>
+ <jar jarfile="${periodicity.tasks.jar}"
+ basedir="${build.dest}"/>
+ </target>
+
<target name="generate-create-sql" depends="extract-torque-files">
<taskdef
name="torque-create-db"
@@ -239,12 +269,7 @@
controlTemplate="sql/db-init/Control.vm"
outputDirectory="${build.src}/sql"
templatePath="${torque.home}"
- outputFile="create-db.sql"
- targetPlatform="${platform}"
- targetDatabase="${database}"
- databaseUser="${databaseUser}"
- databasePassword="${databasePassword}"
- databaseHost="${databaseHost}">
+ outputFile="create-db.sql">
<fileset dir="./src/xml">
<include name="periodicity-schema.xml"/>
</fileset>
1.2 +3 -3 jakarta-commons-sandbox/periodicity/conf/build/build.db.properties
Index: build.db.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/conf/build/build.db.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.db.properties 25 Mar 2002 09:24:17 -0000 1.1
+++ build.db.properties 13 May 2002 06:07:08 -0000 1.2
@@ -11,9 +11,9 @@
#
# -------------------------------------------------------------------
-mysql.createDatabaseUrl = jdbc:mysql://${databaseHost}/mysql
-mysql.databaseUrl = jdbc:mysql://${databaseHost}/periodicity
-mysql.databaseDriver = org.gjt.mm.mysql.Driver
+mysql.createDatabaseUrl=jdbc:mysql://${databaseHost}/mysql
+mysql.databaseUrl=jdbc:mysql://${databaseHost}/periodicity
+mysql.databaseDriver=org.gjt.mm.mysql.Driver
# -------------------------------------------------------------------
#
1.3 +2 -1 jakarta-commons-sandbox/periodicity/conf/build/build.jars.properties
Index: build.jars.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/conf/build/build.jars.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.jars.properties 28 Mar 2002 08:49:13 -0000 1.2
+++ build.jars.properties 13 May 2002 06:07:08 -0000 1.3
@@ -8,8 +8,9 @@
commons-lang.jar = ${lib.repo}/commons-lang-0.1-dev.jar
jdbc.jar = ${lib.repo}/jdbc2_0-stdext.jar
junit.jar = ${lib.repo}/junit-3.7.jar
+periodicity.tasks.jar= ${lib.repo}/periodicity-tasks.jar
servlet.jar= ${lib.repo}/servlet-2.2.jar
stratum.jar = ${lib.repo}/stratum-0.1-dev.jar
-torque.jar=${lib.repo}/torque-3.0-dev.jar
+torque.jar=${lib.repo}/torque-3.0-b2-dev.jar
tdk.jar= ${lib.repo}/tdk.jar
turbine.jar=${lib.repo}/turbine-2.2-b2-dev.jar
1.3 +69 -94 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/ParamTests.java
Index: ParamTests.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/ParamTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParamTests.java 3 Apr 2002 04:38:24 -0000 1.2
+++ ParamTests.java 13 May 2002 06:07:09 -0000 1.3
@@ -1,95 +1,70 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Jetspeed" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache" or
- * "Apache Jetspeed", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
+/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test;
-
-import org.apache.commons.periodicity.test.altrep.ValidAltRepTest;
-import org.apache.commons.periodicity.test.usertype.ValidUserTypeTest;
-import org.apache.commons.periodicity.test.encodingparam.ValidEncodingParamTest;
-import junit.framework.TestSuite;
-import junit.framework.Test;
-import java.util.Date;
-
-/**
- * This class consolidates all of the individual JUnit TestCase
- * classes for the iCalendar parameter types into a single JUnit
- * TestSuite. JUnit can be found at <a href="http://www.junit.org">JUnit.org.</a>
- * @author Mike George
- * <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
- */
-public class ParamTests extends TestSuite
-{
- /**
- * This static method returns the Testsuite object that
- * JUnit needs to perform its tests.
- * @return A TestSuite object that will be used in JUnit testing.
- */
- public static Test suite() {
-
- String dateStr = new Date().toString();
- TestSuite ts = new TestSuite(dateStr);
-
- try
- {
- ts.addTest(new ValidAltRepTest(dateStr));
- ts.addTest(new ValidUserTypeTest(dateStr));
- ts.addTest(new ValidEncodingParamTest(dateStr));
- return ts;
- }
- catch(Throwable t)
- {
- System.out.println("Throwable thrown in ParamTests.suite() method.");
- }
- return ts;
- }
-}
+import org.apache.commons.periodicity.test.altrep.ValidAltRepTest;
import org.apache.commons.periodicity.test.altrep.InvalidAltRepTest;
+
+import org.apache.commons.periodicity.test.usertype.ValidUserTypeTest;
import org.apache.commons.periodicity.test.usertype.InvalidUserTypeTest;
+
+import org.apache.commons.periodicity.test.encodingparam.ValidEncodingParamTest;
import org.apache.commons.periodicity.test.encodingparam.InvalidEncodingParamTest;
+
+import org.apache.commons.periodicity.test.dirparam.ValidDirParamTest;
+import org.apache.commons.periodicity.test.dirparam.InvalidDirParamTest;
+
+import org.apache.commons.periodicity.test.freebusyparam.ValidFreeBusyParamTest;
+import org.apache.commons.periodicity.test.freebusyparam.InvalidFreeBusyParamTest;
+
+import org.apache.commons.periodicity.test.participation.ValidParticipationParamTest;
+import org.apache.commons.periodicity.test.participation.InvalidParticipationParamTest;
+
+import org.apache.commons.periodicity.test.rangeparam.ValidRangeParamTest;
+import org.apache.commons.periodicity.test.rangeparam.InvalidRangeParamTest;
+
+import org.apache.commons.periodicity.test.relatedparam.ValidRelatedParamTest;
+import org.apache.commons.periodicity.test.relatedparam.InvalidRelatedParamTest;
+
+import org.apache.commons.periodicity.test.relationship.ValidRelationshipTest;
+import org.apache.commons.periodicity.test.relationship.InvalidRelationshipTest;
+
+import org.apache.commons.periodicity.test.roleparam.ValidRoleParamTest;
+import org.apache.commons.periodicity.test.roleparam.InvalidRoleParamTest;
+
+import org.apache.commons.periodicity.test.rsvpparam.ValidRsvpParamTest;
+import org.apache.commons.periodicity.test.rsvpparam.InvalidRsvpParamTest;
+
+import org.apache.commons.periodicity.test.valueparam.ValidValueParamTest;
+import org.apache.commons.periodicity.test.valueparam.InvalidValueParamTest;
+
+import junit.framework.TestSuite;
import junit.framework.Test;
import java.util.Date;
+/**
* This class consolidates all of the individual JUnit TestCase
* classes for the iCalendar parameter types into a single JUnit
* TestSuite. JUnit can be found at <a href="http://www.junit.org">JUnit.org.</a>
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class ParamTests extends TestSuite
{
/**
* This static method returns the Testsuite object that
* JUnit needs to perform its tests.
* @return A TestSuite object that will be used in JUnit testing.
*/
public static Test suite() {
+ String dateStr = new Date().toString();
TestSuite ts = new TestSuite(dateStr);
+ try
{
ts.addTest(new ValidAltRepTest(dateStr));
ts.addTest(new InvalidAltRepTest(dateStr));
+
+ ts.addTest(new ValidUserTypeTest(dateStr));
ts.addTest(new InvalidUserTypeTest(dateStr));
+
+ ts.addTest(new ValidEncodingParamTest(dateStr));
ts.addTest(new InvalidEncodingParamTest(dateStr));
+
+ ts.addTest(new ValidDirParamTest(dateStr));
+ ts.addTest(new InvalidDirParamTest(dateStr));
+
+ ts.addTest(new ValidFreeBusyParamTest(dateStr));
+ ts.addTest(new InvalidFreeBusyParamTest(dateStr));
+
+ ts.addTest(new ValidParticipationParamTest(dateStr));
+ ts.addTest(new InvalidParticipationParamTest(dateStr));
+
+ ts.addTest(new ValidRangeParamTest(dateStr));
+ ts.addTest(new InvalidRangeParamTest(dateStr));
+
+ ts.addTest(new ValidRelatedParamTest(dateStr));
+ ts.addTest(new InvalidRelatedParamTest(dateStr));
+
+ ts.addTest(new ValidRelationshipTest(dateStr));
+ ts.addTest(new InvalidRelationshipTest(dateStr));
+
+ ts.addTest(new ValidRoleParamTest(dateStr));
+ ts.addTest(new InvalidRoleParamTest(dateStr));
+
+ ts.addTest(new ValidRsvpParamTest(dateStr));
+ ts.addTest(new InvalidRsvpParamTest(dateStr));
+
+ ts.addTest(new ValidValueParamTest(dateStr));
+ ts.addTest(new InvalidValueParamTest(dateStr));
return ts;
}
catch(Throwable t)
{
System.out.println("Throwable thrown in ParamTests.suite() method.");
}
return ts;
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/altrep/InvalidAltRepTest.java
Index: InvalidAltRepTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.altrep;
import org.apache.commons.periodicity.ical.parameters.AltRep;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This test tries to set an invalid URI. It should cause an iCal
* exception to be thrown in the FieldEdits class.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidAltRepTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidAltRepTest(String name) throws Throwable
{
super("InvalidAltRepTest:" + name);
runTest();
}
/**
* This method attempts to set the AltRep with an invalid URI
* @throws ICalendarException
*/
public void test_setInvalidAltRep() throws ICalendarException
{
try
{
AltRep testAltRep = new AltRep("http://these-are-bad-chars^<>*.htm");
}
catch(ICalendarException e)
{
return;
}
fail("Expected ICalendarException not thrown in InvalidAltRepTest.");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_setInvalidAltRep();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/dirparam/InvalidDirParamTest.java
Index: InvalidDirParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.dirparam;
import org.apache.commons.periodicity.ical.parameters.DirParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This test case show cause the FieldEdits class to throw an
* ICalendarException
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidDirParamTest extends TestCase
{
static final String BAD_URI = "http://this-is-a- bad-URI-^<>*.htm";
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidDirParamTest(String name) throws Throwable
{
super("InvalidDirParamTest:" + name);
runTest();
}
/**
* This method passes a invalid URI to an AltRep object using
* the one-arg constructor. This should cause the FieldEdits
* class to throw an exception.
* @throws ICalendarException
*/
public void test_setInvalidDirParamOneArg() throws ICalendarException
{
try
{
DirParam dp = new DirParam(BAD_URI);
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidDirParam.onearg method");
}
/**
* This method passes an invalid URI to an AltRep object using
* a set method. This should cause the FieldEdits
* class to throw an exception.
* @throws ICalendarException
*/
public void test_setInvalidDirParamNoArg() throws ICalendarException
{
try
{
DirParam dp = new DirParam();
dp.setValue(BAD_URI);
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidDirParam.noarg method");
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_setInvalidDirParamOneArg();
test_setInvalidDirParamNoArg();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/encodingparam/InvalidEncodingParamTest.java
Index: InvalidEncodingParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.encodingparam;
import org.apache.commons.periodicity.ical.parameters.EncodingParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that an invalid encoding parameter
* causes an exception to be thrown.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidEncodingParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidEncodingParamTest(String name) throws Throwable
{
super("ValidEncodingParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor and the set
* methods. It should throw an ICalendarException
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
EncodingParam e1 = new EncodingParam();
e1.setValue("NOT-BASE64");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidEncodingParamTest.noarg method");
}
/**
* This method tests the one-arg constructor. It should
* throw an ICalendarException.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
EncodingParam e1 = new EncodingParam("NOT-BASE64");
e1.setValue("NOT-BASE64");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidEncodingParamTest.onearg method");
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/freebusyparam/InvalidFreeBusyParamTest.java
Index: InvalidFreeBusyParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.freebusyparam;
import org.apache.commons.periodicity.ical.parameters.FreeBusyParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* FreeBusyParam class cause an exception to be thrown. The
* valid values for this parameter are "FREE", "BUSY",
* "BUSY-UNAVAILABLE", "BUSY-TENTATIVE", iana-token, and
* x-name. This parameter is covered in RFC 2445 Section 4.2.9
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidFreeBusyParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidFreeBusyParamTest(String name) throws Throwable
{
super("InvalidFreeBusyParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
FreeBusyParam e1 = new FreeBusyParam();
e1.setValue("BAD-FREE");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidFreeBusyParamTest.noarg method");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
FreeBusyParam e1 = new FreeBusyParam("BAD-FREE");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidFreeBusyParamTest.onearg method");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/participation/InvalidParticipationParamTest.java
Index: InvalidParticipationParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.participation;
import org.apache.commons.periodicity.ical.parameters.Participation;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* Participation class cause an exception to be thrown. The
* valid values for this parameter are "NEEDS-ACTION", "ACCEPTED",
* "DECLINED", "TENTATIVE", "DELEGATED", "COMPLETED",
* and "IN-PROCESS".
* This parameter is covered in RFC 2445 Section 4.2.12
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidParticipationParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidParticipationParamTest(String name) throws Throwable
{
super("InvalidParticipationParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
Participation e1 = new Participation();
e1.setValue("NOT-DECLINED");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidParticipationParamTest.");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
Participation e1 = new Participation("NOT-DECLINED");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidParticipationParamTest.");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/rangeparam/InvalidRangeParamTest.java
Index: InvalidRangeParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.rangeparam;
import org.apache.commons.periodicity.ical.parameters.RangeParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* RangeParam class cause an exception to be thrown. The
* valid values for this parameter are "THISANDPRIOR"
* and "THISANDFUTURE".
* This parameter is covered in RFC 2445 Section 4.2.13
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidRangeParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidRangeParamTest(String name) throws Throwable
{
super("InvalidRangeParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
RangeParam r1 = new RangeParam();
r1.setValue("NOT-THISANDPRIOR");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRangeParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
RangeParam r1 = new RangeParam("NOT-THISANDPRIOR");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRangeParamTest.oneArg");
}
/**
* This method runs the test.
@throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/rangeparam/ValidRangeParamTest.java
Index: ValidRangeParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.rangeparam;
import org.apache.commons.periodicity.ical.parameters.RangeParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that valid inputs to the
* RangeParam class can be set and retrieved correctly. The
* valid values for this parameter are "THISANDPRIOR"
* and "THISANDFUTURE".
* This parameter is covered in RFC 2445 Section 4.2.13
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class ValidRangeParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
*/
public ValidRangeParamTest(String name) throws Throwable
{
super("ValidRangeParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor and the set/get
* methods.
*/
public void test_NoArgConstructor() throws ICalendarException
{
RangeParam r1 = new RangeParam();
r1.setValue("THISANDPRIOR");
assertEquals(r1.getValue(), "THISANDPRIOR");
RangeParam r2 = new RangeParam();
r2.setValue("THISANDFUTURE");
assertEquals(r2.getValue(), "THISANDFUTURE");
RangeParam r3 = new RangeParam();
r3.setValue(RangeParam.PRIOR_RANGE);
assertEquals(r3.getValue(), RangeParam.PRIOR_RANGE);
RangeParam r4 = new RangeParam();
r4.setValue(RangeParam.FUTURE_RANGE);
assertEquals(r4.getValue(), RangeParam.FUTURE_RANGE);
}
/**
* This method tests the one-arg constructor and the get
* methods.
*/
public void test_OneArgConstructor() throws ICalendarException
{
RangeParam r1 = new RangeParam("THISANDPRIOR");
assertEquals(r1.getValue(), "THISANDPRIOR");
RangeParam r2 = new RangeParam("THISANDFUTURE");
assertEquals(r2.getValue(), "THISANDFUTURE");
RangeParam r3 = new RangeParam(RangeParam.PRIOR_RANGE);
assertEquals(r3.getValue(), RangeParam.PRIOR_RANGE);
RangeParam r4 = new RangeParam(RangeParam.FUTURE_RANGE);
assertEquals(r4.getValue(), RangeParam.FUTURE_RANGE);
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/relatedparam/InvalidRelatedParamTest.java
Index: InvalidRelatedParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.relatedparam;
import org.apache.commons.periodicity.ical.parameters.RelatedParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* RelatedParam class cause an exception to be thrown. The
* valid values for this parameter are "START" and "END".
* This parameter is covered in RFC 2445 Section 4.2.14
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidRelatedParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidRelatedParamTest(String name) throws Throwable
{
super("InvalidRelatedParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
RelatedParam r1 = new RelatedParam();
r1.setValue("NOT-START");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRelatedParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
RelatedParam r1 = new RelatedParam("NOT-START");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRelatedParamTest.oneArg");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/relatedparam/ValidRelatedParamTest.java
Index: ValidRelatedParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.relatedparam;
import org.apache.commons.periodicity.ical.parameters.RelatedParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that valid inputs to the
* RelatedParam class can be set and retrieved correctly. The
* valid values for this parameter are "START" and "END".
* This parameter is covered in RFC 2445 Section 4.2.14
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class ValidRelatedParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
*/
public ValidRelatedParamTest(String name) throws Throwable
{
super("ValidRelatedParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor and the set/get
* methods.
*/
public void test_NoArgConstructor() throws ICalendarException
{
RelatedParam r1 = new RelatedParam();
r1.setValue("START");
assertEquals(r1.getValue(), "START");
RelatedParam r2 = new RelatedParam();
r2.setValue("END");
assertEquals(r2.getValue(), "END");
RelatedParam r3 = new RelatedParam();
r3.setValue(RelatedParam.START_TRIGGER);
assertEquals(r3.getValue(), RelatedParam.START_TRIGGER);
RelatedParam r4 = new RelatedParam();
r4.setValue(RelatedParam.END_TRIGGER);
assertEquals(r4.getValue(), RelatedParam.END_TRIGGER);
}
/**
* This method tests the one-arg constructor and the get
* methods.
*/
public void test_OneArgConstructor() throws ICalendarException
{
RelatedParam r1 = new RelatedParam("START");
assertEquals(r1.getValue(), "START");
RelatedParam r2 = new RelatedParam("END");
assertEquals(r2.getValue(), "END");
RelatedParam r3 = new RelatedParam(RelatedParam.START_TRIGGER);
assertEquals(r3.getValue(), RelatedParam.START_TRIGGER);
RelatedParam r4 = new RelatedParam(RelatedParam.END_TRIGGER);
assertEquals(r4.getValue(), RelatedParam.END_TRIGGER);
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/relationship/InvalidRelationshipTest.java
Index: InvalidRelationshipTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.relationship;
import org.apache.commons.periodicity.ical.parameters.Relationship;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* Relationship class cause an exception to be thrown. The
* valid values for this parameter are "PARENT", "CHILD" and
* "SIBLING".
* This parameter is covered in RFC 2445 Section 4.2.15
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidRelationshipTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidRelationshipTest(String name) throws Throwable
{
super("InvalidRelationshipTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
Relationship r1 = new Relationship();
r1.setValue("NOT-PARENT");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRelatedParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
Relationship r1 = new Relationship("NOT-PARENT");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRelatedParamTest.oneArg");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/roleparam/InvalidRoleParamTest.java
Index: InvalidRoleParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.roleparam;
import org.apache.commons.periodicity.ical.parameters.RoleParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* Participation class cause an exception to be thrown. The
* valid values for this parameter are "CHAIR", "REQ-PARTICIPANT",
* "OPT-PARTICIPANT", AND "NON-PARTICIPANT".
* This parameter is covered in RFC 2445 Section 4.2.16.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidRoleParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidRoleParamTest(String name) throws Throwable
{
super("InvalidRoleParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
RoleParam e1 = new RoleParam();
e1.setValue("NOT-CHAIR");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
RoleParam e1 = new RoleParam("NOT-CHAIR");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.oneArg");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/rsvpparam/InvalidRsvpParamTest.java
Index: InvalidRsvpParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.rsvpparam;
import org.apache.commons.periodicity.ical.parameters.RsvpParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* RsvpParam class cause and exception to be thrown. The
* valid values for this parameter are "TRUE and "FALSE".
* This parameter is covered in RFC 2445 Section 4.2.17.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidRsvpParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidRsvpParamTest(String name) throws Throwable
{
super("InvalidRsvpParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
RsvpParam e1 = new RsvpParam();
e1.setValue("NOT-TRUE");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
RsvpParam e1 = new RsvpParam("NOT-TRUE");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.oneArg");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
1.4 +15 -201 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/usertype/ValidUserTypeTest.java
Index: ValidUserTypeTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/usertype/ValidUserTypeTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValidUserTypeTest.java 16 Mar 2002 23:56:26 -0000 1.3
+++ ValidUserTypeTest.java 13 May 2002 06:07:09 -0000 1.4
@@ -1,201 +1,15 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Jetspeed" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache" or
- * "Apache Jetspeed", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.commons.periodicity.test.usertype;
-
-import org.apache.commons.periodicity.ical.parameters.UserType;
-import org.apache.commons.periodicity.util.ICalendarException;
-import junit.framework.TestCase;
-import junit.framework.TestResult; //remove this line
-import java.lang.reflect.Array;
-
-/**
- * This class tests to ensure that a CUTYPE value passed into
- * the UserType class (org\apache\commons\periodicity\parameters\UserType)
- * is stored correctly and is valid when retrieved.
- * Valid user types include "INDIVIDUAL", "GROUP", "RESOURCE", "ROOM",
- * X-types and "UNKNOWN".
- * CUTYPE is covered in RFC2445 Section 4.2.3.
- * @author Mike George
- * <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
- */
-
-public class ValidUserTypeTest extends TestCase
-{
- public static final String[] VALUES = new String[]
- {
- "INDIVIDUAL", "GROUP", "RESOURCE", "ROOM", "UNKNOWN"
- };
-
- /**
- * This public constructor passes a String to the TestCase
- * constructor.
- * @param A name that helps uniquely identify the test, i.e. a date, test#.
- */
- public ValidUserTypeTest(String name) throws Throwable
- {
- super("ValidUserTypeTest:" + name);
- runTest();
- }
-
- /**
- * This method passes a valid CUTYPE value to a UserType object using
- * the single parameter constructor in the UserType class.
- */
- public void test_useSingleArgConstructor() throws ICalendarException
- {
- final int length = Array.getLength(VALUES);
-
- for (int i = 0; i < length; i++)
- {
- UserType test = new UserType(VALUES[i]);
- TestCase.assertEquals(test.getValue(), VALUES[i]);
- }
- }
-
- /**
- * This method uses the setvalue method directly to pass in a valid
- * CUTYPE value.
- */
- public void test_useSetValue() throws ICalendarException
- {
- final int length = Array.getLength(VALUES);
- UserType test = new UserType();
-
- for (int i = 0; i < length; i++)
- {
- test.setValue(VALUES[i]);
- TestCase.assertEquals(test.getValue(), VALUES[i]);
- }
- }
-
- /**
- * This method tests to make sure that if a null value is
- * passed in, a null value is returned.
- */
- public void test_setNullValue() throws ICalendarException
- {
- //Using no-arg constructor
- UserType test = new UserType();
- TestCase.assertEquals(test.getValue(), null);
- }
-
- /**
- * This method passes in a valid parameter and then uses
- * the get<CUTYPE> method to validate the parameter.
- */
- public void test_setValidValue() throws ICalendarException
- {
- UserType test1 = new UserType("INDIVIDUAL");
- TestCase.assertEquals(test1.isIndividual(), true);
- TestCase.assertEquals(test1.isGroup(), false);
- TestCase.assertEquals(test1.isResource(), false);
- TestCase.assertEquals(test1.isRoom(), false);
- TestCase.assertEquals(test1.isUnknown(), false);
-
- UserType test2 = new UserType("GROUP");
- TestCase.assertEquals(test2.isIndividual(), false);
- TestCase.assertEquals(test2.isGroup(), true);
- TestCase.assertEquals(test2.isResource(), false);
- TestCase.assertEquals(test2.isRoom(), false);
- TestCase.assertEquals(test2.isUnknown(), false);
-
- UserType test3 = new UserType("RESOURCE");
- TestCase.assertEquals(test3.isIndividual(), false);
- TestCase.assertEquals(test3.isGroup(), false);
- TestCase.assertEquals(test3.isResource(), true);
- TestCase.assertEquals(test3.isRoom(), false);
- TestCase.assertEquals(test3.isUnknown(), false);
-
- UserType test4 = new UserType("ROOM");
- TestCase.assertEquals(test4.isIndividual(), false);
- TestCase.assertEquals(test4.isGroup(), false);
- TestCase.assertEquals(test4.isResource(), false);
- TestCase.assertEquals(test4.isRoom(), true);
- TestCase.assertEquals(test4.isUnknown(), false);
-
- UserType test5 = new UserType("UNKNOWN");
- TestCase.assertEquals(test5.isIndividual(), false);
- TestCase.assertEquals(test5.isGroup(), false);
- TestCase.assertEquals(test5.isResource(), false);
- TestCase.assertEquals(test5.isRoom(), false);
- TestCase.assertEquals(test5.isUnknown(), true);
- }
-
-
- /**
- * This method tests to make sure that an X-value can be set
- * and retrieved using both the single-arg and no-arg constructors
- */
- public void test_setXName() throws ICalendarException
- {
- UserType test1 = new UserType();
- test1.setValue("X-newOne");
- TestCase.assertEquals(test1.getValue(), "X-newOne");
-
- UserType test2 = new UserType("X-newTwo");
- TestCase.assertEquals(test2.getValue(), "X-newTwo");
- }
-
- /**
- * This method runs the test.
- */
- public void runTest() throws Throwable
- {
- test_useSingleArgConstructor();
- test_useSetValue();
- test_setNullValue();
- test_setValidValue();
- test_setXName();
- }
-}
+/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.usertype;
+import org.apache.commons.periodicity.ical.parameters.UserType;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
import junit.framework.TestResult; //remove this line
import java.lang.reflect.Array;
+/**
* This class tests to ensure that a CUTYPE value passed into
* the UserType class (org\apache\commons\periodicity\parameters\UserType)
* is stored correctly and is valid when retrieved.
* Valid user types include "INDIVIDUAL", "GROUP", "RESOURCE", "ROOM",
* X-types and "UNKNOWN".
* CUTYPE is covered in RFC2445 Section 4.2.3.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class ValidUserTypeTest extends TestCase
{
public static final String[] VALUES = new String[]
{
"INDIVIDUAL", "GROUP", "RESOURCE", "ROOM", "UNKNOWN"
};
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
*/
public ValidUserTypeTest(String name) throws Throwable
{
super("ValidUserTypeTest:" + name);
runTest();
}
+ /**
* This method passes a valid CUTYPE value to a UserType object using
* the single parameter constructor in the UserType class.
*/
public void test_useSingleArgConstructor() throws ICalendarException
{
final int length = Array.getLength(VALUES);
+ for (int i = 0; i < length; i++)
{
UserType test = new UserType(VALUES[i]);
TestCase.assertEquals(test.getValue(), VALUES[i]);
}
}
+ /**
* This method uses the setvalue method directly to pass in a valid
* CUTYPE value.
*/
public void test_useSetValue() throws ICalendarException
{
final int length = Array.getLength(VALUES);
UserType test = new UserType();
for (int i = 0; i < length; i++)
{
test.setValue(VALUES[i]);
TestCase.assertEquals(test.getValue(), VALUES[i]);
}
}
+ /**
* This method tests to make sure that if a null value is
* passed in, a null value is returned.
*/
public void test_setNullValue() throws ICalendarException
{
//Using no-arg constructor
UserType test = new UserType();
TestCase.assertEquals(test.getValue(), null);
}
+ /**
* This method passes in a valid parameter and then uses
* the get<CUTYPE> method to validate the parameter.
*/
public void test_setValidValue() throws ICalendarException
{
UserType test1 = new UserType("INDIVIDUAL");
TestCase.assertEquals(test1.isIndividual(), true);
TestCase.assertEquals(test1.isGroup(), false);
TestCase.assertEquals(test1.isResource(), false);
TestCase.assertEquals(test1.isRoom(), false);
TestCase.assertEquals(test1.isUnknown(), false);
+ UserType test2 = new UserType("GROUP");
TestCase.assertEquals(test2.isIndividual(), false);
TestCase.assertEquals(test2.isGroup(), true);
TestCase.assertEquals(test2.isResource(), false);
TestCase.assertEquals(test2.isRoom(), false);
TestCase.assertEquals(test2.isUnknown(), false);
+ UserType test3 = new UserType("RESOURCE");
TestCase.assertEquals(test3.isIndividual(), false);
TestCase.assertEquals(test3.isGroup(), false);
TestCase.assertEquals(test3.isResource(), true);
TestCase.assertEquals(test3.isRoom(), false);
TestCase.assertEquals(test3.isUnknown(), false);
+ UserType test4 = new UserType("ROOM");
TestCase.assertEquals(test4.isIndividual(), false);
TestCase.assertEquals(test4.isGroup(), false);
TestCase.assertEquals(test4.isResource(), false);
TestCase.assertEquals(test4.isRoom(), true);
TestCase.assertEquals(test4.isUnknown(), false);
+ UserType test5 = new UserType("UNKNOWN");
TestCase.assertEquals(test5.isIndividual(), false);
TestCase.assertEquals(test5.isGroup(), false);
TestCase.assertEquals(test5.isResource(), false);
TestCase.assertEquals(test5.isRoom(), false);
TestCase.assertEquals(test5.isUnknown(), true);
}
+ /**
* This method tests to make sure that an X-value can be set
* and retrieved using both the single-arg and no-arg constructors
*/
public void test_setXName() throws ICalendarException
{
UserType test1 = new UserType();
test1.setValue("X-newOne");
TestCase.assertEquals(test1.getValue(), "X-newOne");
+ UserType test2 = new UserType("X-newTwo");
TestCase.assertEquals(test2.getValue(), "X-newTwo");
}
+ /**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_useSingleArgConstructor();
test_useSetValue();
test_setNullValue();
test_setValidValue();
test_setXName();
}
}
\ No newline at end of file
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/usertype/InvalidUserTypeTest.java
Index: InvalidUserTypeTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.usertype;
import org.apache.commons.periodicity.ical.parameters.UserType;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
import junit.framework.TestResult; //remove this line
import java.lang.reflect.Array;
/**
* This class tests to ensure that an invalid CUTYPE value passed into
* the UserType class (org\apache\commons\periodicity\parameters\UserType)
* throws an exception.
* Valid user types include "INDIVIDUAL", "GROUP", "RESOURCE", "ROOM",
* X-types and "UNKNOWN".
* CUTYPE is covered in RFC2445 Section 4.2.3.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidUserTypeTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidUserTypeTest(String name) throws Throwable
{
super("InvalidUserTypeTest:" + name);
runTest();
}
/**
* This method passes an invalid CUTYPE value to a UserType object using
* the single parameter constructor in the UserType class.
* @throws ICalendarException
*/
public void test_useSingleArgConstructor() throws ICalendarException
{
try
{
UserType test = new UserType("NOT-INDIVIDUAL");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidUserTypeTest.useSingleArg");
}
/**
* This method uses the setvalue method directly to pass in an invalid
* CUTYPE value.
* @throws ICalendarException
*/
public void test_useSetValue() throws ICalendarException
{
try
{
UserType test = new UserType();
test.setValue("NOT-INDIVIDUAL");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidUserTypeTest.useSetValue");
}
/**
* This method runs the test.
* @throws Throwable
*/
public void runTest() throws Throwable
{
test_useSingleArgConstructor();
test_useSetValue();
}
}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/valueparam/InvalidValueParamTest.java
Index: InvalidValueParamTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.periodicity.test.valueparam;
import org.apache.commons.periodicity.ical.parameters.ValueParam;
import org.apache.commons.periodicity.util.ICalendarException;
import junit.framework.TestCase;
/**
* This class tests to ensure that invalid inputs to the
* ValueParam class cause and exception to be thrown. Valid values
* are "BINARY", "BOOLEAN", "CAL-ADDRESS", "DATE", "DATE-TIME",
* "DURATION", "FLOAT", "INTEGER", "PERIOD", "RECUR", "TEXT",
* "TIME", "URI", and "UTC-OFFSET".
* This parameter is covered in RFC 2445 Section 4.2.20.
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class InvalidValueParamTest extends TestCase
{
/**
* This public constructor passes a String to the TestCase
* constructor.
* @param A name that helps uniquely identify the test, i.e. a date, test#.
* @throws Throwable
*/
public InvalidValueParamTest(String name) throws Throwable
{
super("InvalidValueParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor.
* @throws ICalendarException
*/
public void test_NoArgConstructor() throws ICalendarException
{
try
{
ValueParam e1 = new ValueParam();
e1.setValue("NOT-BINARY");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.noArg");
}
/**
* This method tests the one-arg constructor.
* @throws ICalendarException
*/
public void test_OneArgConstructor() throws ICalendarException
{
try
{
ValueParam e1 = new ValueParam("NOT-BINARY");
}
catch (ICalendarException e)
{
return;
}
fail("Expected ICalendarException in InvalidRoleParamTest.oneArg");
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>