All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.testrunner.VespaCliTestRunnerConfig Maven / Gradle / Ivy

There is a newer version: 8.444.18
Show newest version
// ------------   D O   N O T   E D I T !   ------------
// This file is generated from a config definition file.

package com.yahoo.vespa.testrunner;

import java.util.*;
import java.io.File;
import java.nio.file.Path;
import com.yahoo.config.*;

/**
 * This class represents the root node of vespa-cli-test-runner
 *
 * Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
 */
public final class VespaCliTestRunnerConfig extends ConfigInstance {

  public final static String CONFIG_DEF_MD5 = "d740e9863dd861d3663bff2ffbfee01a";
  public final static String CONFIG_DEF_NAME = "vespa-cli-test-runner";
  public final static String CONFIG_DEF_NAMESPACE = "com.yahoo.vespa.testrunner";
  public final static String[] CONFIG_DEF_SCHEMA = {
    "package=com.yahoo.vespa.testrunner",
    "artifactsPath path",
    "testsPath path",
    "useAthenzCredentials bool default=false"
  };

  public static String getDefMd5()       { return CONFIG_DEF_MD5; }
  public static String getDefName()      { return CONFIG_DEF_NAME; }
  public static String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }

  public interface Producer extends ConfigInstance.Producer {
    void getConfig(Builder builder);
  }

  public static final class Builder implements ConfigInstance.Builder {
    private Set __uninitialized = new HashSet(List.of(
      "artifactsPath",
      "testsPath"
      ));

    private FileReference artifactsPath = null;
    private FileReference testsPath = null;
    private Boolean useAthenzCredentials = null;

    public Builder() { }

    public Builder(VespaCliTestRunnerConfig config) {
      artifactsPath(config.artifactsPath.getFileReference());
      testsPath(config.testsPath.getFileReference());
      useAthenzCredentials(config.useAthenzCredentials());
    }

    private Builder override(Builder __superior) {
      if (__superior.artifactsPath != null)
        artifactsPath(__superior.artifactsPath);
      if (__superior.testsPath != null)
        testsPath(__superior.testsPath);
      if (__superior.useAthenzCredentials != null)
        useAthenzCredentials(__superior.useAthenzCredentials);
      return this;
    }

    public Builder artifactsPath(FileReference __value) {
    if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
      artifactsPath = __value;
      __uninitialized.remove("artifactsPath");
      return this;
    }


    public Builder testsPath(FileReference __value) {
    if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
      testsPath = __value;
      __uninitialized.remove("testsPath");
      return this;
    }


    public Builder useAthenzCredentials(boolean __value) {
      useAthenzCredentials = __value;
      return this;
    }

    private Builder useAthenzCredentials(String __value) {
      return useAthenzCredentials(Boolean.valueOf(__value));
    }

    private boolean _applyOnRestart = false;

    @java.lang.Override
    public final boolean dispatchGetConfig(ConfigInstance.Producer producer) {
      if (producer instanceof Producer) {
        ((Producer)producer).getConfig(this);
        return true;
      }
      return false;
    }

    @java.lang.Override
    public final String getDefMd5() { return CONFIG_DEF_MD5; }

    @java.lang.Override
    public final String getDefName() { return CONFIG_DEF_NAME; }

    @java.lang.Override
    public final String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }

    @java.lang.Override
    public final boolean getApplyOnRestart() { return _applyOnRestart; }

    @java.lang.Override
    public final void setApplyOnRestart(boolean applyOnRestart) { _applyOnRestart = applyOnRestart; }

    public VespaCliTestRunnerConfig build() {
      return new VespaCliTestRunnerConfig(this);
    }

  }

  // Location of artifacts required for test runtime
  private final PathNode artifactsPath;
  // Location of HTTP tests
  private final PathNode testsPath;
  // Whether credentials are from Athenz
  private final BooleanNode useAthenzCredentials;

  public VespaCliTestRunnerConfig(Builder builder) {
    this(builder, true);
  }

  private VespaCliTestRunnerConfig(Builder builder, boolean throwIfUninitialized) {
    if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
      throw new IllegalArgumentException("The following builder parameters for " +
          "vespa-cli-test-runner must be initialized: " + builder.__uninitialized);

    artifactsPath = (builder.artifactsPath == null) ?
        new PathNode() : new PathNode(builder.artifactsPath);
    testsPath = (builder.testsPath == null) ?
        new PathNode() : new PathNode(builder.testsPath);
    useAthenzCredentials = (builder.useAthenzCredentials == null) ?
        new BooleanNode(false) : new BooleanNode(builder.useAthenzCredentials);
  }

  /**
   * @return vespa-cli-test-runner.artifactsPath
   */
  public Path artifactsPath() {
    return artifactsPath.value();
  }

  /**
   * @return vespa-cli-test-runner.testsPath
   */
  public Path testsPath() {
    return testsPath.value();
  }

  /**
   * @return vespa-cli-test-runner.useAthenzCredentials
   */
  public boolean useAthenzCredentials() {
    return useAthenzCredentials.value();
  }

  private ChangesRequiringRestart getChangesRequiringRestart(VespaCliTestRunnerConfig newConfig) {
    ChangesRequiringRestart changes = new ChangesRequiringRestart("vespa-cli-test-runner");
    return changes;
  }

  private static boolean containsFieldsFlaggedWithRestart() {
    return false;
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy