org.dmfs.rfc5545.recur.InvalidRecurrenceRuleException Java Examples
The following examples show how to use
org.dmfs.rfc5545.recur.InvalidRecurrenceRuleException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RRuleFieldAdapter.java From opentasks-provider with Apache License 2.0 | 6 votes |
@Override public RecurrenceRule getFrom(Cursor cursor) { int columnIdx = cursor.getColumnIndex(mFieldName); if (columnIdx < 0) { throw new IllegalArgumentException("The column '" + mFieldName + "' is missing in cursor."); } if (cursor.isNull(columnIdx)) { return null; } try { return new RecurrenceRule(cursor.getString(columnIdx)); } catch (InvalidRecurrenceRuleException e) { throw new IllegalArgumentException("can not parse RRULE '" + cursor.getString(columnIdx) + "'", e); } }
Example #2
Source File: RRuleFieldAdapter.java From opentasks-provider with Apache License 2.0 | 6 votes |
@Override public RecurrenceRule getFrom(ContentValues values) { String rrule = values.getAsString(mFieldName); if (rrule == null) { return null; } try { return new RecurrenceRule(rrule); } catch (InvalidRecurrenceRuleException e) { throw new IllegalArgumentException("can not parse RRULE '" + rrule + "'", e); } }
Example #3
Source File: RRuleFieldAdapter.java From opentasks with Apache License 2.0 | 6 votes |
@Override public RecurrenceRule getFrom(Cursor cursor) { int columnIdx = cursor.getColumnIndex(mFieldName); if (columnIdx < 0) { throw new IllegalArgumentException("The column '" + mFieldName + "' is missing in cursor."); } if (cursor.isNull(columnIdx)) { return null; } try { return new RecurrenceRule(cursor.getString(columnIdx)); } catch (InvalidRecurrenceRuleException e) { throw new IllegalArgumentException("can not parse RRULE '" + cursor.getString(columnIdx) + "'", e); } }
Example #4
Source File: RRuleFieldAdapter.java From opentasks with Apache License 2.0 | 6 votes |
@Override public RecurrenceRule getFrom(ContentValues values) { String rrule = values.getAsString(mFieldName); if (rrule == null) { return null; } try { return new RecurrenceRule(rrule); } catch (InvalidRecurrenceRuleException e) { throw new IllegalArgumentException("can not parse RRULE '" + rrule + "'", e); } }
Example #5
Source File: RecurrenceSetIteratorTest.java From lib-recur with Apache License 2.0 | 5 votes |
/** * See https://github.com/dmfs/lib-recur/issues/61 */ @Test public void testMultipleRulesWithFastForward() throws InvalidRecurrenceRuleException { DateTime start = new DateTime(DateTime.UTC, 2019, 1, 1, 0, 0, 0); // Combine all Recurrence Rules into a RecurrenceSet RecurrenceSet ruleSet = new RecurrenceSet(); ruleSet.addInstances(new RecurrenceRuleAdapter(new RecurrenceRule("FREQ=HOURLY;INTERVAL=5"))); ruleSet.addInstances(new RecurrenceRuleAdapter(new RecurrenceRule("FREQ=DAILY;INTERVAL=1"))); // Create an iterator using the RecurrenceSet RecurrenceSetIterator it = ruleSet.iterator(start.getTimeZone(), start.getTimestamp()); // Fast forward to the time of calculation (1/1/2019 at 10pm). it.fastForward(new DateTime(DateTime.UTC, 2019, 1, 1, 22, 0, 0).getTimestamp()); assertThat(() -> it::next, startsWith( new DateTime(DateTime.UTC, 2019, 1, 2, 0, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 1, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 6, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 11, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 16, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 21, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 3, 0, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 3, 2, 0, 0).getTimestamp() )); }
Example #6
Source File: TaskProviderTest.java From opentasks with Apache License 2.0 | 5 votes |
/** * Create task with start and due, check datetime values including generated duration. */ @Test public void testInsertTaskWithoutStartAndDueButRRULE() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TitleData("test"), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX))))), resultsIn(mClient, new Assert<>(task, new Composite<>( new TitleData("test"), new VersionData(0))), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new Composite<>( new CharSequenceRowData<>(Tasks.TITLE, "test"), new InstanceTestData( absent(), absent(), absent(), 0), new CharSequenceRowData<>(Tasks.TZ, null)) ))); }
Example #7
Source File: SingularityValidator.java From Singularity with Apache License 2.0 | 5 votes |
private void checkForValidRFC5545Schedule(String schedule) { try { new RecurrenceRule(schedule); } catch (InvalidRecurrenceRuleException ex) { badRequest( "Schedule %s is not a valid RFC5545 schedule, error is: %s", schedule, ex ); } }
Example #8
Source File: RecurrenceSetIteratorTest.java From lib-recur with Apache License 2.0 | 5 votes |
/** * See https://github.com/dmfs/lib-recur/issues/61 */ @Test public void testMultipleRules() throws InvalidRecurrenceRuleException { DateTime start = new DateTime(DateTime.UTC, 2019, 1, 1, 0, 0, 0); // Combine all Recurrence Rules into a RecurrenceSet RecurrenceSet ruleSet = new RecurrenceSet(); ruleSet.addInstances(new RecurrenceRuleAdapter(new RecurrenceRule("FREQ=HOURLY;INTERVAL=5"))); ruleSet.addInstances(new RecurrenceRuleAdapter(new RecurrenceRule("FREQ=DAILY;INTERVAL=1"))); // Create an iterator using the RecurrenceSet RecurrenceSetIterator it = ruleSet.iterator(start.getTimeZone(), start.getTimestamp()); assertThat(() -> it::next, startsWith( new DateTime(DateTime.UTC, 2019, 1, 1, 0, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 1, 5, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 1, 10, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 1, 15, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 1, 20, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 0, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 1, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 6, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 11, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 16, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 2, 21, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 3, 0, 0, 0).getTimestamp(), new DateTime(DateTime.UTC, 2019, 1, 3, 2, 0, 0).getTimestamp() )); }
Example #9
Source File: RFC5545Schedule.java From Singularity with Apache License 2.0 | 5 votes |
public RFC5545Schedule(String schedule) throws InvalidRecurrenceRuleException { // DTSTART is RFC5545 but NOT in the recur string, but its a nice to have? :) Pattern pattern = Pattern.compile("DTSTART=([0-9]{8}T[0-9]{6})"); Matcher matcher = pattern.matcher(schedule); if (matcher.find()) { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss"); this.dtStart = formatter.parseDateTime(matcher.group(1)); this.recurrenceRule = new RecurrenceRule(matcher.replaceAll("").replace("RRULE:", "")); } else { this.recurrenceRule = new RecurrenceRule(schedule); this.dtStart = org.joda.time.DateTime.now().withSecondOfMinute(0); } }
Example #10
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and RDATEs. */ @Test public void testRDate() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RDatesTaskData(new Seq<>(start, second, third, fourth, fifth)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RDATE, "20180104T123456Z," + "20180105T123456Z," + "20180106T123456Z," + "20180107T123456Z," + "20180108T123456Z" ))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #11
Source File: SingularityJobPoller.java From Singularity with Apache License 2.0 | 4 votes |
private Optional<Long> getExpectedRuntime( SingularityRequest request, SingularityTaskId taskId ) { if (request.getScheduledExpectedRuntimeMillis().isPresent()) { return request.getScheduledExpectedRuntimeMillis(); } else { final Optional<SingularityDeployStatistics> deployStatistics = deployManager.getDeployStatistics( taskId.getRequestId(), taskId.getDeployId() ); if ( deployStatistics.isPresent() && deployStatistics.get().getAverageRuntimeMillis().isPresent() ) { return deployStatistics.get().getAverageRuntimeMillis(); } String scheduleExpression = request.getScheduleTypeSafe() == ScheduleType.RFC5545 ? request.getSchedule().get() : request.getQuartzScheduleSafe(); Date nextRunAtDate; try { if (request.getScheduleTypeSafe() == ScheduleType.RFC5545) { final RFC5545Schedule rfc5545Schedule = new RFC5545Schedule(scheduleExpression); nextRunAtDate = rfc5545Schedule.getNextValidTime(); } else { final CronExpression cronExpression = new CronExpression(scheduleExpression); final Date startDate = new Date(taskId.getStartedAt()); nextRunAtDate = cronExpression.getNextValidTimeAfter(startDate); } if (nextRunAtDate == null) { String msg = String.format( "No next run date found for %s (%s)", taskId, scheduleExpression ); LOG.warn(msg); exceptionNotifier.notify(msg, ImmutableMap.of("taskId", taskId.toString())); return Optional.empty(); } } catch (ParseException | InvalidRecurrenceRuleException e) { LOG.warn( "Unable to parse schedule of type {} for expression {} (taskId: {}, err: {})", request.getScheduleTypeSafe(), scheduleExpression, taskId, e ); exceptionNotifier.notify( String.format("Unable to parse schedule (%s)", e.getMessage()), e, ImmutableMap.of( "taskId", taskId.toString(), "scheduleExpression", scheduleExpression, "scheduleType", request.getScheduleTypeSafe().toString() ) ); return Optional.empty(); } return Optional.of(nextRunAtDate.getTime() - taskId.getStartedAt()); } }
Example #12
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART, DUE and an RRULE. */ @Test public void testRRule() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp())) */) ); }
Example #13
Source File: TaskProviderDetachInstancesTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if two all-day instances of a task with a DTSTART, DUE, RRULE, RDATE and EXDATE are detached correctly. */ @Test public void testRRuleRDateCompleteWithExdatesAllDay() throws InvalidRecurrenceRuleException, RemoteException, OperationApplicationException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new Synced<>(mTestAccount, new TaskListsTable(mAuthority))); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 1, 0); DateTime start = DateTime.parse("20180104"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); OperationsQueue queue = new BasicOperationsQueue(mClient); queue.enqueue(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TitleData("Test-Task"), new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;INTERVAL=2;COUNT=2", RecurrenceRule.RfcMode.RFC2445_LAX)), new RDatesTaskData( new Seq<>( DateTime.parse("20180105"), DateTime.parse("20180107"))), new ExDatesTaskData( new Seq<>( DateTime.parse("20180104"), DateTime.parse("20180105"))))), // update the first non-closed instance new BulkUpdate<>(instancesTable, new StatusData<>(Tasks.STATUS_COMPLETED), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.DISTANCE_FROM_CURRENT, 0))) )); queue.flush(); Synced<Tasks> tasksTable = new Synced<>(mTestAccount, new TasksTable(mAuthority)); Synced<Instances> syncedInstances = new Synced<>(mTestAccount, instancesTable); assertThat(new Seq<>( // update the second instance new BulkUpdate<>(instancesTable, new StatusData<>(Tasks.STATUS_COMPLETED), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.DISTANCE_FROM_CURRENT, 0))) ), resultsIn(queue, /* * We expect five tasks: * - the original master deleted * - completed and deleted overrides for the first and second instance * - detached first and second instances */ // the first detached task instance: new Counted<>(1, new BulkAssert<>(syncedInstances, new Composite<>( new InstanceTestData(DateTime.parse("20180106"), DateTime.parse("20180107"), absent(), -1), new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED))), new AllOf<>( new EqArg<>(Instances.INSTANCE_START, DateTime.parse("20180106").getTimestamp()), new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // the original master has been deleted new Counted<>(0, new Assert<>(task, new Composite<>(new EmptyRowData<>()))), // there is no instance referring to the master new Counted<>(0, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // the second detached task instance: new Counted<>(1, new BulkAssert<>(syncedInstances, new Composite<>( new InstanceTestData(DateTime.parse("20180107"), DateTime.parse("20180108"), absent(), -1), new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED))), new AllOf<>( new EqArg<>(Instances.INSTANCE_START, DateTime.parse("20180107").getTimestamp()), new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // two completed instances, neither of them referring to the master new Counted<>(2, new BulkAssert<>( syncedInstances, new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED)), new AllOf<>( new EqArg<>(Instances.DISTANCE_FROM_CURRENT, -1), new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // five tasks in total (two deleted overrides, two detached ones and the old master) new Counted<>(5, new BulkAssert<>( tasksTable, new TitleData("Test-Task"), new AnyOf<>())), // three deleted tasks in total (the old overrides and the old master) new Counted<>(3, new BulkAssert<>( tasksTable, new TitleData("Test-Task"), new EqArg<>(Tasks._DELETED, 1))))); }
Example #14
Source File: TaskProviderDetachInstancesTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if two instances of a task with a DTSTART, DUE and an RRULE are detached correctly. */ @Test public void testRRuleCompleteAll() throws InvalidRecurrenceRuleException, RemoteException, OperationApplicationException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new Synced<>(mTestAccount, new TaskListsTable(mAuthority))); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); OperationsQueue queue = new BasicOperationsQueue(mClient); queue.enqueue(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TitleData("Test-Task"), new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=2", RecurrenceRule.RfcMode.RFC2445_LAX)))), // complete the first non-closed instance new BulkUpdate<>(instancesTable, new StatusData<>(Tasks.STATUS_COMPLETED), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.DISTANCE_FROM_CURRENT, 0))) )); queue.flush(); Synced<Tasks> tasksTable = new Synced<>(mTestAccount, new TasksTable(mAuthority)); Synced<Instances> syncedInstances = new Synced<>(mTestAccount, instancesTable); assertThat(new Seq<>( // update the second instance new BulkUpdate<>(instancesTable, new StatusData<>(Tasks.STATUS_COMPLETED), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.DISTANCE_FROM_CURRENT, 0))) ), resultsIn(queue, /* * We expect five tasks: * - the original master with updated RRULE, DTSTART and DUE, deleted * - a completed and deleted overrides for the first and second instance * - a detached first and second instance */ // the original master new Assert<>(task, new Composite<>( // points to former second instance before being deleted new TimeData<>(start.addDuration(day), due.addDuration(day)), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=1"), new CharSequenceRowData<>(Tasks._DELETED, "1"))), // there is no instance referring to the master because it has been fully completed (and deleted) new Counted<>(0, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // the first detached task instance: new Counted<>(1, new BulkAssert<>(syncedInstances, new Composite<>( new InstanceTestData(localStart, localDue, absent(), -1), new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED))), new AllOf<>( new EqArg<>(Instances.INSTANCE_START, start.getTimestamp()), new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // the second detached task instance: new Counted<>(1, new BulkAssert<>(syncedInstances, new Composite<>( new InstanceTestData(second, second.addDuration(new Duration(1, 0, 3600)), absent(), -1), new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED))), new AllOf<>( new EqArg<>(Instances.INSTANCE_START, second.getTimestamp()), new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // two instances total, both completed new Counted<>(2, new BulkAssert<>( syncedInstances, new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED)), new AnyOf<>())), // five tasks in total new Counted<>(5, new BulkAssert<>( tasksTable, new TitleData("Test-Task"), new AnyOf<>())), // three deleted tasks in total new Counted<>(3, new BulkAssert<>( tasksTable, new TitleData("Test-Task"), new EqArg<>(Tasks._DELETED, 1))))); }
Example #15
Source File: TaskProviderDetachInstancesTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if the first instance of a task with a DTSTART, DUE and an RRULE is correctly detached when completed. */ @Test public void testRRule() throws InvalidRecurrenceRuleException, RemoteException, OperationApplicationException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new Synced<>(mTestAccount, new TaskListsTable(mAuthority))); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); OperationsQueue queue = new BasicOperationsQueue(mClient); queue.enqueue(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))) )); queue.flush(); assertThat(new Seq<>( // update the first non-closed instance new BulkUpdate<>(instancesTable, new StatusData<>(Tasks.STATUS_COMPLETED), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.DISTANCE_FROM_CURRENT, 0))) ), resultsIn(queue, /* * We expect three tasks: * - the original master with updated RRULE, DTSTART and DUE * - a deleted instance * - a detached task */ // the original master new Assert<>(task, new Composite<>( new TimeData<>(start.addDuration(day), due.addDuration(day)), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=4"))), // there is one instance referring to the master (the old second instance, now first) new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // the detached task instance: new Counted<>(1, new BulkAssert<>(new Synced<>(mTestAccount, instancesTable), new Composite<>( new InstanceTestData(localStart, localDue, absent(), -1), new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED))), new Not<>(new ReferringTo<>(Instances.TASK_ID, task)))), // the deleted task (doesn't have an instance) new Counted<>(1, new BulkAssert<>(new Synced<>(mTestAccount, new TasksTable(mAuthority)), new Composite<>(new TimeData<>(start, due)), new AllOf<>( new ReferringTo<>(Tasks.ORIGINAL_INSTANCE_ID, task), new EqArg<>(Tasks._DELETED, 1)))), // the former 2nd instance (now first) new AssertRelated<>(new Synced<>(mTestAccount, instancesTable), Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())))); }
Example #16
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and RDATEs, complete first via instances table. */ @Test public void testRDateFirstCompleteViaInstances() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Tasks> tasksTable = new TasksTable(mAuthority); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, tasksTable)); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), // first insert the task new Put<>(task, new Composite<>( new TimeData<>(start, due), new RDatesTaskData(start, second, third, fourth, fifth))), // then complete the first instance new BulkUpdate<>(instancesTable, new CharSequenceRowData<>(Tasks.STATUS, String.valueOf(Tasks.STATUS_COMPLETED)), new AllOf<>( new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp())))), resultsIn(mClient, // we've already closed the first instance which has been detached, the master now points to the second instance new Counted<>(1, new Assert<>(task, new Composite<>( new TimeData<>(DateTime.parse("20180105T123456Z"), DateTime.parse("20180105T133456Z")), new RDatesTaskData( // "20180104T123456Z" // the detached instance DateTime.parse("20180105T123456Z"), DateTime.parse("20180106T123456Z"), DateTime.parse("20180107T123456Z"), DateTime.parse("20180108T123456Z"))))), // there must be one task which is not equal to the original task, it's the detached instance new Counted<>(1, new BulkAssert<>(tasksTable, new Composite<>( new TimeData<>(start, due), new StatusData<>(Tasks.STATUS_COMPLETED), new CharSequenceRowData<>(Tasks.ORIGINAL_INSTANCE_ID, null), new CharSequenceRowData<>(Tasks.ORIGINAL_INSTANCE_SYNC_ID, null), new CharSequenceRowData<>(Tasks.ORIGINAL_INSTANCE_TIME, null)), new Not<>(new ReferringTo<>(Tasks._ID, task)))), // and one instance which doesn't refer to the original task new Counted<>(1, new BulkAssert<>(instancesTable, new Not<>(new ReferringTo<>(Instances.TASK_ID, task)))), // but 4 instances of that original task // new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance, detached and completed new Counted<>(1, new BulkAssert<>(instancesTable, new Composite<>( new InstanceTestData(localStart, localDue, absent(), -1)), new AllOf<>( new IsNull<>(Instances.INSTANCE_ORIGINAL_TIME), // the detached instance has no INSTANCE_ORIGINAL_TIME new Not<>(new ReferringTo<>(Instances.TASK_ID, task))))), // 2nd instance: new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())))/*, // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #17
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and RDATEs, complete first inserted first. */ @Test public void testRDateFirstCompleteFirstInserted() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); RowSnapshot<Tasks> override = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), // first insert override new Put<>(override, new Composite<>( new TimeData<>(start, due), new OriginalInstanceSyncIdData("xyz", start), new StatusData<>(Tasks.STATUS_COMPLETED))), // then insert task new Put<>(task, new Composite<>( new SyncIdData("xyz"), new TimeData<>(start, due), new RDatesTaskData(new Seq<>(start, second, third, fourth, fifth)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new SyncIdData("xyz"), new CharSequenceRowData<>(Tasks.RDATE, "20180104T123456Z," + "20180105T123456Z," + "20180106T123456Z," + "20180107T123456Z," + "20180108T123456Z" ))), new Assert<>(override, new Composite<>( new TimeData<>(start, due), new OriginalInstanceSyncIdData("xyz", start), new StatusData<>(Tasks.STATUS_COMPLETED))), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, override)), // new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance, overridden and completed new AssertRelated<>(instancesTable, Instances.TASK_ID, override, new InstanceTestData(localStart, localDue, new Present<>(start), -1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp())), // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp()))/*, // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #18
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and RDATEs, complete first. */ @Test public void testRDateFirstComplete() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); RowSnapshot<Tasks> override = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), // first insert new task, new Put<>(task, new Composite<>( new TimeData<>(start, due), new RDatesTaskData(new Seq<>(start, second, third, fourth, fifth)))), // next, insert override new Put<>(override, new Composite<>( new TimeData<>(start, due), new OriginalInstanceData(task, start), new StatusData<>(Tasks.STATUS_COMPLETED))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RDATE, "20180104T123456Z," + "20180105T123456Z," + "20180106T123456Z," + "20180107T123456Z," + "20180108T123456Z" ))), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, override)), // new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, override, new InstanceTestData(localStart, localDue, new Present<>(start), -1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp())), // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp()))/*, // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #19
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and RDATEs, add exdate afterwards. */ @Test public void testRDateAddExDate() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RDatesTaskData(new Seq<>(start, second, third, fourth, fifth)))), // the third instance becomed an exdate now new Put<>(task, new Composite<>( new ExDatesTaskData(new Seq<>(third)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RDATE, "20180104T123456Z," + "20180105T123456Z," + "20180106T123456Z," + "20180107T123456Z," + "20180108T123456Z"), new CharSequenceRowData<>(Tasks.EXDATE, "20180106T123456Z" ))), // new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: // new AssertRelated<>(instancesTable, Instances.TASK_ID, task, // new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), // new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #20
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a timed DTSTART, DUE and a floating RRULE UNTIL. * <p> * Note, this combination should not be accepted by the provider. For the time being, however, it should be tolerated instead of causing a crash. */ @Test public void testRRuleWithFloatingMismatch() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;UNTIL=20180106", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;UNTIL=20180106"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp())) */) ); }
Example #21
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART, an RRULE and EXDATEs. */ @Test public void testRRuleWithExDates() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)), new ExDatesTaskData(new Seq<>(third, fifth)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"), new CharSequenceRowData<>(Tasks.EXDATE, "20180106T123456Z,20180108T123456Z"))), // new Counted<>(3, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 4th instance (now 3rd): new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp()))*/) ); }
Example #22
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test RRULE with overridden instance (via update on the instances table). This time we don't override the date time fields and expect the instance to * inherit the original instance start and due (instead of the master start and due) */ @Ignore("Test tries to override the 3rd instance which has not been created because we currently only expand one instance.") @Test public void testRRuleWithOverride2() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Tasks> tasksTable = new TasksTable(mAuthority); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, tasksTable)); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new TitleData("original"), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))), // the override just changes the title new BulkUpdate<>(instancesTable, new Composite<>( new CharSequenceRowData<Instances>(Tasks.TITLE, "override")), new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp()))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.TITLE, "original"), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), new AssertRelated<>(tasksTable, Tasks.ORIGINAL_INSTANCE_ID, task, new Composite<>( // note the task table contains the original time zone, not the default one new TimeData<>(third.shiftTimeZone(start.getTimeZone()), third.shiftTimeZone(start.getTimeZone()).addDuration(hour)), new CharSequenceRowData<>(Tasks.TITLE, "override"), new OriginalInstanceData(task, third))), new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.ORIGINAL_INSTANCE_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp())), // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3th instance (the overridden one). We don't have a row reference to this row, so we select it by the ORIGINAL_INSTANCE-ID new AssertRelated<>(instancesTable, Tasks.ORIGINAL_INSTANCE_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))) ); }
Example #23
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test RRULE with overridden instance (inserted into the tasks table) */ @Test public void testRRuleWithOverride() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); RowSnapshot<Tasks> taskOverride = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new TitleData("original"), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))), // the override moves the instance by an hour new Put<>(taskOverride, new Composite<>( new TimeData<>(third.addDuration(hour), third.addDuration(hour).addDuration(hour)), new TitleData("override"), new OriginalInstanceData(task, third))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.TITLE, "original"), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), new Assert<>(taskOverride, new Composite<>( new TimeData<>(third.addDuration(hour), third.addDuration(hour).addDuration(hour)), new CharSequenceRowData<>(Tasks.TITLE, "override"), new OriginalInstanceData(task, third))), // new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, taskOverride)), new Counted<>(0, new AssertRelated<>(instancesTable, Instances.TASK_ID, taskOverride)), // new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3th instance (the overridden one): new AssertRelated<>(instancesTable, Instances.TASK_ID, taskOverride, new InstanceTestData(third.addDuration(hour), third.addDuration(hour).addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #24
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Remove an instance from a task with an RRULE. */ @Ignore("Test tries to delete 3rd instance which has not been created because currently only 1 instance is expanded") @Test public void testRRuleRemoveInstance() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration hour = new Duration(1, 0, 3600 /* 1 hour */); DateTime start = DateTime.parse("20180104T123456Z"); DateTime due = start.addDuration(hour); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))), // remove the third instance new BulkDelete<>(instancesTable, new AllOf<>(new ReferringTo<>(Instances.TASK_ID, task), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp()))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"), new CharSequenceRowData<>(Tasks.EXDATE, "20180106T123456Z"))), new Counted<>(4, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp())), // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 4th instance (now 3rd): new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance (now 4th): new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))) ); }
Example #25
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DTSTART and an RRULE but no DUE */ @Test public void testRRuleNoDue() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.parse("20180104T123456Z"); Duration day = new Duration(1, 1, 0); DateTime localStart = start.shiftTimeZone(TimeZone.getDefault()); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(new Present<>(localStart), absent(), new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(new Present<>(second), absent(), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(new Present<>(third), absent(), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(new Present<>(fourth), absent(), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(new Present<>(fifth), absent(), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #26
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with a DUE and an RRULE but no DTSTART. */ @Test public void testRRuleNoDtStart() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime due = DateTime.parse("20180104T123456Z"); Duration day = new Duration(1, 1, 0); DateTime localDue = due.shiftTimeZone(TimeZone.getDefault()); DateTime second = localDue.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new DueData<>(due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new DueData<>(due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(absent(), new Present<>(localDue), new Present<>(due), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, due.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(absent(), new Present<>(second), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(absent(), new Present<>(third), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(absent(), new Present<>(fourth), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(absent(), new Present<>(fifth), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp()))*/) ); }
Example #27
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with an all-day DTSTART, DUE and an RRULE with an absolute UNTIL * <p> * Note, this combination should not be accepted by the provider. For the time being, however, it should be tolerated instead of causing a crash. */ @Test public void testAllDayRRuleFloatingMismatch() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration days = new Duration(1, 2, 0); DateTime start = DateTime.parse("20180104"); DateTime due = start.addDuration(days); DateTime localStart = start; Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due; assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;UNTIL=20180106T120000Z", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;UNTIL=20180106T120000Z"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp())) */) ); }
Example #28
Source File: TaskProviderRecurrenceTest.java From opentasks with Apache License 2.0 | 4 votes |
/** * Test if instances of a task with an all-day DTSTART, DUE and an RRULE. */ @Test public void testAllDayRRule() throws InvalidRecurrenceRuleException { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); Table<Instances> instancesTable = new InstanceTable(mAuthority); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); Duration days = new Duration(1, 2, 0); DateTime start = DateTime.parse("20180104"); DateTime due = start.addDuration(days); DateTime localStart = start; Duration day = new Duration(1, 1, 0); DateTime second = localStart.addDuration(day); DateTime third = second.addDuration(day); DateTime fourth = third.addDuration(day); DateTime fifth = fourth.addDuration(day); DateTime localDue = due; assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<>()), new Put<>(task, new Composite<>( new TimeData<>(start, due), new RRuleTaskData(new RecurrenceRule("FREQ=DAILY;COUNT=5", RecurrenceRule.RfcMode.RFC2445_LAX)))) ), resultsIn(mClient, new Assert<>(task, new Composite<>( new TimeData<>(start, due), new CharSequenceRowData<>(Tasks.RRULE, "FREQ=DAILY;COUNT=5"))), // new Counted<>(5, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), new Counted<>(1, new AssertRelated<>(instancesTable, Instances.TASK_ID, task)), // 1st instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(localStart, localDue, new Present<>(start), 0), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, start.getTimestamp()))/*, // 2nd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(second, second.addDuration(hour), new Present<>(second), 1), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, second.getTimestamp())), // 3rd instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(third, third.addDuration(hour), new Present<>(third), 2), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, third.getTimestamp())), // 4th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fourth, fourth.addDuration(hour), new Present<>(fourth), 3), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fourth.getTimestamp())), // 5th instance: new AssertRelated<>(instancesTable, Instances.TASK_ID, task, new InstanceTestData(fifth, fifth.addDuration(hour), new Present<>(fifth), 4), new EqArg<>(Instances.INSTANCE_ORIGINAL_TIME, fifth.getTimestamp())) */) ); }