Skip to content

Commit b7f43d5

Browse files
authored
Use io.openlineage.server.* pkg and add class Metadata (MarquezProject#2853)
* Use `io.openlineage.server.*` pkg and add class `Metadata` Signed-off-by: wslulciuc <[email protected]> * Add back `models.BaseEvent` Signed-off-by: Willy Lulciuc <[email protected]> * Add `MetadataTest.testNewRun()` Signed-off-by: Willy Lulciuc <[email protected]> * Add `testNewRunWithParent()`, `testNewRunWithNominalStartAndEndTime()`, and more Signed-off-by: Willy Lulciuc <[email protected]> * Add `Metadata.Run.ParentRun.Job.Id` Signed-off-by: Willy Lulciuc <[email protected]> * Add `testNewRunWithIO()` Signed-off-by: Willy Lulciuc <[email protected]> * Assert IO dataset name and source Signed-off-by: Willy Lulciuc <[email protected]> * Add `testNewRunWithInputDatasetsOnly()`, `testNewRunWithOutputDatasetsOnly()` Signed-off-by: Willy Lulciuc <[email protected]> * Define `Metadata.Job.location` as `URL` Signed-off-by: Willy Lulciuc <[email protected]> * Add assertions for facets and improved readability Signed-off-by: Willy Lulciuc <[email protected]> * Cleanup `Metadata.Job` instantiation Signed-off-by: Willy Lulciuc <[email protected]> * Update test suite Signed-off-by: Willy Lulciuc <[email protected]> * continued: Update test suite Signed-off-by: Willy Lulciuc <[email protected]> * continued: Update test suite Signed-off-by: Willy Lulciuc <[email protected]> * Clean up docs for class `Metadata` Signed-off-by: Willy Lulciuc <[email protected]> * Apply spotless Signed-off-by: Willy Lulciuc <[email protected]> * Add copyright header Signed-off-by: Willy Lulciuc <[email protected]> --------- Signed-off-by: wslulciuc <[email protected]> Signed-off-by: Willy Lulciuc <[email protected]>
1 parent 2ec2a3c commit b7f43d5

File tree

7 files changed

+1439
-1
lines changed

7 files changed

+1439
-1
lines changed
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/*
2+
* Copyright 2018-2024 contributors to the Marquez project
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package marquez.api.exceptions;
7+
8+
import static com.google.common.base.Preconditions.checkNotNull;
9+
import static marquez.common.base.MorePreconditions.checkNotBlank;
10+
11+
import java.io.Serial;
12+
import java.util.UUID;
13+
import javax.ws.rs.BadRequestException;
14+
15+
public class FacetNotValid {
16+
public static class MissingRunIdForParent extends BadRequestException {
17+
@Serial private static final long serialVersionUID = 1L;
18+
19+
public MissingRunIdForParent(final UUID runId) {
20+
super(
21+
String.format(
22+
"Facet 'ParentRunFacet' for run '%s' not valid, missing 'runId' for parent run.",
23+
checkNotNull(runId)));
24+
}
25+
}
26+
27+
public static class MissingJobForParent extends BadRequestException {
28+
@Serial private static final long serialVersionUID = 1L;
29+
30+
public MissingJobForParent(final UUID runId) {
31+
super(
32+
String.format(
33+
"Facet 'ParentRunFacet' for run '%s' not valid, missing 'job' for parent run.",
34+
checkNotNull(runId)));
35+
}
36+
}
37+
38+
public static class MissingNamespaceForParentJob extends BadRequestException {
39+
@Serial private static final long serialVersionUID = 1L;
40+
41+
public MissingNamespaceForParentJob(final UUID runId) {
42+
super(
43+
String.format(
44+
"Facet 'ParentRunFacet' for run '%s' not valid, missing 'namespace' for parent job.",
45+
checkNotNull(runId)));
46+
}
47+
}
48+
49+
public static class MissingNameForParentJob extends BadRequestException {
50+
@Serial private static final long serialVersionUID = 1L;
51+
52+
public MissingNameForParentJob(final UUID runId) {
53+
super(
54+
String.format(
55+
"Facet 'ParentRunFacet' for run '%s' not valid, missing 'name' for parent job.",
56+
checkNotNull(runId)));
57+
}
58+
}
59+
60+
public static class MissingNominalStartTimeForRun extends BadRequestException {
61+
@Serial private static final long serialVersionUID = 1L;
62+
63+
public MissingNominalStartTimeForRun(final UUID runId) {
64+
super(
65+
String.format(
66+
"Facet 'NominalTimeRunFacet' for run '%s' not valid, missing 'nominalStartTime'.",
67+
checkNotNull(runId)));
68+
}
69+
}
70+
71+
public static class MissingSourceCodeLanguageForJob extends BadRequestException {
72+
@Serial private static final long serialVersionUID = 1L;
73+
74+
public MissingSourceCodeLanguageForJob(final String jobName) {
75+
super(
76+
String.format(
77+
"Facet 'SourceCodeJobFacet' for job '%s' not valid, missing 'language'.",
78+
checkNotBlank(jobName)));
79+
}
80+
}
81+
82+
public static class MissingSourceCodeForJob extends BadRequestException {
83+
@Serial private static final long serialVersionUID = 1L;
84+
85+
public MissingSourceCodeForJob(final String jobName) {
86+
super(
87+
String.format(
88+
"Facet 'SourceCodeJobFacet' for job '%s' not valid, missing 'sourceCode'.",
89+
checkNotBlank(jobName)));
90+
}
91+
}
92+
93+
public static class MissingSourceCodeTypeForJob extends BadRequestException {
94+
@Serial private static final long serialVersionUID = 1L;
95+
96+
public MissingSourceCodeTypeForJob(final String jobName) {
97+
super(
98+
String.format(
99+
"Facet 'SourceCodeLocationJobFacet' for job '%s' not valid, missing 'type'.",
100+
checkNotBlank(jobName)));
101+
}
102+
}
103+
104+
public static class MissingSourceCodeUrlForJob extends BadRequestException {
105+
@Serial private static final long serialVersionUID = 1L;
106+
107+
public MissingSourceCodeUrlForJob(final String jobName) {
108+
super(
109+
String.format(
110+
"Facet 'SourceCodeLocationJobFacet' for job '%s' not valid, missing 'url'.",
111+
checkNotBlank(jobName)));
112+
}
113+
}
114+
115+
public static class MissingDescriptionForJob extends BadRequestException {
116+
@Serial private static final long serialVersionUID = 1L;
117+
118+
public MissingDescriptionForJob(final String jobName) {
119+
super(
120+
String.format(
121+
"Facet 'DocumentationJobFacet' for job '%s' not valid, missing 'description'.",
122+
checkNotBlank(jobName)));
123+
}
124+
}
125+
126+
public static class MissingNameForDatasetField extends BadRequestException {
127+
@Serial private static final long serialVersionUID = 1L;
128+
129+
public MissingNameForDatasetField(final String datasetName) {
130+
super(
131+
String.format(
132+
"Facet 'SchemaDatasetFacet' for dataset '%s' not valid, missing 'name'.",
133+
checkNotBlank(datasetName)));
134+
}
135+
}
136+
137+
public static class MissingNameForDatasetSource extends BadRequestException {
138+
@Serial private static final long serialVersionUID = 1L;
139+
140+
public MissingNameForDatasetSource(final String datasetName) {
141+
super(
142+
String.format(
143+
"Facet 'DatasourceDatasetFacet' for dataset '%s' not valid, missing 'name' for source.",
144+
checkNotBlank(datasetName)));
145+
}
146+
}
147+
148+
public static class MissingConnectionUriForDatasetSource extends BadRequestException {
149+
@Serial private static final long serialVersionUID = 1L;
150+
151+
public MissingConnectionUriForDatasetSource(final String datasetName) {
152+
super(
153+
String.format(
154+
"Facet 'DatasourceDatasetFacet' for dataset '%s' not valid, missing 'uri' for source.",
155+
checkNotBlank(datasetName)));
156+
}
157+
}
158+
159+
public static class MissingSourceForDataset extends BadRequestException {
160+
@Serial private static final long serialVersionUID = 1L;
161+
162+
public MissingSourceForDataset(final String datasetName) {
163+
super(
164+
String.format(
165+
"Dataset '%s' not valid, missing 'DatasourceDatasetFacet'.",
166+
checkNotBlank(datasetName)));
167+
}
168+
}
169+
}

0 commit comments

Comments
 (0)