diff --git a/.github/linters/sun_checks.xml b/.github/linters/sun_checks.xml
index ee2e150..7626626 100644
--- a/.github/linters/sun_checks.xml
+++ b/.github/linters/sun_checks.xml
@@ -114,7 +114,9 @@
-
+
+
+
@@ -171,7 +173,9 @@
-
+
+
+
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index d7e1bc6..a26f9fc 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -15,9 +15,9 @@ jobs:
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
- FILTER_REGEX_INCLUDE: .*src/main/.*
+ FILTER_REGEX_INCLUDE: .*sdk/src/main/.*|.*generator/src/main/.*
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# mvnw is provided as is from the Maven Wrapper project. Can't change it
- FILTER_REGEX_EXCLUDE: .*mvnw
\ No newline at end of file
+ FILTER_REGEX_EXCLUDE: .*mvnw|.*sdk/src/main/java/dev/cdevents/models/.*
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2697907..da035c7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -50,7 +50,7 @@ jobs:
- name: Release
run: |
- ./mvnw -ntp -B --file pom.xml -Prelease
+ ./mvnw -ntp -B --file pom.xml -Prelease -pl :cdevents-sdk-java-parent
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
diff --git a/generator/pom.xml b/generator/pom.xml
new file mode 100644
index 0000000..ed6f4af
--- /dev/null
+++ b/generator/pom.xml
@@ -0,0 +1,147 @@
+
+
+ 4.0.0
+
+
+ dev.cdevents
+ cdevents-sdk-java-parent
+ 0.1.3-SNAPSHOT
+
+
+ cdevents-sdk-java-generator
+
+ cdevents-sdk-java-generator
+ Source code generator for CDEvents Java SDK
+ https://github.com/cdevents
+
+
+ true
+ true
+ true
+ 11
+ 11
+ ${project.basedir}/../sdk
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.12.0
+
+
+
+ com.github.spullara.mustache.java
+ compiler
+ 0.9.6
+
+
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ runtime
+
+
+
+
+
+
+
+ org.jsonschema2pojo
+ jsonschema2pojo-maven-plugin
+ 1.2.1
+
+ ${sdk.project.dir}/src/main/java
+ false
+ false
+ false
+
+
+
+ generate-artifact-packaged-from-schema
+ generate-sources
+
+ generate
+
+
+
+ ${sdk.project.dir}/src/main/resources/schema/artifact-packaged-event.json
+
+
+ dev.cdevents.models.artifact.packaged
+
+
+
+ generate-artifact-published-from-schema
+ generate-sources
+
+ generate
+
+
+
+ ${sdk.project.dir}/src/main/resources/schema/artifact-published-event.json
+
+
+ dev.cdevents.models.artifact.published
+
+
+
+ generate-pipeline-run-finished-from-schema
+ generate-sources
+
+ generate
+
+
+
+
+ ${sdk.project.dir}/src/main/resources/schema/pipeline-run-finished-event.json
+
+
+ dev.cdevents.models.pipelinerun.finished
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+ run-CDEventsGenerator-main-class
+ process-classes
+
+ java
+
+
+ dev.cdevents.generator.CDEventsGenerator
+
+ ${project.basedir}
+ ${sdk.project.dir}
+
+
+
+
+
+
+
+
diff --git a/generator/src/main/java/dev/cdevents/generator/CDEventsGenerator.java b/generator/src/main/java/dev/cdevents/generator/CDEventsGenerator.java
new file mode 100644
index 0000000..4862101
--- /dev/null
+++ b/generator/src/main/java/dev/cdevents/generator/CDEventsGenerator.java
@@ -0,0 +1,165 @@
+package dev.cdevents.generator;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.mustachejava.DefaultMustacheFactory;
+import com.github.mustachejava.Mustache;
+import com.github.mustachejava.MustacheFactory;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public final class CDEventsGenerator {
+
+ private CDEventsGenerator() {
+ }
+
+ private static ObjectMapper objectMapper = new ObjectMapper();
+ private static Logger log = LoggerFactory.getLogger(CDEventsGenerator.class);
+
+ private static final int SUBJECT_INDEX = 2;
+ private static final int PREDICATE_INDEX = 3;
+ private static final int VERSION_INDEX = 4;
+ private static final int SUBSTRING_PIPELINE_INDEX = 8;
+
+ private static final String TARGET_PACKAGE = "src/main/java/dev/cdevents/events";
+
+ /**
+ * Event JsonSchema files location.
+ */
+ private static final String RESOURCES_DIR = "src/main/resources/";
+ /**
+ * Mustache generic event template file.
+ */
+ private static final String EVENT_TEMPLATE_MUSTACHE = RESOURCES_DIR + "template/event-template.mustache";
+
+ /**
+ * Main method to generate CDEvents from Json schema files.
+ * @param args [0] - base directory for the cdevents-java-sdk-generator module
+ * [1] - base directory for the cdevents-java-sdk module
+ */
+ public static void main(String[] args) {
+ if (args == null || args.length < 2) {
+ throw new IllegalArgumentException("Insufficient arguments passed to CDEventsGenerator");
+ }
+ String generatorBaseDir = args[0];
+ String sdkBaseDir = args[1];
+ String targetPackageDir = sdkBaseDir + File.separator + "src/main/java/dev/cdevents/events";
+ File folder = new File(sdkBaseDir + File.separator + RESOURCES_DIR + "schema");
+ System.out.println(folder.toPath().toAbsolutePath());
+ if (folder.isDirectory()) {
+ File[] files = folder.listFiles((dir, name) -> name.toLowerCase().endsWith(".json"));
+ if (files != null) {
+ //Create Mustache factory and compile event-template.mustache template
+ MustacheFactory mf = new DefaultMustacheFactory();
+ Mustache mustache = mf.compile(generatorBaseDir + File.separator + EVENT_TEMPLATE_MUSTACHE);
+
+ //Generate a class file for each Json schema file using a mustache template
+
+ for (File file : files) {
+ SchemaData schemaData = buildCDEventDataFromJsonSchema(file);
+ generateClassFileFromSchemaData(mustache, schemaData, targetPackageDir);
+ }
+ }
+ }
+ }
+
+ private static void generateClassFileFromSchemaData(Mustache mustache, SchemaData schemaData, String targetPackageDir) {
+ String classFileName = StringUtils.join(new String[]{schemaData.getCapitalizedSubject(), schemaData.getCapitalizedPredicate(), "CDEvent", ".java"});
+ File classFile = new File(targetPackageDir, classFileName);
+ try {
+ FileWriter fileWriter = new FileWriter(classFile);
+ BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+ mustache.execute(bufferedWriter, schemaData).flush();
+ fileWriter.close();
+ } catch (IOException e) {
+ log.error("Exception occurred while generating class file from Json schema {}", e.getMessage());
+ throw new IllegalStateException("Exception occurred while generating class file from Json schema ", e);
+ }
+ log.info("Rendered event-template has been written to file - {}", classFile.getAbsolutePath());
+ }
+
+ private static SchemaData buildCDEventDataFromJsonSchema(File file) {
+ SchemaData schemaData = new SchemaData();
+
+ log.info("Processing event JsonSchema file: {}", file.getAbsolutePath());
+ try {
+ JsonNode rootNode = objectMapper.readTree(file);
+ JsonNode contextNode = rootNode.get("properties").get("context").get("properties");
+
+ String eventType = contextNode.get("type").get("enum").get(0).asText();
+ log.info("eventType: {}", eventType);
+ String[] type = eventType.split("\\.");
+ String subject = type[SUBJECT_INDEX];
+ String predicate = type[PREDICATE_INDEX];
+ String capitalizedSubject = StringUtils.capitalize(subject);
+ if (subject.equals("pipelinerun")) {
+ capitalizedSubject = capitalizedSubject.substring(0, SUBSTRING_PIPELINE_INDEX)
+ + StringUtils.capitalize(subject.substring(SUBSTRING_PIPELINE_INDEX));
+ }
+ String capitalizedPredicate = StringUtils.capitalize(predicate);
+ String version = type[VERSION_INDEX];
+
+ //set the Schema JsonNode required values to schemaData
+ schemaData.setSubject(subject);
+ schemaData.setPredicate(predicate);
+ schemaData.setCapitalizedSubject(capitalizedSubject);
+ schemaData.setCapitalizedPredicate(capitalizedPredicate);
+ schemaData.setSchemaFileName(file.getName());
+ schemaData.setUpperCaseSubject(subject.toUpperCase());
+ schemaData.setVersion(version);
+
+ JsonNode subjectNode = rootNode.get("properties").get("subject").get("properties");
+ JsonNode subjectContentNode = subjectNode.get("content").get("properties");
+ updateSubjectContentProperties(schemaData, subjectContentNode);
+ } catch (IOException e) {
+ log.error("Exception occurred while building schema data from Json schema {}", e.getMessage());
+ throw new IllegalStateException("Exception occurred while building schema data from Json schema ", e);
+ }
+ return schemaData;
+ }
+
+ private static void updateSubjectContentProperties(SchemaData schemaData, JsonNode subjectContentNode) {
+ Iterator> contentProps = subjectContentNode.fields();
+ List contentFields = new ArrayList<>();
+ List contentObjectFields = new ArrayList<>();
+ while (contentProps.hasNext()) {
+ Map.Entry contentMap = contentProps.next();
+ String contentField = contentMap.getKey();
+ String capitalizedContentField = StringUtils.capitalize(contentField);
+ JsonNode contentNode = contentMap.getValue();
+ if (!contentNode.get("type").asText().equals("object")) {
+ contentFields.add(new SchemaData.ContentField(contentField, capitalizedContentField, "String"));
+ } else {
+ schemaData.setObjectName(contentField);
+ schemaData.setCapitalizedObjectName(capitalizedContentField);
+ JsonNode contentObjectNode = contentNode.get("properties");
+ Iterator contentObjectProps = contentObjectNode.fieldNames();
+ while (contentObjectProps.hasNext()) {
+ String contentObjField = contentObjectProps.next();
+ String capitalizedContentObjField = StringUtils.capitalize(contentObjField);
+ contentObjectFields.add(new SchemaData.ContentObjectField(contentObjField,
+ capitalizedContentObjField, contentField, capitalizedContentField, "String"));
+ }
+ }
+ }
+ schemaData.setContentFields(contentFields);
+ schemaData.setContentObjectFields(contentObjectFields);
+ }
+
+ private static String getFieldsDataType(String fieldName) {
+ if (fieldName.equalsIgnoreCase("url")) {
+ return "URI";
+ } else {
+ return "String";
+ }
+ }
+}
diff --git a/generator/src/main/java/dev/cdevents/generator/SchemaData.java b/generator/src/main/java/dev/cdevents/generator/SchemaData.java
new file mode 100644
index 0000000..d6c2d5b
--- /dev/null
+++ b/generator/src/main/java/dev/cdevents/generator/SchemaData.java
@@ -0,0 +1,335 @@
+package dev.cdevents.generator;
+
+import java.util.List;
+
+public class SchemaData {
+
+ private String subject;
+ private String predicate;
+
+ private String capitalizedSubject;
+
+ private String capitalizedPredicate;
+
+ private String objectName;
+ private String capitalizedObjectName;
+ private String version;
+ private String upperCaseSubject;
+ private String schemaFileName;
+
+ private List contentFields;
+
+ private List contentObjectFields;
+
+ /**
+ * Default constructor.
+ */
+ public SchemaData() {
+ }
+
+ /**
+ * @return the subject of an event
+ */
+ public String getSubject() {
+ return subject;
+ }
+
+ /**
+ * @param subject
+ */
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ /**
+ * @return the predicate of an event
+ */
+ public String getPredicate() {
+ return predicate;
+ }
+
+ /**
+ * @param predicate
+ */
+ public void setPredicate(String predicate) {
+ this.predicate = predicate;
+ }
+
+ /**
+ * @return the Capitalized Subject of an event
+ */
+ public String getCapitalizedSubject() {
+ return capitalizedSubject;
+ }
+
+ /**
+ * @param capitalizedSubject
+ */
+ public void setCapitalizedSubject(String capitalizedSubject) {
+ this.capitalizedSubject = capitalizedSubject;
+ }
+
+ /**
+ * @return the Capitalized predicate of an event
+ */
+ public String getCapitalizedPredicate() {
+ return capitalizedPredicate;
+ }
+
+ /**
+ * @param capitalizedPredicate
+ */
+ public void setCapitalizedPredicate(String capitalizedPredicate) {
+ this.capitalizedPredicate = capitalizedPredicate;
+ }
+
+ /**
+ * @return the objectName of an event
+ */
+ public String getObjectName() {
+ return objectName;
+ }
+
+ /**
+ * @param objectName
+ */
+ public void setObjectName(String objectName) {
+ this.objectName = objectName;
+ }
+
+ /**
+ * @return the Capitalized Object name of an event
+ */
+ public String getCapitalizedObjectName() {
+ return capitalizedObjectName;
+ }
+
+ /**
+ * @param capitalizedObjectName
+ */
+ public void setCapitalizedObjectName(String capitalizedObjectName) {
+ this.capitalizedObjectName = capitalizedObjectName;
+ }
+
+ /**
+ * @return the version of an event
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return the Uppercase Subject of an event
+ */
+ public String getUpperCaseSubject() {
+ return upperCaseSubject;
+ }
+
+ /**
+ * @param upperCaseSubject
+ */
+ public void setUpperCaseSubject(String upperCaseSubject) {
+ this.upperCaseSubject = upperCaseSubject;
+ }
+
+ /**
+ * @return the Schema file name of an event
+ */
+ public String getSchemaFileName() {
+ return schemaFileName;
+ }
+
+ /**
+ * @param schemaFileName
+ */
+ public void setSchemaFileName(String schemaFileName) {
+ this.schemaFileName = schemaFileName;
+ }
+
+ /**
+ * @return the Content fields of an event
+ */
+ public List getContentFields() {
+ return contentFields;
+ }
+
+ /**
+ * @param contentFields
+ */
+ public void setContentFields(List contentFields) {
+ this.contentFields = contentFields;
+ }
+
+ /**
+ * @return the Content Object fields of an event
+ */
+ public List getContentObjectFields() {
+ return contentObjectFields;
+ }
+
+ /**
+ * @param contentObjectFields
+ */
+ public void setContentObjectFields(List contentObjectFields) {
+ this.contentObjectFields = contentObjectFields;
+ }
+
+ public static class ContentField {
+ private String fieldName;
+ private String capitalizedFieldName;
+ private String dataType;
+
+ /**
+ * @return the Field name of an event content
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * @param fieldName
+ */
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * @return the Capitalized Field name of an event content
+ */
+ public String getCapitalizedFieldName() {
+ return capitalizedFieldName;
+ }
+
+ /**
+ * @param capitalizedFieldName
+ */
+ public void setCapitalizedFieldName(String capitalizedFieldName) {
+ this.capitalizedFieldName = capitalizedFieldName;
+ }
+
+ /**
+ * @return the dataType of an event content
+ */
+ public String getDataType() {
+ return dataType;
+ }
+
+ /**
+ * @param dataType
+ */
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ /**
+ * @param fieldName
+ * @param capitalizedFieldName
+ * @param dataType
+ */
+ public ContentField(String fieldName, String capitalizedFieldName, String dataType) {
+ this.fieldName = fieldName;
+ this.capitalizedFieldName = capitalizedFieldName;
+ this.dataType = dataType;
+ }
+ }
+
+ public static class ContentObjectField {
+ private String fieldName;
+ private String capitalizedFieldName;
+ private String objectName;
+ private String capitalizedObjectName;
+ private String dataType;
+
+ /**
+ * @return the Field name of an event contentObject
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * @param fieldName
+ */
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * @return the Capitalized Field name of an event contentObject
+ */
+ public String getCapitalizedFieldName() {
+ return capitalizedFieldName;
+ }
+
+ /**
+ * @param capitalizedFieldName
+ */
+ public void setCapitalizedFieldName(String capitalizedFieldName) {
+ this.capitalizedFieldName = capitalizedFieldName;
+ }
+
+ /**
+ * @return the Object name of an event contentObject
+ */
+ public String getObjectName() {
+ return objectName;
+ }
+
+ /**
+ * @param objectName
+ */
+ public void setObjectName(String objectName) {
+ this.objectName = objectName;
+ }
+
+ /**
+ * @return the Capitalized Object name of an event contentObject
+ */
+ public String getCapitalizedObjectName() {
+ return capitalizedObjectName;
+ }
+
+ /**
+ * @param capitalizedObjectName
+ */
+ public void setCapitalizedObjectName(String capitalizedObjectName) {
+ this.capitalizedObjectName = capitalizedObjectName;
+ }
+
+ /**
+ * @return the dataType of an event contentObject
+ */
+ public String getDataType() {
+ return dataType;
+ }
+
+ /**
+ * @param dataType
+ */
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ /**
+ * @param fieldName
+ * @param capitalizedFieldName
+ * @param objectName
+ * @param capitalizedObjectName
+ * @param dataType
+ */
+ public ContentObjectField(String fieldName, String capitalizedFieldName, String objectName, String capitalizedObjectName, String dataType) {
+ this.fieldName = fieldName;
+ this.capitalizedFieldName = capitalizedFieldName;
+ this.objectName = objectName;
+ this.capitalizedObjectName = capitalizedObjectName;
+ this.dataType = dataType;
+ }
+ }
+}
diff --git a/generator/src/main/java/dev/cdevents/generator/package-info.java b/generator/src/main/java/dev/cdevents/generator/package-info.java
new file mode 100644
index 0000000..5de18c7
--- /dev/null
+++ b/generator/src/main/java/dev/cdevents/generator/package-info.java
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-Present https://cdevents.dev/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package dev.cdevents.generator;
diff --git a/generator/src/main/resources/template/event-template.mustache b/generator/src/main/resources/template/event-template.mustache
new file mode 100644
index 0000000..9ff38d0
--- /dev/null
+++ b/generator/src/main/resources/template/event-template.mustache
@@ -0,0 +1,164 @@
+// Code generated by dev.cdevents.generator.CDEventsGenerator. DO NOT EDIT.
+
+/*
+Copyright 2023 The CDEvents Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+*/
+
+package dev.cdevents.events;
+
+
+import dev.cdevents.constants.CDEventConstants;
+import dev.cdevents.exception.CDEventsException;
+import dev.cdevents.models.CDEvent;
+import dev.cdevents.models.{{subject}}.{{predicate}}.*;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+
+public class {{capitalizedSubject}}{{capitalizedPredicate}}CDEvent extends {{capitalizedSubject}}{{capitalizedPredicate}}Event implements CDEvent {
+
+
+ /**
+ * Constructor to init CDEvent and set the Subject for {@link {{capitalizedSubject}}{{capitalizedPredicate}}CDEvent}.
+ */
+
+ public {{capitalizedSubject}}{{capitalizedPredicate}}CDEvent() {
+ initCDEvent();
+ }
+
+
+ /**
+ * Initialize the CDEvent with the context values.
+ */
+
+ @Override
+ public void initCDEvent() {
+ setContext(new Context());
+ setSubject(new Subject());
+ setCustomData(new Object());
+ setCustomDataContentType("application/json");
+ Context context = getContext();
+ context.setId(UUID.randomUUID().toString());
+ context.setTimestamp(new Date());
+ context.setVersion(CDEventConstants.CDEVENTS_SPEC_VERSION);
+ getSubject().setContent(new Content());
+ {{#getCapitalizedObjectName}}
+ getSubject().getContent().set{{capitalizedObjectName}}(new {{capitalizedObjectName}}());
+ {{/getCapitalizedObjectName}}
+ getSubject().setType(CDEventConstants.SubjectType.{{upperCaseSubject}}.getSubjectType());
+ }
+
+ /**
+ * @return the event source
+ */
+
+ @Override
+ public String eventSource() {
+ return getContext().getSource();
+ }
+
+
+ /**
+ * @return the current CDEvent type
+ */
+
+ @Override
+ public String currentCDEventType() {
+ return getContext().getType().value();
+ }
+
+
+ /**
+ * @return the {{schemaFileName}} schema URL
+ */
+
+ @Override
+ public String schemaURL() {
+ String eventSchemaName = "{{schemaFileName}}".substring(0, "{{schemaFileName}}".lastIndexOf(".json"));
+ return String.format("https://cdevents.dev/%s/schema/%s", CDEventConstants.CDEVENTS_SPEC_VERSION, eventSchemaName);
+ }
+
+
+ /**
+ * @return the {{schemaFileName}} schema Json
+ */
+
+ @Override
+ public String eventSchema() {
+ try {
+ return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/{{schemaFileName}}"));
+ } catch (IOException e) {
+ throw new CDEventsException("Exception while reading Event JsonSchema file ", e);
+ }
+ }
+
+
+ /**
+ * @param source
+ * Sets the {@link Context} source value
+ */
+
+ public void setSource(URI source) {
+ getContext().setSource(source.toString());
+ }
+
+
+ /**
+ * @param subjectId
+ * sets the subject Id
+ */
+
+ public void setSubjectId(String subjectId) {
+ getSubject().setId(subjectId);
+ }
+
+
+ /**
+ * @param subjectSource
+ * sets the subject source
+ */
+
+ public void setSubjectSource(URI subjectSource) {
+ getSubject().setSource(subjectSource.toString());
+ }
+
+
+ {{#getContentFields}}
+ /**
+ * @param {{fieldName}}
+ */
+ public void setSubject{{capitalizedFieldName}}({{dataType}} {{fieldName}}) {
+ getSubject().getContent().set{{capitalizedFieldName}}({{fieldName}});
+ }
+
+ {{/getContentFields}}
+
+ {{#getContentObjectFields}}
+ /**
+ * @param {{fieldName}}
+ */
+ public void setSubject{{capitalizedObjectName}}{{capitalizedFieldName}}({{dataType}} {{fieldName}}) {
+ getSubject().getContent().get{{capitalizedObjectName}}().set{{capitalizedFieldName}}({{fieldName}});
+ }
+ {{/getContentObjectFields}}
+
+}
diff --git a/pom.xml b/pom.xml
index ca487fd..171f92a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,11 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
dev.cdevents
- cdevents-sdk-java
+ cdevents-sdk-java-parent
0.1.3-SNAPSHOT
+ pom
- cdevents-sdk-java
- cdevents java sdk
+ cdevents-sdk-java-parent
+ CDEvents Java SDK
https://github.com/cdevents
2022
@@ -23,9 +24,9 @@
1.8
2.3.0
5.8.2
- 3.22.0
- 2.15.0
- 2.0.7
+ 3.22.0
+ 2.15.0
+ 2.0.7
1.0.80
1.4.1
cdevents/sdk-java
@@ -41,9 +42,10 @@
3.1.1
3.5.0
3.3.0
- 1.6.0
+ 1.7.0
3.3.1
3.2.1
+ 3.0.0
@@ -81,6 +83,11 @@
${repository.url}
+
+ generator
+ sdk
+
+
@@ -93,64 +100,6 @@
-
-
- io.cloudevents
- cloudevents-core
- ${cloudevents.version}
-
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
-
-
-
- com.networknt
- json-schema-validator
- ${json.schema.version}
-
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
-
-
-
- com.github.package-url
- packageurl-java
- ${packageurl.version}
-
-
-
-
- org.junit.jupiter
- junit-jupiter
- ${junit-jupiter.version}
- test
-
-
-
- org.assertj
- assertj-core
- ${assertj-core.version}
- test
-
-
-
- org.slf4j
- slf4j-simple
- ${slf4j.version}
- test
-
-
-
@@ -178,6 +127,17 @@
org.apache.maven.plugins
maven-jar-plugin
${version.jar.plugin}
+
+
+
+ ${git.commit.author.time}
+ ${git.commit.id}
+
+
+ true
+
+
+
org.apache.maven.plugins
@@ -194,82 +154,48 @@
maven-source-plugin
${version.source.plugin}
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${version.sourcefire.plugin}
+
+
+ org.jreleaser
+ jreleaser-maven-plugin
+ ${version.jreleaser.plugin}
+
+
+ io.github.git-commit-id
+ git-commit-id-maven-plugin
+ ${version.git.plugin}
+
+
+ resolve-git-properties
+
+ revision
+
+ validate
+
+ false
+ false
+ true
+ ${project.build.directory}/git.properties
+
+ yyyy-MM-dd'T'HH:mm:ssXXX
+
+
+
+
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 3.0.0
-
+
io.github.git-commit-id
git-commit-id-maven-plugin
${version.git.plugin}
-
-
- resolve-git-properties
-
- revision
-
- validate
-
- false
- false
- true
- ${project.build.directory}/git.properties
- yyyy-MM-dd'T'HH:mm:ssXXX
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- ${git.commit.author.time}
- ${git.commit.id}
-
-
- true
-
-
-
-
-
- org.moditect
- moditect-maven-plugin
- 1.0.0.Final
-
-
- add-module-infos
- package
-
- add-module-info
-
-
- true
- false
-
-
- dev.cdevents
-
- *;
-
- true
-
-
-
- --multi-release=9
-
-
-
-
-
-
+
+
@@ -298,7 +224,9 @@
generate-sources
${session.executionRootDirectory}/LICENSE
- ${project.build.outputDirectory}/META-INF/LICENSE-${project.identifier}
+
+ ${project.build.outputDirectory}/META-INF/LICENSE-${project.identifier}
+
@@ -350,6 +278,7 @@
org.jreleaser
jreleaser-maven-plugin
+ false
@@ -362,7 +291,9 @@
ALWAYS
- {{commitShortHash}} {{commitTitle}}
- - {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}
+ - {{contributorName}}{{#contributorUsernameAsLink}}
+ ({{.}}){{/contributorUsernameAsLink}}
+
@@ -384,7 +315,9 @@
ALWAYS
https://s01.oss.sonatype.org/service/local
- https://s01.oss.sonatype.org/content/repositories/snapshots/
+
+ https://s01.oss.sonatype.org/content/repositories/snapshots/
+
true
true
target/staging-deploy
@@ -399,4 +332,4 @@
-
+
\ No newline at end of file
diff --git a/sdk/pom.xml b/sdk/pom.xml
new file mode 100644
index 0000000..425f20a
--- /dev/null
+++ b/sdk/pom.xml
@@ -0,0 +1,117 @@
+
+
+ 4.0.0
+
+
+ dev.cdevents
+ cdevents-sdk-java-parent
+ 0.1.3-SNAPSHOT
+
+
+ cdevents-sdk-java
+
+ cdevents-sdk-java
+ CDEvents Java SDK
+ https://github.com/cdevents
+
+
+
+ io.cloudevents
+ cloudevents-core
+ ${cloudevents.version}
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
+
+
+ com.networknt
+ json-schema-validator
+ ${json.schema.version}
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+ com.github.package-url
+ packageurl-java
+ ${packageurl.version}
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${junit-jupiter.version}
+ test
+
+
+
+ org.assertj
+ assertj-core
+ ${assertj-core.version}
+ test
+
+
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
+
+
+
+
+
+
+ org.moditect
+ moditect-maven-plugin
+ 1.0.0.Final
+
+
+ add-module-infos
+ package
+
+ add-module-info
+
+
+ true
+ false
+
+
+ dev.cdevents
+
+ *;
+
+ true
+
+
+
+ --multi-release=9
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/dev/cdevents/CDEvents.java b/sdk/src/main/java/dev/cdevents/CDEvents.java
similarity index 76%
rename from src/main/java/dev/cdevents/CDEvents.java
rename to sdk/src/main/java/dev/cdevents/CDEvents.java
index 167743d..d4ebd30 100644
--- a/src/main/java/dev/cdevents/CDEvents.java
+++ b/sdk/src/main/java/dev/cdevents/CDEvents.java
@@ -16,6 +16,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.Set;
@@ -29,7 +31,6 @@ private CDEvents() {
private static ObjectMapper objectMapper = new CustomObjectMapper().customConfiguration();
private static Logger log = LoggerFactory.getLogger(CDEvents.class);
-
/**
* @param cdEvent
* @return json string of a cdEvent
@@ -43,7 +44,6 @@ public static String cdEventAsJson(CDEvent cdEvent) {
}
}
-
/**
* Creates a CloudEvent from the cdEvent.
* @param cdEvent
@@ -55,17 +55,20 @@ public static CloudEvent cdEventAsCloudEvent(CDEvent cdEvent) {
throw new CDEventsException("CDEvent validation failed against schema URL - " + cdEvent.schemaURL());
}
String cdEventJson = cdEventAsJson(cdEvent);
- log.info("CDEvent with type {} as json - {}", cdEvent.getContext().getType(), cdEventJson);
- CloudEvent ceToSend = new CloudEventBuilder()
- .withId(UUID.randomUUID().toString())
- .withSource(cdEvent.getContext().getSource())
- .withType(cdEvent.getContext().getType())
- .withDataContentType("application/json")
- .withData(cdEventJson.getBytes(StandardCharsets.UTF_8))
- .withTime(OffsetDateTime.now())
- .build();
-
- return ceToSend;
+ log.info("CDEvent with type {} as json - {}", cdEvent.currentCDEventType(), cdEventJson);
+ try {
+ CloudEvent ceToSend = new CloudEventBuilder()
+ .withId(UUID.randomUUID().toString())
+ .withSource(new URI(cdEvent.eventSource()))
+ .withType(cdEvent.currentCDEventType())
+ .withDataContentType("application/json")
+ .withData(cdEventJson.getBytes(StandardCharsets.UTF_8))
+ .withTime(OffsetDateTime.now())
+ .build();
+ return ceToSend;
+ } catch (URISyntaxException e) {
+ throw new CDEventsException("Exception occurred while building CloudEvent from CDEvent ", e);
+ }
}
/**
diff --git a/src/main/java/dev/cdevents/config/CustomObjectMapper.java b/sdk/src/main/java/dev/cdevents/config/CustomObjectMapper.java
similarity index 88%
rename from src/main/java/dev/cdevents/config/CustomObjectMapper.java
rename to sdk/src/main/java/dev/cdevents/config/CustomObjectMapper.java
index 965b359..b884fdf 100644
--- a/src/main/java/dev/cdevents/config/CustomObjectMapper.java
+++ b/sdk/src/main/java/dev/cdevents/config/CustomObjectMapper.java
@@ -6,6 +6,8 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import java.text.SimpleDateFormat;
+
public class CustomObjectMapper extends ObjectMapper {
/**
@@ -17,6 +19,7 @@ public ObjectMapper customConfiguration() {
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ .setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"))
.registerModule(new JavaTimeModule());
}
}
diff --git a/src/main/java/dev/cdevents/config/package-info.java b/sdk/src/main/java/dev/cdevents/config/package-info.java
similarity index 100%
rename from src/main/java/dev/cdevents/config/package-info.java
rename to sdk/src/main/java/dev/cdevents/config/package-info.java
diff --git a/src/main/java/dev/cdevents/constants/CDEventConstants.java b/sdk/src/main/java/dev/cdevents/constants/CDEventConstants.java
similarity index 96%
rename from src/main/java/dev/cdevents/constants/CDEventConstants.java
rename to sdk/src/main/java/dev/cdevents/constants/CDEventConstants.java
index 145bf13..efcfb37 100644
--- a/src/main/java/dev/cdevents/constants/CDEventConstants.java
+++ b/sdk/src/main/java/dev/cdevents/constants/CDEventConstants.java
@@ -5,6 +5,15 @@ public final class CDEventConstants {
private CDEventConstants() {
}
+ /**
+ * Event JsonSchema files location.
+ */
+ public static final String SCHEMA_FOLDER = "src/main/resources/schema";
+ /**
+ * Mustache generic event template file.
+ */
+ public static final String EVENT_TEMPLATE_MUSTACHE = "template/event-template.mustache";
+
/**
* CDEvents Version.
*/
diff --git a/src/main/java/dev/cdevents/constants/package-info.java b/sdk/src/main/java/dev/cdevents/constants/package-info.java
similarity index 100%
rename from src/main/java/dev/cdevents/constants/package-info.java
rename to sdk/src/main/java/dev/cdevents/constants/package-info.java
diff --git a/sdk/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java b/sdk/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java
new file mode 100644
index 0000000..404e304
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java
@@ -0,0 +1,157 @@
+// Code generated by dev.cdevents.generator.CDEventsGenerator. DO NOT EDIT.
+
+/*
+Copyright 2023 The CDEvents Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+*/
+
+package dev.cdevents.events;
+
+
+import dev.cdevents.constants.CDEventConstants;
+import dev.cdevents.exception.CDEventsException;
+import dev.cdevents.models.CDEvent;
+import dev.cdevents.models.artifact.packaged.*;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+
+public class ArtifactPackagedCDEvent extends ArtifactPackagedEvent implements CDEvent {
+
+
+ /**
+ * Constructor to init CDEvent and set the Subject for {@link ArtifactPackagedCDEvent}.
+ */
+
+ public ArtifactPackagedCDEvent() {
+ initCDEvent();
+ }
+
+
+ /**
+ * Initialize the CDEvent with the context values.
+ */
+
+ @Override
+ public void initCDEvent() {
+ setContext(new Context());
+ setSubject(new Subject());
+ setCustomData(new Object());
+ setCustomDataContentType("application/json");
+ Context context = getContext();
+ context.setId(UUID.randomUUID().toString());
+ context.setTimestamp(new Date());
+ context.setVersion(CDEventConstants.CDEVENTS_SPEC_VERSION);
+ getSubject().setContent(new Content());
+ getSubject().getContent().setChange(new Change());
+ getSubject().setType(CDEventConstants.SubjectType.ARTIFACT.getSubjectType());
+ }
+
+ /**
+ * @return the event source
+ */
+
+ @Override
+ public String eventSource() {
+ return getContext().getSource();
+ }
+
+
+ /**
+ * @return the current CDEvent type
+ */
+
+ @Override
+ public String currentCDEventType() {
+ return getContext().getType().value();
+ }
+
+
+ /**
+ * @return the artifact-packaged-event.json schema URL
+ */
+
+ @Override
+ public String schemaURL() {
+ String eventSchemaName = "artifact-packaged-event.json".substring(0, "artifact-packaged-event.json".lastIndexOf(".json"));
+ return String.format("https://cdevents.dev/%s/schema/%s", CDEventConstants.CDEVENTS_SPEC_VERSION, eventSchemaName);
+ }
+
+
+ /**
+ * @return the artifact-packaged-event.json schema Json
+ */
+
+ @Override
+ public String eventSchema() {
+ try {
+ return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/artifact-packaged-event.json"));
+ } catch (IOException e) {
+ throw new CDEventsException("Exception while reading Event JsonSchema file ", e);
+ }
+ }
+
+
+ /**
+ * @param source
+ * Sets the {@link Context} source value
+ */
+
+ public void setSource(URI source) {
+ getContext().setSource(source.toString());
+ }
+
+
+ /**
+ * @param subjectId
+ * sets the subject Id
+ */
+
+ public void setSubjectId(String subjectId) {
+ getSubject().setId(subjectId);
+ }
+
+
+ /**
+ * @param subjectSource
+ * sets the subject source
+ */
+
+ public void setSubjectSource(URI subjectSource) {
+ getSubject().setSource(subjectSource.toString());
+ }
+
+
+
+ /**
+ * @param id
+ */
+ public void setSubjectChangeId(String id) {
+ getSubject().getContent().getChange().setId(id);
+ }
+ /**
+ * @param source
+ */
+ public void setSubjectChangeSource(String source) {
+ getSubject().getContent().getChange().setSource(source);
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java b/sdk/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java
new file mode 100644
index 0000000..914d88b
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java
@@ -0,0 +1,144 @@
+// Code generated by dev.cdevents.generator.CDEventsGenerator. DO NOT EDIT.
+
+/*
+Copyright 2023 The CDEvents Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+*/
+
+package dev.cdevents.events;
+
+
+import dev.cdevents.constants.CDEventConstants;
+import dev.cdevents.exception.CDEventsException;
+import dev.cdevents.models.CDEvent;
+import dev.cdevents.models.artifact.published.*;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+
+public class ArtifactPublishedCDEvent extends ArtifactPublishedEvent implements CDEvent {
+
+
+ /**
+ * Constructor to init CDEvent and set the Subject for {@link ArtifactPublishedCDEvent}.
+ */
+
+ public ArtifactPublishedCDEvent() {
+ initCDEvent();
+ }
+
+
+ /**
+ * Initialize the CDEvent with the context values.
+ */
+
+ @Override
+ public void initCDEvent() {
+ setContext(new Context());
+ setSubject(new Subject());
+ setCustomData(new Object());
+ setCustomDataContentType("application/json");
+ Context context = getContext();
+ context.setId(UUID.randomUUID().toString());
+ context.setTimestamp(new Date());
+ context.setVersion(CDEventConstants.CDEVENTS_SPEC_VERSION);
+ getSubject().setContent(new Content());
+ getSubject().setType(CDEventConstants.SubjectType.ARTIFACT.getSubjectType());
+ }
+
+ /**
+ * @return the event source
+ */
+
+ @Override
+ public String eventSource() {
+ return getContext().getSource();
+ }
+
+
+ /**
+ * @return the current CDEvent type
+ */
+
+ @Override
+ public String currentCDEventType() {
+ return getContext().getType().value();
+ }
+
+
+ /**
+ * @return the artifact-published-event.json schema URL
+ */
+
+ @Override
+ public String schemaURL() {
+ String eventSchemaName = "artifact-published-event.json".substring(0, "artifact-published-event.json".lastIndexOf(".json"));
+ return String.format("https://cdevents.dev/%s/schema/%s", CDEventConstants.CDEVENTS_SPEC_VERSION, eventSchemaName);
+ }
+
+
+ /**
+ * @return the artifact-published-event.json schema Json
+ */
+
+ @Override
+ public String eventSchema() {
+ try {
+ return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/artifact-published-event.json"));
+ } catch (IOException e) {
+ throw new CDEventsException("Exception while reading Event JsonSchema file ", e);
+ }
+ }
+
+
+ /**
+ * @param source
+ * Sets the {@link Context} source value
+ */
+
+ public void setSource(URI source) {
+ getContext().setSource(source.toString());
+ }
+
+
+ /**
+ * @param subjectId
+ * sets the subject Id
+ */
+
+ public void setSubjectId(String subjectId) {
+ getSubject().setId(subjectId);
+ }
+
+
+ /**
+ * @param subjectSource
+ * sets the subject source
+ */
+
+ public void setSubjectSource(URI subjectSource) {
+ getSubject().setSource(subjectSource.toString());
+ }
+
+
+
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java b/sdk/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java
new file mode 100644
index 0000000..238130c
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java
@@ -0,0 +1,172 @@
+// Code generated by dev.cdevents.generator.CDEventsGenerator. DO NOT EDIT.
+
+/*
+Copyright 2023 The CDEvents Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+*/
+
+package dev.cdevents.events;
+
+
+import dev.cdevents.constants.CDEventConstants;
+import dev.cdevents.exception.CDEventsException;
+import dev.cdevents.models.CDEvent;
+import dev.cdevents.models.pipelinerun.finished.*;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+
+public class PipelineRunFinishedCDEvent extends PipelineRunFinishedEvent implements CDEvent {
+
+
+ /**
+ * Constructor to init CDEvent and set the Subject for {@link PipelineRunFinishedCDEvent}.
+ */
+
+ public PipelineRunFinishedCDEvent() {
+ initCDEvent();
+ }
+
+
+ /**
+ * Initialize the CDEvent with the context values.
+ */
+
+ @Override
+ public void initCDEvent() {
+ setContext(new Context());
+ setSubject(new Subject());
+ setCustomData(new Object());
+ setCustomDataContentType("application/json");
+ Context context = getContext();
+ context.setId(UUID.randomUUID().toString());
+ context.setTimestamp(new Date());
+ context.setVersion(CDEventConstants.CDEVENTS_SPEC_VERSION);
+ getSubject().setContent(new Content());
+ getSubject().setType(CDEventConstants.SubjectType.PIPELINERUN.getSubjectType());
+ }
+
+ /**
+ * @return the event source
+ */
+
+ @Override
+ public String eventSource() {
+ return getContext().getSource();
+ }
+
+
+ /**
+ * @return the current CDEvent type
+ */
+
+ @Override
+ public String currentCDEventType() {
+ return getContext().getType().value();
+ }
+
+
+ /**
+ * @return the pipeline-run-finished-event.json schema URL
+ */
+
+ @Override
+ public String schemaURL() {
+ String eventSchemaName = "pipeline-run-finished-event.json".substring(0, "pipeline-run-finished-event.json".lastIndexOf(".json"));
+ return String.format("https://cdevents.dev/%s/schema/%s", CDEventConstants.CDEVENTS_SPEC_VERSION, eventSchemaName);
+ }
+
+
+ /**
+ * @return the pipeline-run-finished-event.json schema Json
+ */
+
+ @Override
+ public String eventSchema() {
+ try {
+ return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/pipeline-run-finished-event.json"));
+ } catch (IOException e) {
+ throw new CDEventsException("Exception while reading Event JsonSchema file ", e);
+ }
+ }
+
+
+ /**
+ * @param source
+ * Sets the {@link Context} source value
+ */
+
+ public void setSource(URI source) {
+ getContext().setSource(source.toString());
+ }
+
+
+ /**
+ * @param subjectId
+ * sets the subject Id
+ */
+
+ public void setSubjectId(String subjectId) {
+ getSubject().setId(subjectId);
+ }
+
+
+ /**
+ * @param subjectSource
+ * sets the subject source
+ */
+
+ public void setSubjectSource(URI subjectSource) {
+ getSubject().setSource(subjectSource.toString());
+ }
+
+
+ /**
+ * @param pipelineName
+ */
+ public void setSubjectPipelineName(String pipelineName) {
+ getSubject().getContent().setPipelineName(pipelineName);
+ }
+
+ /**
+ * @param url
+ */
+ public void setSubjectUrl(String url) {
+ getSubject().getContent().setUrl(url);
+ }
+
+ /**
+ * @param outcome
+ */
+ public void setSubjectOutcome(String outcome) {
+ getSubject().getContent().setOutcome(outcome);
+ }
+
+ /**
+ * @param errors
+ */
+ public void setSubjectErrors(String errors) {
+ getSubject().getContent().setErrors(errors);
+ }
+
+
+
+}
diff --git a/src/main/java/dev/cdevents/events/package-info.java b/sdk/src/main/java/dev/cdevents/events/package-info.java
similarity index 100%
rename from src/main/java/dev/cdevents/events/package-info.java
rename to sdk/src/main/java/dev/cdevents/events/package-info.java
diff --git a/src/main/java/dev/cdevents/exception/CDEventsException.java b/sdk/src/main/java/dev/cdevents/exception/CDEventsException.java
similarity index 100%
rename from src/main/java/dev/cdevents/exception/CDEventsException.java
rename to sdk/src/main/java/dev/cdevents/exception/CDEventsException.java
diff --git a/src/main/java/dev/cdevents/exception/package-info.java b/sdk/src/main/java/dev/cdevents/exception/package-info.java
similarity index 100%
rename from src/main/java/dev/cdevents/exception/package-info.java
rename to sdk/src/main/java/dev/cdevents/exception/package-info.java
diff --git a/sdk/src/main/java/dev/cdevents/models/CDEvent.java b/sdk/src/main/java/dev/cdevents/models/CDEvent.java
new file mode 100644
index 0000000..82eb7d2
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/CDEvent.java
@@ -0,0 +1,30 @@
+package dev.cdevents.models;
+
+public interface CDEvent {
+
+ /**
+ * @return current CDEvent type
+ */
+ String currentCDEventType();
+
+ /**
+ * @return schema URL for validating the CDEvent structure
+ */
+ String schemaURL();
+
+ /**
+ * @return schema json for validating the CDEvent structure
+ */
+ String eventSchema();
+
+ /**
+ * Initialize the CDEvent with the context values.
+ */
+ void initCDEvent();
+
+ /**
+ * @return source of the event
+ */
+ String eventSource();
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/packaged/ArtifactPackagedEvent.java b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/ArtifactPackagedEvent.java
new file mode 100644
index 0000000..1afae0b
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/ArtifactPackagedEvent.java
@@ -0,0 +1,98 @@
+
+package dev.cdevents.models.artifact.packaged;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "context",
+ "subject",
+ "customData",
+ "customDataContentType"
+})
+@Generated("jsonschema2pojo")
+public class ArtifactPackagedEvent {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ private Context context;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ private Subject subject;
+ @JsonProperty("customData")
+ private Object customData;
+ @JsonProperty("customDataContentType")
+ private String customDataContentType;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public Context getContext() {
+ return context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public void setContext(Context context) {
+ this.context = context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public Subject getSubject() {
+ return subject;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ @JsonProperty("customData")
+ public Object getCustomData() {
+ return customData;
+ }
+
+ @JsonProperty("customData")
+ public void setCustomData(Object customData) {
+ this.customData = customData;
+ }
+
+ @JsonProperty("customDataContentType")
+ public String getCustomDataContentType() {
+ return customDataContentType;
+ }
+
+ @JsonProperty("customDataContentType")
+ public void setCustomDataContentType(String customDataContentType) {
+ this.customDataContentType = customDataContentType;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Change.java b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Change.java
new file mode 100644
index 0000000..8c07d82
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Change.java
@@ -0,0 +1,57 @@
+
+package dev.cdevents.models.artifact.packaged;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "source"
+})
+@Generated("jsonschema2pojo")
+public class Change {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("source")
+ private String source;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Content.java b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Content.java
new file mode 100644
index 0000000..e5a1c70
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Content.java
@@ -0,0 +1,44 @@
+
+package dev.cdevents.models.artifact.packaged;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "change"
+})
+@Generated("jsonschema2pojo")
+public class Content {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("change")
+ private Change change;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("change")
+ public Change getChange() {
+ return change;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("change")
+ public void setChange(Change change) {
+ this.change = change;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Context.java b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Context.java
new file mode 100644
index 0000000..850c137
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Context.java
@@ -0,0 +1,200 @@
+
+package dev.cdevents.models.artifact.packaged;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+})
+@Generated("jsonschema2pojo")
+public class Context {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ private String version;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private Context.Type type = Context.Type.fromValue("dev.cdevents.artifact.packaged.0.1.0");
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ private Date timestamp;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public Context.Type getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(Context.Type type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ @Generated("jsonschema2pojo")
+ public enum Type {
+
+ DEV_CDEVENTS_ARTIFACT_PACKAGED_0_1_0("dev.cdevents.artifact.packaged.0.1.0");
+ private final String value;
+ private final static Map CONSTANTS = new HashMap();
+
+ static {
+ for (Context.Type c: values()) {
+ CONSTANTS.put(c.value, c);
+ }
+ }
+
+ Type(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+ @JsonCreator
+ public static Context.Type fromValue(String value) {
+ Context.Type constant = CONSTANTS.get(value);
+ if (constant == null) {
+ throw new IllegalArgumentException(value);
+ } else {
+ return constant;
+ }
+ }
+
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Subject.java b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Subject.java
new file mode 100644
index 0000000..3b116bd
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/packaged/Subject.java
@@ -0,0 +1,113 @@
+
+package dev.cdevents.models.artifact.packaged;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "source",
+ "type",
+ "content"
+})
+@Generated("jsonschema2pojo")
+public class Subject {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private String type;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ private Content content;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public Content getContent() {
+ return content;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public void setContent(Content content) {
+ this.content = content;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/published/ArtifactPublishedEvent.java b/sdk/src/main/java/dev/cdevents/models/artifact/published/ArtifactPublishedEvent.java
new file mode 100644
index 0000000..bc19088
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/published/ArtifactPublishedEvent.java
@@ -0,0 +1,98 @@
+
+package dev.cdevents.models.artifact.published;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "context",
+ "subject",
+ "customData",
+ "customDataContentType"
+})
+@Generated("jsonschema2pojo")
+public class ArtifactPublishedEvent {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ private Context context;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ private Subject subject;
+ @JsonProperty("customData")
+ private Object customData;
+ @JsonProperty("customDataContentType")
+ private String customDataContentType;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public Context getContext() {
+ return context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public void setContext(Context context) {
+ this.context = context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public Subject getSubject() {
+ return subject;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ @JsonProperty("customData")
+ public Object getCustomData() {
+ return customData;
+ }
+
+ @JsonProperty("customData")
+ public void setCustomData(Object customData) {
+ this.customData = customData;
+ }
+
+ @JsonProperty("customDataContentType")
+ public String getCustomDataContentType() {
+ return customDataContentType;
+ }
+
+ @JsonProperty("customDataContentType")
+ public void setCustomDataContentType(String customDataContentType) {
+ this.customDataContentType = customDataContentType;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/published/Content.java b/sdk/src/main/java/dev/cdevents/models/artifact/published/Content.java
new file mode 100644
index 0000000..870b16d
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/published/Content.java
@@ -0,0 +1,16 @@
+
+package dev.cdevents.models.artifact.published;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+
+})
+@Generated("jsonschema2pojo")
+public class Content {
+
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/published/Context.java b/sdk/src/main/java/dev/cdevents/models/artifact/published/Context.java
new file mode 100644
index 0000000..3d3b399
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/published/Context.java
@@ -0,0 +1,200 @@
+
+package dev.cdevents.models.artifact.published;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+})
+@Generated("jsonschema2pojo")
+public class Context {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ private String version;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private Context.Type type = Context.Type.fromValue("dev.cdevents.artifact.published.0.1.0");
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ private Date timestamp;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public Context.Type getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(Context.Type type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ @Generated("jsonschema2pojo")
+ public enum Type {
+
+ DEV_CDEVENTS_ARTIFACT_PUBLISHED_0_1_0("dev.cdevents.artifact.published.0.1.0");
+ private final String value;
+ private final static Map CONSTANTS = new HashMap();
+
+ static {
+ for (Context.Type c: values()) {
+ CONSTANTS.put(c.value, c);
+ }
+ }
+
+ Type(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+ @JsonCreator
+ public static Context.Type fromValue(String value) {
+ Context.Type constant = CONSTANTS.get(value);
+ if (constant == null) {
+ throw new IllegalArgumentException(value);
+ } else {
+ return constant;
+ }
+ }
+
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/artifact/published/Subject.java b/sdk/src/main/java/dev/cdevents/models/artifact/published/Subject.java
new file mode 100644
index 0000000..ee6c5b5
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/artifact/published/Subject.java
@@ -0,0 +1,113 @@
+
+package dev.cdevents.models.artifact.published;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "source",
+ "type",
+ "content"
+})
+@Generated("jsonschema2pojo")
+public class Subject {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private String type;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ private Content content;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public Content getContent() {
+ return content;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public void setContent(Content content) {
+ this.content = content;
+ }
+
+}
diff --git a/src/main/java/dev/cdevents/models/package-info.java b/sdk/src/main/java/dev/cdevents/models/package-info.java
similarity index 100%
rename from src/main/java/dev/cdevents/models/package-info.java
rename to sdk/src/main/java/dev/cdevents/models/package-info.java
diff --git a/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Content.java b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Content.java
new file mode 100644
index 0000000..35026c2
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Content.java
@@ -0,0 +1,68 @@
+
+package dev.cdevents.models.pipelinerun.finished;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "pipelineName",
+ "url",
+ "outcome",
+ "errors"
+})
+@Generated("jsonschema2pojo")
+public class Content {
+
+ @JsonProperty("pipelineName")
+ private String pipelineName;
+ @JsonProperty("url")
+ private String url;
+ @JsonProperty("outcome")
+ private String outcome;
+ @JsonProperty("errors")
+ private String errors;
+
+ @JsonProperty("pipelineName")
+ public String getPipelineName() {
+ return pipelineName;
+ }
+
+ @JsonProperty("pipelineName")
+ public void setPipelineName(String pipelineName) {
+ this.pipelineName = pipelineName;
+ }
+
+ @JsonProperty("url")
+ public String getUrl() {
+ return url;
+ }
+
+ @JsonProperty("url")
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ @JsonProperty("outcome")
+ public String getOutcome() {
+ return outcome;
+ }
+
+ @JsonProperty("outcome")
+ public void setOutcome(String outcome) {
+ this.outcome = outcome;
+ }
+
+ @JsonProperty("errors")
+ public String getErrors() {
+ return errors;
+ }
+
+ @JsonProperty("errors")
+ public void setErrors(String errors) {
+ this.errors = errors;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Context.java b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Context.java
new file mode 100644
index 0000000..52b33a0
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Context.java
@@ -0,0 +1,200 @@
+
+package dev.cdevents.models.pipelinerun.finished;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+})
+@Generated("jsonschema2pojo")
+public class Context {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ private String version;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private Context.Type type = Context.Type.fromValue("dev.cdevents.pipelinerun.finished.0.1.0");
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ private Date timestamp;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public Context.Type getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(Context.Type type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ @Generated("jsonschema2pojo")
+ public enum Type {
+
+ DEV_CDEVENTS_PIPELINERUN_FINISHED_0_1_0("dev.cdevents.pipelinerun.finished.0.1.0");
+ private final String value;
+ private final static Map CONSTANTS = new HashMap();
+
+ static {
+ for (Context.Type c: values()) {
+ CONSTANTS.put(c.value, c);
+ }
+ }
+
+ Type(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+ @JsonCreator
+ public static Context.Type fromValue(String value) {
+ Context.Type constant = CONSTANTS.get(value);
+ if (constant == null) {
+ throw new IllegalArgumentException(value);
+ } else {
+ return constant;
+ }
+ }
+
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/PipelineRunFinishedEvent.java b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/PipelineRunFinishedEvent.java
new file mode 100644
index 0000000..82f4bb7
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/PipelineRunFinishedEvent.java
@@ -0,0 +1,98 @@
+
+package dev.cdevents.models.pipelinerun.finished;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "context",
+ "subject",
+ "customData",
+ "customDataContentType"
+})
+@Generated("jsonschema2pojo")
+public class PipelineRunFinishedEvent {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ private Context context;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ private Subject subject;
+ @JsonProperty("customData")
+ private Object customData;
+ @JsonProperty("customDataContentType")
+ private String customDataContentType;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public Context getContext() {
+ return context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("context")
+ public void setContext(Context context) {
+ this.context = context;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public Subject getSubject() {
+ return subject;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("subject")
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ @JsonProperty("customData")
+ public Object getCustomData() {
+ return customData;
+ }
+
+ @JsonProperty("customData")
+ public void setCustomData(Object customData) {
+ this.customData = customData;
+ }
+
+ @JsonProperty("customDataContentType")
+ public String getCustomDataContentType() {
+ return customDataContentType;
+ }
+
+ @JsonProperty("customDataContentType")
+ public void setCustomDataContentType(String customDataContentType) {
+ this.customDataContentType = customDataContentType;
+ }
+
+}
diff --git a/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Subject.java b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Subject.java
new file mode 100644
index 0000000..e46d704
--- /dev/null
+++ b/sdk/src/main/java/dev/cdevents/models/pipelinerun/finished/Subject.java
@@ -0,0 +1,113 @@
+
+package dev.cdevents.models.pipelinerun.finished;
+
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "source",
+ "type",
+ "content"
+})
+@Generated("jsonschema2pojo")
+public class Subject {
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("source")
+ private String source;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ private String type;
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ private Content content;
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public Content getContent() {
+ return content;
+ }
+
+ /**
+ *
+ * (Required)
+ *
+ */
+ @JsonProperty("content")
+ public void setContent(Content content) {
+ this.content = content;
+ }
+
+}
diff --git a/src/test/java/dev/cdevents/package-info.java b/sdk/src/main/java/dev/cdevents/package-info.java
similarity index 97%
rename from src/test/java/dev/cdevents/package-info.java
rename to sdk/src/main/java/dev/cdevents/package-info.java
index 18c5117..5bc6e6d 100644
--- a/src/test/java/dev/cdevents/package-info.java
+++ b/sdk/src/main/java/dev/cdevents/package-info.java
@@ -1,17 +1,17 @@
-/**
- * Copyright 2022-Present https://cdevents.dev/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package dev.cdevents;
+/**
+ * Copyright 2022-Present https://cdevents.dev/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package dev.cdevents;
diff --git a/sdk/src/main/resources/schema/artifact-packaged-event.json b/sdk/src/main/resources/schema/artifact-packaged-event.json
new file mode 100644
index 0000000..320078b
--- /dev/null
+++ b/sdk/src/main/resources/schema/artifact-packaged-event.json
@@ -0,0 +1,109 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://cdevents.dev/0.1.2/schema/artifact-packaged-event",
+ "properties": {
+ "context": {
+ "properties": {
+ "version": {
+ "type": "string",
+ "minLength": 1
+ },
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string",
+ "minLength": 1
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "dev.cdevents.artifact.packaged.0.1.0"
+ ],
+ "default": "dev.cdevents.artifact.packaged.0.1.0"
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+ ]
+ },
+ "subject": {
+ "properties": {
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "minLength": 1
+ },
+ "content": {
+ "properties": {
+ "change": {
+ "properties": {
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "id"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "change"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "id",
+ "type",
+ "content"
+ ]
+ },
+ "customData": {
+ "oneOf": [
+ {
+ "type": "object"
+ },
+ {
+ "type": "string",
+ "contentEncoding": "base64"
+ }
+ ]
+ },
+ "customDataContentType": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "context",
+ "subject"
+ ]
+}
\ No newline at end of file
diff --git a/sdk/src/main/resources/schema/artifact-published-event.json b/sdk/src/main/resources/schema/artifact-published-event.json
new file mode 100644
index 0000000..c3a748c
--- /dev/null
+++ b/sdk/src/main/resources/schema/artifact-published-event.json
@@ -0,0 +1,89 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://cdevents.dev/0.1.2/schema/artifact-published-event",
+ "properties": {
+ "context": {
+ "properties": {
+ "version": {
+ "type": "string",
+ "minLength": 1
+ },
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string",
+ "minLength": 1
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "dev.cdevents.artifact.published.0.1.0"
+ ],
+ "default": "dev.cdevents.artifact.published.0.1.0"
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+ ]
+ },
+ "subject": {
+ "properties": {
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "minLength": 1
+ },
+ "content": {
+ "properties": {},
+ "additionalProperties": false,
+ "type": "object"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "id",
+ "type",
+ "content"
+ ]
+ },
+ "customData": {
+ "oneOf": [
+ {
+ "type": "object"
+ },
+ {
+ "type": "string",
+ "contentEncoding": "base64"
+ }
+ ]
+ },
+ "customDataContentType": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "context",
+ "subject"
+ ]
+}
\ No newline at end of file
diff --git a/sdk/src/main/resources/schema/pipeline-run-finished-event.json b/sdk/src/main/resources/schema/pipeline-run-finished-event.json
new file mode 100644
index 0000000..1e4ec1d
--- /dev/null
+++ b/sdk/src/main/resources/schema/pipeline-run-finished-event.json
@@ -0,0 +1,102 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://cdevents.dev/0.1.2/schema/pipeline-run-finished-event",
+ "properties": {
+ "context": {
+ "properties": {
+ "version": {
+ "type": "string",
+ "minLength": 1
+ },
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string",
+ "minLength": 1
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "dev.cdevents.pipelinerun.finished.0.1.0"
+ ],
+ "default": "dev.cdevents.pipelinerun.finished.0.1.0"
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "version",
+ "id",
+ "source",
+ "type",
+ "timestamp"
+ ]
+ },
+ "subject": {
+ "properties": {
+ "id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "minLength": 1
+ },
+ "content": {
+ "properties": {
+ "pipelineName": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ },
+ "outcome": {
+ "type": "string"
+ },
+ "errors": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "id",
+ "type",
+ "content"
+ ]
+ },
+ "customData": {
+ "oneOf": [
+ {
+ "type": "object"
+ },
+ {
+ "type": "string",
+ "contentEncoding": "base64"
+ }
+ ]
+ },
+ "customDataContentType": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "context",
+ "subject"
+ ]
+}
\ No newline at end of file
diff --git a/sdk/src/test/java/dev/cdevents/CDEventTest.java b/sdk/src/test/java/dev/cdevents/CDEventTest.java
new file mode 100644
index 0000000..2f01485
--- /dev/null
+++ b/sdk/src/test/java/dev/cdevents/CDEventTest.java
@@ -0,0 +1,166 @@
+package dev.cdevents;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import dev.cdevents.config.CustomObjectMapper;
+import dev.cdevents.constants.CDEventConstants;
+import dev.cdevents.events.ArtifactPackagedCDEvent;
+import dev.cdevents.events.ArtifactPublishedCDEvent;
+import dev.cdevents.events.PipelineRunFinishedCDEvent;
+import dev.cdevents.exception.CDEventsException;
+import io.cloudevents.CloudEvent;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class CDEventTest {
+
+ private static ObjectMapper objectMapper = new CustomObjectMapper().customConfiguration();
+
+ @Test
+ void createPipelineRunFinishedEventAsCloudEvent() {
+ PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ cdEvent.setSubjectId("/dev/pipeline/run/subject");
+ cdEvent.setSubjectSource(URI.create("/dev/pipeline/run/subject"));
+ cdEvent.setSubjectPipelineName("Name-pipeline");
+ cdEvent.setSubjectUrl(URI.create("http://dev/pipeline/url").toString());
+ cdEvent.setSubjectErrors("errors to place");
+ cdEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS.getOutcome());
+
+ String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
+
+ CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
+
+ String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
+
+ assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType().value());
+ assertThat(ceEvent.getSource().toString()).isEqualTo(cdEvent.getContext().getSource());
+ assertThat(ceDataJson).isEqualTo(cdEventJson);
+
+ }
+
+ @Test
+ void createPipelineRunFinishedEventOptionalFieldsUnset() throws IOException {
+ InputStream inputStream = getClass().getResourceAsStream("/pipelinerun_finished_optional.json");
+
+ JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
+ JsonNode expectedContextNode = expectedJsonNode.get("context");
+ JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
+
+ PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
+ cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
+ cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
+
+ String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
+ JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
+ JsonNode cdEventContextNode = cdEventJsonNode.get("context");
+ JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
+
+ //validates CDEvent against schema
+ assertTrue(CDEvents.validateCDEvent(cdEvent));
+
+ //assert context and subject mandatory fields
+ assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
+ assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
+ assertEquals(expectedSubjectNode, cdEventSubjectNode);
+ assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
+ assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
+
+ //assert Optional field Subject Source, Content pipelineName, url, outcome, errors are set to null
+ assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
+ assertThat(expectedSubjectNode.get("content").get("pipelineName")).isEqualTo(null);
+ assertThat(expectedSubjectNode.get("content").get("url")).isEqualTo(null);
+ assertThat(expectedSubjectNode.get("content").get("outcome")).isEqualTo(null);
+ assertThat(expectedSubjectNode.get("content").get("errors")).isEqualTo(null);
+
+ }
+
+ @Test
+ void testInvalidPipelineRunFinishedEventWithNoSubject() {
+ PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ Exception exception = assertThrows(CDEventsException.class, () -> {
+ CDEvents.cdEventAsCloudEvent(cdEvent);
+ });
+ String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
+ assertThat(exception.getMessage()).isEqualTo(expectedError);
+ }
+ @Test
+ void createArtifactPackagedEventAsCloudEvent() {
+
+ ArtifactPackagedCDEvent cdEvent = new ArtifactPackagedCDEvent();
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ cdEvent.setSubjectId("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b");
+ cdEvent.setSubjectSource(URI.create("/dev/artifact/source"));
+
+ cdEvent.setSubjectChangeId("test-feature");
+ cdEvent.setSubjectChangeSource(URI.create("/github.com/test-repo").toString());
+
+ String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
+
+ CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
+
+ String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
+
+ assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType().value());
+ assertThat(ceEvent.getSource().toString()).isEqualTo(cdEvent.getContext().getSource());
+ assertThat(ceDataJson).isEqualTo(cdEventJson);
+ }
+
+ @Test
+ void testInvalidArtifactPackagedEventWithNoSubject() {
+ ArtifactPackagedCDEvent cdEvent = new ArtifactPackagedCDEvent();
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ Exception exception = assertThrows(CDEventsException.class, () -> {
+ CDEvents.cdEventAsCloudEvent(cdEvent);
+ });
+ String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
+
+ assertThat(exception.getMessage()).isEqualTo(expectedError);
+ }
+
+ @Test
+ void createArtifactPublishedEventAsCloudEvent() {
+ ArtifactPublishedCDEvent cdEvent = new ArtifactPublishedCDEvent();
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ cdEvent.setSubjectId("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b");
+ cdEvent.setSubjectSource(URI.create("/dev/artifact/source"));
+
+ String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
+
+ CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
+
+ String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
+
+ assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType().value());
+ assertThat(ceEvent.getSource().toString()).isEqualTo(cdEvent.getContext().getSource());
+ assertThat(ceDataJson).isEqualTo(cdEventJson);
+
+ }
+
+ @Test
+ void testInvalidArtifactPublishedEventWithNoSubject() {
+ ArtifactPublishedCDEvent cdEvent = new ArtifactPublishedCDEvent();
+
+ cdEvent.setSource(URI.create("http://dev.cdevents"));
+
+ Exception exception = assertThrows(CDEventsException.class, () -> {
+ CDEvents.cdEventAsCloudEvent(cdEvent);
+ });
+ String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
+
+ assertThat(exception.getMessage()).isEqualTo(expectedError);
+ }
+}
diff --git a/src/test/java/dev/cdevents/constants/CDEventTypesTest.java b/sdk/src/test/java/dev/cdevents/constants/CDEventTypesTest.java
similarity index 100%
rename from src/test/java/dev/cdevents/constants/CDEventTypesTest.java
rename to sdk/src/test/java/dev/cdevents/constants/CDEventTypesTest.java
diff --git a/src/test/java/dev/cdevents/constants/package-info.java b/sdk/src/test/java/dev/cdevents/constants/package-info.java
similarity index 97%
rename from src/test/java/dev/cdevents/constants/package-info.java
rename to sdk/src/test/java/dev/cdevents/constants/package-info.java
index f5ef604..a421795 100644
--- a/src/test/java/dev/cdevents/constants/package-info.java
+++ b/sdk/src/test/java/dev/cdevents/constants/package-info.java
@@ -1,17 +1,17 @@
-/**
- * Copyright 2022-Present https://cdevents.dev/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package dev.cdevents.constants;
+/**
+ * Copyright 2022-Present https://cdevents.dev/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package dev.cdevents.constants;
diff --git a/src/main/java/dev/cdevents/package-info.java b/sdk/src/test/java/dev/cdevents/package-info.java
similarity index 97%
rename from src/main/java/dev/cdevents/package-info.java
rename to sdk/src/test/java/dev/cdevents/package-info.java
index 18c5117..5bc6e6d 100644
--- a/src/main/java/dev/cdevents/package-info.java
+++ b/sdk/src/test/java/dev/cdevents/package-info.java
@@ -1,17 +1,17 @@
-/**
- * Copyright 2022-Present https://cdevents.dev/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package dev.cdevents;
+/**
+ * Copyright 2022-Present https://cdevents.dev/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package dev.cdevents;
diff --git a/src/test/resources/pipelinerun_finished_optional.json b/sdk/src/test/resources/pipelinerun_finished_optional.json
similarity index 92%
rename from src/test/resources/pipelinerun_finished_optional.json
rename to sdk/src/test/resources/pipelinerun_finished_optional.json
index e63f64d..d4eb1b4 100644
--- a/src/test/resources/pipelinerun_finished_optional.json
+++ b/sdk/src/test/resources/pipelinerun_finished_optional.json
@@ -11,7 +11,7 @@
"customDataContentType": "application/json",
"subject": {
"id": "/dev/pipeline/run/subject",
- "type": "PIPELINERUN",
+ "type": "pipelineRun",
"content": {
}
}
diff --git a/src/test/resources/pipelinerun_queued_optional.json b/sdk/src/test/resources/pipelinerun_queued_optional.json
similarity index 100%
rename from src/test/resources/pipelinerun_queued_optional.json
rename to sdk/src/test/resources/pipelinerun_queued_optional.json
diff --git a/src/test/resources/pipelinerun_started_optional.json b/sdk/src/test/resources/pipelinerun_started_optional.json
similarity index 100%
rename from src/test/resources/pipelinerun_started_optional.json
rename to sdk/src/test/resources/pipelinerun_started_optional.json
diff --git a/src/test/resources/taskrun_finished_optional.json b/sdk/src/test/resources/taskrun_finished_optional.json
similarity index 100%
rename from src/test/resources/taskrun_finished_optional.json
rename to sdk/src/test/resources/taskrun_finished_optional.json
diff --git a/src/test/resources/taskrun_started_optional.json b/sdk/src/test/resources/taskrun_started_optional.json
similarity index 100%
rename from src/test/resources/taskrun_started_optional.json
rename to sdk/src/test/resources/taskrun_started_optional.json
diff --git a/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java b/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java
deleted file mode 100644
index e160367..0000000
--- a/src/main/java/dev/cdevents/events/ArtifactPackagedCDEvent.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.ArtifactPackagedSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class ArtifactPackagedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ArtifactPackagedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ArtifactPackagedCDEvent}.
- */
- public ArtifactPackagedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ArtifactPackagedSubject(CDEventConstants.SubjectType.ARTIFACT));
- }
-
- /**
- * @return subject
- */
- public ArtifactPackagedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ArtifactPackagedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ArtifactPackagedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the artifact-packaged-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/artifact-packaged-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the artifact-packaged-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/artifact-packaged-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.artifact.packaged.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.artifact.packaged.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"change\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"change\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id in the PURL format
- */
- public void setSubjectId(PackageURL subjectId) {
- getSubject().setId(subjectId.toString());
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param changeId
- * sets The changeId that this artifact belongs to
- */
- public void setSubjectChangeId(String changeId) {
- getSubject().getContent().getChange().setId(changeId);
-
- }
-
- /**
- * @param changeSource
- * sets The changeSource that this artifact belongs to
- */
- public void setSubjectChangeSource(URI changeSource) {
- getSubject().getContent().getChange().setSource(changeSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java b/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java
deleted file mode 100644
index 748cc0f..0000000
--- a/src/main/java/dev/cdevents/events/ArtifactPublishedCDEvent.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.ArtifactPublishedSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class ArtifactPublishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ArtifactPublishedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ArtifactPublishedCDEvent}.
- */
- public ArtifactPublishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ArtifactPublishedSubject(CDEventConstants.SubjectType.ARTIFACT));
- }
-
- /**
- * @return subject
- */
- public ArtifactPublishedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ArtifactPublishedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ArtifactPublishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the artifact-published-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/artifact-published-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the artifact-published-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/artifact-published-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.artifact.published.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.artifact.published.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id in PURL format
- */
- public void setSubjectId(PackageURL subjectId) {
- getSubject().setId(subjectId.toString());
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/BranchCreatedCDEvent.java b/src/main/java/dev/cdevents/events/BranchCreatedCDEvent.java
deleted file mode 100644
index cf493de..0000000
--- a/src/main/java/dev/cdevents/events/BranchCreatedCDEvent.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.BranchSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class BranchCreatedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private BranchSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link BranchCreatedCDEvent}.
- */
- public BranchCreatedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new BranchSubject(CDEventConstants.SubjectType.BRANCH));
- }
-
- /**
- * @return subject
- */
- public BranchSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(BranchSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.BranchCreatedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the branch-created-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/branch-created-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the branch-created-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/branch-created-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.branch.created.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.branch.created.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/BranchDeletedCDEvent.java b/src/main/java/dev/cdevents/events/BranchDeletedCDEvent.java
deleted file mode 100644
index 7c5ec77..0000000
--- a/src/main/java/dev/cdevents/events/BranchDeletedCDEvent.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.BranchSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class BranchDeletedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private BranchSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link BranchDeletedCDEvent}.
- */
- public BranchDeletedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new BranchSubject(CDEventConstants.SubjectType.BRANCH));
- }
-
- /**
- * @return subject
- */
- public BranchSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(BranchSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.BranchDeletedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the branch-deleted-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/branch-deleted-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the branch-deleted-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/branch-deleted-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.branch.deleted.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.branch.deleted.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/BuildFinishedCDEvent.java b/src/main/java/dev/cdevents/events/BuildFinishedCDEvent.java
deleted file mode 100644
index 2fbfef4..0000000
--- a/src/main/java/dev/cdevents/events/BuildFinishedCDEvent.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.BuildFinishedSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class BuildFinishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private BuildFinishedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link BuildFinishedCDEvent}.
- */
- public BuildFinishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new BuildFinishedSubject(CDEventConstants.SubjectType.BUILD));
- }
-
- /**
- * @return subject
- */
- public BuildFinishedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(BuildFinishedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.BuildFinishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the build-finished-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/build-finished-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the build-finished-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/build-finished-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.build.finished.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.build.finished.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"artifactId\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param artifactId
- * sets the subjects artifactId in PURL format
- */
- public void setSubjectArtifactId(PackageURL artifactId) {
- getSubject().getContent().setArtifactId(artifactId.toString());
-
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/BuildQueuedCDEvent.java b/src/main/java/dev/cdevents/events/BuildQueuedCDEvent.java
deleted file mode 100644
index af32ef4..0000000
--- a/src/main/java/dev/cdevents/events/BuildQueuedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.BuildQueuedSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class BuildQueuedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private BuildQueuedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link BuildQueuedCDEvent}.
- */
- public BuildQueuedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new BuildQueuedSubject(CDEventConstants.SubjectType.BUILD));
- }
-
- /**
- * @return subject
- */
- public BuildQueuedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(BuildQueuedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.BuildQueuedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the build-queued-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/build-queued-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the build-queued-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/build-queued-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.build.queued.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.build.queued.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/BuildStartedCDEvent.java b/src/main/java/dev/cdevents/events/BuildStartedCDEvent.java
deleted file mode 100644
index 54d8513..0000000
--- a/src/main/java/dev/cdevents/events/BuildStartedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.BuildStartedSubject;
-import dev.cdevents.models.CDEvent;
-
-import java.net.URI;
-
-public class BuildStartedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private BuildStartedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link BuildStartedCDEvent}.
- */
- public BuildStartedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new BuildStartedSubject(CDEventConstants.SubjectType.BUILD));
- }
-
- /**
- * @return subject
- */
- public BuildStartedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(BuildStartedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.BuildStartedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the build-started-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/build-started-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the build-started-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/build-started-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.build.started.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.build.started.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/ChangeAbandonedCDEvent.java b/src/main/java/dev/cdevents/events/ChangeAbandonedCDEvent.java
deleted file mode 100644
index a8726b3..0000000
--- a/src/main/java/dev/cdevents/events/ChangeAbandonedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ChangeSubject;
-
-import java.net.URI;
-
-public class ChangeAbandonedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private ChangeSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ChangeAbandonedCDEvent}.
- */
- public ChangeAbandonedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ChangeSubject(CDEventConstants.SubjectType.CHANGE));
- }
-
- /**
- * @return subject
- */
- public ChangeSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ChangeSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ChangeAbandonedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the change-abandoned-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/change-abandoned-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the change-abandoned-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/change-abandoned-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.change.abandoned.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.change.abandoned.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the change branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ChangeCreatedCDEvent.java b/src/main/java/dev/cdevents/events/ChangeCreatedCDEvent.java
deleted file mode 100644
index 0e4c099..0000000
--- a/src/main/java/dev/cdevents/events/ChangeCreatedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ChangeSubject;
-
-import java.net.URI;
-
-public class ChangeCreatedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private ChangeSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ChangeCreatedCDEvent}.
- */
- public ChangeCreatedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ChangeSubject(CDEventConstants.SubjectType.CHANGE));
- }
-
- /**
- * @return subject
- */
- public ChangeSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ChangeSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ChangeCreatedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the change-created-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/change-created-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the change-created-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/change-created-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.change.created.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.change.created.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the change branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ChangeMergedCDEvent.java b/src/main/java/dev/cdevents/events/ChangeMergedCDEvent.java
deleted file mode 100644
index 8d30a2a..0000000
--- a/src/main/java/dev/cdevents/events/ChangeMergedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ChangeSubject;
-
-import java.net.URI;
-
-public class ChangeMergedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private ChangeSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ChangeMergedCDEvent}.
- */
- public ChangeMergedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ChangeSubject(CDEventConstants.SubjectType.CHANGE));
- }
-
- /**
- * @return subject
- */
- public ChangeSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ChangeSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ChangeMergedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the change-merged-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/change-merged-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the change-merged-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/change-merged-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.change.merged.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.change.merged.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the change branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ChangeReviewedCDEvent.java b/src/main/java/dev/cdevents/events/ChangeReviewedCDEvent.java
deleted file mode 100644
index de8b858..0000000
--- a/src/main/java/dev/cdevents/events/ChangeReviewedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ChangeSubject;
-
-import java.net.URI;
-
-public class ChangeReviewedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private ChangeSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ChangeReviewedCDEvent}.
- */
- public ChangeReviewedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ChangeSubject(CDEventConstants.SubjectType.CHANGE));
- }
-
- /**
- * @return subject
- */
- public ChangeSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ChangeSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ChangeReviewedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the change-reviewed-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/change-reviewed-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the change-reviewed-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/change-reviewed-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.change.reviewed.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.change.reviewed.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the change branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ChangeUpdatedCDEvent.java b/src/main/java/dev/cdevents/events/ChangeUpdatedCDEvent.java
deleted file mode 100644
index 3629d90..0000000
--- a/src/main/java/dev/cdevents/events/ChangeUpdatedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ChangeSubject;
-
-import java.net.URI;
-
-public class ChangeUpdatedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.1";
- @JsonProperty(required = true)
- private ChangeSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ChangeUpdatedCDEvent}.
- */
- public ChangeUpdatedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ChangeSubject(CDEventConstants.SubjectType.CHANGE));
- }
-
- /**
- * @return subject
- */
- public ChangeSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ChangeSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ChangeUpdatedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the change-updated-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/change-updated-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the change-updated-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/change-updated-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.change.updated.0.1.1\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.change.updated.0.1.1\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"repository\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the change branch source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryId
- * sets the id of the repository
- */
- public void setSubjectRepositoryId(String repositoryId) {
- getSubject().getContent().getRepository().setId(repositoryId);
- }
-
- /**
- * @param repositorySource
- * sets the source of the repository.
- */
- public void setSubjectRepositorySource(URI repositorySource) {
- getSubject().getContent().getRepository().setSource(repositorySource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/EnvironmentCreatedCDEvent.java b/src/main/java/dev/cdevents/events/EnvironmentCreatedCDEvent.java
deleted file mode 100644
index 81b4318..0000000
--- a/src/main/java/dev/cdevents/events/EnvironmentCreatedCDEvent.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.EnvironmentCreatedSubject;
-
-import java.net.URI;
-
-public class EnvironmentCreatedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private EnvironmentCreatedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link EnvironmentCreatedCDEvent}.
- */
- public EnvironmentCreatedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new EnvironmentCreatedSubject(CDEventConstants.SubjectType.ENVIRONMENT));
- }
-
- /**
- * @return subject
- */
- public EnvironmentCreatedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(EnvironmentCreatedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.EnvironmentCreatedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the environment-created-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/environment-created-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the environment-created-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/environment-created-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.environment.created.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.environment.created.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param subjectName
- * sets the subject name
- */
- public void setSubjectName(String subjectName) {
- getSubject().getContent().setName(subjectName);
- }
-
- /**
- * @param subjectUrl
- * sets the subject URL
- */
- public void setSubjectUrl(String subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
-
-}
diff --git a/src/main/java/dev/cdevents/events/EnvironmentDeletedCDEvent.java b/src/main/java/dev/cdevents/events/EnvironmentDeletedCDEvent.java
deleted file mode 100644
index 6be83d1..0000000
--- a/src/main/java/dev/cdevents/events/EnvironmentDeletedCDEvent.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.EnvironmentDeletedSubject;
-
-import java.net.URI;
-
-public class EnvironmentDeletedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private EnvironmentDeletedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link EnvironmentDeletedCDEvent}.
- */
- public EnvironmentDeletedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new EnvironmentDeletedSubject(CDEventConstants.SubjectType.ENVIRONMENT));
- }
-
- /**
- * @return subject
- */
- public EnvironmentDeletedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(EnvironmentDeletedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.EnvironmentDeletedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the environment-Deleted-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/environment-deleted-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the environment-Deleted-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/environment-deleted-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.environment.deleted.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.environment.deleted.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param subjectName
- * sets the subject name
- */
- public void setSubjectName(String subjectName) {
- getSubject().getContent().setName(subjectName);
- }
-
-
-}
diff --git a/src/main/java/dev/cdevents/events/EnvironmentModifiedCDEvent.java b/src/main/java/dev/cdevents/events/EnvironmentModifiedCDEvent.java
deleted file mode 100644
index 3d54e71..0000000
--- a/src/main/java/dev/cdevents/events/EnvironmentModifiedCDEvent.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.EnvironmentModifiedSubject;
-
-import java.net.URI;
-
-public class EnvironmentModifiedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private EnvironmentModifiedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link EnvironmentModifiedCDEvent}.
- */
- public EnvironmentModifiedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new EnvironmentModifiedSubject(CDEventConstants.SubjectType.ENVIRONMENT));
- }
-
- /**
- * @return subject
- */
- public EnvironmentModifiedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(EnvironmentModifiedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.EnvironmentModifiedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the environment-Modified-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/environment-modified-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the environment-Modified-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/environment-modified-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.environment.modified.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.environment.modified.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param subjectName
- * sets the subject name
- */
- public void setSubjectName(String subjectName) {
- getSubject().getContent().setName(subjectName);
- }
-
- /**
- * @param subjectUrl
- * sets the subject URL
- */
- public void setSubjectUrl(String subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
-
-}
diff --git a/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java b/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java
deleted file mode 100644
index 03d68c0..0000000
--- a/src/main/java/dev/cdevents/events/PipelineRunFinishedCDEvent.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.PipelineRunFinishedSubject;
-
-import java.net.URI;
-
-public class PipelineRunFinishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private PipelineRunFinishedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link PipelineRunFinishedCDEvent}.
- */
- public PipelineRunFinishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new PipelineRunFinishedSubject(CDEventConstants.SubjectType.PIPELINERUN));
- }
-
- /**
- * @return subject
- */
- public PipelineRunFinishedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(PipelineRunFinishedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.PipelineRunFinishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the pipeline-run-finished-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/pipeline-run-finished-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the pipeline-run-finished-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/pipeline-run-finished-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.pipelinerun.finished.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.pipelinerun.finished.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"pipelineName\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"outcome\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"errors\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the pipeline source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param pipelineName
- * sets the pipeline name
- */
- public void setSubjectPipelineName(String pipelineName) {
- getSubject().getContent().setPipelineName(pipelineName);
- }
-
- /**
- * @param subjectUrl
- * sets the pipeline URL
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param subjectOutcome
- * sets the {@link PipelineRunFinishedCDEvent} outcome
- */
- public void setSubjectOutcome(CDEventConstants.Outcome subjectOutcome) {
- getSubject().getContent().setOutcome(subjectOutcome);
- }
-
- /**
- * @param subjectErrors
- * sets the {@link PipelineRunFinishedCDEvent} errors
- */
- public void setSubjectErrors(String subjectErrors) {
- getSubject().getContent().setErrors(subjectErrors);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/PipelineRunQueuedCDEvent.java b/src/main/java/dev/cdevents/events/PipelineRunQueuedCDEvent.java
deleted file mode 100644
index dce77b6..0000000
--- a/src/main/java/dev/cdevents/events/PipelineRunQueuedCDEvent.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.PipelineRunQueuedSubject;
-
-import java.net.URI;
-
-public class PipelineRunQueuedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private PipelineRunQueuedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link PipelineRunQueuedCDEvent}.
- */
- public PipelineRunQueuedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new PipelineRunQueuedSubject(CDEventConstants.SubjectType.PIPELINERUN));
- }
-
- /**
- * @return subject
- */
- public PipelineRunQueuedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(PipelineRunQueuedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the PipelineRunQueuedEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.PipelineRunQueuedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the pipeline-run-queued-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/pipeline-run-queued-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the pipeline-run-queued-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/pipeline-run-queued-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.pipelinerun.queued.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.pipelinerun.queued.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"pipelineName\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the pipeline source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param pipelineName
- * sets the pipeline name
- */
- public void setSubjectPipelineName(String pipelineName) {
- getSubject().getContent().setPipelineName(pipelineName);
- }
-
- /**
- * @param subjectUrl
- * sets the pipeline URL
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/PipelineRunStartedCDEvent.java b/src/main/java/dev/cdevents/events/PipelineRunStartedCDEvent.java
deleted file mode 100644
index 4e71966..0000000
--- a/src/main/java/dev/cdevents/events/PipelineRunStartedCDEvent.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.PipelineRunStartedSubject;
-
-import java.net.URI;
-
-public class PipelineRunStartedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private PipelineRunStartedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link PipelineRunStartedCDEvent}.
- */
- public PipelineRunStartedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new PipelineRunStartedSubject(CDEventConstants.SubjectType.PIPELINERUN));
- }
-
- /**
- * @return subject
- */
- public PipelineRunStartedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(PipelineRunStartedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the PipelineRunStartedEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.PipelineRunStartedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the pipeline-run-started-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/pipeline-run-started-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the pipeline-run-started-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/pipeline-run-started-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.pipelinerun.started.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.pipelinerun.started.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"pipelineName\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"pipelineName\",\n" +
- " \"url\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the pipeline source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param pipelineName
- * sets the pipeline name
- */
- public void setSubjectPipelineName(String pipelineName) {
- getSubject().getContent().setPipelineName(pipelineName);
- }
-
- /**
- * @param subjectUrl
- * sets the pipeline URL
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/RepositoryCreatedCDEvent.java b/src/main/java/dev/cdevents/events/RepositoryCreatedCDEvent.java
deleted file mode 100644
index 4b7895a..0000000
--- a/src/main/java/dev/cdevents/events/RepositoryCreatedCDEvent.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.RepositorySubject;
-
-import java.net.URI;
-
-public class RepositoryCreatedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private RepositorySubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link RepositoryCreatedCDEvent}.
- */
- public RepositoryCreatedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new RepositorySubject(CDEventConstants.SubjectType.REPOSITORY));
- }
-
- /**
- * @return subject
- */
- public RepositorySubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(RepositorySubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.RepositoryCreatedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the repository-created-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/repository-created-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the repository-created-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/repository-created-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.repository.created.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.repository.created.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"owner\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"viewUrl\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"name\",\n" +
- " \"url\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the repository source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryName
- * sets the name of the repository
- */
- public void setSubjectName(String repositoryName) {
- getSubject().getContent().setName(repositoryName);
- }
-
- /**
- * @param repositoryOwner
- * sets the name of the repository.
- */
- public void setSubjectOwner(String repositoryOwner) {
- getSubject().getContent().setOwner(repositoryOwner);
- }
-
- /**
- * @param subjectUrl
- * sets URL to the repository
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param subjectViewUrl
- * sets URL for humans to view the content of the repository
- */
- public void setSubjectViewUrl(URI subjectViewUrl) {
- getSubject().getContent().setViewUrl(subjectViewUrl);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/RepositoryDeletedCDEvent.java b/src/main/java/dev/cdevents/events/RepositoryDeletedCDEvent.java
deleted file mode 100644
index 902a4c7..0000000
--- a/src/main/java/dev/cdevents/events/RepositoryDeletedCDEvent.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.RepositorySubject;
-
-import java.net.URI;
-
-public class RepositoryDeletedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private RepositorySubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link RepositoryDeletedCDEvent}.
- */
- public RepositoryDeletedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new RepositorySubject(CDEventConstants.SubjectType.REPOSITORY));
- }
-
- /**
- * @return subject
- */
- public RepositorySubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(RepositorySubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.RepositoryDeletedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the repository-deleted-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/repository-deleted-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the repository-deleted-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/repository-deleted-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.repository.deleted.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.repository.deleted.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"owner\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"viewUrl\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the repository source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryName
- * sets the name of the repository
- */
- public void setSubjectName(String repositoryName) {
- getSubject().getContent().setName(repositoryName);
- }
-
- /**
- * @param repositoryOwner
- * sets the name of the repository.
- */
- public void setSubjectOwner(String repositoryOwner) {
- getSubject().getContent().setOwner(repositoryOwner);
- }
-
- /**
- * @param subjectUrl
- * sets URL to the repository
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param subjectViewUrl
- * sets URL for humans to view the content of the repository
- */
- public void setSubjectViewUrl(URI subjectViewUrl) {
- getSubject().getContent().setViewUrl(subjectViewUrl);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/RepositoryModifiedCDEvent.java b/src/main/java/dev/cdevents/events/RepositoryModifiedCDEvent.java
deleted file mode 100644
index 9b5d058..0000000
--- a/src/main/java/dev/cdevents/events/RepositoryModifiedCDEvent.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.RepositorySubject;
-
-import java.net.URI;
-
-public class RepositoryModifiedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private RepositorySubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link RepositoryModifiedCDEvent}.
- */
- public RepositoryModifiedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new RepositorySubject(CDEventConstants.SubjectType.REPOSITORY));
- }
-
- /**
- * @return subject
- */
- public RepositorySubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(RepositorySubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.RepositoryModifiedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the repository-modified-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/repository-modified-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the repository-modified-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/repository-modified-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.repository.modified.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.repository.modified.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"name\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"owner\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"viewUrl\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the repository source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param repositoryName
- * sets the name of the repository
- */
- public void setSubjectName(String repositoryName) {
- getSubject().getContent().setName(repositoryName);
- }
-
- /**
- * @param repositoryOwner
- * sets the name of the repository.
- */
- public void setSubjectOwner(String repositoryOwner) {
- getSubject().getContent().setOwner(repositoryOwner);
- }
-
- /**
- * @param subjectUrl
- * sets URL to the repository
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param subjectViewUrl
- * sets URL for humans to view the content of the repository
- */
- public void setSubjectViewUrl(URI subjectViewUrl) {
- getSubject().getContent().setViewUrl(subjectViewUrl);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ServiceDeployedCDEvent.java b/src/main/java/dev/cdevents/events/ServiceDeployedCDEvent.java
deleted file mode 100644
index d35db31..0000000
--- a/src/main/java/dev/cdevents/events/ServiceDeployedCDEvent.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ServiceDeployedSubject;
-
-import java.net.URI;
-
-public class ServiceDeployedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ServiceDeployedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ServiceDeployedCDEvent}.
- */
- public ServiceDeployedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ServiceDeployedSubject(CDEventConstants.SubjectType.SERVICE));
- }
-
- /**
- * @return subject
- */
- public ServiceDeployedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ServiceDeployedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent Type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ServiceDeployedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the service-deployed-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/service-deployed-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the service-deployed-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/service-deployed-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.service.deployed.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.service.deployed.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"environment\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " },\n" +
- " \"artifactId\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"environment\",\n" +
- " \"artifactId\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param environmentId
- * sets the environmentId that this service belongs to
- */
- public void setSubjectEnvironmentId(String environmentId) {
- getSubject().getContent().getEnvironment().setId(environmentId);
- }
-
- /**
- * @param environmentSource
- * sets the environmentSource that this service belongs to
- */
- public void setSubjectEnvironmentSource(URI environmentSource) {
- getSubject().getContent().getEnvironment().setSource(environmentSource);
- }
-
- /**
- * @param artifactId
- * sets the subject artifactId
- */
- public void setSubjectArtifactId(PackageURL artifactId) {
- getSubject().getContent().setArtifactId(artifactId.toString());
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ServicePublishedCDEvent.java b/src/main/java/dev/cdevents/events/ServicePublishedCDEvent.java
deleted file mode 100644
index d65d797..0000000
--- a/src/main/java/dev/cdevents/events/ServicePublishedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ServicePublishedSubject;
-
-import java.net.URI;
-
-public class ServicePublishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ServicePublishedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ServicePublishedCDEvent}.
- */
- public ServicePublishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ServicePublishedSubject(CDEventConstants.SubjectType.SERVICE));
- }
-
- /**
- * @return subject
- */
- public ServicePublishedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ServicePublishedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent Type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ServicePublishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the service-Published-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/service-published-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the service-Published-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/service-published-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.service.published.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.service.published.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"environment\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param environmentId
- * sets the environmentId that this service belongs to
- */
- public void setSubjectEnvironmentId(String environmentId) {
- getSubject().getContent().getEnvironment().setId(environmentId);
- }
-
- /**
- * @param environmentSource
- * sets the environmentSource that this service belongs to
- */
- public void setSubjectEnvironmentSource(URI environmentSource) {
- getSubject().getContent().getEnvironment().setSource(environmentSource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ServiceRemovedCDEvent.java b/src/main/java/dev/cdevents/events/ServiceRemovedCDEvent.java
deleted file mode 100644
index d90130b..0000000
--- a/src/main/java/dev/cdevents/events/ServiceRemovedCDEvent.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ServiceRemovedSubject;
-
-import java.net.URI;
-
-public class ServiceRemovedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ServiceRemovedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ServiceRemovedCDEvent}.
- */
- public ServiceRemovedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ServiceRemovedSubject(CDEventConstants.SubjectType.SERVICE));
- }
-
- /**
- * @return subject
- */
- public ServiceRemovedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ServiceRemovedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent Type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ServiceRemovedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the service-Removed-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/service-removed-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the service-Removed-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/service-removed-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.service.removed.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.service.removed.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"environment\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param environmentId
- * sets the environmentId that this service belongs to
- */
- public void setSubjectEnvironmentId(String environmentId) {
- getSubject().getContent().getEnvironment().setId(environmentId);
- }
-
- /**
- * @param environmentSource
- * sets the environmentSource that this service belongs to
- */
- public void setSubjectEnvironmentSource(URI environmentSource) {
- getSubject().getContent().getEnvironment().setSource(environmentSource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ServiceRolledBackCDEvent.java b/src/main/java/dev/cdevents/events/ServiceRolledBackCDEvent.java
deleted file mode 100644
index b844f00..0000000
--- a/src/main/java/dev/cdevents/events/ServiceRolledBackCDEvent.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ServiceRolledBackSubject;
-
-import java.net.URI;
-
-public class ServiceRolledBackCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ServiceRolledBackSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ServiceRolledBackCDEvent}.
- */
- public ServiceRolledBackCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ServiceRolledBackSubject(CDEventConstants.SubjectType.SERVICE));
- }
-
- /**
- * @return subject
- */
- public ServiceRolledBackSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ServiceRolledBackSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent Type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ServiceRolledBackEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the service-RolledBack-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/service-rolledback-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the service-RolledBack-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/service-rolledback-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.service.rolledback.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.service.rolledback.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"environment\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " },\n" +
- " \"artifactId\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"environment\",\n" +
- " \"artifactId\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param environmentId
- * sets the environmentId that this service belongs to
- */
- public void setSubjectEnvironmentId(String environmentId) {
- getSubject().getContent().getEnvironment().setId(environmentId);
- }
-
- /**
- * @param environmentSource
- * sets the environmentSource that this service belongs to
- */
- public void setSubjectEnvironmentSource(URI environmentSource) {
- getSubject().getContent().getEnvironment().setSource(environmentSource);
- }
-
- /**
- * @param artifactId
- * sets the subject artifactId
- */
- public void setSubjectArtifactId(PackageURL artifactId) {
- getSubject().getContent().setArtifactId(artifactId.toString());
- }
-}
diff --git a/src/main/java/dev/cdevents/events/ServiceUpgradedCDEvent.java b/src/main/java/dev/cdevents/events/ServiceUpgradedCDEvent.java
deleted file mode 100644
index e05d8fa..0000000
--- a/src/main/java/dev/cdevents/events/ServiceUpgradedCDEvent.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.ServiceUpgradedSubject;
-
-import java.net.URI;
-
-public class ServiceUpgradedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private ServiceUpgradedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link ServiceUpgradedCDEvent}.
- */
- public ServiceUpgradedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new ServiceUpgradedSubject(CDEventConstants.SubjectType.SERVICE));
- }
-
- /**
- * @return subject
- */
- public ServiceUpgradedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(ServiceUpgradedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent Type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.ServiceUpgradedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the service-Upgraded-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/service-upgraded-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the service-Upgraded-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/service-upgraded-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.service.upgraded.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.service.upgraded.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"environment\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " },\n" +
- " \"artifactId\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"environment\",\n" +
- " \"artifactId\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param environmentId
- * sets the environmentId that this service belongs to
- */
- public void setSubjectEnvironmentId(String environmentId) {
- getSubject().getContent().getEnvironment().setId(environmentId);
- }
-
- /**
- * @param environmentSource
- * sets the environmentSource that this service belongs to
- */
- public void setSubjectEnvironmentSource(URI environmentSource) {
- getSubject().getContent().getEnvironment().setSource(environmentSource);
- }
-
- /**
- * @param artifactId
- * sets the subject artifactId
- */
- public void setSubjectArtifactId(PackageURL artifactId) {
- getSubject().getContent().setArtifactId(artifactId.toString());
- }
-}
diff --git a/src/main/java/dev/cdevents/events/TaskRunFinishedCDEvent.java b/src/main/java/dev/cdevents/events/TaskRunFinishedCDEvent.java
deleted file mode 100644
index 38cf58c..0000000
--- a/src/main/java/dev/cdevents/events/TaskRunFinishedCDEvent.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TaskRunFinishedSubject;
-
-import java.net.URI;
-
-public class TaskRunFinishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TaskRunFinishedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TaskRunFinishedCDEvent}.
- */
- public TaskRunFinishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TaskRunFinishedSubject(CDEventConstants.SubjectType.TASKRUN));
- }
-
- /**
- * @return subject
- */
- public TaskRunFinishedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TaskRunFinishedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TaskRunFinishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the task-run-finished-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/task-run-finished-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the task-run-finished-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/task-run-finished-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.taskrun.finished.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.taskrun.finished.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"taskName\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"pipelineRun\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " },\n" +
- " \"outcome\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"errors\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the taskRun subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the taskRun subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param taskName
- * sets the taskName
- */
- public void setSubjectTaskName(String taskName) {
- getSubject().getContent().setTaskName(taskName);
- }
-
- /**
- * @param subjectUrl
- * sets the taskRun URL
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param subjectOutcome
- * sets the {@link TaskRunFinishedCDEvent} outcome
- */
- public void setSubjectOutcome(CDEventConstants.Outcome subjectOutcome) {
- getSubject().getContent().setOutcome(subjectOutcome);
- }
-
- /**
- * @param subjectErrors
- * sets the {@link TaskRunFinishedCDEvent} errors
- */
- public void setSubjectErrors(String subjectErrors) {
- getSubject().getContent().setErrors(subjectErrors);
- }
-
- /**
- * @param pipelineRunId
- * sets The pipelineRunId that this taskRun belongs to
- */
- public void setSubjectPipelineRunId(String pipelineRunId) {
- getSubject().getContent().getPipelineRun().setId(pipelineRunId);
-
- }
-
- /**
- * @param pipelineRunSource
- * sets The pipelineRunSource that this taskRun belongs to
- */
- public void setSubjectPipelineRunSource(URI pipelineRunSource) {
- getSubject().getContent().getPipelineRun().setSource(pipelineRunSource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/TaskRunStartedCDEvent.java b/src/main/java/dev/cdevents/events/TaskRunStartedCDEvent.java
deleted file mode 100644
index b32f7a4..0000000
--- a/src/main/java/dev/cdevents/events/TaskRunStartedCDEvent.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TaskRunStartedSubject;
-
-import java.net.URI;
-
-public class TaskRunStartedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TaskRunStartedSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TaskRunStartedCDEvent}.
- */
- public TaskRunStartedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TaskRunStartedSubject(CDEventConstants.SubjectType.TASKRUN));
- }
-
- /**
- * @return subject
- */
- public TaskRunStartedSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TaskRunStartedSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the TaskRunStartedEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TaskRunStartedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the task-run-started-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/task-run-started-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the task-run-started-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/task-run-started-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.taskrun.started.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.taskrun.started.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {\n" +
- " \"taskName\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"url\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"pipelineRun\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\"\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the taskRun source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
- /**
- * @param taskName
- * sets the taskName
- */
- public void setSubjectTaskName(String taskName) {
- getSubject().getContent().setTaskName(taskName);
- }
-
- /**
- * @param subjectUrl
- * sets the taskRun URL
- */
- public void setSubjectUrl(URI subjectUrl) {
- getSubject().getContent().setUrl(subjectUrl);
- }
-
- /**
- * @param pipelineRunId
- * sets The pipelineRunId that this taskRun belongs to
- */
- public void setSubjectPipelineRunId(String pipelineRunId) {
- getSubject().getContent().getPipelineRun().setId(pipelineRunId);
-
- }
-
- /**
- * @param pipelineRunSource
- * sets The pipelineRunSource that this taskRun belongs to
- */
- public void setSubjectPipelineRunSource(URI pipelineRunSource) {
- getSubject().getContent().getPipelineRun().setSource(pipelineRunSource);
- }
-}
diff --git a/src/main/java/dev/cdevents/events/TestCaseFinishedCDEvent.java b/src/main/java/dev/cdevents/events/TestCaseFinishedCDEvent.java
deleted file mode 100644
index 08bfea4..0000000
--- a/src/main/java/dev/cdevents/events/TestCaseFinishedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TestCaseSubject;
-
-import java.net.URI;
-
-public class TestCaseFinishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TestCaseSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TestCaseFinishedCDEvent}.
- */
- public TestCaseFinishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TestCaseSubject(CDEventConstants.SubjectType.TESTCASE));
- }
-
- /**
- * @return subject
- */
- public TestCaseSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TestCaseSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TestCaseFinishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the test-case-finished-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/test-case-finished-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the test-case-finished-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/test-case-finished-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.testcase.finished.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.testcase.finished.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/TestCaseQueuedCDEvent.java b/src/main/java/dev/cdevents/events/TestCaseQueuedCDEvent.java
deleted file mode 100644
index f68a495..0000000
--- a/src/main/java/dev/cdevents/events/TestCaseQueuedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TestCaseSubject;
-
-import java.net.URI;
-
-public class TestCaseQueuedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TestCaseSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TestCaseQueuedCDEvent}.
- */
- public TestCaseQueuedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TestCaseSubject(CDEventConstants.SubjectType.TESTCASE));
- }
-
- /**
- * @return subject
- */
- public TestCaseSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TestCaseSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TestCaseQueuedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the test-case-queued-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/test-case-queued-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the test-case-queued-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/test-case-queued-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.testcase.queued.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.testcase.queued.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/TestCaseStartedCDEvent.java b/src/main/java/dev/cdevents/events/TestCaseStartedCDEvent.java
deleted file mode 100644
index ba63ef3..0000000
--- a/src/main/java/dev/cdevents/events/TestCaseStartedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TestCaseSubject;
-
-import java.net.URI;
-
-public class TestCaseStartedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TestCaseSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TestCaseStartedCDEvent}.
- */
- public TestCaseStartedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TestCaseSubject(CDEventConstants.SubjectType.TESTCASE));
- }
-
- /**
- * @return subject
- */
- public TestCaseSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TestCaseSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TestCaseStartedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the test-case-started-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/test-case-started-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the test-case-started-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/test-case-started-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.testcase.started.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.testcase.started.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/TestSuiteFinishedCDEvent.java b/src/main/java/dev/cdevents/events/TestSuiteFinishedCDEvent.java
deleted file mode 100644
index d005dec..0000000
--- a/src/main/java/dev/cdevents/events/TestSuiteFinishedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TestSuiteSubject;
-
-import java.net.URI;
-
-public class TestSuiteFinishedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TestSuiteSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TestSuiteFinishedCDEvent}.
- */
- public TestSuiteFinishedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TestSuiteSubject(CDEventConstants.SubjectType.TESTSUITE));
- }
-
- /**
- * @return subject
- */
- public TestSuiteSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TestSuiteSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TestSuiteFinishedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the test-suite-finished-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/test-suite-finished-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the test-suite-finished-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/test-suite-finished-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.testsuite.finished.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.testsuite.finished.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/events/TestSuiteStartedCDEvent.java b/src/main/java/dev/cdevents/events/TestSuiteStartedCDEvent.java
deleted file mode 100644
index a08f115..0000000
--- a/src/main/java/dev/cdevents/events/TestSuiteStartedCDEvent.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package dev.cdevents.events;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.models.CDEvent;
-import dev.cdevents.models.TestSuiteSubject;
-
-import java.net.URI;
-
-public class TestSuiteStartedCDEvent extends CDEvent {
-
- private static final String CDEVENT_VERSION = "0.1.0";
- @JsonProperty(required = true)
- private TestSuiteSubject subject;
-
- /**
- * Constructor to init CDEvent and set the Subject for {@link TestSuiteStartedCDEvent}.
- */
- public TestSuiteStartedCDEvent() {
- initCDEvent(currentCDEventType());
- setSubject(new TestSuiteSubject(CDEventConstants.SubjectType.TESTSUITE));
- }
-
- /**
- * @return subject
- */
- public TestSuiteSubject getSubject() {
- return subject;
- }
-
- /**
- * @param subject
- */
- public void setSubject(TestSuiteSubject subject) {
- this.subject = subject;
- }
-
- /**
- * @return the current CDEvent type
- */
- @Override
- public String currentCDEventType() {
- return CDEventConstants.CDEventTypes.TestSuiteStartedEvent.getEventType().concat(CDEVENT_VERSION);
- }
-
- /**
- * @return the test-suite-started-event schema URL
- */
- @Override
- public String schemaURL() {
- return String.format("https://cdevents.dev/%s/schema/test-suite-started-event", CDEventConstants.CDEVENTS_SPEC_VERSION);
- }
-
- /**
- * @return the test-suite-started-event schema Json
- */
- @Override
- public String eventSchema() {
- return "{\n" +
- " \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n" +
- " \"$id\": \"https://cdevents.dev/0.1.2/schema/test-suite-started-event\",\n" +
- " \"properties\": {\n" +
- " \"context\": {\n" +
- " \"properties\": {\n" +
- " \"version\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"enum\": [\n" +
- " \"dev.cdevents.testsuite.started.0.1.0\"\n" +
- " ],\n" +
- " \"default\": \"dev.cdevents.testsuite.started.0.1.0\"\n" +
- " },\n" +
- " \"timestamp\": {\n" +
- " \"type\": \"string\",\n" +
- " \"format\": \"date-time\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"version\",\n" +
- " \"id\",\n" +
- " \"source\",\n" +
- " \"type\",\n" +
- " \"timestamp\"\n" +
- " ]\n" +
- " },\n" +
- " \"subject\": {\n" +
- " \"properties\": {\n" +
- " \"id\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"source\": {\n" +
- " \"type\": \"string\"\n" +
- " },\n" +
- " \"type\": {\n" +
- " \"type\": \"string\",\n" +
- " \"minLength\": 1\n" +
- " },\n" +
- " \"content\": {\n" +
- " \"properties\": {},\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"id\",\n" +
- " \"type\",\n" +
- " \"content\"\n" +
- " ]\n" +
- " },\n" +
- " \"customData\": {\n" +
- " \"oneOf\": [\n" +
- " {\n" +
- " \"type\": \"object\"\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"string\",\n" +
- " \"contentEncoding\": \"base64\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"customDataContentType\": {\n" +
- " \"type\": \"string\"\n" +
- " }\n" +
- " },\n" +
- " \"additionalProperties\": false,\n" +
- " \"type\": \"object\",\n" +
- " \"required\": [\n" +
- " \"context\",\n" +
- " \"subject\"\n" +
- " ]\n" +
- "}";
- }
-
- /**
- * @param subjectId
- * sets the subject Id
- */
- public void setSubjectId(String subjectId) {
- getSubject().setId(subjectId);
- }
-
- /**
- * @param subjectSource
- * sets the subject source
- */
- public void setSubjectSource(URI subjectSource) {
- getSubject().setSource(subjectSource);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/ArtifactPackagedSubject.java b/src/main/java/dev/cdevents/models/ArtifactPackagedSubject.java
deleted file mode 100644
index 774b1f3..0000000
--- a/src/main/java/dev/cdevents/models/ArtifactPackagedSubject.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ArtifactPackagedSubject extends Subject {
-
- @JsonProperty(required = true)
- private ArtifactPackagedSubjectContent content = new ArtifactPackagedSubjectContent();
-
- /**
- * @return the Artifact subject's Content
- */
- public ArtifactPackagedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ArtifactPackagedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ArtifactPackagedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ArtifactPackagedSubjectContent());
- }
-
- public class ArtifactPackagedSubjectContent {
- private Change change = new Change();
-
- /**
- * @return change
- */
- public Change getChange() {
- return change;
- }
-
- /**
- * @param change
- */
- public void setChange(Change change) {
- this.change = change;
- }
-
- public class Change {
- private String id;
-
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
- }
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/ArtifactPublishedSubject.java b/src/main/java/dev/cdevents/models/ArtifactPublishedSubject.java
deleted file mode 100644
index 7749562..0000000
--- a/src/main/java/dev/cdevents/models/ArtifactPublishedSubject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class ArtifactPublishedSubject extends Subject {
-
- @JsonProperty(required = true)
- private Object content = new Object();
-
- /**
- * @return the Artifact subject's Content
- */
- public Object getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(Object content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ArtifactPublishedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/BranchSubject.java b/src/main/java/dev/cdevents/models/BranchSubject.java
deleted file mode 100644
index f451952..0000000
--- a/src/main/java/dev/cdevents/models/BranchSubject.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class BranchSubject extends Subject {
-
- @JsonProperty(required = true)
- private BranchSubjectContent content;
-
-
- /**
- * @return the Branch subject's Content
- */
- public BranchSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(BranchSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public BranchSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new BranchSubjectContent());
-
- }
-
- public class BranchSubjectContent {
-
- private Repository repository = new Repository();
-
- /**
- * @return repository
- */
- public Repository getRepository() {
- return repository;
- }
-
- /**
- * @param repository
- */
- public void setRepository(Repository repository) {
- this.repository = repository;
- }
-
- public class Repository {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/BuildFinishedSubject.java b/src/main/java/dev/cdevents/models/BuildFinishedSubject.java
deleted file mode 100644
index 91fdfe8..0000000
--- a/src/main/java/dev/cdevents/models/BuildFinishedSubject.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class BuildFinishedSubject extends Subject {
-
- @JsonProperty(required = true)
- private BuildFinishedSubjectContent content = new BuildFinishedSubjectContent();
-
- /**
- * @return the BuildStarted subject's Content
- */
- public BuildFinishedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(BuildFinishedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public BuildFinishedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
- public class BuildFinishedSubjectContent {
-
- @JsonProperty(required = true)
- private String artifactId;
-
- /**
- * @return artifactId
- */
- public String getArtifactId() {
- return artifactId;
- }
-
- /**
- * @param artifactId
- */
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/BuildQueuedSubject.java b/src/main/java/dev/cdevents/models/BuildQueuedSubject.java
deleted file mode 100644
index 6b34400..0000000
--- a/src/main/java/dev/cdevents/models/BuildQueuedSubject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class BuildQueuedSubject extends Subject {
-
- @JsonProperty(required = true)
- private Object content = new Object();
-
- /**
- * @return the BuildQueued subject's Content
- */
- public Object getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(Object content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public BuildQueuedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/BuildStartedSubject.java b/src/main/java/dev/cdevents/models/BuildStartedSubject.java
deleted file mode 100644
index 0dc32d6..0000000
--- a/src/main/java/dev/cdevents/models/BuildStartedSubject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class BuildStartedSubject extends Subject {
-
- @JsonProperty(required = true)
- private Object content = new Object();
-
- /**
- * @return the BuildStarted subject's Content
- */
- public Object getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(Object content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public BuildStartedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/CDEvent.java b/src/main/java/dev/cdevents/models/CDEvent.java
deleted file mode 100644
index 1c82b2b..0000000
--- a/src/main/java/dev/cdevents/models/CDEvent.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-import java.time.LocalDateTime;
-import java.util.UUID;
-
-public abstract class CDEvent {
-
- @JsonProperty(required = true)
- private Context context;
-
- @JsonProperty
- private Object customData = new Object();
-
- @JsonProperty
- private String customDataContentType = "application/json";
-
-
- /**
- * @return current CDEvent type
- */
- public abstract String currentCDEventType();
-
- /**
- * @return schema URL for validating the CDEvent structure
- */
- public abstract String schemaURL();
-
- /**
- * @return schema json for validating the CDEvent structure
- */
- public abstract String eventSchema();
-
- /**
- * @param source
- * Sets the {@link Context} source value
- */
- public void setSource(URI source) {
- this.getContext().setSource(source);
- }
-
- /**
- * @return context
- */
- public Context getContext() {
- return context;
- }
-
- /**
- * @param context
- */
- public void setContext(Context context) {
- this.context = context;
- }
-
- /**
- * @return customData
- */
- public Object getCustomData() {
- return customData;
- }
-
- /**
- * @param customData
- */
- public void setCustomData(Object customData) {
- this.customData = customData;
- }
-
- /**
- * @return customDataContentType
- */
- public String getCustomDataContentType() {
- return customDataContentType;
- }
-
- /**
- * @param customDataContentType
- */
- public void setCustomDataContentType(String customDataContentType) {
- this.customDataContentType = customDataContentType;
- }
-
- /**
- * @param cdeventType
- * Initialize the CDEvent with the context values
- */
- public void initCDEvent(String cdeventType) {
- setContext(new Context(UUID.randomUUID().toString(), LocalDateTime.now(), cdeventType, CDEventConstants.CDEVENTS_SPEC_VERSION));
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ChangeSubject.java b/src/main/java/dev/cdevents/models/ChangeSubject.java
deleted file mode 100644
index eb53599..0000000
--- a/src/main/java/dev/cdevents/models/ChangeSubject.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ChangeSubject extends Subject {
-
- @JsonProperty(required = true)
- private ChangeSubjectContent content;
-
-
- /**
- * @return the Change subject's Content
- */
- public ChangeSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ChangeSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ChangeSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ChangeSubjectContent());
-
- }
-
- public class ChangeSubjectContent {
-
- private Repository repository = new Repository();
-
- /**
- * @return repository
- */
- public Repository getRepository() {
- return repository;
- }
-
- /**
- * @param repository
- */
- public void setRepository(Repository repository) {
- this.repository = repository;
- }
-
- public class Repository {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/Context.java b/src/main/java/dev/cdevents/models/Context.java
deleted file mode 100644
index e47ae5c..0000000
--- a/src/main/java/dev/cdevents/models/Context.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.net.URI;
-import java.time.LocalDateTime;
-
-public class Context {
- @JsonProperty(required = true)
- private String id;
-
- @JsonProperty(required = true)
- private String type;
-
- @JsonProperty(required = true)
- private URI source;
-
- @JsonProperty(required = true)
- private String version;
-
- @JsonProperty(required = true)
- @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
- private LocalDateTime timestamp;
-
- /**
- * @param id
- * @param timestamp
- * @param type
- * @param version
- */
- public Context(String id, LocalDateTime timestamp, String type, String version) {
- this.id = id;
- this.timestamp = timestamp;
- this.type = type;
- this.version = version;
- }
-
- /**
- * @return Context id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- /**
- * @return version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * @param version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * @return timestamp
- */
- public LocalDateTime getTimestamp() {
- return timestamp;
- }
-
- /**
- * @param timestamp
- */
- public void setTimestamp(LocalDateTime timestamp) {
- this.timestamp = timestamp;
- }
-}
diff --git a/src/main/java/dev/cdevents/models/EnvironmentCreatedSubject.java b/src/main/java/dev/cdevents/models/EnvironmentCreatedSubject.java
deleted file mode 100644
index cbc5caa..0000000
--- a/src/main/java/dev/cdevents/models/EnvironmentCreatedSubject.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class EnvironmentCreatedSubject extends Subject {
-
- @JsonProperty(required = true)
- private EnvironmentCreatedSubjectContent content;
-
-
-
- /**
- * @return the EnvironmentCreated subject's content
- */
- public EnvironmentCreatedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(EnvironmentCreatedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * Constructor to set the Subject Type.
- *
- * @param subjectType
- */
- public EnvironmentCreatedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new EnvironmentCreatedSubjectContent());
- }
-
-
- public class EnvironmentCreatedSubjectContent {
- @JsonProperty
- private String name;
-
- @JsonProperty
- private String url;
-
- /**
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return url
- */
- public String getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(String url) {
- this.url = url;
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/EnvironmentDeletedSubject.java b/src/main/java/dev/cdevents/models/EnvironmentDeletedSubject.java
deleted file mode 100644
index 8127723..0000000
--- a/src/main/java/dev/cdevents/models/EnvironmentDeletedSubject.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class EnvironmentDeletedSubject extends Subject {
-
- @JsonProperty(required = true)
- private EnvironmentDeletedSubjectContent content;
-
-
-
- /**
- * @return the EnvironmentDeleted subject's content
- */
- public EnvironmentDeletedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(EnvironmentDeletedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * Constructor to set the Subject Type.
- *
- * @param subjectType
- */
- public EnvironmentDeletedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new EnvironmentDeletedSubjectContent());
- }
-
-
- public class EnvironmentDeletedSubjectContent {
- @JsonProperty
- private String name;
-
- /**
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- }
-}
diff --git a/src/main/java/dev/cdevents/models/EnvironmentModifiedSubject.java b/src/main/java/dev/cdevents/models/EnvironmentModifiedSubject.java
deleted file mode 100644
index 48bc468..0000000
--- a/src/main/java/dev/cdevents/models/EnvironmentModifiedSubject.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class EnvironmentModifiedSubject extends Subject {
-
- @JsonProperty(required = true)
- private EnvironmentModifiedSubjectContent content;
-
-
-
- /**
- * @return the EnvironmentModified subject's content
- */
- public EnvironmentModifiedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(EnvironmentModifiedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * Constructor to set the Subject Type.
- *
- * @param subjectType
- */
- public EnvironmentModifiedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new EnvironmentModifiedSubjectContent());
- }
-
-
- public class EnvironmentModifiedSubjectContent {
- @JsonProperty
- private String name;
-
- @JsonProperty
- private String url;
-
- /**
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return url
- */
- public String getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(String url) {
- this.url = url;
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/PipelineRunFinishedSubject.java b/src/main/java/dev/cdevents/models/PipelineRunFinishedSubject.java
deleted file mode 100644
index a2b7aeb..0000000
--- a/src/main/java/dev/cdevents/models/PipelineRunFinishedSubject.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class PipelineRunFinishedSubject extends Subject {
-
- @JsonProperty(required = true)
- private PipelineRunFinishedSubjectContent content;
-
-
- /**
- * @return the PipelineRunFinished subject's Content
- */
- public PipelineRunFinishedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(PipelineRunFinishedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public PipelineRunFinishedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new PipelineRunFinishedSubjectContent());
-
- }
-
- public class PipelineRunFinishedSubjectContent {
-
- @JsonProperty
- private String pipelineName;
-
- @JsonProperty
- private URI url;
-
- @JsonProperty
- private CDEventConstants.Outcome outcome;
-
- @JsonProperty
- private String errors;
-
- /**
- * @return pipelineName
- */
- public String getPipelineName() {
- return pipelineName;
- }
-
- /**
- * @param pipelineName
- */
- public void setPipelineName(String pipelineName) {
- this.pipelineName = pipelineName;
- }
-
- /**
- * @return URL
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- /**
- * @return outcome
- */
- public CDEventConstants.Outcome getOutcome() {
- return outcome;
- }
-
- /**
- * @param outcome
- */
- public void setOutcome(CDEventConstants.Outcome outcome) {
- this.outcome = outcome;
- }
-
-
- /**
- * @return errors
- */
- public String getErrors() {
- return errors;
- }
-
-
- /**
- * @param errors
- */
- public void setErrors(String errors) {
- this.errors = errors;
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/PipelineRunQueuedSubject.java b/src/main/java/dev/cdevents/models/PipelineRunQueuedSubject.java
deleted file mode 100644
index ca48a14..0000000
--- a/src/main/java/dev/cdevents/models/PipelineRunQueuedSubject.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class PipelineRunQueuedSubject extends Subject {
-
- @JsonProperty(required = true)
- private PipelineRunQueuedSubjectContent content;
-
-
- /**
- * @return the PipelineRunQueued subject's Content
- */
- public PipelineRunQueuedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(PipelineRunQueuedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public PipelineRunQueuedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new PipelineRunQueuedSubjectContent());
-
- }
-
- public class PipelineRunQueuedSubjectContent {
-
- @JsonProperty
- private String pipelineName;
-
- @JsonProperty
- private URI url;
-
-
- /**
- * @return pipelineName
- */
- public String getPipelineName() {
- return pipelineName;
- }
-
- /**
- * @param pipelineName
- */
- public void setPipelineName(String pipelineName) {
- this.pipelineName = pipelineName;
- }
-
- /**
- * @return URL
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- }
-}
diff --git a/src/main/java/dev/cdevents/models/PipelineRunStartedSubject.java b/src/main/java/dev/cdevents/models/PipelineRunStartedSubject.java
deleted file mode 100644
index a9d76af..0000000
--- a/src/main/java/dev/cdevents/models/PipelineRunStartedSubject.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class PipelineRunStartedSubject extends Subject {
-
- @JsonProperty(required = true)
- private PipelineRunStartedSubjectContent content;
-
-
- /**
- * @return the PipelineRunStarted subject's Content
- */
- public PipelineRunStartedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(PipelineRunStartedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public PipelineRunStartedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new PipelineRunStartedSubjectContent());
-
- }
-
- public class PipelineRunStartedSubjectContent {
-
- @JsonProperty
- private String pipelineName;
-
- @JsonProperty
- private URI url;
-
-
- /**
- * @return pipelineName
- */
- public String getPipelineName() {
- return pipelineName;
- }
-
- /**
- * @param pipelineName
- */
- public void setPipelineName(String pipelineName) {
- this.pipelineName = pipelineName;
- }
-
- /**
- * @return URL
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- }
-}
diff --git a/src/main/java/dev/cdevents/models/RepositorySubject.java b/src/main/java/dev/cdevents/models/RepositorySubject.java
deleted file mode 100644
index b124c49..0000000
--- a/src/main/java/dev/cdevents/models/RepositorySubject.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class RepositorySubject extends Subject {
-
- @JsonProperty(required = true)
- private RepositorySubjectContent content;
-
-
- /**
- * @return the Repository subject's Content
- */
- public RepositorySubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(RepositorySubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public RepositorySubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new RepositorySubjectContent());
-
- }
-
- public class RepositorySubjectContent {
-
- private String name;
- private String owner;
- private URI url;
- private URI viewUrl;
-
-
- /**
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return owner
- */
- public String getOwner() {
- return owner;
- }
-
- /**
- * @param owner
- */
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- /**
- * @return url
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- /**
- * @return viewUrl
- */
- public URI getViewUrl() {
- return viewUrl;
- }
-
- /**
- * @param viewUrl
- */
- public void setViewUrl(URI viewUrl) {
- this.viewUrl = viewUrl;
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ServiceDeployedSubject.java b/src/main/java/dev/cdevents/models/ServiceDeployedSubject.java
deleted file mode 100644
index a56dc04..0000000
--- a/src/main/java/dev/cdevents/models/ServiceDeployedSubject.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-import java.net.URI;
-
-public class ServiceDeployedSubject extends Subject {
-
- @JsonProperty(required = true)
- private ServiceDeployedSubjectContent content;
-
- /**
- * @return the Service Deployed subject's Content
- */
- public ServiceDeployedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ServiceDeployedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ServiceDeployedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ServiceDeployedSubjectContent());
- }
-
- public class ServiceDeployedSubjectContent {
-
- @JsonProperty
- private Environment environment = new Environment();
- @JsonProperty
- private String artifactId;
-
- /**
- * @return environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * @param environment
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- /**
- * @return artifactId
- */
- public String getArtifactId() {
- return artifactId;
- }
-
- /**
- * @param artifactId
- */
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public class Environment {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ServicePublishedSubject.java b/src/main/java/dev/cdevents/models/ServicePublishedSubject.java
deleted file mode 100644
index 1fcea70..0000000
--- a/src/main/java/dev/cdevents/models/ServicePublishedSubject.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ServicePublishedSubject extends Subject {
-
- @JsonProperty(required = true)
- private ServicePublishedSubjectContent content;
-
- /**
- * @return the Service Published subject's Content
- */
- public ServicePublishedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ServicePublishedSubjectContent content) {
- this.content = content;
- }
-
-
- /**
- * @param subjectType
- */
- public ServicePublishedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ServicePublishedSubjectContent());
- }
-
- public class ServicePublishedSubjectContent {
-
- @JsonProperty
- private Environment environment = new Environment();
-
- /**
- * @return environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * @param environment
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- public class Environment {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ServiceRemovedSubject.java b/src/main/java/dev/cdevents/models/ServiceRemovedSubject.java
deleted file mode 100644
index 5e9c58b..0000000
--- a/src/main/java/dev/cdevents/models/ServiceRemovedSubject.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ServiceRemovedSubject extends Subject {
-
- @JsonProperty(required = true)
- private ServiceRemovedSubjectContent content;
-
- /**
- * @return the Service Removed subject's Content
- */
- public ServiceRemovedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ServiceRemovedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ServiceRemovedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ServiceRemovedSubjectContent());
- }
-
- public class ServiceRemovedSubjectContent {
-
- @JsonProperty
- private Environment environment = new Environment();
-
- /**
- * @return environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * @param environment
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- public class Environment {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ServiceRolledBackSubject.java b/src/main/java/dev/cdevents/models/ServiceRolledBackSubject.java
deleted file mode 100644
index b897e5d..0000000
--- a/src/main/java/dev/cdevents/models/ServiceRolledBackSubject.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ServiceRolledBackSubject extends Subject {
-
- @JsonProperty(required = true)
- private ServiceRolledBackSubjectContent content;
-
- /**
- * @return the Service RolledBack subject's Content
- */
- public ServiceRolledBackSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ServiceRolledBackSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ServiceRolledBackSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ServiceRolledBackSubjectContent());
- }
-
- public class ServiceRolledBackSubjectContent {
-
- @JsonProperty
- private Environment environment = new Environment();
- @JsonProperty
- private String artifactId;
-
- /**
- * @return environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * @param environment
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- /**
- * @return artifactId
- */
- public String getArtifactId() {
- return artifactId;
- }
-
- /**
- * @param artifactId
- */
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public class Environment {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/ServiceUpgradedSubject.java b/src/main/java/dev/cdevents/models/ServiceUpgradedSubject.java
deleted file mode 100644
index 9e7d26a..0000000
--- a/src/main/java/dev/cdevents/models/ServiceUpgradedSubject.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class ServiceUpgradedSubject extends Subject {
-
- @JsonProperty(required = true)
- private ServiceUpgradedSubjectContent content;
-
- /**
- * @return the Service Upgraded subject's Content
- */
- public ServiceUpgradedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(ServiceUpgradedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public ServiceUpgradedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new ServiceUpgradedSubjectContent());
- }
-
- public class ServiceUpgradedSubjectContent {
-
- @JsonProperty
- private Environment environment = new Environment();
- @JsonProperty
- private String artifactId;
-
- /**
- * @return environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * @param environment
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- /**
- * @return artifactId
- */
- public String getArtifactId() {
- return artifactId;
- }
-
- /**
- * @param artifactId
- */
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public class Environment {
- private String id;
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/Subject.java b/src/main/java/dev/cdevents/models/Subject.java
deleted file mode 100644
index b04c421..0000000
--- a/src/main/java/dev/cdevents/models/Subject.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class Subject {
-
- @JsonProperty(required = true)
- private String id;
-
- @JsonProperty
- private URI source;
-
- @JsonProperty(required = true)
- private CDEventConstants.SubjectType type;
-
- /**
- * Constructor to set the Subject Type.
- * @param type
- */
- public Subject(CDEventConstants.SubjectType type) {
- this.type = type;
- }
-
- /**
- * @return Subject id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
-
- /**
- * @return subject type
- */
- public CDEventConstants.SubjectType getType() {
- return type;
- }
-
-
- /**
- * @param type
- */
- public void setType(CDEventConstants.SubjectType type) {
- this.type = type;
- }
-}
diff --git a/src/main/java/dev/cdevents/models/TaskRunFinishedSubject.java b/src/main/java/dev/cdevents/models/TaskRunFinishedSubject.java
deleted file mode 100644
index f584586..0000000
--- a/src/main/java/dev/cdevents/models/TaskRunFinishedSubject.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class TaskRunFinishedSubject extends Subject {
-
- @JsonProperty(required = true)
- private TaskRunFinishedSubjectContent content;
-
-
- /**
- * @return the TaskRunFinished subject's Content
- */
- public TaskRunFinishedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(TaskRunFinishedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public TaskRunFinishedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new TaskRunFinishedSubjectContent());
-
- }
-
- public class TaskRunFinishedSubjectContent {
-
- @JsonProperty
- private String taskName;
-
- @JsonProperty
- private URI url;
-
- @JsonProperty
- private CDEventConstants.Outcome outcome;
-
- @JsonProperty
- private String errors;
-
- @JsonProperty
- private PipelineRun pipelineRun = new PipelineRun();
-
- /**
- * @return taskName
- */
- public String getTaskName() {
- return taskName;
- }
-
- /**
- * @param taskName
- */
- public void setTaskName(String taskName) {
- this.taskName = taskName;
- }
-
- /**
- * @return URL
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- /**
- * @return outcome
- */
- public CDEventConstants.Outcome getOutcome() {
- return outcome;
- }
-
- /**
- * @param outcome
- */
- public void setOutcome(CDEventConstants.Outcome outcome) {
- this.outcome = outcome;
- }
-
-
- /**
- * @return errors
- */
- public String getErrors() {
- return errors;
- }
-
-
- /**
- * @param errors
- */
- public void setErrors(String errors) {
- this.errors = errors;
- }
-
- /**
- * @return pipelineRun
- */
- public PipelineRun getPipelineRun() {
- return pipelineRun;
- }
-
- /**
- * @param pipelineRun
- */
- public void setPipelineRun(PipelineRun pipelineRun) {
- this.pipelineRun = pipelineRun;
- }
-
- public class PipelineRun {
- private String id;
-
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/TaskRunStartedSubject.java b/src/main/java/dev/cdevents/models/TaskRunStartedSubject.java
deleted file mode 100644
index a820c4a..0000000
--- a/src/main/java/dev/cdevents/models/TaskRunStartedSubject.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-import java.net.URI;
-
-public class TaskRunStartedSubject extends Subject {
-
- @JsonProperty(required = true)
- private TaskRunStartedSubjectContent content;
-
-
- /**
- * @return the TaskRunStarted subject's Content
- */
- public TaskRunStartedSubjectContent getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(TaskRunStartedSubjectContent content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public TaskRunStartedSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- setContent(new TaskRunStartedSubjectContent());
-
- }
-
- public class TaskRunStartedSubjectContent {
-
- @JsonProperty
- private String taskName;
-
- @JsonProperty
- private URI url;
-
- @JsonProperty
- private PipelineRun pipelineRun = new PipelineRun();
-
-
- /**
- * @return taskName
- */
- public String getTaskName() {
- return taskName;
- }
-
- /**
- * @param taskName
- */
- public void setTaskName(String taskName) {
- this.taskName = taskName;
- }
-
- /**
- * @return URL
- */
- public URI getUrl() {
- return url;
- }
-
- /**
- * @param url
- */
- public void setUrl(URI url) {
- this.url = url;
- }
-
- /**
- * @return pipelineRun
- */
- public PipelineRun getPipelineRun() {
- return pipelineRun;
- }
-
- /**
- * @param pipelineRun
- */
- public void setPipelineRun(PipelineRun pipelineRun) {
- this.pipelineRun = pipelineRun;
- }
-
- public class PipelineRun {
- private String id;
-
- private URI source;
-
- /**
- * @return id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return source
- */
- public URI getSource() {
- return source;
- }
-
- /**
- * @param source
- */
- public void setSource(URI source) {
- this.source = source;
- }
- }
- }
-}
diff --git a/src/main/java/dev/cdevents/models/TestCaseSubject.java b/src/main/java/dev/cdevents/models/TestCaseSubject.java
deleted file mode 100644
index 1f0417a..0000000
--- a/src/main/java/dev/cdevents/models/TestCaseSubject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class TestCaseSubject extends Subject {
-
- @JsonProperty(required = true)
- private Object content = new Object();
-
- /**
- * @return the TestCase subject's Content
- */
- public Object getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(Object content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public TestCaseSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
-}
diff --git a/src/main/java/dev/cdevents/models/TestSuiteSubject.java b/src/main/java/dev/cdevents/models/TestSuiteSubject.java
deleted file mode 100644
index 451f3a8..0000000
--- a/src/main/java/dev/cdevents/models/TestSuiteSubject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package dev.cdevents.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import dev.cdevents.constants.CDEventConstants;
-
-public class TestSuiteSubject extends Subject {
-
- @JsonProperty(required = true)
- private Object content = new Object();
-
- /**
- * @return the TestCase subject's Content
- */
- public Object getContent() {
- return content;
- }
-
- /**
- * @param content
- */
- public void setContent(Object content) {
- this.content = content;
- }
-
- /**
- * @param subjectType
- */
- public TestSuiteSubject(CDEventConstants.SubjectType subjectType) {
- super(subjectType);
- }
-
-}
diff --git a/src/test/java/dev/cdevents/CDEventsTest.java b/src/test/java/dev/cdevents/CDEventsTest.java
deleted file mode 100644
index 930e111..0000000
--- a/src/test/java/dev/cdevents/CDEventsTest.java
+++ /dev/null
@@ -1,1385 +0,0 @@
-package dev.cdevents;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.packageurl.MalformedPackageURLException;
-import com.github.packageurl.PackageURL;
-import dev.cdevents.config.CustomObjectMapper;
-import dev.cdevents.constants.CDEventConstants;
-import dev.cdevents.events.*;
-import dev.cdevents.exception.CDEventsException;
-import io.cloudevents.CloudEvent;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.nio.charset.StandardCharsets;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
-
-public class CDEventsTest {
-
- private static ObjectMapper objectMapper = new CustomObjectMapper().customConfiguration();
-
- @Test
- void createPipelineRunFinishedEventAsCloudEvent() throws IOException {
- PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/pipeline/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/pipeline/run/subject"));
- cdEvent.setSubjectPipelineName("Name-pipeline");
- cdEvent.setSubjectUrl(URI.create("http://dev/pipeline/url"));
- cdEvent.setSubjectErrors("errors to place");
- cdEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS);
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
-
- }
-
- @Test
- void createPipelineRunFinishedEventOptionalFieldsUnset() throws IOException {
- InputStream inputStream = getClass().getResourceAsStream("/pipelinerun_finished_optional.json");
-
- JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
- JsonNode expectedContextNode = expectedJsonNode.get("context");
- JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
-
- PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
- cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
- cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
- JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
- JsonNode cdEventContextNode = cdEventJsonNode.get("context");
- JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
-
- //validates CDEvent against schema
- assertTrue(CDEvents.validateCDEvent(cdEvent));
-
- //assert context and subject mandatory fields
- assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
- assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
- assertEquals(expectedSubjectNode, cdEventSubjectNode);
- assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
- assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
-
- //assert Optional field Subject Source, Content pipelineName, url, outcome, errors are set to null
- assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("pipelineName")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("url")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("outcome")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("errors")).isEqualTo(null);
-
- }
-
- @Test
- void testInvalidPipelineRunFinishedEventWithNoSubject() {
- PipelineRunFinishedCDEvent cdEvent = new PipelineRunFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createPipelineRunQueuedEventAsCloudEvent() {
-
- PipelineRunQueuedCDEvent cdEvent = new PipelineRunQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/pipeline/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/pipeline/run/subject"));
- cdEvent.setSubjectPipelineName("test-pipeline-queued");
- cdEvent.setSubjectUrl(URI.create("http://dev/pipeline/url"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
-
- }
-
- @Test
- void testInvalidPipelineRunQueuedEventWithNoSubject() {
- PipelineRunQueuedCDEvent cdEvent = new PipelineRunQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createPipelineRunQueuedEventWithOptionalFieldsUnset() throws IOException {
- InputStream inputStream = getClass().getResourceAsStream("/pipelinerun_queued_optional.json");
-
- JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
- JsonNode expectedContextNode = expectedJsonNode.get("context");
- JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
-
- PipelineRunQueuedCDEvent cdEvent = new PipelineRunQueuedCDEvent();
- cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
- cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
- JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
- JsonNode cdEventContextNode = cdEventJsonNode.get("context");
- JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
-
- //validates CDEvent against schema
- assertTrue(CDEvents.validateCDEvent(cdEvent));
-
- //assert context and subject mandatory fields
- assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
- assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
- assertEquals(expectedSubjectNode, cdEventSubjectNode);
- assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
- assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
-
- //assert Optional field Subject Source, pipelineName, url is set to null
- assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("pipelineName")).isEqualTo(null);
- assertThat(expectedSubjectNode.get("content").get("url")).isEqualTo(null);
-
-
- }
-
- @Test
- void testPipelineRunQueuedEventWithCustomData() throws JsonProcessingException {
- PipelineRunQueuedCDEvent cdEvent = new PipelineRunQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/pipeline/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/pipeline/run/subject"));
- cdEvent.setSubjectPipelineName("test-pipeline-queued");
- cdEvent.setSubjectUrl(URI.create("http://dev/pipeline/url"));
-
- String customDataJson = "{\"key1\": \"value1\",\"key2\" : {\"test\": \"customData\" }}";
- cdEvent.setCustomData(customDataJson);
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void createPipelineRunStartedEventAsCloudEvent() {
-
- PipelineRunStartedCDEvent cdEvent = new PipelineRunStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/pipeline/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/pipeline/run/subject"));
- cdEvent.setSubjectPipelineName("test-pipeline-started");
- cdEvent.setSubjectUrl(URI.create("http://dev/pipeline/url"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
-
- }
-
- @Test
- void testInvalidPipelineRunStartedEventWithNoSubject() {
- PipelineRunStartedCDEvent cdEvent = new PipelineRunStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createPipelineRunStartedJsonEventWithOptionalFieldsUnset() throws IOException {
-
- InputStream inputStream = getClass().getResourceAsStream("/pipelinerun_started_optional.json");
-
- JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
- JsonNode expectedContextNode = expectedJsonNode.get("context");
- JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
-
- PipelineRunStartedCDEvent cdEvent = new PipelineRunStartedCDEvent();
- cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
-
- cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
- cdEvent.setSubjectPipelineName(expectedSubjectNode.get("content").get("pipelineName").asText());
- cdEvent.setSubjectUrl(URI.create(expectedSubjectNode.get("content").get("url").asText()));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
- JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
- JsonNode cdEventContextNode = cdEventJsonNode.get("context");
- JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
-
- //validates CDEvent against schema
- assertTrue(CDEvents.validateCDEvent(cdEvent));
-
- //assert context and subject mandatory fields
- assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
- assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
- assertEquals(expectedSubjectNode, cdEventSubjectNode);
- assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
- assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
- assertThat(cdEventSubjectNode.get("content").get("pipelineName").asText()).isEqualTo(expectedSubjectNode.get("content").get("pipelineName").asText());
- assertThat(cdEventSubjectNode.get("content").get("url").asText()).isEqualTo(expectedSubjectNode.get("content").get("url").asText());
-
- //assert Optional field Subject Source is set to null
- assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
-
- }
-
-
- @Test
- void createTaskRunStartedEventAsCloudEvent() {
-
- TaskRunStartedCDEvent cdEvent = new TaskRunStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/task/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/task/run/subject"));
- cdEvent.setSubjectTaskName("test-task-started");
- cdEvent.setSubjectUrl(URI.create("http://dev/task/url"));
- cdEvent.setSubjectPipelineRunId("/dev/pipeline/run/subject");
- cdEvent.setSubjectPipelineRunSource(URI.create("http://dev/pipeline/run/subject"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTaskRunStartedEventWithNoSubject() {
- TaskRunStartedCDEvent cdEvent = new TaskRunStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createTaskRunStartedEventJsonWithOptionalFieldsUnset() throws IOException {
- InputStream inputStream = getClass().getResourceAsStream("/taskrun_started_optional.json");
-
- JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
- JsonNode expectedContextNode = expectedJsonNode.get("context");
- JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
-
- TaskRunStartedCDEvent cdEvent = new TaskRunStartedCDEvent();
- cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
-
- cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
- cdEvent.setSubjectPipelineRunId(expectedSubjectNode.get("content").get("pipelineRun").get("id").asText());
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
- JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
- JsonNode cdEventContextNode = cdEventJsonNode.get("context");
- JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
-
- //validates CDEvent against schema
- assertTrue(CDEvents.validateCDEvent(cdEvent));
-
- //assert context and subject mandatory fields
- assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
- assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
- assertEquals(expectedSubjectNode, cdEventSubjectNode);
- assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
- assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
- assertThat(cdEventSubjectNode.get("content").get("pipelineRun").get("id").asText()).isEqualTo(expectedSubjectNode.get("content").get("pipelineRun").get("id").asText());
-
- //assert Optional fields Subject Source, Content taskName, URL and pipelineRun Source are set to null
- assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("taskName")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("url")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("pipelineRun").get("source")).isEqualTo(null);
-
- }
-
- @Test
- void createTaskRunFinishedEventAsCloudEvent() {
-
- TaskRunFinishedCDEvent cdEvent = new TaskRunFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/task/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/task/run/subject"));
- cdEvent.setSubjectTaskName("test-task-finished");
- cdEvent.setSubjectUrl(URI.create("http://dev/task/url"));
- cdEvent.setSubjectErrors("errors to place");
- cdEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS);
- cdEvent.setSubjectPipelineRunId("/dev/pipeline/run/subject");
- cdEvent.setSubjectPipelineRunSource(URI.create("http://dev/pipeline/run/subject"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void createTaskRunFinishedEventJsonWithOptionalFieldsUnset() throws IOException {
-
- InputStream inputStream = getClass().getResourceAsStream("/taskrun_finished_optional.json");
-
- JsonNode expectedJsonNode = objectMapper.readTree(inputStream);
- JsonNode expectedContextNode = expectedJsonNode.get("context");
- JsonNode expectedSubjectNode = expectedJsonNode.get("subject");
-
- TaskRunFinishedCDEvent cdEvent = new TaskRunFinishedCDEvent();
- cdEvent.setSource(URI.create(expectedContextNode.get("source").asText()));
- cdEvent.setSubjectId(expectedSubjectNode.get("id").asText());
- cdEvent.setSubjectPipelineRunId(expectedSubjectNode.get("content").get("pipelineRun").get("id").asText());
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
- JsonNode cdEventJsonNode = objectMapper.readTree(cdEventJson);
- JsonNode cdEventContextNode = cdEventJsonNode.get("context");
- JsonNode cdEventSubjectNode = cdEventJsonNode.get("subject");
-
- //validates CDEvent against schema
- assertTrue(CDEvents.validateCDEvent(cdEvent));
-
- //assert context and subject mandatory fields
- assertThat(cdEventContextNode.get("type").asText()).isEqualTo(expectedContextNode.get("type").asText());
- assertThat(cdEventContextNode.get("source").asText()).isEqualTo(expectedContextNode.get("source").asText());
- assertEquals(expectedSubjectNode, cdEventSubjectNode);
- assertThat(cdEventSubjectNode.get("id").asText()).isEqualTo(expectedSubjectNode.get("id").asText());
- assertThat(cdEventSubjectNode.get("type").asText()).isEqualTo(expectedSubjectNode.get("type").asText());
- assertThat(cdEventSubjectNode.get("content").get("pipelineRun").get("id").asText()).isEqualTo(expectedSubjectNode.get("content").get("pipelineRun").get("id").asText());
-
- //assert Optional fields Subject Source, Content taskName, URL, outcome, errors and pipelineRun Source are set to null
- assertThat(cdEventSubjectNode.get("source")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("taskName")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("url")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("outcome")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("errors")).isEqualTo(null);
- assertThat(cdEventSubjectNode.get("content").get("pipelineRun").get("source")).isEqualTo(null);
- }
-
- @Test
- void testInvalidTaskRunFinishedEventWithNoSubject() {
- TaskRunFinishedCDEvent cdEvent = new TaskRunFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createRepositoryCreatedEventAsCloudEvent() {
-
- RepositoryCreatedCDEvent cdEvent = new RepositoryCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/github.com/test-repo");
- cdEvent.setSubjectSource(URI.create("/github.com/test-repo"));
- cdEvent.setSubjectName("test-repo");
- cdEvent.setSubjectOwner("test-user");
- cdEvent.setSubjectUrl(URI.create("git://github.com/test-org/test-repo"));
- cdEvent.setSubjectViewUrl(URI.create("http://github.com/test-org/test-repo/view"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidRepositoryCreatedEventWithNoSubject() {
- RepositoryCreatedCDEvent cdEvent = new RepositoryCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createRepositoryModifiedEventAsCloudEvent() {
-
- RepositoryModifiedCDEvent cdEvent = new RepositoryModifiedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/github.com/test-repo");
- cdEvent.setSubjectSource(URI.create("/github.com/test-repo"));
- cdEvent.setSubjectName("test-repo");
- cdEvent.setSubjectOwner("test-user");
- cdEvent.setSubjectUrl(URI.create("git://github.com/test-org/test-repo"));
- cdEvent.setSubjectViewUrl(URI.create("http://github.com/test-org/test-repo/view"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidRepositoryModifiedEventWithNoSubject() {
- RepositoryModifiedCDEvent cdEvent = new RepositoryModifiedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createRepositoryDeletedEventAsCloudEvent() {
-
- RepositoryDeletedCDEvent cdEvent = new RepositoryDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/github.com/test-repo");
- cdEvent.setSubjectSource(URI.create("/github.com/test-repo"));
- cdEvent.setSubjectName("test-repo");
- cdEvent.setSubjectOwner("test-user");
- cdEvent.setSubjectUrl(URI.create("git://github.com/test-org/test-repo"));
- cdEvent.setSubjectViewUrl(URI.create("http://github.com/test-org/test-repo/view"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidRepositoryDeletedEventWithNoSubject() {
- RepositoryDeletedCDEvent cdEvent = new RepositoryDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createBranchCreatedEventAsCloudEvent() {
-
- BranchCreatedCDEvent cdEvent = new BranchCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidBranchCreatedEventWithNoSubject() {
- BranchCreatedCDEvent cdEvent = new BranchCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createBranchDeletedEventAsCloudEvent() {
-
- BranchDeletedCDEvent cdEvent = new BranchDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidBranchDeletedEventWithNoSubject() {
- BranchDeletedCDEvent cdEvent = new BranchDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createChangeCreatedEventAsCloudEvent() {
-
- ChangeCreatedCDEvent cdEvent = new ChangeCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidChangeCreatedEventWithNoSubject() {
- ChangeCreatedCDEvent cdEvent = new ChangeCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createChangeReviewedEventAsCloudEvent() {
-
- ChangeReviewedCDEvent cdEvent = new ChangeReviewedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidChangeReviewedEventWithNoSubject() {
- ChangeReviewedCDEvent cdEvent = new ChangeReviewedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createChangeMergedEventAsCloudEvent() {
-
- ChangeMergedCDEvent cdEvent = new ChangeMergedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidChangeMergedEventWithNoSubject() {
- ChangeMergedCDEvent cdEvent = new ChangeMergedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createChangeAbandonedEventAsCloudEvent() {
-
- ChangeAbandonedCDEvent cdEvent = new ChangeAbandonedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidChangeAbandonedEventWithNoSubject() {
- ChangeAbandonedCDEvent cdEvent = new ChangeAbandonedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
- @Test
- void createChangeUpdatedEventAsCloudEvent() {
-
- ChangeUpdatedCDEvent cdEvent = new ChangeUpdatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-branch");
- cdEvent.setSubjectSource(URI.create("/github.com/test-branch"));
- cdEvent.setSubjectRepositoryId("/github.com/test-repo");
- cdEvent.setSubjectRepositorySource(URI.create("http://github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidChangeUpdatedEventWithNoSubject() {
- ChangeUpdatedCDEvent cdEvent = new ChangeUpdatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createBuildQueuedEventAsCloudEvent() {
-
- BuildQueuedCDEvent cdEvent = new BuildQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-build");
- cdEvent.setSubjectSource(URI.create("/dev/builds/test-build"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidBuildQueuedEventWithNoSubject() {
- BuildQueuedCDEvent cdEvent = new BuildQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createBuildStartedEventAsCloudEvent() {
-
- BuildStartedCDEvent cdEvent = new BuildStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-build");
- cdEvent.setSubjectSource(URI.create("/dev/builds/test-build"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidBuildStartedEventWithNoSubject() {
- BuildStartedCDEvent cdEvent = new BuildStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createBuildFinishedAsCloudEvent() throws MalformedPackageURLException {
-
- BuildFinishedCDEvent cdEvent = new BuildFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-build");
- cdEvent.setSubjectSource(URI.create("/dev/builds/test-build"));
- cdEvent.setSubjectArtifactId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidBuildFinishedEventWithNoSubject() {
- BuildFinishedCDEvent cdEvent = new BuildFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createTestCaseQueuedEventAsCloudEvent() {
-
- TestCaseQueuedCDEvent cdEvent = new TestCaseQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-case-1");
- cdEvent.setSubjectSource(URI.create("/dev/test-case"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTestCaseQueuedEventWithNoSubject() {
- TestCaseQueuedCDEvent cdEvent = new TestCaseQueuedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
- @Test
- void createTestCaseStartedEventAsCloudEvent() {
-
- TestCaseStartedCDEvent cdEvent = new TestCaseStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-case-1");
- cdEvent.setSubjectSource(URI.create("/dev/test-case"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTestCaseStartedEventWithNoSubject() {
- TestCaseStartedCDEvent cdEvent = new TestCaseStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createTestCaseFinishedEventAsCloudEvent() {
-
- TestCaseFinishedCDEvent cdEvent = new TestCaseFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-case-1");
- cdEvent.setSubjectSource(URI.create("/dev/test-case"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTestCaseFinishedEventWithNoSubject() {
- TestCaseFinishedCDEvent cdEvent = new TestCaseFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createTestSuiteStartedEventAsCloudEvent() {
-
- TestSuiteStartedCDEvent cdEvent = new TestSuiteStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-suite-1");
- cdEvent.setSubjectSource(URI.create("/dev/test-suite"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTestSuiteStartedEventWithNoSubject() {
- TestSuiteStartedCDEvent cdEvent = new TestSuiteStartedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createTestSuiteFinishedEventAsCloudEvent() {
-
- TestSuiteFinishedCDEvent cdEvent = new TestSuiteFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("test-suite-1");
- cdEvent.setSubjectSource(URI.create("/dev/test-suite"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidTestSuiteFinishedEventWithNoSubject() {
- TestSuiteFinishedCDEvent cdEvent = new TestSuiteFinishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createArtifactPackagedEventAsCloudEvent() throws MalformedPackageURLException {
-
- ArtifactPackagedCDEvent cdEvent = new ArtifactPackagedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b"));
- cdEvent.setSubjectSource(URI.create("/dev/artifact/source"));
-
- cdEvent.setSubjectChangeId("test-feature");
- cdEvent.setSubjectChangeSource(URI.create("/github.com/test-repo"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidArtifactPackagedEventWithNoSubject() {
- ArtifactPackagedCDEvent cdEvent = new ArtifactPackagedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createArtifactPublishedEventAsCloudEvent() throws MalformedPackageURLException {
- ArtifactPublishedCDEvent cdEvent = new ArtifactPublishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b"));
- cdEvent.setSubjectSource(URI.create("/dev/artifact/source"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
-
- }
-
- @Test
- void testInvalidArtifactPublishedEventWithNoSubject() {
- ArtifactPublishedCDEvent cdEvent = new ArtifactPublishedCDEvent();
-
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createEnvironmentCreatedEventAsCloudEvent() {
- EnvironmentCreatedCDEvent cdEvent = new EnvironmentCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/environment/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/environment/run/subject"));
- cdEvent.setSubjectName("Name");
- cdEvent.setSubjectUrl("http://dev/environment/url");
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidEnvironmentCreatedEventWithNoSubject() {
- EnvironmentCreatedCDEvent cdEvent = new EnvironmentCreatedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createEnvironmentModifiedEventAsCloudEvent() {
- EnvironmentModifiedCDEvent cdEvent = new EnvironmentModifiedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/environment/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/environment/run/subject"));
- cdEvent.setSubjectName("Name");
- cdEvent.setSubjectUrl("http://dev/environment/url");
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidEnvironmentModifiedEventWithNoSubject() {
- EnvironmentModifiedCDEvent cdEvent = new EnvironmentModifiedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createEnvironmentDeletedEventAsCloudEvent() {
- EnvironmentDeletedCDEvent cdEvent = new EnvironmentDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/environment/run/subject");
- cdEvent.setSubjectSource(URI.create("/dev/environment/run/subject"));
- cdEvent.setSubjectName("Name");
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidEnvironmentDeletedEventWithNoSubject() {
- EnvironmentDeletedCDEvent cdEvent = new EnvironmentDeletedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createServiceDeployedEventAsCloudEvent() throws MalformedPackageURLException {
- ServiceDeployedCDEvent cdEvent = new ServiceDeployedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/service/run/subject");
- cdEvent.setSubjectSource(URI.create("dev/service/run/subject"));
- cdEvent.setSubjectEnvironmentId("dev/environment/run/subject");
- cdEvent.setSubjectEnvironmentSource(URI.create("dev/environment/run/subject"));
- cdEvent.setSubjectArtifactId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidServiceDeployedEventWithNoSubject() {
- ServiceDeployedCDEvent cdEvent = new ServiceDeployedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createServiceUpgradedEventAsCloudEvent() throws MalformedPackageURLException {
- ServiceUpgradedCDEvent cdEvent = new ServiceUpgradedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/service/run/subject");
- cdEvent.setSubjectSource(URI.create("dev/service/run/subject"));
- cdEvent.setSubjectEnvironmentId("dev/environment/run/subject");
- cdEvent.setSubjectEnvironmentSource(URI.create("dev/environment/run/subject"));
- cdEvent.setSubjectArtifactId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidServiceUpgradedEventWithNoSubject() {
- ServiceUpgradedCDEvent cdEvent = new ServiceUpgradedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createServiceRolledBackEventAsCloudEvent() throws MalformedPackageURLException {
- ServiceRolledBackCDEvent cdEvent = new ServiceRolledBackCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/service/run/subject");
- cdEvent.setSubjectSource(URI.create("dev/service/run/subject"));
- cdEvent.setSubjectEnvironmentId("dev/environment/run/subject");
- cdEvent.setSubjectEnvironmentSource(URI.create("dev/environment/run/subject"));
- cdEvent.setSubjectArtifactId(new PackageURL("pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidServiceRolledBackEventWithNoSubject() {
- ServiceRolledBackCDEvent cdEvent = new ServiceRolledBackCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createServiceRemovedEventAsCloudEvent() {
- ServiceRemovedCDEvent cdEvent = new ServiceRemovedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/service/run/subject");
- cdEvent.setSubjectSource(URI.create("dev/service/run/subject"));
- cdEvent.setSubjectEnvironmentId("dev/environment/run/subject");
- cdEvent.setSubjectEnvironmentSource(URI.create("dev/environment/run/subject"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidServiceRemovedEventWithNoSubject() {
- ServiceRemovedCDEvent cdEvent = new ServiceRemovedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-
- @Test
- void createServicePublishedEventAsCloudEvent() {
- ServicePublishedCDEvent cdEvent = new ServicePublishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- cdEvent.setSubjectId("/dev/service/run/subject");
- cdEvent.setSubjectSource(URI.create("dev/service/run/subject"));
- cdEvent.setSubjectEnvironmentId("dev/environment/run/subject");
- cdEvent.setSubjectEnvironmentSource(URI.create("dev/environment/run/subject"));
-
- String cdEventJson = CDEvents.cdEventAsJson(cdEvent);
-
- CloudEvent ceEvent = CDEvents.cdEventAsCloudEvent(cdEvent);
-
- String ceDataJson = new String(ceEvent.getData().toBytes(), StandardCharsets.UTF_8);
-
- assertThat(ceEvent.getType()).isEqualTo(cdEvent.getContext().getType());
- assertThat(ceEvent.getSource()).isEqualTo(cdEvent.getContext().getSource());
- assertThat(ceDataJson).isEqualTo(cdEventJson);
- }
-
- @Test
- void testInvalidServicePublishedEventWithNoSubject() {
- ServicePublishedCDEvent cdEvent = new ServicePublishedCDEvent();
- cdEvent.setSource(URI.create("http://dev.cdevents"));
-
- Exception exception = assertThrows(CDEventsException.class, () -> {
- CDEvents.cdEventAsCloudEvent(cdEvent);
- });
- String expectedError = "CDEvent validation failed against schema URL - " + cdEvent.schemaURL();
-
- assertThat(exception.getMessage()).isEqualTo(expectedError);
- }
-}