From 31eba319c7c7e1f60fbb0480b9edcba332876412 Mon Sep 17 00:00:00 2001 From: Ben Fortuna Date: Tue, 7 Jan 2025 11:39:10 +1100 Subject: [PATCH] Added strategy samples --- .palantir/revapi.yml | 307 ++++++++++++++++++ src/main/java/module-info.java | 2 +- .../extensions/data/CalendarCSVParser.java | 5 +- .../extensions/model/concept/ReportType.java | 4 + .../model/concept/ResourceType.java | 6 + .../strategy/entity/ApplicationTest.groovy | 21 ++ .../resources/strategy/application/notion.vcf | 6 + .../strategy/collection/productivity.ics | 9 + .../resources/strategy/collection/recipes.ics | 10 + .../collection/working_with_icalendar.ics | 10 + .../strategy/report/budget_tracker.ics | 35 ++ .../strategy/report/expense_tracker.ics | 18 +- .../strategy/report/investment_portfolio.ics | 14 + 13 files changed, 442 insertions(+), 5 deletions(-) create mode 100644 src/test/groovy/net/fortuna/ical4j/extensions/strategy/entity/ApplicationTest.groovy create mode 100644 src/test/resources/strategy/application/notion.vcf create mode 100644 src/test/resources/strategy/collection/productivity.ics create mode 100644 src/test/resources/strategy/collection/recipes.ics create mode 100644 src/test/resources/strategy/collection/working_with_icalendar.ics create mode 100644 src/test/resources/strategy/report/budget_tracker.ics create mode 100644 src/test/resources/strategy/report/investment_portfolio.ics diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml index af47914..60e4b0b 100644 --- a/.palantir/revapi.yml +++ b/.palantir/revapi.yml @@ -792,6 +792,313 @@ acceptedBreaks: justification: "prototype_singature_change" "2.0.0": org.mnode.ical4j:ical4j-extensions: + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.Acknowledged" + new: "class net.fortuna.ical4j.extensions.caldav.property.Acknowledged" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.AlarmAgent" + new: "class net.fortuna.ical4j.extensions.caldav.property.AlarmAgent" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerAccess" + new: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerAccess" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerAttendeeComment" + new: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerAttendeeComment" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerPrivateComment" + new: "class net.fortuna.ical4j.extensions.caldav.property.CalendarServerPrivateComment" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.DefaultAlarm" + new: "class net.fortuna.ical4j.extensions.caldav.property.DefaultAlarm" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.caldav.property.Proximity" + new: "class net.fortuna.ical4j.extensions.caldav.property.Proximity" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.AutodateKey" + new: "class net.fortuna.ical4j.extensions.groupwise.AutodateKey" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.ImmutableItemType" + new: "class net.fortuna.ical4j.extensions.groupwise.ImmutableItemType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.ImmutableShowAs" + new: "class net.fortuna.ical4j.extensions.groupwise.ImmutableShowAs" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.ItemType" + new: "class net.fortuna.ical4j.extensions.groupwise.ItemType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.MessageId" + new: "class net.fortuna.ical4j.extensions.groupwise.MessageId" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.RecordId" + new: "class net.fortuna.ical4j.extensions.groupwise.RecordId" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.groupwise.ShowAs" + new: "class net.fortuna.ical4j.extensions.groupwise.ShowAs" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.lotus.Charset" + new: "class net.fortuna.ical4j.extensions.lotus.Charset" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.lotus.ImmutableCharset" + new: "class net.fortuna.ical4j.extensions.lotus.ImmutableCharset" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.lotus.UpdateSubject" + new: "class net.fortuna.ical4j.extensions.lotus.UpdateSubject" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.alarm.DisplayNotification" + new: "class net.fortuna.ical4j.extensions.model.alarm.DisplayNotification" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.alarm.EmailNotification" + new: "class net.fortuna.ical4j.extensions.model.alarm.EmailNotification" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.alarm.ProximityNotification" + new: "class net.fortuna.ical4j.extensions.model.alarm.ProximityNotification" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.ActionType" + new: "class net.fortuna.ical4j.extensions.model.concept.ActionType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.AssetType" + new: "class net.fortuna.ical4j.extensions.model.concept.AssetType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.AvailabilityType" + new: "class net.fortuna.ical4j.extensions.model.concept.AvailabilityType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.EventType" + new: "class net.fortuna.ical4j.extensions.model.concept.EventType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.ImmutableConcept" + new: "class net.fortuna.ical4j.extensions.model.concept.ImmutableConcept" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.IssueType" + new: "class net.fortuna.ical4j.extensions.model.concept.IssueType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.NoteType" + new: "class net.fortuna.ical4j.extensions.model.concept.NoteType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.ObservanceType" + new: "class net.fortuna.ical4j.extensions.model.concept.ObservanceType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.ParticipantType" + new: "class net.fortuna.ical4j.extensions.model.concept.ParticipantType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.ReportType" + new: "class net.fortuna.ical4j.extensions.model.concept.ReportType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.concept.RequestType" + new: "class net.fortuna.ical4j.extensions.model.concept.RequestType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Alternate" + new: "class net.fortuna.ical4j.extensions.model.link.Alternate" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Author" + new: "class net.fortuna.ical4j.extensions.model.link.Author" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Bookmark" + new: "class net.fortuna.ical4j.extensions.model.link.Bookmark" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Copyright" + new: "class net.fortuna.ical4j.extensions.model.link.Copyright" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Edit" + new: "class net.fortuna.ical4j.extensions.model.link.Edit" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.External" + new: "class net.fortuna.ical4j.extensions.model.link.External" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Help" + new: "class net.fortuna.ical4j.extensions.model.link.Help" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Hub" + new: "class net.fortuna.ical4j.extensions.model.link.Hub" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Icon" + new: "class net.fortuna.ical4j.extensions.model.link.Icon" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.ImmutableLink" + new: "class net.fortuna.ical4j.extensions.model.link.ImmutableLink" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.License" + new: "class net.fortuna.ical4j.extensions.model.link.License" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Next" + new: "class net.fortuna.ical4j.extensions.model.link.Next" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Prev" + new: "class net.fortuna.ical4j.extensions.model.link.Prev" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Related" + new: "class net.fortuna.ical4j.extensions.model.link.Related" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Replies" + new: "class net.fortuna.ical4j.extensions.model.link.Replies" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Self" + new: "class net.fortuna.ical4j.extensions.model.link.Self" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Status" + new: "class net.fortuna.ical4j.extensions.model.link.Status" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.link.Webmention" + new: "class net.fortuna.ical4j.extensions.model.link.Webmention" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.location.Office" + new: "class net.fortuna.ical4j.extensions.model.location.Office" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.location.PublicPlace" + new: "class net.fortuna.ical4j.extensions.model.location.PublicPlace" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.participant.AbstractRole" + new: "class net.fortuna.ical4j.extensions.model.participant.AbstractRole" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.participant.Contact" + new: "class net.fortuna.ical4j.extensions.model.participant.Contact" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.CalStart" + new: "class net.fortuna.ical4j.extensions.model.property.CalStart" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.CompletionStatus" + new: "class net.fortuna.ical4j.extensions.model.property.CompletionStatus" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.HtmlDescription" + new: "class net.fortuna.ical4j.extensions.model.property.HtmlDescription" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.LicLocation" + new: "class net.fortuna.ical4j.extensions.model.property.LicLocation" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.MarkdownDescription" + new: "class net.fortuna.ical4j.extensions.model.property.MarkdownDescription" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.Notify" + new: "class net.fortuna.ical4j.extensions.model.property.Notify" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.Repeats" + new: "class net.fortuna.ical4j.extensions.model.property.Repeats" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.WrAlarmId" + new: "class net.fortuna.ical4j.extensions.model.property.WrAlarmId" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.WrCalDesc" + new: "class net.fortuna.ical4j.extensions.model.property.WrCalDesc" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.WrCalName" + new: "class net.fortuna.ical4j.extensions.model.property.WrCalName" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.WrRelCalId" + new: "class net.fortuna.ical4j.extensions.model.property.WrRelCalId" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.model.property.WrTimezone" + new: "class net.fortuna.ical4j.extensions.model.property.WrTimezone" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.AllDayEvent" + new: "class net.fortuna.ical4j.extensions.outlook.AllDayEvent" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.BusyStatus" + new: "class net.fortuna.ical4j.extensions.outlook.BusyStatus" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.ImmutableAllDayEvent" + new: "class net.fortuna.ical4j.extensions.outlook.ImmutableAllDayEvent" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.ImmutableBusyStatus" + new: "class net.fortuna.ical4j.extensions.outlook.ImmutableBusyStatus" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.Importance" + new: "class net.fortuna.ical4j.extensions.outlook.Importance" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.InstType" + new: "class net.fortuna.ical4j.extensions.outlook.InstType" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.OriginalEnd" + new: "class net.fortuna.ical4j.extensions.outlook.OriginalEnd" + justification: "refactoring_prototype" + - code: "java.class.noLongerImplementsInterface" + old: "class net.fortuna.ical4j.extensions.outlook.OriginalStart" + new: "class net.fortuna.ical4j.extensions.outlook.OriginalStart" + justification: "refactoring_prototype" + - code: "java.class.removed" + old: "class net.fortuna.ical4j.extensions.model.concept.AssetType" + justification: "renamed_asset_to_resource" + - code: "java.method.exception.checkedRemoved" + old: "method void net.fortuna.ical4j.extensions.data.CalendarCSVParser::parse(java.io.InputStream,\ + \ net.fortuna.ical4j.data.ContentHandler) throws java.io.IOException, net.fortuna.ical4j.data.ParserException" + new: "method void net.fortuna.ical4j.extensions.data.CalendarCSVParser::parse(java.io.InputStream,\ + \ net.fortuna.ical4j.data.ContentHandler) throws java.io.IOException" + justification: "renamed_asset_to_resource" + - code: "java.method.exception.checkedRemoved" + old: "method void net.fortuna.ical4j.extensions.data.CalendarCSVParser::parse(java.io.Reader,\ + \ net.fortuna.ical4j.data.ContentHandler) throws java.io.IOException, net.fortuna.ical4j.data.ParserException" + new: "method void net.fortuna.ical4j.extensions.data.CalendarCSVParser::parse(java.io.Reader,\ + \ net.fortuna.ical4j.data.ContentHandler) throws java.io.IOException" + justification: "renamed_asset_to_resource" - code: "java.method.removed" old: "method java.util.Optional> net.fortuna.ical4j.extensions.strategy.AbstractStrategy::getPrototype()" justification: "refactoring_strategies" diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index bc89aaf..96ebdf4 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,5 +1,4 @@ module ical4j.extensions { - requires java.base; requires ical4j.core; requires ical4j.vcard; @@ -30,4 +29,5 @@ exports net.fortuna.ical4j.extensions.strategy.observance; exports net.fortuna.ical4j.extensions.strategy.issue; exports net.fortuna.ical4j.extensions.strategy.request; + exports net.fortuna.ical4j.extensions.strategy.resource; } diff --git a/src/main/java/net/fortuna/ical4j/extensions/data/CalendarCSVParser.java b/src/main/java/net/fortuna/ical4j/extensions/data/CalendarCSVParser.java index f755433..b87c897 100644 --- a/src/main/java/net/fortuna/ical4j/extensions/data/CalendarCSVParser.java +++ b/src/main/java/net/fortuna/ical4j/extensions/data/CalendarCSVParser.java @@ -2,7 +2,6 @@ import net.fortuna.ical4j.data.CalendarParser; import net.fortuna.ical4j.data.ContentHandler; -import net.fortuna.ical4j.data.ParserException; import java.io.*; @@ -18,12 +17,12 @@ public CalendarCSVParser(String componentName) { } @Override - public void parse(InputStream inputStream, ContentHandler contentHandler) throws IOException, ParserException { + public void parse(InputStream inputStream, ContentHandler contentHandler) throws IOException { parse(new InputStreamReader(inputStream), contentHandler); } @Override - public void parse(Reader reader, ContentHandler contentHandler) throws IOException, ParserException { + public void parse(Reader reader, ContentHandler contentHandler) throws IOException { try (BufferedReader in = new BufferedReader(reader)) { contentHandler.startCalendar(); diff --git a/src/main/java/net/fortuna/ical4j/extensions/model/concept/ReportType.java b/src/main/java/net/fortuna/ical4j/extensions/model/concept/ReportType.java index d4d458c..dbd5a6e 100644 --- a/src/main/java/net/fortuna/ical4j/extensions/model/concept/ReportType.java +++ b/src/main/java/net/fortuna/ical4j/extensions/model/concept/ReportType.java @@ -12,8 +12,10 @@ public class ReportType extends ImmutableConcept { public enum Id { Attendance("semcal:concept:report:attendance"), + Budget("semcal:concept:report:budget"), Diagnostic("semcal:concept:report:diagnostic"), Expense("semcal:concept:report:expense"), + Income("semcal:concept:report:income"), Presence("semcal:concept:report:presence"), Report("semcal:concept:report"), Timesheet("semcal:concept:report:timesheet"), @@ -36,6 +38,8 @@ public URI getUri() { public static final ReportType ATTENDANCE = new ReportType(Id.Attendance); + public static final ReportType BUDGET = new ReportType(Id.Budget); + public static final ReportType TIME_TO_RESPOND = new ReportType(Id.TimeToRespond); public static final ReportType TIME_TO_RESOLVE = new ReportType(Id.TimeToResolve); diff --git a/src/main/java/net/fortuna/ical4j/extensions/model/concept/ResourceType.java b/src/main/java/net/fortuna/ical4j/extensions/model/concept/ResourceType.java index 228b701..4187472 100644 --- a/src/main/java/net/fortuna/ical4j/extensions/model/concept/ResourceType.java +++ b/src/main/java/net/fortuna/ical4j/extensions/model/concept/ResourceType.java @@ -9,6 +9,8 @@ public class ResourceType extends ImmutableConcept { public enum Id { + Application("semcal:concept:resource:application"), + Asset("semcal:concept:resource:asset"), Book("semcal:concept:resource:book"), Collection("semcal:concept:resource:collection"), ConfigurationItem("semcal:concept:resource:configuration_item"), @@ -28,6 +30,10 @@ public URI getUri() { } } + public static final ResourceType APPLICATION = new ResourceType(Id.Application); + + public static final ResourceType ASSET = new ResourceType(Id.Asset); + public static final ResourceType COLLECTION = new ResourceType(Id.Collection); public static final ResourceType CONFIGURATION_ITEM = new ResourceType(Id.ConfigurationItem); diff --git a/src/test/groovy/net/fortuna/ical4j/extensions/strategy/entity/ApplicationTest.groovy b/src/test/groovy/net/fortuna/ical4j/extensions/strategy/entity/ApplicationTest.groovy new file mode 100644 index 0000000..c3cf10a --- /dev/null +++ b/src/test/groovy/net/fortuna/ical4j/extensions/strategy/entity/ApplicationTest.groovy @@ -0,0 +1,21 @@ +package net.fortuna.ical4j.extensions.strategy.entity + +import net.fortuna.ical4j.vcard.VCardBuilder +import spock.lang.Specification + +class ApplicationTest extends Specification { + + def 'test parsing equivalence'() { + expect: 'parsed model matches strategy' + def application = new Application().withPrototype(prototype).get() + application.propertyList <=> prototype.propertyList == 0 + + and: 'output is valid' + !application.validate().hasErrors() + + where: 'prototype loaded from samples' + prototype << new File('src/test/resources/strategy/application').listFiles().collect { + return new VCardBuilder(new FileInputStream(it)).build().entities + }.flatten() + } +} diff --git a/src/test/resources/strategy/application/notion.vcf b/src/test/resources/strategy/application/notion.vcf new file mode 100644 index 0000000..07b14ea --- /dev/null +++ b/src/test/resources/strategy/application/notion.vcf @@ -0,0 +1,6 @@ +BEGIN:VCARD +VERSION:4.0 +FN:Notion +KIND:APPLICATION +URL:https://www.notion.com/ +END:VCARD diff --git a/src/test/resources/strategy/collection/productivity.ics b/src/test/resources/strategy/collection/productivity.ics new file mode 100644 index 0000000..4a03743 --- /dev/null +++ b/src/test/resources/strategy/collection/productivity.ics @@ -0,0 +1,9 @@ +BEGIN:VCALENDAR +BEGIN:VJOURNAL +CONCEPT:semcal:concept:resource:collection +SUMMARY:Productivity on the Web +DESCRIPTION:Links and resources for different productivity methodologies and strategies. +LINK;VALUE=URI;LINKREL=related;LABEL=Intro & Overview of Pillars, Pipelines & Vaults – Notion Life OS: + https://youtu.be/d93SGaf82OM?si=KgPq9Hj37sI6xY9j +END:VJOURNAL +END:VCALENDAR diff --git a/src/test/resources/strategy/collection/recipes.ics b/src/test/resources/strategy/collection/recipes.ics new file mode 100644 index 0000000..7384b2d --- /dev/null +++ b/src/test/resources/strategy/collection/recipes.ics @@ -0,0 +1,10 @@ +BEGIN:VCALENDAR +BEGIN:VJOURNAL +CONCEPT:semcal:concept:resource:collection +SUMMARY:Recipes on the Web +DESCRIPTION:Links to various recipes +LINK;VALUE=URI;LINKREL=related;LABEL=How to make scones: + https://www.womensweeklyfood.com.au/recipe/quick-and-easy/basic-scone-22571/ +CATEGORIES:Lifestyle +END:VJOURNAL +END:VCALENDAR diff --git a/src/test/resources/strategy/collection/working_with_icalendar.ics b/src/test/resources/strategy/collection/working_with_icalendar.ics new file mode 100644 index 0000000..0da8991 --- /dev/null +++ b/src/test/resources/strategy/collection/working_with_icalendar.ics @@ -0,0 +1,10 @@ +BEGIN:VCALENDAR +BEGIN:VJOURNAL +CONCEPT:semcal:concept:resource:collection +SUMMARY:Working with iCalendar +DESCRIPTION:Articles on working with the iCalendar specification +LINK;VALUE=URI;LINKREL=related;LABEL=iCalendar, CalDAV & Elixir: + https://blog.swmansion.com/icalendar-caldav-elixir-13be601572eb +CATEGORIES:Education and Employment +END:VJOURNAL +END:VCALENDAR diff --git a/src/test/resources/strategy/report/budget_tracker.ics b/src/test/resources/strategy/report/budget_tracker.ics new file mode 100644 index 0000000..c9e6d5d --- /dev/null +++ b/src/test/resources/strategy/report/budget_tracker.ics @@ -0,0 +1,35 @@ +BEGIN:VCALENDAR +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report +SUMMARY:Monthly Budget Tracker +DTSTART;VALUE=DATE:20250101 +RRULE:FREQ=MONTHLY;INTERVAL=1 +RELATED-TO;VALUE=UID;RELTYPE=CHILD:2 +END:VJOURNAL +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report:budget +SUMMARY:Budget - Groceries +DTSTART;VALUE=DATE:20250101 +RRULE:FREQ=MONTHLY;INTERVAL=1 +STRUCTURED-DATA;VALUE=TEXT;FMTTYPE=application/json:{ + "total": 1000, + "remaining": 1000 +} +UID:2 +CATEGORIES:Household +END:VJOURNAL +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report:budget +SUMMARY:Groceries +DTSTART;VALUE=DATE:20250101 +SEQUENCE:1 +RECURRENCE-ID;VALUE=DATE:20250101 +RRULE:FREQ=MONTHLY;INTERVAL=1 +STRUCTURED-DATA;VALUE=TEXT;FMTTYPE=application/json:{ + "total": 1000, + "remaining": 735 +} +UID:2 +CATEGORIES:Household +END:VJOURNAL +END:VCALENDAR diff --git a/src/test/resources/strategy/report/expense_tracker.ics b/src/test/resources/strategy/report/expense_tracker.ics index b5f3df2..702d94c 100644 --- a/src/test/resources/strategy/report/expense_tracker.ics +++ b/src/test/resources/strategy/report/expense_tracker.ics @@ -1,12 +1,28 @@ BEGIN:VCALENDAR BEGIN:VJOURNAL CONCEPT:semcal:concept:report -SUMMARY:Expense Tracker +SUMMARY:Monthly Expense Tracker +RRULE:FREQ=MONTHLY;INTERVAL=1 RELATED-TO;VALUE=UID;RELTYPE=CHILD:2 +RELATED-TO;VALUE=UID;RELTYPE=CHILD:3 +RELATED-TO;VALUE=UID;RELTYPE=CHILD:4 END:VJOURNAL BEGIN:VJOURNAL CONCEPT:semcal:concept:report:expense SUMMARY:Groceries UID:2 +CATEGORIES:Household +END:VJOURNAL +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report:expense +SUMMARY:Utilities +UID:3 +CATEGORIES:Household +END:VJOURNAL +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report:expense +SUMMARY:Rent/Mortgage +UID:4 +CATEGORIES:Household END:VJOURNAL END:VCALENDAR diff --git a/src/test/resources/strategy/report/investment_portfolio.ics b/src/test/resources/strategy/report/investment_portfolio.ics new file mode 100644 index 0000000..9e52b2c --- /dev/null +++ b/src/test/resources/strategy/report/investment_portfolio.ics @@ -0,0 +1,14 @@ +BEGIN:VCALENDAR +BEGIN:VJOURNAL +CONCEPT:semcal:concept:report +SUMMARY:Investment Portfolio +RRULE:FREQ=WEEKLY;INTERVAL=1 +RELATED-TO;VALUE=UID;RELTYPE=CHILD:2 +END:VJOURNAL +BEGIN:VJOURNAL +CONCEPT:semcal:concept:resource:asset +SUMMARY:AAPL +UID:2 +CATEGORIES:Finance,Investments +END:VJOURNAL +END:VCALENDAR