diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandler.kt similarity index 74% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandler.kt index 7c34c95d..03bd54ed 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandler.kt @@ -10,27 +10,27 @@ import android.content.Entity import android.provider.CalendarContract.Events import android.provider.CalendarContract.ExtendedProperties import at.bitfire.synctools.icalendar.AssociatedEvents -import at.bitfire.synctools.mapping.calendar.processor.AccessLevelProcessor -import at.bitfire.synctools.mapping.calendar.processor.AndroidEventFieldProcessor -import at.bitfire.synctools.mapping.calendar.processor.AttendeesProcessor -import at.bitfire.synctools.mapping.calendar.processor.AvailabilityProcessor -import at.bitfire.synctools.mapping.calendar.processor.CategoriesProcessor -import at.bitfire.synctools.mapping.calendar.processor.ColorProcessor -import at.bitfire.synctools.mapping.calendar.processor.DescriptionProcessor -import at.bitfire.synctools.mapping.calendar.processor.DurationProcessor -import at.bitfire.synctools.mapping.calendar.processor.EndTimeProcessor -import at.bitfire.synctools.mapping.calendar.processor.LocationProcessor -import at.bitfire.synctools.mapping.calendar.processor.OrganizerProcessor -import at.bitfire.synctools.mapping.calendar.processor.OriginalInstanceTimeProcessor -import at.bitfire.synctools.mapping.calendar.processor.RecurrenceFieldsProcessor -import at.bitfire.synctools.mapping.calendar.processor.RemindersProcessor -import at.bitfire.synctools.mapping.calendar.processor.SequenceProcessor -import at.bitfire.synctools.mapping.calendar.processor.StartTimeProcessor -import at.bitfire.synctools.mapping.calendar.processor.StatusProcessor -import at.bitfire.synctools.mapping.calendar.processor.TitleProcessor -import at.bitfire.synctools.mapping.calendar.processor.UidProcessor -import at.bitfire.synctools.mapping.calendar.processor.UnknownPropertiesProcessor -import at.bitfire.synctools.mapping.calendar.processor.UrlProcessor +import at.bitfire.synctools.mapping.calendar.handler.AccessLevelHandler +import at.bitfire.synctools.mapping.calendar.handler.AndroidEventFieldHandler +import at.bitfire.synctools.mapping.calendar.handler.AttendeesHandler +import at.bitfire.synctools.mapping.calendar.handler.AvailabilityHandler +import at.bitfire.synctools.mapping.calendar.handler.CategoriesHandler +import at.bitfire.synctools.mapping.calendar.handler.ColorHandler +import at.bitfire.synctools.mapping.calendar.handler.DescriptionHandler +import at.bitfire.synctools.mapping.calendar.handler.DurationHandler +import at.bitfire.synctools.mapping.calendar.handler.EndTimeHandler +import at.bitfire.synctools.mapping.calendar.handler.LocationHandler +import at.bitfire.synctools.mapping.calendar.handler.OrganizerHandler +import at.bitfire.synctools.mapping.calendar.handler.OriginalInstanceTimeHandler +import at.bitfire.synctools.mapping.calendar.handler.RecurrenceFieldsHandler +import at.bitfire.synctools.mapping.calendar.handler.RemindersHandler +import at.bitfire.synctools.mapping.calendar.handler.SequenceHandler +import at.bitfire.synctools.mapping.calendar.handler.StartTimeHandler +import at.bitfire.synctools.mapping.calendar.handler.StatusHandler +import at.bitfire.synctools.mapping.calendar.handler.TitleHandler +import at.bitfire.synctools.mapping.calendar.handler.UidHandler +import at.bitfire.synctools.mapping.calendar.handler.UnknownPropertiesHandler +import at.bitfire.synctools.mapping.calendar.handler.UrlHandler import at.bitfire.synctools.storage.calendar.EventAndExceptions import at.bitfire.synctools.storage.calendar.EventsContract import net.fortuna.ical4j.model.DateList @@ -51,38 +51,38 @@ import java.util.UUID * @param accountName account name (used to generate reminder email address) * @param prodIdGenerator generates the `PRODID` to use */ -class AndroidEventProcessor( +class AndroidEventHandler( accountName: String, private val prodIdGenerator: ProdIdGenerator ) { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() - private val fieldProcessors: Array = arrayOf( + private val fieldHandlers: Array = arrayOf( // event row fields - UidProcessor(), - OriginalInstanceTimeProcessor(tzRegistry), - TitleProcessor(), - LocationProcessor(), - StartTimeProcessor(tzRegistry), - EndTimeProcessor(tzRegistry), - DurationProcessor(tzRegistry), - RecurrenceFieldsProcessor(tzRegistry), - DescriptionProcessor(), - ColorProcessor(), - AccessLevelProcessor(), - AvailabilityProcessor(), - StatusProcessor(), + UidHandler(), + OriginalInstanceTimeHandler(tzRegistry), + TitleHandler(), + LocationHandler(), + StartTimeHandler(tzRegistry), + EndTimeHandler(tzRegistry), + DurationHandler(tzRegistry), + RecurrenceFieldsHandler(tzRegistry), + DescriptionHandler(), + ColorHandler(), + AccessLevelHandler(), + AvailabilityHandler(), + StatusHandler(), // scheduling - SequenceProcessor(), - OrganizerProcessor(), - AttendeesProcessor(), + SequenceHandler(), + OrganizerHandler(), + AttendeesHandler(), // extended properties - CategoriesProcessor(), - UnknownPropertiesProcessor(), - UrlProcessor(), + CategoriesHandler(), + UnknownPropertiesHandler(), + UrlHandler(), // sub-components - RemindersProcessor(accountName) + RemindersHandler(accountName) ) @@ -102,7 +102,7 @@ class AndroidEventProcessor( /** * Maps an Android event with its exceptions to VEVENTs. * - * VEVENTs must have a valid `UID`, so this method (or better to say, the [UidProcessor] that it calls) + * VEVENTs must have a valid `UID`, so this method (or better to say, the [UidHandler] that it calls) * generates an UID, if necessary. If an `UID` was generated, it is noted in the result. */ fun mapToVEvents(eventAndExceptions: EventAndExceptions): MappingResult { @@ -190,8 +190,8 @@ class AndroidEventProcessor( // initialization adds DTSTAMP val vEvent = VEvent(/* initialise = */ true) - for (processor in fieldProcessors) - processor.process(from = entity, main = main, to = vEvent) + for (handler in fieldHandlers) + handler.process(from = entity, main = main, to = vEvent) return vEvent } @@ -220,7 +220,7 @@ class AndroidEventProcessor( it.values.getAsString(ExtendedProperties.NAME) == EventsContract.EXTNAME_GOOGLE_CALENDAR_UID }?.values?.getAsString(ExtendedProperties.VALUE) if (googleCalendarUid != null) { - // copy to UID_2445 so that it will be processed by UidProcessor and return + // copy to UID_2445 so that it will be processed by UidHandler and return mainValues.put(Events.UID_2445, googleCalendarUid) return googleCalendarUid } diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/EndTimeBuilder.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/EndTimeBuilder.kt index 59a74c9e..8ef1fe8a 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/EndTimeBuilder.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/EndTimeBuilder.kt @@ -93,7 +93,7 @@ class EndTimeBuilder: AndroidEntityBuilder { * - DTEND is DATE, DTSTART is DATE-TIME → DTEND is amended to DATE-TIME with time and timezone from DTSTART * - DTEND is DATE-TIME, DTSTART is DATE → DTEND is reduced to its date component * - * @see at.bitfire.synctools.mapping.calendar.processor.RecurrenceFieldsProcessor.alignUntil + * @see at.bitfire.synctools.mapping.calendar.handler.RecurrenceFieldsHandler.alignUntil */ @VisibleForTesting internal fun alignWithDtStart(dtEnd: DtEnd, dtStart: DtStart): DtEnd { diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandler.kt similarity index 94% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandler.kt index 14426cc0..290981b6 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -14,7 +14,7 @@ import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Clazz import org.json.JSONException -class AccessLevelProcessor: AndroidEventFieldProcessor { +class AccessLevelHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val values = from.entityValues diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidEventFieldProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidEventFieldHandler.kt similarity index 94% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidEventFieldProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidEventFieldHandler.kt index bbb5ca95..21f4665d 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidEventFieldProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidEventFieldHandler.kt @@ -4,13 +4,13 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import at.bitfire.synctools.exception.InvalidLocalResourceException import net.fortuna.ical4j.model.component.VEvent -interface AndroidEventFieldProcessor { +interface AndroidEventFieldHandler { /** * Takes specific data from an event (= event row plus data rows, taken from the content provider) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeField.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeField.kt similarity index 97% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeField.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeField.kt index eb290554..dec127e7 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeField.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeField.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import at.bitfire.synctools.util.AndroidTimeUtils import net.fortuna.ical4j.model.Date diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandler.kt similarity index 96% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandler.kt index f0cf0b72..f3471c04 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,7 +21,7 @@ import java.net.URISyntaxException import java.util.logging.Level import java.util.logging.Logger -class AttendeesProcessor: AndroidEventFieldProcessor { +class AttendeesHandler: AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandler.kt similarity index 88% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandler.kt index e6d80e32..69393f09 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandler.kt @@ -4,14 +4,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Transp -class AvailabilityProcessor: AndroidEventFieldProcessor { +class AvailabilityHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val transp: Transp = when (from.entityValues.getAsInteger(Events.AVAILABILITY)) { diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandler.kt similarity index 90% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandler.kt index 65b23ae2..d7e17da9 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.ExtendedProperties @@ -13,7 +13,7 @@ import net.fortuna.ical4j.model.TextList import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Categories -class CategoriesProcessor: AndroidEventFieldProcessor { +class CategoriesHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val extended = from.subValues.filter { it.uri == ExtendedProperties.CONTENT_URI }.map { it.values } diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandler.kt similarity index 93% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandler.kt index 735076cb..c8efcadd 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -13,7 +13,7 @@ import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Color import java.util.logging.Logger -class ColorProcessor: AndroidEventFieldProcessor { +class ColorHandler: AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandler.kt similarity index 86% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandler.kt index fc4c8e1f..0aa4f52f 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -12,7 +12,7 @@ import at.bitfire.vcard4android.Utils.trimToNull import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Description -class DescriptionProcessor: AndroidEventFieldProcessor { +class DescriptionHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val description = from.entityValues.getAsString(Events.DESCRIPTION).trimToNull() diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandler.kt similarity index 96% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandler.kt index 32d4d04a..294ab149 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -21,9 +21,9 @@ import java.time.Instant import java.time.Period import java.time.ZoneOffset -class DurationProcessor( +class DurationHandler( private val tzRegistry: TimeZoneRegistry -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val values = from.entityValues diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandler.kt similarity index 93% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandler.kt index e2f3e667..9cf9d2b5 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -13,9 +13,9 @@ import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.DtEnd import java.util.logging.Logger -class EndTimeProcessor( +class EndTimeHandler( private val tzRegistry: TimeZoneRegistry -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandler.kt similarity index 86% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandler.kt index 81c41812..a86ac604 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -12,7 +12,7 @@ import at.bitfire.vcard4android.Utils.trimToNull import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Location -class LocationProcessor: AndroidEventFieldProcessor { +class LocationHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val location = from.entityValues.getAsString(Events.EVENT_LOCATION).trimToNull() diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandler.kt similarity index 92% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandler.kt index 55065fa9..b87abd63 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Attendees @@ -16,7 +16,7 @@ import java.net.URISyntaxException import java.util.logging.Level import java.util.logging.Logger -class OrganizerProcessor: AndroidEventFieldProcessor { +class OrganizerHandler: AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandler.kt similarity index 93% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandler.kt index 14fdf0f1..ac2120a7 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -16,9 +16,9 @@ import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.RecurrenceId import net.fortuna.ical4j.util.TimeZones -class OriginalInstanceTimeProcessor( +class OriginalInstanceTimeHandler( private val tzRegistry: TimeZoneRegistry -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { // only applicable to exceptions, not to main events diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldsProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldsHandler.kt similarity index 98% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldsProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldsHandler.kt index a78c96ed..4beb7c5f 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldsProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldsHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -28,9 +28,9 @@ import java.util.LinkedList import java.util.logging.Level import java.util.logging.Logger -class RecurrenceFieldsProcessor( +class RecurrenceFieldsHandler( private val tzRegistry: TimeZoneRegistry -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandler.kt similarity index 95% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandler.kt index 97921db3..729852ce 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -22,9 +22,9 @@ import java.time.Duration import java.util.logging.Level import java.util.logging.Logger -class RemindersProcessor( +class RemindersHandler( private val accountName: String -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { private val logger get() = Logger.getLogger(javaClass.name) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandler.kt similarity index 85% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandler.kt index 27d55b89..af4a0deb 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandler.kt @@ -4,14 +4,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import at.bitfire.synctools.storage.calendar.EventsContract import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Sequence -class SequenceProcessor: AndroidEventFieldProcessor { +class SequenceHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val seqNo = from.entityValues.getAsInteger(EventsContract.COLUMN_SEQUENCE) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandler.kt similarity index 91% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandler.kt index 9dd904b2..2539e78b 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -13,9 +13,9 @@ import net.fortuna.ical4j.model.TimeZoneRegistry import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.DtStart -class StartTimeProcessor( +class StartTimeHandler( private val tzRegistry: TimeZoneRegistry -): AndroidEventFieldProcessor { +): AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val values = from.entityValues diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandler.kt similarity index 89% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandler.kt index ee4bb0b0..9c8f2730 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandler.kt @@ -4,14 +4,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Status -class StatusProcessor: AndroidEventFieldProcessor { +class StatusHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val status = when (from.entityValues.getAsInteger(Events.STATUS)) { diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandler.kt similarity index 86% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandler.kt index ba2eac2f..2894cc90 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -12,7 +12,7 @@ import at.bitfire.vcard4android.Utils.trimToNull import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Summary -class TitleProcessor: AndroidEventFieldProcessor { +class TitleHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val summary = from.entityValues.getAsString(Events.TITLE).trimToNull() diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidGenerator.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidGenerator.kt similarity index 83% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidGenerator.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidGenerator.kt index fd1f9424..867e400d 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidGenerator.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidGenerator.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler fun interface UidGenerator { diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandler.kt similarity index 75% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandler.kt index 47fc7092..92633d8a 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandler.kt @@ -4,17 +4,17 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events import net.fortuna.ical4j.model.component.VEvent import net.fortuna.ical4j.model.property.Uid -class UidProcessor: AndroidEventFieldProcessor { +class UidHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { - // Should always be available because AndroidEventProcessor ensures there's a UID to be RFC 5545-compliant. + // Should always be available because AndroidEventHandler ensures there's a UID to be RFC 5545-compliant. // However technically it can be null (and no UID is OK according to RFC 2445). val uid = main.entityValues.getAsString(Events.UID_2445) if (uid != null) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandler.kt similarity index 88% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandler.kt index 62f7b035..1c8994b0 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.ExtendedProperties @@ -15,7 +15,7 @@ import org.json.JSONException import java.util.logging.Level import java.util.logging.Logger -class UnknownPropertiesProcessor: AndroidEventFieldProcessor { +class UnknownPropertiesHandler: AndroidEventFieldHandler { private val logger: Logger get() = Logger.getLogger(javaClass.name) @@ -39,9 +39,9 @@ class UnknownPropertiesProcessor: AndroidEventFieldProcessor { /** * These saved unknown properties are not restored into the [VEvent] as properties. - * Usually they're used by other processors instead. + * Usually they're used by other handlers instead. * - * In the future, this shouldn't be necessary anymore because when other builders/processors store data, + * In the future, this shouldn't be necessary anymore because when other builders/handlers store data, * they shouldn't use an unknown property, but instead define their own extended property. */ val EXCLUDED = arrayOf(Property.CLASS) diff --git a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessor.kt b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandler.kt similarity index 91% rename from lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessor.kt rename to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandler.kt index 88cb9e19..b12931ab 100644 --- a/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessor.kt +++ b/lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandler.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.ExtendedProperties @@ -14,7 +14,7 @@ import net.fortuna.ical4j.model.property.Url import java.net.URI import java.net.URISyntaxException -class UrlProcessor: AndroidEventFieldProcessor { +class UrlHandler: AndroidEventFieldHandler { override fun process(from: Entity, main: Entity, to: VEvent) { val extended = from.subValues.filter { it.uri == ExtendedProperties.CONTENT_URI }.map { it.values } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandlerTest.kt similarity index 95% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandlerTest.kt index d6b640f5..a70e10e8 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandlerTest.kt @@ -29,9 +29,9 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class AndroidEventProcessorTest { +class AndroidEventHandlerTest { - private val processor = AndroidEventProcessor( + private val handler = AndroidEventHandler( accountName = "account@example.com", prodIdGenerator = DefaultProdIdGenerator(javaClass.simpleName) ) @@ -45,7 +45,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents processes exceptions`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.TITLE to "Recurring non-all-day event with exception", @@ -78,7 +78,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents ignores exception when there's only one invalid RRULE`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.TITLE to "Factically non-recurring non-all-day event with exception", @@ -108,7 +108,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents rewrites cancelled exception to EXDATE`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.TITLE to "Recurring all-day event with cancelled exception", @@ -139,7 +139,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents ignores cancelled exception without RECURRENCE-ID`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.TITLE to "Recurring all-day event with cancelled exception and no RECURRENCE-ID", @@ -170,7 +170,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents generates DTSTAMP`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L @@ -184,7 +184,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents generates PRODID (no packages)`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L @@ -197,7 +197,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents generates PRODID (two packages)`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L, @@ -214,7 +214,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents generates UID when necessary`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L @@ -229,7 +229,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents takes UID from main event row`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L, @@ -245,7 +245,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents takes UID from Google Calendar data row`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L @@ -265,7 +265,7 @@ class AndroidEventProcessorTest { @Test fun `mapToVEvents prefers UID from main event row over Google Calendar data row`() { - val result = processor.mapToVEvents( + val result = handler.mapToVEvents( eventAndExceptions = EventAndExceptions( main = Entity(contentValuesOf( Events.DTSTART to 1594056600000L, diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandlerTest.kt similarity index 85% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandlerTest.kt index cdaaebfc..7eb438fd 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,15 +21,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class AccessLevelProcessorTest { +class AccessLevelHandlerTest { - private val processor = AccessLevelProcessor() + private val handler = AccessLevelHandler() @Test fun `No access-level`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.classification) } @@ -41,7 +41,7 @@ class AccessLevelProcessorTest { ExtendedProperties.NAME to UnknownProperty.CONTENT_ITEM_TYPE, ExtendedProperties.VALUE to "[\"CLASS\",\"x-other\"]" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Clazz("x-other"), result.classification) } @@ -51,7 +51,7 @@ class AccessLevelProcessorTest { val entity = Entity(contentValuesOf( Events.ACCESS_LEVEL to Events.ACCESS_DEFAULT )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.classification) } @@ -65,7 +65,7 @@ class AccessLevelProcessorTest { ExtendedProperties.NAME to UnknownProperty.CONTENT_ITEM_TYPE, ExtendedProperties.VALUE to "[\"CLASS\",\"x-other\"]" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Clazz("x-other"), result.classification) } @@ -75,7 +75,7 @@ class AccessLevelProcessorTest { val entity = Entity(contentValuesOf( Events.ACCESS_LEVEL to Events.ACCESS_PUBLIC )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Clazz.PUBLIC, result.classification) } @@ -85,7 +85,7 @@ class AccessLevelProcessorTest { val entity = Entity(contentValuesOf( Events.ACCESS_LEVEL to Events.ACCESS_PRIVATE )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Clazz.PRIVATE, result.classification) } @@ -95,7 +95,7 @@ class AccessLevelProcessorTest { val entity = Entity(contentValuesOf( Events.ACCESS_LEVEL to Events.ACCESS_CONFIDENTIAL )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Clazz.CONFIDENTIAL, result.classification) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeFieldTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeFieldTest.kt similarity index 98% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeFieldTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeFieldTest.kt index 7c9d3887..da01b908 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeFieldTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeFieldTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import at.bitfire.synctools.util.AndroidTimeUtils import io.mockk.every diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandlerTest.kt similarity index 92% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandlerTest.kt index c79db162..b8d244af 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -28,9 +28,9 @@ import org.robolectric.RobolectricTestRunner import java.net.URI @RunWith(RobolectricTestRunner::class) -class AttendeesProcessorTest { +class AttendeesHandlerTest { - private val processor = AttendeesProcessor() + private val handler = AttendeesHandler() @Test fun `Attendee is email address`() { @@ -39,7 +39,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_EMAIL to "attendee@example.com" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals( URI("mailto:attendee@example.com"), result.getProperty(Property.ATTENDEE).calAddress @@ -54,7 +54,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_IDENTITY to "//example.com/principals/attendee" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals( URI("https://example.com/principals/attendee"), result.getProperty(Property.ATTENDEE).calAddress @@ -70,7 +70,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_IDENTITY to "//example.com/principals/attendee" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendees = result.getProperties(Property.ATTENDEE) assertEquals(1, attendees.size) val attendee = attendees.first() @@ -90,7 +90,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to type )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.CUTYPE)) } @@ -106,7 +106,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to type )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(CuType.GROUP, attendee.getParameter(Parameter.CUTYPE)) } @@ -122,7 +122,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to type )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.CUTYPE)) assertEquals(Role.CHAIR, attendee.getParameter(Parameter.ROLE)) @@ -138,7 +138,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_RESOURCE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(CuType.RESOURCE, attendee.getParameter(Parameter.CUTYPE)) assertEquals(Role.CHAIR, attendee.getParameter(Parameter.ROLE)) @@ -155,7 +155,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to type )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(CuType.UNKNOWN, attendee.getParameter(Parameter.CUTYPE)) } @@ -172,7 +172,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_NONE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.ROLE)) } @@ -188,7 +188,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_REQUIRED )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.ROLE)) } @@ -204,7 +204,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_OPTIONAL )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(Role.OPT_PARTICIPANT, attendee.getParameter(Parameter.ROLE)) } @@ -220,7 +220,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_RESOURCE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(CuType.RESOURCE, attendee.getParameter(Parameter.CUTYPE)) } @@ -235,7 +235,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_TYPE to Attendees.TYPE_RESOURCE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(CuType.ROOM, attendee.getParameter(Parameter.CUTYPE)) } @@ -248,7 +248,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_EMAIL to "attendee@example.com" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.PARTSTAT)) } @@ -261,7 +261,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_STATUS to Attendees.ATTENDEE_STATUS_INVITED )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(PartStat.NEEDS_ACTION, attendee.getParameter(Parameter.PARTSTAT)) } @@ -274,7 +274,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_STATUS to Attendees.ATTENDEE_STATUS_ACCEPTED )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(PartStat.ACCEPTED, attendee.getParameter(Parameter.PARTSTAT)) } @@ -287,7 +287,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_STATUS to Attendees.ATTENDEE_STATUS_DECLINED )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(PartStat.DECLINED, attendee.getParameter(Parameter.PARTSTAT)) } @@ -300,7 +300,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_STATUS to Attendees.ATTENDEE_STATUS_TENTATIVE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertEquals(PartStat.TENTATIVE, attendee.getParameter(Parameter.PARTSTAT)) } @@ -313,7 +313,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_STATUS to Attendees.ATTENDEE_STATUS_NONE )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertNull(attendee.getParameter(Parameter.PARTSTAT)) } @@ -326,7 +326,7 @@ class AttendeesProcessorTest { Attendees.ATTENDEE_EMAIL to "attendee@example.com" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val attendee = result.getProperty(Property.ATTENDEE) assertTrue(attendee.getParameter(Parameter.RSVP).rsvp) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandlerTest.kt similarity index 84% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandlerTest.kt index 9d6d2c3a..db72c57d 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -20,15 +20,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class AvailabilityProcessorTest { +class AvailabilityHandlerTest { - private val processor = AvailabilityProcessor() + private val handler = AvailabilityHandler() @Test fun `No availability`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) // OPAQUE is default value assertNull(result.getProperty(Property.TRANSP)) } @@ -39,7 +39,7 @@ class AvailabilityProcessorTest { val entity = Entity(contentValuesOf( Events.AVAILABILITY to Events.AVAILABILITY_BUSY )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) // OPAQUE is default value assertNull(result.getProperty(Property.TRANSP)) } @@ -50,7 +50,7 @@ class AvailabilityProcessorTest { val entity = Entity(contentValuesOf( Events.AVAILABILITY to Events.AVAILABILITY_FREE )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Transp.TRANSPARENT, result.getProperty(Property.TRANSP)) } @@ -60,7 +60,7 @@ class AvailabilityProcessorTest { val entity = Entity(contentValuesOf( Events.AVAILABILITY to Events.AVAILABILITY_TENTATIVE )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) // OPAQUE is default value assertNull(result.getProperty(Property.TRANSP)) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandlerTest.kt similarity index 86% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandlerTest.kt index 4480bb76..ba640d72 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,15 +21,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class CategoriesProcessorTest { +class CategoriesHandlerTest { - private val processor = CategoriesProcessor() + private val handler = CategoriesHandler() @Test fun `No categories`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.getProperty(Property.CATEGORIES)) } @@ -41,7 +41,7 @@ class CategoriesProcessorTest { ExtendedProperties.NAME to EventsContract.EXTNAME_CATEGORIES, ExtendedProperties.VALUE to "Cat 1\\Cat 2" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(listOf("Cat 1", "Cat 2"), result.getProperty(Property.CATEGORIES).categories.toList()) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandlerTest.kt similarity index 84% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandlerTest.kt index 7e739737..0f6e3586 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -20,15 +20,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class ColorProcessorTest { +class ColorHandlerTest { - private val processor = ColorProcessor() + private val handler = ColorHandler() @Test fun `No color`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.getProperty(Color.PROPERTY_NAME)) } @@ -38,7 +38,7 @@ class ColorProcessorTest { val entity = Entity(contentValuesOf( Events.EVENT_COLOR_KEY to Css3Color.silver.name )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("silver", result.getProperty(Color.PROPERTY_NAME).value) } @@ -48,7 +48,7 @@ class ColorProcessorTest { val entity = Entity(contentValuesOf( Events.EVENT_COLOR to Css3Color.silver.argb )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("silver", result.getProperty(Color.PROPERTY_NAME).value) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandlerTest.kt similarity index 81% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandlerTest.kt index 9d403aa9..03f91b84 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -18,15 +18,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class DescriptionProcessorTest { +class DescriptionHandlerTest { - private val processor = DescriptionProcessor() + private val handler = DescriptionHandler() @Test fun `No description`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.description) } @@ -36,7 +36,7 @@ class DescriptionProcessorTest { Events.DESCRIPTION to " " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.description) } @@ -46,7 +46,7 @@ class DescriptionProcessorTest { Events.DESCRIPTION to "Two words " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("Two words", result.description.value) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt similarity index 89% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt index 630eea75..7a70e7fa 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/DurationProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -21,12 +21,12 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class DurationProcessorTest { +class DurationHandlerTest { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() private val tzVienna = tzRegistry.getTimeZone("Europe/Vienna")!! - private val processor = DurationProcessor(tzRegistry) + private val handler = DurationHandler(tzRegistry) // Note: When the calendar provider sets a non-null DURATION, it implies that the event is recurring. @@ -38,7 +38,7 @@ class DurationProcessorTest { Events.DTSTART to 1592733600000L, // 21/06/2020 10:00 UTC Events.DURATION to "P4D" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(Date("20200625")), result.endDate) assertNull(result.duration) } @@ -51,7 +51,7 @@ class DurationProcessorTest { Events.DTSTART to 1760486400000L, // Wed Oct 15 2025 00:00:00 GMT+0000 Events.DURATION to "PT24H" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(Date("20251016")), result.endDate) assertNull(result.duration) } @@ -66,7 +66,7 @@ class DurationProcessorTest { Events.DURATION to "P1D", )) // DST transition at 03:00, clock is set back to 02:00 → P1D = PT25H - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(DateTime("20251027T010000", tzVienna)), result.endDate) assertNull(result.duration) } @@ -81,7 +81,7 @@ class DurationProcessorTest { Events.DURATION to "P24H" )) // DST transition at 03:00, clock is set back to 02:00 → P1D = PT25H - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(DateTime("20251027T000000", tzVienna)), result.endDate) assertNull(result.duration) } @@ -95,7 +95,7 @@ class DurationProcessorTest { val entity = Entity(contentValuesOf( Events.DURATION to "PT1H" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.duration) } @@ -107,7 +107,7 @@ class DurationProcessorTest { Events.EVENT_TIMEZONE to "Europe/Vienna", Events.DURATION to "P-1D" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) assertNull(result.duration) } @@ -120,7 +120,7 @@ class DurationProcessorTest { Events.EVENT_TIMEZONE to "Europe/Vienna", Events.DURATION to "PT0S" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) assertNull(result.duration) } @@ -132,7 +132,7 @@ class DurationProcessorTest { Events.DTSTART to 1761433200000L, // Sun Oct 26 2025 01:00:00 GMT+0200 Events.EVENT_TIMEZONE to "Europe/Vienna" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) assertNull(result.duration) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandlerTest.kt similarity index 89% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandlerTest.kt index 0ce5fa0a..6a9e6fa8 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/EndTimeProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Events @@ -24,12 +24,12 @@ import org.robolectric.RobolectricTestRunner import java.time.ZoneId @RunWith(RobolectricTestRunner::class) -class EndTimeProcessorTest { +class EndTimeHandlerTest { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() private val tzVienna = tzRegistry.getTimeZone("Europe/Vienna")!! - private val processor = EndTimeProcessor(tzRegistry) + private val handler = EndTimeHandler(tzRegistry) // Note: When the calendar provider sets a non-null DTEND, it implies that the event is not recurring. @@ -41,7 +41,7 @@ class EndTimeProcessorTest { Events.DTSTART to 1592697500000L, // DTSTART is required for DTEND to be processed Events.DTEND to 1592697600000L, // 21/06/2020 )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(Date("20200621")), result.endDate) } @@ -55,7 +55,7 @@ class EndTimeProcessorTest { Events.DTEND to 1592733600000L, // 21/06/2020 12:00 +0200 Events.EVENT_END_TIMEZONE to "Europe/Vienna" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(DateTime("20200621T120000", tzVienna)), result.endDate) } @@ -68,7 +68,7 @@ class EndTimeProcessorTest { Events.EVENT_TIMEZONE to "Europe/Vienna", // required in Android; will be used as end time zone, if end time zone is missing Events.DTEND to 1592733600000L // 21/06/2020 12:00 +0200 )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtEnd(DateTime("20200621T120000", tzVienna)), result.endDate) } @@ -83,7 +83,7 @@ class EndTimeProcessorTest { Events.EVENT_TIMEZONE to null, // required in Android; if it's not available against all expectations, we use UTC as fallback Events.DTEND to 1592733600000L // 21/06/2020 12:00 +0200 )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(1592733600000L, result.endDate?.date?.time) assertEquals(defaultTz, (result.endDate?.date as? DateTime)?.timeZone) } @@ -98,7 +98,7 @@ class EndTimeProcessorTest { Events.DTSTART to 1592733500000L, Events.DTEND to 1592733500000L )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) } @@ -108,7 +108,7 @@ class EndTimeProcessorTest { val entity = Entity(contentValuesOf( Events.DTSTART to 1592733500000L )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) } @@ -118,7 +118,7 @@ class EndTimeProcessorTest { val entity = Entity(contentValuesOf( Events.DTEND to 1592733500000L )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.endDate) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandlerTest.kt similarity index 81% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandlerTest.kt index 205e848f..547233d6 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/LocationProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/LocationHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -18,15 +18,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class LocationProcessorTest { +class LocationHandlerTest { - private val processor = LocationProcessor() + private val handler = LocationHandler() @Test fun `No event location`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.location) } @@ -36,7 +36,7 @@ class LocationProcessorTest { Events.EVENT_LOCATION to " " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.location) } @@ -46,7 +46,7 @@ class LocationProcessorTest { Events.EVENT_LOCATION to "Two words " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("Two words", result.location.value) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandlerTest.kt similarity index 86% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandlerTest.kt index a76fbf78..54b71de2 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OrganizerProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OrganizerHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.Entity import android.provider.CalendarContract.Attendees @@ -19,9 +19,9 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class OrganizerProcessorTest { +class OrganizerHandlerTest { - private val processor = OrganizerProcessor() + private val handler = OrganizerHandler() @Test fun `No ORGANIZER for non-group-scheduled event`() { @@ -29,7 +29,7 @@ class OrganizerProcessorTest { val entity = Entity(contentValuesOf( Events.ORGANIZER to "organizer@example.com" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.organizer) } @@ -43,7 +43,7 @@ class OrganizerProcessorTest { Attendees.ATTENDEE_EMAIL to "organizer@example.com", Attendees.ATTENDEE_TYPE to Attendees.RELATIONSHIP_ORGANIZER )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Organizer("mailto:organizer@example.com"), result.organizer) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandlerTest.kt similarity index 84% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandlerTest.kt index 9a702900..507c6532 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/OriginalInstanceTimeProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/OriginalInstanceTimeHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,12 +21,12 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class OriginalInstanceTimeProcessorTest { +class OriginalInstanceTimeHandlerTest { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() private val tzVienna = tzRegistry.getTimeZone("Europe/Vienna")!! - private val processor = OriginalInstanceTimeProcessor(tzRegistry) + private val handler = OriginalInstanceTimeHandler(tzRegistry) @Test fun `Original event is all-day`() { @@ -35,7 +35,7 @@ class OriginalInstanceTimeProcessorTest { Events.ORIGINAL_INSTANCE_TIME to 1594080000000L, Events.ORIGINAL_ALL_DAY to 1 )) - processor.process(entity, Entity(ContentValues()), result) + handler.process(entity, Entity(ContentValues()), result) assertEquals(RecurrenceId(Date("20200707")), result.recurrenceId) } @@ -47,7 +47,7 @@ class OriginalInstanceTimeProcessorTest { Events.ORIGINAL_ALL_DAY to 0, Events.EVENT_TIMEZONE to tzVienna.id )) - processor.process(entity, Entity(ContentValues()), result) + handler.process(entity, Entity(ContentValues()), result) assertEquals(RecurrenceId(DateTime("20250922T161348", tzVienna)), result.recurrenceId) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldHandlerTest.kt similarity index 91% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldHandlerTest.kt index d1c42834..fc3f912d 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RecurrenceFieldProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RecurrenceFieldHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -30,12 +30,12 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class RecurrenceFieldProcessorTest { +class RecurrenceFieldHandlerTest { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() private val tzVienna = tzRegistry.getTimeZone("Europe/Vienna") - private val processor = RecurrenceFieldsProcessor(tzRegistry) + private val handler = RecurrenceFieldsHandler(tzRegistry) @Test fun `Recurring exception`() { @@ -47,7 +47,7 @@ class RecurrenceFieldProcessorTest { Events.EXRULE to "FREQ=WEEKLY;COUNT=1", Events.EXDATE to "20260201T010203Z" )) - processor.process(entity, Entity(ContentValues()), result) + handler.process(entity, Entity(ContentValues()), result) // exceptions must never have recurrence properties assertNull(result.getProperty(Property.RRULE)) assertNull(result.getProperty(Property.RDATE)) @@ -63,7 +63,7 @@ class RecurrenceFieldProcessorTest { Events.EXRULE to "FREQ=WEEKLY;COUNT=1", Events.EXDATE to "20260201T010203Z" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) // non-recurring events must never have recurrence properties assertNull(result.getProperty(Property.RRULE)) assertNull(result.getProperty(Property.RDATE)) @@ -81,7 +81,7 @@ class RecurrenceFieldProcessorTest { Events.EXRULE to "FREQ=WEEKLY;COUNT=1", Events.EXDATE to "20260201T010203Z" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals( listOf(RRule("FREQ=DAILY;COUNT=10")), result.getProperties(Property.RRULE) @@ -110,7 +110,7 @@ class RecurrenceFieldProcessorTest { Events.EXDATE to "1759403653000" // should be removed because the only RRULE is invalid and discarded, // so the whole event isn't recurring anymore )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.getProperty(Property.RRULE)) assertNull(result.getProperty(Property.EXDATE)) } @@ -123,7 +123,7 @@ class RecurrenceFieldProcessorTest { Events.RRULE to "FREQ=DAILY;COUNT=10", // EXRULE is only processed for recurring events Events.EXRULE to "FREQ=DAILY;UNTIL=20251002T111300Z" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.getProperty(Property.EXRULE)) } @@ -133,7 +133,7 @@ class RecurrenceFieldProcessorTest { val recur = Recur.Builder() .frequency(Recur.Frequency.DAILY) .build() - val result = processor.alignUntil( + val result = handler.alignUntil( recur = recur, startDate = mockk() ) @@ -146,7 +146,7 @@ class RecurrenceFieldProcessorTest { .frequency(Recur.Frequency.DAILY) .until(Date("20251015")) .build() - val result = processor.alignUntil( + val result = handler.alignUntil( recur = recur, startDate = Date() ) @@ -155,7 +155,7 @@ class RecurrenceFieldProcessorTest { @Test fun `alignUntil(recurUntil=DATE, startDate=DATE-TIME)`() { - val result = processor.alignUntil( + val result = handler.alignUntil( recur = Recur.Builder() .frequency(Recur.Frequency.DAILY) .until(Date("20251015")) @@ -173,7 +173,7 @@ class RecurrenceFieldProcessorTest { @Test fun `alignUntil(recurUntil=DATE-TIME, startDate=DATE)`() { - val result = processor.alignUntil( + val result = handler.alignUntil( recur = Recur.Builder() .frequency(Recur.Frequency.DAILY) .until(DateTime("20251015T153118", tzVienna)) @@ -191,7 +191,7 @@ class RecurrenceFieldProcessorTest { @Test fun `alignUntil(recurUntil=DATE-TIME, startDate=DATE-TIME)`() { - val result = processor.alignUntil( + val result = handler.alignUntil( recur = Recur.Builder() .frequency(Recur.Frequency.DAILY) .until(DateTime("20251015T153118", tzVienna)) diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandlerTest.kt similarity index 87% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandlerTest.kt index 4d01889c..8eb06b96 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/RemindersProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/RemindersHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,10 +21,10 @@ import org.robolectric.RobolectricTestRunner import java.time.Duration @RunWith(RobolectricTestRunner::class) -class RemindersProcessorTest { +class RemindersHandlerTest { private val accountName = "user@example.com" - private val processor = RemindersProcessor(accountName) + private val handler = RemindersHandler(accountName) @Test fun `Email reminder`() { @@ -37,7 +37,7 @@ class RemindersProcessorTest { Reminders.MINUTES to 10 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val alarm = result.alarms.first() assertEquals(Action.EMAIL, alarm.action) assertNotNull(alarm.summary) @@ -48,7 +48,7 @@ class RemindersProcessorTest { fun `Email reminder (account name is not an email address)`() { // test account name that doesn't look like an email address val nonEmailAccountName = "ical4android" - val processor2 = RemindersProcessor(nonEmailAccountName) + val handler2 = RemindersHandler(nonEmailAccountName) val entity = Entity(ContentValues()) entity.addSubValue(Reminders.CONTENT_URI, contentValuesOf( @@ -56,7 +56,7 @@ class RemindersProcessorTest { Reminders.MINUTES to 10 )) val result = VEvent() - processor2.process(entity, entity, result) + handler2.process(entity, entity, result) val alarm = result.alarms.first() assertEquals(Action.DISPLAY, alarm.action) assertNotNull(alarm.description) @@ -71,7 +71,7 @@ class RemindersProcessorTest { Reminders.MINUTES to 10 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val alarm = result.alarms.first() assertEquals(Action.DISPLAY, alarm.action) assertNotNull(alarm.description) @@ -87,7 +87,7 @@ class RemindersProcessorTest { Reminders.MINUTES to 10 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val alarm = result.alarms.first() assertEquals(Duration.ofMinutes(-10), alarm.trigger.duration) } @@ -100,7 +100,7 @@ class RemindersProcessorTest { Reminders.MINUTES to -10 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) val alarm = result.alarms.first() assertEquals(Duration.ofMinutes(10), alarm.trigger.duration) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandlerTest.kt similarity index 81% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandlerTest.kt index fdeb24f4..086b619d 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/SequenceProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/SequenceHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -18,15 +18,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class SequenceProcessorTest { +class SequenceHandlerTest { - private val processor = SequenceProcessor() + private val handler = SequenceHandler() @Test fun `No sequence`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.sequence) } @@ -36,7 +36,7 @@ class SequenceProcessorTest { EventsContract.COLUMN_SEQUENCE to 0 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.sequence) } @@ -46,7 +46,7 @@ class SequenceProcessorTest { EventsContract.COLUMN_SEQUENCE to 1 )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(1, result.sequence.sequenceNo) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandlerTest.kt similarity index 86% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandlerTest.kt index cf5c6871..3863f27c 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StartTimeProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StartTimeHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -23,12 +23,12 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class StartTimeProcessorTest { +class StartTimeHandlerTest { private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry() private val tzVienna = tzRegistry.getTimeZone("Europe/Vienna")!! - private val processor = StartTimeProcessor(tzRegistry) + private val handler = StartTimeHandler(tzRegistry) @Test fun `All-day event`() { @@ -38,7 +38,7 @@ class StartTimeProcessorTest { Events.DTSTART to 1592697600000L, // 21/06/2020 Events.EVENT_TIMEZONE to AndroidTimeUtils.TZID_UTC )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtStart(Date("20200621")), result.startDate) } @@ -49,14 +49,14 @@ class StartTimeProcessorTest { Events.DTSTART to 1592733600000L, // 21/06/2020 12:00 +0200 Events.EVENT_TIMEZONE to "Europe/Vienna" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(DtStart(DateTime("20200621T120000", tzVienna)), result.startDate) } @Test(expected = InvalidLocalResourceException::class) fun `No start time`() { val entity = Entity(ContentValues()) - processor.process(entity, entity, VEvent()) + handler.process(entity, entity, VEvent()) } } \ No newline at end of file diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandlerTest.kt similarity index 82% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandlerTest.kt index 92a1dbb7..8f063514 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/StatusProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/StatusHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -19,15 +19,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class StatusProcessorTest { +class StatusHandlerTest { - private val processor = StatusProcessor() + private val handler = StatusHandler() @Test fun `No status`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.status) } @@ -37,7 +37,7 @@ class StatusProcessorTest { val entity = Entity(contentValuesOf( Events.STATUS to Events.STATUS_CONFIRMED )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Status.VEVENT_CONFIRMED, result.status) } @@ -47,7 +47,7 @@ class StatusProcessorTest { val entity = Entity(contentValuesOf( Events.STATUS to Events.STATUS_TENTATIVE )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Status.VEVENT_TENTATIVE, result.status) } @@ -57,7 +57,7 @@ class StatusProcessorTest { val entity = Entity(contentValuesOf( Events.STATUS to Events.STATUS_CANCELED )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(Status.VEVENT_CANCELLED, result.status) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandlerTest.kt similarity index 81% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandlerTest.kt index 29ee5188..8477cc76 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/TitleProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/TitleHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -18,15 +18,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class TitleProcessorTest { +class TitleHandlerTest { - private val processor = TitleProcessor() + private val handler = TitleHandler() @Test fun `No title`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.summary) } @@ -36,7 +36,7 @@ class TitleProcessorTest { Events.TITLE to " " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.summary) } @@ -46,7 +46,7 @@ class TitleProcessorTest { Events.TITLE to "Two words " )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("Two words", result.summary.value) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandlerTest.kt similarity index 81% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandlerTest.kt index 2ef01b80..a79e4342 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UidProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UidHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -18,15 +18,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class UidProcessorTest { +class UidHandlerTest { - private val processor = UidProcessor() + private val handler = UidHandler() @Test fun `No UID`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.uid) } @@ -36,7 +36,7 @@ class UidProcessorTest { Events.UID_2445 to "from-event" )) val result = VEvent() - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals("from-event", result.uid.value) } diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandlerTest.kt similarity index 87% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandlerTest.kt index bb996c80..ebb6d574 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UnknownPropertiesProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UnknownPropertiesHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -21,15 +21,15 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) -class UnknownPropertiesProcessorTest { +class UnknownPropertiesHandlerTest { - private val processor = UnknownPropertiesProcessor() + private val handler = UnknownPropertiesHandler() @Test fun `No unknown properties`() { val result = VEvent(/* initialise = */ false) val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertTrue(result.properties.isEmpty()) } @@ -37,7 +37,7 @@ class UnknownPropertiesProcessorTest { fun `Three unknown properties, one of them excluded`() { val result = VEvent(/* initialise = */ false) val entity = Entity(ContentValues()) - entity.addSubValue(ExtendedProperties.CONTENT_URI, contentValuesOf( // used by ClassificationProcessor + entity.addSubValue(ExtendedProperties.CONTENT_URI, contentValuesOf( // used by ClassificationHandler ExtendedProperties.NAME to UnknownProperty.CONTENT_ITEM_TYPE, ExtendedProperties.VALUE to "[\"CLASS\", \"CONFIDENTIAL\"]" )) @@ -49,7 +49,7 @@ class UnknownPropertiesProcessorTest { ExtendedProperties.NAME to UnknownProperty.CONTENT_ITEM_TYPE, ExtendedProperties.VALUE to "[\"X-PROP2\", \"value 2\", {\"arg1\": \"arg-value\"}]" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(listOf( XProperty("X-PROP1", "value 1"), XProperty("X-PROP2", "value 2").apply { diff --git a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessorTest.kt b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandlerTest.kt similarity index 85% rename from lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessorTest.kt rename to lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandlerTest.kt index 571579be..027cf165 100644 --- a/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/processor/UrlProcessorTest.kt +++ b/lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/UrlHandlerTest.kt @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -package at.bitfire.synctools.mapping.calendar.processor +package at.bitfire.synctools.mapping.calendar.handler import android.content.ContentValues import android.content.Entity @@ -20,15 +20,15 @@ import org.robolectric.RobolectricTestRunner import java.net.URI @RunWith(RobolectricTestRunner::class) -class UrlProcessorTest { +class UrlHandlerTest { - private val processor = UrlProcessor() + private val handler = UrlHandler() @Test fun `No URL`() { val result = VEvent() val entity = Entity(ContentValues()) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.url) } @@ -40,7 +40,7 @@ class UrlProcessorTest { ExtendedProperties.NAME to EventsContract.EXTNAME_URL, ExtendedProperties.VALUE to "invalid\\uri" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertNull(result.url) } @@ -52,7 +52,7 @@ class UrlProcessorTest { ExtendedProperties.NAME to EventsContract.EXTNAME_URL, ExtendedProperties.VALUE to "https://example.com" )) - processor.process(entity, entity, result) + handler.process(entity, entity, result) assertEquals(URI("https://example.com"), result.url.uri) }