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/04/03 06:38:24 UTC
cvs commit: jakarta-commons-sandbox/periodicity/src/xml/schema vtimezone.xsd
prickett 02/04/02 20:38:24
Modified: periodicity/src/java/org/apache/commons/periodicity/test
ParamTests.java
periodicity/src/xml/schema vtimezone.xsd
Added: periodicity/src/java/org/apache/commons/periodicity/test/encodingparam
ValidEncodingParamTest.java
Log:
Contributed by Mike George - Thanks Mike for your hard work!!!
Correction to the time zone schema to handle an unexpected case
New test to test that you can set/get valid encoding parameter values
Addition to the ParamTests to run the ValidEncodingParamTest.
Revision Changes Path
1.2 +95 -93 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParamTests.java 11 Mar 2002 06:30:00 -0000 1.1
+++ ParamTests.java 3 Apr 2002 04:38:24 -0000 1.2
@@ -1,93 +1,95 @@
-/* ====================================================================
- * 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 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));
- return ts;
- }
- catch(Throwable t)
- {
- System.out.println("Throwable thrown in ParamTests.suite() method.");
- }
- return ts;
- }
-}
+/* ====================================================================
+ * 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;
+ }
+}
1.1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/encodingparam/ValidEncodingParamTest.java
Index: ValidEncodingParamTest.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 valid inputs to the
* EncodingParam class can be set and retrieved correctly. The
* valid values for this parameter are "8BIT", "BASE64", iana-token, and
* x-name. This parameter is covered in RFC 2445 Section 4.2.7
* @author Mike George
* <a href="mailto:javajoe2975@comcast.net">javajoe2975@comcast.net</a>
*/
public class ValidEncodingParamTest 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 ValidEncodingParamTest(String name) throws Throwable
{
super("ValidTZIDParamTest:" + name);
runTest();
}
/**
* This method tests the no-arg constructor and the set/get
* methods.
* @param A valid Encoding Parameter value
*/
public void test_NoArgConstructor() throws ICalendarException
{
//Test the no arg constructor alone
EncodingParam first = new EncodingParam();
assertEquals(first.getValue(), null);
//Test the set/get BASE64 string entry
EncodingParam e1 = new EncodingParam();
e1.setValue("BASE64");
assertEquals(e1.getValue(), "BASE64");
//Test the set/get 8BIT string entry
EncodingParam e2 = new EncodingParam();
e2.setValue("8BIT");
assertEquals(e2.getValue(), "8BIT");
//Test using the constant variables
EncodingParam e3 = new EncodingParam();
e3.setValue(EncodingParam.BASE_64_ENCODING);
assertEquals(e3.getValue(), EncodingParam.BASE_64_ENCODING);
EncodingParam e4 = new EncodingParam();
e4.setValue(EncodingParam.EIGHT_BIT_ENCODING);
assertEquals(e4.getValue(), EncodingParam.EIGHT_BIT_ENCODING);
//Test for X-Name case
EncodingParam e5 = new EncodingParam();
e5.setValue("X-TEST");
assertEquals(e5.getValue(), "X-TEST");
}
/**
* This method tests the no-arg constructor and the set/get
* methods.
* @param A valid Encoding Parameter value
*/
public void test_OneArgConstructor() throws ICalendarException
{
//Test the set/get BASE64 string entry
EncodingParam e1 = new EncodingParam("BASE64");
assertEquals(e1.getValue(), "BASE64");
//Test the set/get 8BIT string entry
EncodingParam e2 = new EncodingParam("8BIT");
assertEquals(e2.getValue(), "8BIT");
//Test using the constant variables
EncodingParam e3 = new EncodingParam(EncodingParam.BASE_64_ENCODING);
assertEquals(e3.getValue(), EncodingParam.BASE_64_ENCODING);
EncodingParam e4 = new EncodingParam(EncodingParam.EIGHT_BIT_ENCODING);
assertEquals(e4.getValue(), EncodingParam.EIGHT_BIT_ENCODING);
//Test for X-Name case
EncodingParam e5 = new EncodingParam("X-TEST");
assertEquals(e5.getValue(), "X-TEST");
}
/**
* Test to make sure that the isEightBit() and
* isBase64() methods work correctly.
*/
public void test_EncodingType() throws ICalendarException
{
boolean t = true;
boolean f = false;
EncodingParam e1 = new EncodingParam("8BIT");
assertEquals(e1.isEightBit(), t);
assertEquals(e1.isEightBit(), f);
EncodingParam e2 = new EncodingParam("BASE64");
assertEquals(e2.isBase64(), t);
assertEquals(e2.isBase64(), f);
}
/**
* This method runs the test.
*/
public void runTest() throws Throwable
{
test_NoArgConstructor();
test_OneArgConstructor();
test_EncodingType();
}
}
1.2 +10 -1 jakarta-commons-sandbox/periodicity/src/xml/schema/vtimezone.xsd
Index: vtimezone.xsd
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/xml/schema/vtimezone.xsd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vtimezone.xsd 26 Mar 2002 10:30:04 -0000 1.1
+++ vtimezone.xsd 3 Apr 2002 04:38:24 -0000 1.2
@@ -33,7 +33,16 @@
5. TZSHORTNAME should be the abbreviated form of the TZLONGNAME,
i.e. EST, CST.
-->
- <xsd:element name="VTIMEZONE" type="UniqueTimeZone"/>
+ <xsd:element name="VTIMEZONES" type="ManyZones"/>
+ <xsd:complexType name="ManyZones">
+ <xsd:sequence>
+ <xsd:element name="VTIMEZONE" type="UniqueTimeZone"
+ minOccurs="1"
+ maxOccurs="unbounded"
+ />
+ </xsd:sequence>
+ </xsd:complexType>
+
<xsd:complexType name="UniqueTimeZone">
<xsd:sequence>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>