1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   // Generated from: ../../../../../../metaschema/unit-tests.yaml
6   // Do not edit - changes will be lost when regenerated.
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   * A content validation test case.
31   */
32  @MetaschemaAssembly(
33      formalName = "Validation Case",
34      description = "A content validation test case.",
35      name = "validation-case",
36      moduleClass = MetaschemaTestSuiteModule.class)
37  public class ValidationCase implements IBoundObject {
38    private final IMetaschemaData __metaschemaData;
39  
40    /**
41     * The format of the source content.
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     * A URI reference to the content file location.
56     */
57    @BoundFlag(
58        formalName = "Location",
59        description = "A URI reference to the content file location.",
60        name = "location",
61        required = true,
62        typeAdapter = UriReferenceAdapter.class)
63    private URI _location;
64  
65    /**
66     * The expected result of content validation.
67     */
68    @BoundFlag(
69        formalName = "Validation Result",
70        description = "The expected result of content validation.",
71        name = "validation-result",
72        defaultValue = "VALID",
73        typeAdapter = TokenAdapter.class,
74        valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR,
75            values = { @AllowedValue(value = "VALID", description = "Validation succeeded."),
76                @AllowedValue(value = "INVALID",
77                    description = "Validation resulted in failure caused by some content defect or error.") })))
78    private String _validationResult;
79  
80    /**
81     * Constructs a new
82     * {@code dev.metaschema.model.testing.testsuite.ValidationCase} instance with
83     * no metadata.
84     */
85    public ValidationCase() {
86      this(null);
87    }
88  
89    /**
90     * Constructs a new
91     * {@code dev.metaschema.model.testing.testsuite.ValidationCase} instance with
92     * the specified metadata.
93     *
94     * @param data
95     *          the metaschema data, or {@code null} if none
96     */
97    public ValidationCase(IMetaschemaData data) {
98      this.__metaschemaData = data;
99    }
100 
101   @Override
102   public IMetaschemaData getMetaschemaData() {
103     return __metaschemaData;
104   }
105 
106   /**
107    * Get the source Format.
108    *
109    * <p>
110    * The format of the source content.
111    *
112    * @return the source-format value, or {@code null} if not set
113    */
114   @Nullable
115   public String getSourceFormat() {
116     return _sourceFormat;
117   }
118 
119   /**
120    * Set the source Format.
121    *
122    * <p>
123    * The format of the source content.
124    *
125    * @param value
126    *          the source-format value to set, or {@code null} to clear
127    */
128   public void setSourceFormat(@Nullable String value) {
129     _sourceFormat = value;
130   }
131 
132   /**
133    * Get the location.
134    *
135    * <p>
136    * A URI reference to the content file location.
137    *
138    * @return the location value
139    */
140   @NonNull
141   public URI getLocation() {
142     return _location;
143   }
144 
145   /**
146    * Set the location.
147    *
148    * <p>
149    * A URI reference to the content file location.
150    *
151    * @param value
152    *          the location value to set
153    */
154   public void setLocation(@NonNull URI value) {
155     _location = value;
156   }
157 
158   /**
159    * Get the validation Result.
160    *
161    * <p>
162    * The expected result of content validation.
163    *
164    * @return the validation-result value, or {@code null} if not set
165    */
166   @Nullable
167   public String getValidationResult() {
168     return _validationResult;
169   }
170 
171   /**
172    * Set the validation Result.
173    *
174    * <p>
175    * The expected result of content validation.
176    *
177    * @param value
178    *          the validation-result value to set, or {@code null} to clear
179    */
180   public void setValidationResult(@Nullable String value) {
181     _validationResult = value;
182   }
183 
184   @Override
185   public String toString() {
186     return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
187   }
188 }