1
2
3
4
5
6
7
8 package dev.metaschema.model.testing.testsuite;
9
10 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
11 import org.apache.commons.lang3.builder.ToStringStyle;
12
13 import java.net.URI;
14
15 import dev.metaschema.core.datatype.adapter.TokenAdapter;
16 import dev.metaschema.core.datatype.adapter.UriReferenceAdapter;
17 import dev.metaschema.core.model.IBoundObject;
18 import dev.metaschema.core.model.IMetaschemaData;
19 import dev.metaschema.core.model.constraint.IConstraint;
20 import dev.metaschema.core.util.ObjectUtils;
21 import dev.metaschema.databind.model.annotations.AllowedValue;
22 import dev.metaschema.databind.model.annotations.AllowedValues;
23 import dev.metaschema.databind.model.annotations.BoundFlag;
24 import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
25 import dev.metaschema.databind.model.annotations.ValueConstraints;
26 import edu.umd.cs.findbugs.annotations.NonNull;
27 import edu.umd.cs.findbugs.annotations.Nullable;
28
29
30
31
32 @MetaschemaAssembly(
33 formalName = "Generation Case",
34 description = "A schema generation comparison test case.",
35 name = "generation-case",
36 moduleClass = MetaschemaTestSuiteModule.class)
37 public class GenerationCase implements IBoundObject {
38 private final IMetaschemaData __metaschemaData;
39
40
41
42
43 @BoundFlag(
44 formalName = "Source Format",
45 description = "The format of the source content.",
46 name = "source-format",
47 typeAdapter = TokenAdapter.class,
48 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR,
49 values = { @AllowedValue(value = "XML", description = "Content is XML."),
50 @AllowedValue(value = "JSON", description = "Content is JSON."),
51 @AllowedValue(value = "YAML", description = "Content is YAML.") })))
52 private String _sourceFormat;
53
54
55
56
57 @BoundFlag(
58 formalName = "Location",
59 description = "A URI reference to the expected schema file location.",
60 name = "location",
61 required = true,
62 typeAdapter = UriReferenceAdapter.class)
63 private URI _location;
64
65
66
67
68 @BoundFlag(
69 formalName = "Match Result",
70 description = "The expected result of content comparison.",
71 name = "match-result",
72 defaultValue = "MATCH",
73 typeAdapter = TokenAdapter.class,
74 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {
75 @AllowedValue(value = "MATCH", description = "The actual content matched the expected content."),
76 @AllowedValue(value = "MISMATCH", description = "The actual content did not match the expected content.") })))
77 private String _matchResult;
78
79
80
81
82
83
84 public GenerationCase() {
85 this(null);
86 }
87
88
89
90
91
92
93
94
95
96 public GenerationCase(IMetaschemaData data) {
97 this.__metaschemaData = data;
98 }
99
100 @Override
101 public IMetaschemaData getMetaschemaData() {
102 return __metaschemaData;
103 }
104
105
106
107
108
109
110
111
112
113 @Nullable
114 public String getSourceFormat() {
115 return _sourceFormat;
116 }
117
118
119
120
121
122
123
124
125
126
127 public void setSourceFormat(@Nullable String value) {
128 _sourceFormat = value;
129 }
130
131
132
133
134
135
136
137
138
139 @NonNull
140 public URI getLocation() {
141 return _location;
142 }
143
144
145
146
147
148
149
150
151
152
153 public void setLocation(@NonNull URI value) {
154 _location = value;
155 }
156
157
158
159
160
161
162
163
164
165 @Nullable
166 public String getMatchResult() {
167 return _matchResult;
168 }
169
170
171
172
173
174
175
176
177
178
179 public void setMatchResult(@Nullable String value) {
180 _matchResult = value;
181 }
182
183 @Override
184 public String toString() {
185 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
186 }
187 }