001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005// Generated from: ../../../../../../metaschema/unit-tests.yaml
006// Do not edit - changes will be lost when regenerated.
007
008package dev.metaschema.model.testing.testsuite;
009
010import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
011import org.apache.commons.lang3.builder.ToStringStyle;
012
013import java.net.URI;
014
015import dev.metaschema.core.datatype.adapter.TokenAdapter;
016import dev.metaschema.core.datatype.adapter.UriReferenceAdapter;
017import dev.metaschema.core.model.IBoundObject;
018import dev.metaschema.core.model.IMetaschemaData;
019import dev.metaschema.core.model.constraint.IConstraint;
020import dev.metaschema.core.util.ObjectUtils;
021import dev.metaschema.databind.model.annotations.AllowedValue;
022import dev.metaschema.databind.model.annotations.AllowedValues;
023import dev.metaschema.databind.model.annotations.BoundFlag;
024import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
025import dev.metaschema.databind.model.annotations.ValueConstraints;
026import edu.umd.cs.findbugs.annotations.NonNull;
027import edu.umd.cs.findbugs.annotations.Nullable;
028
029/**
030 * A content validation test case.
031 */
032@MetaschemaAssembly(
033    formalName = "Validation Case",
034    description = "A content validation test case.",
035    name = "validation-case",
036    moduleClass = MetaschemaTestSuiteModule.class)
037public class ValidationCase implements IBoundObject {
038  private final IMetaschemaData __metaschemaData;
039
040  /**
041   * The format of the source content.
042   */
043  @BoundFlag(
044      formalName = "Source Format",
045      description = "The format of the source content.",
046      name = "source-format",
047      typeAdapter = TokenAdapter.class,
048      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR,
049          values = { @AllowedValue(value = "XML", description = "Content is XML."),
050              @AllowedValue(value = "JSON", description = "Content is JSON."),
051              @AllowedValue(value = "YAML", description = "Content is YAML.") })))
052  private String _sourceFormat;
053
054  /**
055   * A URI reference to the content file location.
056   */
057  @BoundFlag(
058      formalName = "Location",
059      description = "A URI reference to the content file location.",
060      name = "location",
061      required = true,
062      typeAdapter = UriReferenceAdapter.class)
063  private URI _location;
064
065  /**
066   * The expected result of content validation.
067   */
068  @BoundFlag(
069      formalName = "Validation Result",
070      description = "The expected result of content validation.",
071      name = "validation-result",
072      defaultValue = "VALID",
073      typeAdapter = TokenAdapter.class,
074      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR,
075          values = { @AllowedValue(value = "VALID", description = "Validation succeeded."),
076              @AllowedValue(value = "INVALID",
077                  description = "Validation resulted in failure caused by some content defect or error.") })))
078  private String _validationResult;
079
080  /**
081   * Constructs a new
082   * {@code dev.metaschema.model.testing.testsuite.ValidationCase} instance with
083   * no metadata.
084   */
085  public ValidationCase() {
086    this(null);
087  }
088
089  /**
090   * Constructs a new
091   * {@code dev.metaschema.model.testing.testsuite.ValidationCase} instance with
092   * the specified metadata.
093   *
094   * @param data
095   *          the metaschema data, or {@code null} if none
096   */
097  public ValidationCase(IMetaschemaData data) {
098    this.__metaschemaData = data;
099  }
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}