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/03/20 05:13:54 UTC
cvs commit: jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/vevent VEventSaveOnlyTest.java
prickett 02/03/19 20:13:54
Modified: periodicity build.properties
periodicity/src/java/org/apache/commons/periodicity/ical/vobjects
VEvent.java
periodicity/src/java/org/apache/commons/periodicity/test/vevent
VEventSaveOnlyTest.java
Log:
Added checks for the values of the parameters that are associated with the
vevents in VEventSaveOnlyTest.
This exercise was the first bug that our JUnit test suite found in the code!!!
It has been fixed.
Revision Changes Path
1.5 +1 -1 jakarta-commons-sandbox/periodicity/build.properties
Index: build.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/build.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- build.properties 18 Mar 2002 05:55:37 -0000 1.4
+++ build.properties 20 Mar 2002 04:13:53 -0000 1.5
@@ -23,7 +23,7 @@
# Default: none
# -------------------------------------------------------------------
-database = mysql
+database=mysql
# --------------------------------------------------------------------
#
1.2 +1 -1 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/ical/vobjects/VEvent.java
Index: VEvent.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/ical/vobjects/VEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- VEvent.java 16 Mar 2002 23:56:25 -0000 1.1
+++ VEvent.java 20 Mar 2002 04:13:53 -0000 1.2
@@ -475,7 +475,7 @@
evt.setDtendDate(getEndTimeProp().getDate().getTime()
.getTime());
}
- if(getEndTimeProp().getDateTime() != null &&
+ if(getEndTimeProp().getDateTime() != null ||
getEndTimeProp().getDate() != null)
{
evt.setDtendTzid(getEndTimeProp().getTimeZoneIDVal());
1.5 +87 -0 jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/vevent/VEventSaveOnlyTest.java
Index: VEventSaveOnlyTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test/vevent/VEventSaveOnlyTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VEventSaveOnlyTest.java 18 Mar 2002 05:29:30 -0000 1.4
+++ VEventSaveOnlyTest.java 20 Mar 2002 04:13:54 -0000 1.5
@@ -75,6 +75,7 @@
import org.apache.commons.periodicity.ical.properties.Priority;
import org.apache.commons.periodicity.ical.properties.Dtend;
import org.apache.commons.periodicity.ical.properties.Transparency;
+import org.apache.commons.periodicity.ical.parameters.RangeParam;
import org.apache.commons.periodicity.ical.vobjects.VEvent;
import org.apache.commons.periodicity.types.VDuration;
import junit.framework.TestCase;
@@ -141,11 +142,13 @@
protected void setUp() throws Exception
{
+ System.err.println("Setting up VEventSaveOnlyTest");
Torque.init("./test.properties");
}
protected void tearDown() throws Exception
{
+ System.err.println("Tearing down VEventSaveOnlyTest");
Torque.shutdown();
}
@@ -156,6 +159,7 @@
*/
protected void saveVEvent() throws Exception
{
+ System.err.println("Running VEventSaveOnlyTest.");
try
{
/* This first event that will be testing all of the primary values
@@ -214,6 +218,7 @@
RecurID recurid = new RecurID();
recurid.setDateTime(recuridTime);
recurid.setTimeZoneID(RECURID_TZID);
+ recurid.setRangeParameter(RangeParam.FUTURE_RANGE);
evt.setRecurID(recurid);
Sequence sequence = new Sequence(SEQUENCE_VALUE);
evt.setSequenceProp(sequence);
@@ -247,7 +252,9 @@
Transparency trans =
new Transparency(Transparency.TRANSPARENT_TRANSP);
evt.setTransProp(trans);
+ System.err.println("About to save first event.");
evt.save();
+ System.err.println("Just finished saving the first event.");
Properties props = new Properties();
props.load(new FileInputStream("./test.properties"));
Connection conn = DriverManager.getConnection(
@@ -408,6 +415,86 @@
BasePeriodicityVeventsPeer.LOCATION));
assertEquals(evt.getPriority(), rs.getInt(
BasePeriodicityVeventsPeer.PRIORITY));
+ if(evt.getStartProp() != null)
+ {
+ assertEquals(evt.getStartProp().getTimeZoneIDVal(),
+ rs.getString(BasePeriodicityVeventsPeer.DTSTART_TZID));
+ }
+ else
+ {
+ fail("evt.getStartProp() == null");
+ }
+ if(evt.getOrganizerProp() != null)
+ {
+ assertEquals(evt.getOrganizerProp().getCommonNameVal(),
+ rs.getString(BasePeriodicityVeventsPeer.ORGANIZER_NAME));
+ assertEquals(evt.getOrganizerProp().getDirectoryParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.ORGANIZER_DIR));
+ assertEquals(evt.getOrganizerProp().getSentByParameterVal(),
+ rs.getString(
+ BasePeriodicityVeventsPeer.ORGANIZER_SENTBY));
+ assertEquals(evt.getOrganizerProp().getLanguageParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.ORGANIZER_LANG));
+ }
+ else
+ {
+ fail("evt.getOrganizer() == null");
+ }
+ if(evt.getDescProp() != null)
+ {
+ assertEquals(evt.getDescProp().getAltRepVal(),
+ rs.getString(BasePeriodicityVeventsPeer.DESC_ALT_REP));
+ assertEquals(evt.getDescProp().getLanguageParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.DESC_LANG));
+ }
+ else
+ {
+ fail("evt.getDescProp() == null");
+ }
+ if(evt.getRecurID() != null)
+ {
+ assertEquals(evt.getRecurID().getRangeParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.RECUR_ID_RANGE));
+ assertEquals(evt.getRecurID().getTimeZoneIDVal(),
+ rs.getString(BasePeriodicityVeventsPeer.RECUR_ID_TZID));
+ }
+ else
+ {
+ fail("evt.getRecurID() == null");
+ }
+ if(evt.getSummaryProp() != null)
+ {
+ assertEquals(evt.getSummaryProp().getAltRepVal(),
+ rs.getString(
+ BasePeriodicityVeventsPeer.SUMMARY_ALT_REP));
+ assertEquals(evt.getSummaryProp().getLanguageParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.SUMMARY_LANG));
+ }
+ else
+ {
+ fail("evt.getSumaryProp() == null");
+ }
+ if(evt.getLocationProp() != null)
+ {
+ assertEquals(evt.getLocationProp().getAltRepVal(),
+ rs.getString(
+ BasePeriodicityVeventsPeer.LOCATION_ALT_REP));
+ assertEquals(evt.getLocationProp().getLanguageParameterVal(),
+ rs.getString(BasePeriodicityVeventsPeer.LOCATION_LANG));
+ }
+ else
+ {
+ fail("evt.getLocationProp() == null");
+ }
+ if(evt.getEndTimeProp() != null)
+ {
+ assertEquals(evt.getEndTimeProp().getTimeZoneIDVal(),
+ rs.getString(BasePeriodicityVeventsPeer.DTEND_TZID));
+ }
+ else
+ {
+ fail("evt.getEndTimeProp() == null");
+ }
}
else if(evt == null)
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>