diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml index 55f41fb..5944309 100644 --- a/.github/workflows/dev_build.yml +++ b/.github/workflows/dev_build.yml @@ -11,8 +11,6 @@ name: GCM Pipeline Development Build on: push: branches: [ "dev" ] - pull_request: - branches: [ "dev" ] jobs: dev-build: @@ -28,18 +26,6 @@ jobs: distribution: 'temurin' cache: maven - - name: Get GCM Version - run: | - echo "gcm_version=v$(mvn help:evaluate -Dexpression=gcm.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV" - - - name: Checkout GCM - if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} - uses: actions/checkout@v4 - with: - repository: HHS/ASPR-8 - path: gcm - ref: dev - - name: Get GCM Taskit Version run: | echo "gcm_taskit_version=v$(mvn help:evaluate -Dexpression=gcm-taskit.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV" @@ -52,24 +38,20 @@ jobs: path: gcm-taskit ref: dev - - name: Get Util Version - if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} + - name: Get GCM and Taskit Version + if: ${{ endsWith(env.gcm_taskit_version, 'SNAPSHOT') }} run: | - echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file gcm/pom.xml)" >> "$GITHUB_ENV" + echo "gcm_version=v$(mvn help:evaluate -Dexpression=gcm.version -q -DforceStdout --file gcm-taskit/pom.xml)" >> "$GITHUB_ENV" + echo "taskit_version=v$(mvn help:evaluate -Dexpression=taskit.version -q -DforceStdout --file gcm-taskit/pom.xml)" >> "$GITHUB_ENV" - - name: Checkout Util - if: ${{ endsWith(env.util_version, 'SNAPSHOT') }} + - name: Checkout GCM + if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} uses: actions/checkout@v4 with: - repository: HHS/ASPR-ms-util - path: util + repository: HHS/ASPR-8 + path: gcm ref: dev - - name: Get Taskit Version - if: ${{ endsWith(env.gcm_taskit_version, 'SNAPSHOT') }} - run: | - echo "taskit_version=v$(mvn help:evaluate -Dexpression=taskit.version -q -DforceStdout --file gcm-taskit/pom.xml)" >> "$GITHUB_ENV" - - name: Checkout Taskit if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }} uses: actions/checkout@v4 @@ -78,6 +60,19 @@ jobs: path: taskit-core ref: dev + - name: Get Util Version + if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} + run: | + echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file gcm/pom.xml)" >> "$GITHUB_ENV" + + - name: Checkout Util + if: ${{ endsWith(env.util_version, 'SNAPSHOT') }} + uses: actions/checkout@v4 + with: + repository: HHS/ASPR-ms-util + path: util + ref: dev + - name: Build Util if: ${{ endsWith(env.util_version, 'SNAPSHOT') }} run: mvn clean install -DskipTests --file util/pom.xml diff --git a/.github/workflows/dev_pr_build.yml b/.github/workflows/dev_pr_build.yml new file mode 100644 index 0000000..d904a12 --- /dev/null +++ b/.github/workflows/dev_pr_build.yml @@ -0,0 +1,97 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: GCM Pipeline Development PR Build + +on: + pull_request: + branches-ignore: [ "main" ] + +jobs: + dev-build: + runs-on: ubuntu-latest + steps: + - name: Checkout GCM Pipeline + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Get GCM Taskit Version + run: | + echo "gcm_taskit_version=v$(mvn help:evaluate -Dexpression=gcm-taskit.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV" + + - name: Checkout GCM Taskit + if: ${{ endsWith(env.gcm_taskit_version, 'SNAPSHOT') }} + uses: actions/checkout@v4 + with: + repository: HHS/ASPR-ms-gcm-taskit + path: gcm-taskit + ref: dev + + - name: Get GCM and Taskit Version + if: ${{ endsWith(env.gcm_taskit_version, 'SNAPSHOT') }} + run: | + echo "gcm_version=v$(mvn help:evaluate -Dexpression=gcm.version -q -DforceStdout --file gcm-taskit/pom.xml)" >> "$GITHUB_ENV" + echo "taskit_version=v$(mvn help:evaluate -Dexpression=taskit.version -q -DforceStdout --file gcm-taskit/pom.xml)" >> "$GITHUB_ENV" + + - name: Checkout GCM + if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} + uses: actions/checkout@v4 + with: + repository: HHS/ASPR-8 + path: gcm + ref: dev + + - name: Checkout Taskit + if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }} + uses: actions/checkout@v4 + with: + repository: HHS/ASPR-ms-taskit + path: taskit-core + ref: dev + + - name: Get Util Version + if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} + run: | + echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file gcm/pom.xml)" >> "$GITHUB_ENV" + + - name: Checkout Util + if: ${{ endsWith(env.util_version, 'SNAPSHOT') }} + uses: actions/checkout@v4 + with: + repository: HHS/ASPR-ms-util + path: util + ref: dev + + - name: Build Util + if: ${{ endsWith(env.util_version, 'SNAPSHOT') }} + run: mvn clean install -DskipTests --file util/pom.xml + + - name: Build GCM + if: ${{ endsWith(env.gcm_version, 'SNAPSHOT') }} + run: mvn clean install -DskipTests --file gcm/pom.xml + + - name: Build Taskit + if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }} + run: mvn clean install -DskipTests --file taskit-core/pom.xml + + - name: Build GCM Taskit + if: ${{ endsWith(env.gcm_taskit_version, 'SNAPSHOT') }} + run: mvn clean install -DskipTests --file gcm-taskit/pom.xml + + - name: Build GCM Pipeline + run: mvn clean install --file pom.xml + + # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + # - name: Update dependency graph + # uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 diff --git a/pom.xml b/pom.xml index 26a3b1f..2e79d55 100644 --- a/pom.xml +++ b/pom.xml @@ -49,39 +49,41 @@ - 1.0.3 + 1.1.0 UTF-8 17 17 + + 1.7.1 + 3.6.0 + 1.4.1 + 0.6.1 + - 1.3.0 - 3.0.0-M5 - 3.0.0-M5 - 3.2.1 - 3.5.0 - 3.2.2 + 1.6.0 + 3.3.0 + 3.3.0 + 3.3.1 + 3.7.0 + 3.2.4 0.4.0 - 4.2.0 2.8.3 - 0.8.9 - 5.8.2 + 3.25.2 + 0.8.12 + 5.10.2 - - gov.hhs.aspr.ms.gcm - simulation - ${gcm.version} - gov.hhs.aspr.ms.gcm.taskit protobuf ${gcm-taskit.version} + provided org.jacoco @@ -105,6 +107,20 @@ + + kr.motd.maven + os-maven-plugin + ${os-maven-plugin.version} + + + detect-os + initialize + + detect + + + + @@ -136,6 +152,78 @@ + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + add-proto-gen-folder-as-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/protobuf/java + + + + + + + + + com.google.code.maven-replacer-plugin + maven-replacer-plugin + ${maven-replacer-plugin.version} + + + replace-warnings-in-gen-files + process-sources + + replace + + + + + + target/generated-sources/**/*.java + + true + + MULTILINE + + + + ^(@SuppressWarnings\(.*?\)\s+)?public final class + @SuppressWarnings("all") public final class + + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-maven-plugin.version} + + + + compile + test-compile + + + + + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} + ${basedir}/src/main/proto/gov/hhs/aspr/ms/gcm/pipeline + false + + + org.apache.maven.plugins @@ -207,13 +295,6 @@ ${maven-javadoc-plugin.version} all,-missing - - - gov.hhs.aspr.ms.gcm - simulation - ${gcm.version} - - false -Xmaxerrs diff --git a/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineInputResolver.java b/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineInputResolver.java new file mode 100644 index 0000000..0411067 --- /dev/null +++ b/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineInputResolver.java @@ -0,0 +1,110 @@ +package gov.hhs.aspr.ms.gcm.pipeline.testsupport; + +import com.google.protobuf.Descriptors.FieldDescriptor; + +import java.nio.file.Path; +import java.util.function.Function; + +import com.google.protobuf.Message; + +/* + * This class contains advanced protobuf logic to progomatically go through each field in the pipeline input and resolve the path against PipelineTestPaths.RESOURCE_DIR + * + * If you are not familiar with protobuf, it is suggested to not look nor touch this code with a 10ft pole. + * + * Additionally, this code should rarely ever change under normal circumstances. + * + * Above each method is a small blurb about what the method does, if you are curious. + */ +public class PipelineInputResolver { + + private final Function resolverFunction; + + // package access for PipelineTestSupport + PipelineInputResolver(Function resolverFunction) { + this.resolverFunction = resolverFunction; + } + + /* + * this method gets called from PipelineTestHelper + * + * it takes in a protobuf message field, the field value and the pipeline input + * builder + * + * it determines the type of the field, either message -> normal pipeline, + * dimensionPipelineInput -> dimension pipeline, or primative. + * + * for primative values, it merely copies the value as is to the builder via the + * set field + * + * for normal pipelines and dimension pipelines, it calls the respective methods + */ + public void resolvePipelineInput(FieldDescriptor PLIField, Object PLIValue, Message.Builder resolvedPLIBuilder) { + resolvedPLIBuilder.setField(PLIField, resolveField(PLIField, PLIValue)); + } + + /* + * This mathod takes a protobuf message value + * + * It creates a new protobuf message builder for the message value + * + * for each field on the value: + * + * it checks if it is a repeated field or not + * + * if not, it sets the field to the value returned by resolveField + * + * if repeated, it adds the value returned by resolveField to the the field + * + * it returns the built protobuf message + */ + private Message resolveFields(Message message) { + + Message.Builder builder = message.newBuilderForType(); + + message.getAllFields().forEach((field, value) -> { + if (field.isRepeated()) { + int fieldCount = message.getRepeatedFieldCount(field); + for (int i = 0; i < fieldCount; i++) { + Object repeatedFieldValue = message.getRepeatedField(field, i); + builder.addRepeatedField(field, resolveField(field, repeatedFieldValue)); + } + } else { + builder.setField(field, resolveField(field, value)); + } + }); + + return builder.build(); + } + + /* + * Takes in a field descriptor and the field value + * + * it determines the type of the field. + * + * There are only 2 cases we care about: + * + * String, in which case we can safely assume that the field is a path field and needs to be resolved + * + * Message, in which case we then go through each field within the message and potentially resolve any fields within it, recurively + * + * returns the new value of the field + */ + private Object resolveField(FieldDescriptor field, Object value) { + Object _value = value; + + switch (field.getJavaType()) { + case STRING: + String path = (String) _value; + _value = this.resolverFunction.apply(path).toString(); + break; + case MESSAGE: + Message fieldMessage = (Message) _value; + _value = resolveFields(fieldMessage); + break; + default: + break; + } + return _value; + } +} diff --git a/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineTestSupport.java b/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineTestSupport.java new file mode 100644 index 0000000..534b01c --- /dev/null +++ b/src/main/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/PipelineTestSupport.java @@ -0,0 +1,217 @@ +package gov.hhs.aspr.ms.gcm.pipeline.testsupport; + +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.Message; +import com.google.protobuf.util.JsonFormat; +import com.google.protobuf.util.JsonFormat.Parser; + +import gov.hhs.aspr.ms.taskit.core.TranslationController; +import gov.hhs.aspr.ms.taskit.core.TranslationEngine; +import gov.hhs.aspr.ms.taskit.core.TranslationEngineType; +import gov.hhs.aspr.ms.taskit.protobuf.ProtobufTranslationEngine; +import gov.hhs.aspr.ms.util.resourcehelper.ResourceHelper; + +/** + * Test support class for testing pipelines. + *

+ * This test is only to be used if you are using protobuf to load and parse your + * pipeline input file. This is highly advised and if you aren't doing so, it is + * a good time to ask yourself why you are not. + *

+ * The param for this class is the type for your pipeline input class. Again, it + * assumes you are using protobuf and thus this type must be an extension of the + * {@link Message} type. + *

+ * Provides utility methods for loading unresolved pipeline input files, + * resolving pipeline input files, creating resolved pipeline input files on + * disk and comparing 2 output files. + * + * @param the type for your pipeline input class + */ +public class PipelineTestSupport { + + private final TranslationEngine translationEngine; + private final Class pipelineInputClassRef; + private final T pipelineInputInstance; + private final PipelineInputResolver pipelineInputResolver; + private final Function resolverFunction; + private final Path testOutputDir; + + /** + * Creates a PipelineTestSupport class + * + * Takes a translation engine builder that should contain a translation engine + * with any and all translation specs needed to validate any and all java types + * used in the pipeline tests. + * + * Takes a default instance of the given pipeline input type. + * + * Takes a class reference of the given pipeline input type. + * + * Takes a resolver function that will be used to resolve the paths in the file + * to the equivalent absolute paths. + * + * Takes in a string for the test output directory so that it can be created for + * you when getting a resolved pipeline input. + * + * @param translationEngine + * @param pipelineInputInstance + * @param pipelineInputClassRef + * @param resolverFunction + * @param testOutputDir + * + */ + public PipelineTestSupport(TranslationEngine translationEngine, T pipelineInputInstance, + Class pipelineInputClassRef, Function resolverFunction, Path testOutputDir) { + this.translationEngine = translationEngine; + this.pipelineInputInstance = pipelineInputInstance; + this.pipelineInputClassRef = pipelineInputClassRef; + this.pipelineInputResolver = new PipelineInputResolver(resolverFunction); + this.resolverFunction = resolverFunction; + this.testOutputDir = testOutputDir; + } + + /** + * Given a pipeline input and a file name, uses taskit to output the pipeline + * input to a file with the given name. + * + * uses a protobuf translation engine and the file will be writen in json + */ + public String createResolvedPipelineInputFile(T input, String fileName) { + T.Builder builder = input.toBuilder(); + + Path resolvedPipelineInputPath = this.resolverFunction.apply(fileName); + TranslationController.builder() + .addTranslationEngine(ProtobufTranslationEngine.builder().build()) + .build() + .writeOutput(builder.build(), resolvedPipelineInputPath, TranslationEngineType.PROTOBUF); + + return resolvedPipelineInputPath.toString(); + } + + /** + * Given two class refs and 2 paths, read in each path using taskit and compare + * the resulting app object (APP_OBJ) classes for both object equals and string + * equals + *

+ * This test will fail if there isn't a properly implemented equals contract on + * the APP_OBJ + *

+ * This test will fail if there isn't a properly implemented toString on the + * APP_OBJ + *

+ * uses the translation engine provided to this class + */ + public boolean filesAreSame(Class inputClassRef, + Class outputClassRef, Path pathOfExpectedOutput, Path pathOfActualOutput) { + + TranslationController translationController = TranslationController.builder() + .addTranslationEngine(this.translationEngine) + .addInputFilePath(pathOfExpectedOutput, inputClassRef, + this.translationEngine.getTranslationEngineType()) + .addInputFilePath(pathOfActualOutput, inputClassRef, this.translationEngine.getTranslationEngineType()) + .build(); + + translationController.readInput(); + + List inputObjs = translationController.getObjects(outputClassRef); + + APP_OBJ obj1 = inputObjs.get(0); + APP_OBJ obj2 = inputObjs.get(1); + + return obj1.equals(obj2) && obj1.toString().equals(obj2.toString()); + } + + /** + * Given an unresolved pipeline input, creates a resolved pipeline input based + * on whether to use the directory input file or not, and whether to set + * runningWithPreviousData to true or not + *

+ * for the directory input file, it only resolves the input and output directory + * paths. Otherwise, it will call the PipelineInputResolver to resolve each and + * every path within the input + *

+ * then creates the Test output dir + *

+ * --------------------- + *

+ * For the input and out directory, the variable names MUST BE: 'inputDirectory' + * and 'outputDirectory' otherwise they will not be resolved. + *

+ * For the setPrev option, it will set the value of 'runningWithPreviousData' to + * true if set. Note that the variable name MUST be 'runningWithPreviousData' + */ + public T getResolvedPipelineInput(T unresolvedInput, boolean useDirectoryFile, boolean setPrev) { + + T.Builder resolvedInputBuilder = unresolvedInput.toBuilder(); + + Map fields = resolvedInputBuilder.getAllFields(); + + if (!useDirectoryFile) { + fields.forEach((pipelineField, pipelineFieldValue) -> { + this.pipelineInputResolver.resolvePipelineInput(pipelineField, pipelineFieldValue, + resolvedInputBuilder); + }); + + if (setPrev) { + fields.forEach((pipelineField, pipelineFieldValue) -> { + if (pipelineField.getName().equals("runningWithPreviousData")) { + resolvedInputBuilder.setField(pipelineField, setPrev); + + return; + } + }); + } + } else { + fields.forEach((pipelineField, pipelineFieldValue) -> { + if (pipelineField.getName().equals("inputDirectory") + || pipelineField.getName().equals("outputDirectory")) { + this.pipelineInputResolver.resolvePipelineInput(pipelineField, pipelineFieldValue, + resolvedInputBuilder); + } + }); + } + + // make outputDir + ResourceHelper.createDirectory(testOutputDir); + + return this.pipelineInputClassRef.cast(resolvedInputBuilder.build()); + } + + /** + * given a filename, attempts to load the file using protobuf + *

+ * file must be of the type assigned to this class and is not allowed to have + * any missing/omitted fields that are not labeled optional. + */ + public T getUnresolvedPipelineInput(String inputFileName) { + Path pipelineInputPath = this.resolverFunction.apply(inputFileName); + + if (!Files.exists(pipelineInputPath)) { + throw new RuntimeException( + "Provided path does not exist: " + pipelineInputPath.toAbsolutePath().toString()); + } + + Parser jsonParser = JsonFormat.parser(); + + T.Builder builder = this.pipelineInputInstance.newBuilderForType(); + + try { + Reader reader = new FileReader(pipelineInputPath.toFile()); + jsonParser.merge(reader, builder); + } catch (IOException e) { + throw new RuntimeException(e); + } + + return this.pipelineInputClassRef.cast(builder.build()); + } +} diff --git a/src/main/proto/gov/hhs/aspr/ms/gcm/pipeline/testsupport.proto b/src/main/proto/gov/hhs/aspr/ms/gcm/pipeline/testsupport.proto new file mode 100644 index 0000000..dc7d3fe --- /dev/null +++ b/src/main/proto/gov/hhs/aspr/ms/gcm/pipeline/testsupport.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package gov.hhs.aspr.ms.gcm.pipeline; + +option java_multiple_files = true; +option java_package = "gov.hhs.aspr.ms.gcm.pipeline.testsupport.input"; + +message TestPipelineInput { + TestSubPipelineInput testPipelineInput = 1; + TestDimensionPipelineInput testDimensionPipelineInput = 2; + optional bool runningWithPreviousData = 3; + optional string inputDirectory = 4; + optional string outputDirectory = 5; +} + +message TestSubPipelineInput { + string testDataFile1 = 1; + string testDataFile2 = 2; + string testDataFile3 = 3; + string testDataFile4 = 4; + string pluginDataFile = 5; +} + +message TestDimensionInstanceInput { + bool enabled = 1; + string inputFile = 2; + string dimensionDataFile = 3; +} + +message TestMultiDimensionPipelineInput { + repeated TestDimensionInstanceInput dimensionInstanceInput = 1; +} + +message TestSingleDimensionPipelineInput { + TestDimensionInstanceInput dimensionInstanceInput = 1; +} + +message TestDimensionPipelineInput { + TestMultiDimensionPipelineInput testMultiDimensionPipelineInput = 1; + TestSingleDimensionPipelineInput testSingleDimensionPipelineInput = 2; +} \ No newline at end of file diff --git a/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineInputResolver.java b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineInputResolver.java new file mode 100644 index 0000000..d54c0db --- /dev/null +++ b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineInputResolver.java @@ -0,0 +1,130 @@ +package gov.hhs.aspr.ms.gcm.pipeline.testsupport; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.nio.file.Path; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.Message; + +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestDimensionInstanceInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestMultiDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestSingleDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestSubPipelineInput; +import gov.hhs.aspr.ms.taskit.protobuf.ProtobufTranslationEngine; +import gov.hhs.aspr.ms.util.annotations.UnitTestMethod; +import gov.hhs.aspr.ms.util.resourcehelper.ResourceHelper; + +public class AT_PipelineInputResolver { + private final Path REOURCE_DIR = ResourceHelper.getResourceDir(AT_PipelineInputResolver.class); + private final String TEST_OUTPUT_DIR_NAME = "testOutput"; + private final Path TEST_OUTPUT_DIR = getResolvedResourcePath(TEST_OUTPUT_DIR_NAME); + private final String TEST_FILE_NAME = "pipeline_tester.json"; + + private final Path getResolvedResourcePath(String path) { + return REOURCE_DIR.resolve(path).toAbsolutePath(); + } + + @Test + @UnitTestMethod(target = PipelineInputResolver.class, name = "resolvePipelineInput", args = { FieldDescriptor.class, + Object.class, Message.Builder.class }) + public void testResolvePipelineInput() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder().build(), TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + PipelineInputResolver pipelineInputResolver = new PipelineInputResolver( + this::getResolvedResourcePath); + + TestPipelineInput unresolvedTestPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_NAME); + + TestPipelineInput.Builder resolvedInputBuilder = unresolvedTestPipelineInput.toBuilder(); + Map fields = resolvedInputBuilder.getAllFields(); + + fields.forEach((pipelineField, pipelineFieldValue) -> { + pipelineInputResolver.resolvePipelineInput(pipelineField, pipelineFieldValue, + resolvedInputBuilder); + }); + + TestPipelineInput resolvedPipelineInput = resolvedInputBuilder.build(); + + TestSubPipelineInput testResolvedSubPipelineInput = resolvedPipelineInput.getTestPipelineInput(); + TestDimensionPipelineInput testResolvedDimensionPipelineInput = resolvedPipelineInput + .getTestDimensionPipelineInput(); + + TestSingleDimensionPipelineInput testResolvedSingleDimensionPipelineInput = testResolvedDimensionPipelineInput + .getTestSingleDimensionPipelineInput(); + TestMultiDimensionPipelineInput testResolvedMultiDimensionPipelineInput = testResolvedDimensionPipelineInput + .getTestMultiDimensionPipelineInput(); + + TestSubPipelineInput testUnresolvedSubPipelineInput = unresolvedTestPipelineInput + .getTestPipelineInput(); + TestDimensionPipelineInput testUnresolvedDimensionPipelineInput = unresolvedTestPipelineInput + .getTestDimensionPipelineInput(); + + TestSingleDimensionPipelineInput testUnresolvedSingleDimensionPipelineInput = testUnresolvedDimensionPipelineInput + .getTestSingleDimensionPipelineInput(); + TestMultiDimensionPipelineInput testUnresolvedMultiDimensionPipelineInput = testUnresolvedDimensionPipelineInput + .getTestMultiDimensionPipelineInput(); + + Path testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile1()); + Path expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile1()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile2()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile2()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile3()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile3()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile4()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile4()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(testResolvedSubPipelineInput.getPluginDataFile()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getPluginDataFile()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(testResolvedSingleDimensionPipelineInput.getDimensionInstanceInput().getInputFile()); + expectedPath = getResolvedResourcePath( + testUnresolvedSingleDimensionPipelineInput.getDimensionInstanceInput().getInputFile()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(testResolvedSingleDimensionPipelineInput.getDimensionInstanceInput() + .getDimensionDataFile()); + expectedPath = getResolvedResourcePath( + testUnresolvedSingleDimensionPipelineInput.getDimensionInstanceInput() + .getDimensionDataFile()); + assertTrue(testPath.isAbsolute()); + + assertEquals(testUnresolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount(), + testResolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount()); + + for (int i = 0; i < testResolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount(); i++) { + TestDimensionInstanceInput unresolvedDimInstance = testUnresolvedMultiDimensionPipelineInput + .getDimensionInstanceInput(i); + TestDimensionInstanceInput resolvedDimInstance = testResolvedMultiDimensionPipelineInput + .getDimensionInstanceInput(i); + + testPath = Path.of(resolvedDimInstance.getInputFile()); + expectedPath = getResolvedResourcePath(unresolvedDimInstance.getInputFile()); + assertTrue(testPath.isAbsolute()); + + testPath = Path.of(resolvedDimInstance.getDimensionDataFile()); + expectedPath = getResolvedResourcePath(unresolvedDimInstance.getDimensionDataFile()); + assertTrue(testPath.isAbsolute()); + } + } +} diff --git a/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineTestSupport.java b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineTestSupport.java new file mode 100644 index 0000000..e1a08fa --- /dev/null +++ b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/testsupport/AT_PipelineTestSupport.java @@ -0,0 +1,310 @@ +package gov.hhs.aspr.ms.gcm.pipeline.testsupport; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.nio.file.Path; +import java.util.function.Function; + +import org.junit.jupiter.api.Test; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.Message; + +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestDimensionInstanceInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestMultiDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestSingleDimensionPipelineInput; +import gov.hhs.aspr.ms.gcm.pipeline.testsupport.input.TestSubPipelineInput; +import gov.hhs.aspr.ms.gcm.simulation.plugins.globalproperties.datamanagers.GlobalPropertiesPluginData; +import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.globalproperties.GlobalPropertiesTranslator; +import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.globalproperties.data.input.GlobalPropertiesPluginDataInput; +import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.properties.PropertiesTranslator; +import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.reports.ReportsTranslator; +import gov.hhs.aspr.ms.taskit.core.TranslationEngine; +import gov.hhs.aspr.ms.taskit.protobuf.ProtobufTranslationEngine; +import gov.hhs.aspr.ms.util.annotations.UnitTestConstructor; +import gov.hhs.aspr.ms.util.annotations.UnitTestMethod; +import gov.hhs.aspr.ms.util.resourcehelper.ResourceHelper; + +public class AT_PipelineTestSupport { + private final Path REOURCE_DIR = ResourceHelper.getResourceDir(this.getClass()); + private final String TEST_OUTPUT_DIR_NAME = "testOutput"; + private final Path TEST_OUTPUT_DIR = getResolvedResourcePath(TEST_OUTPUT_DIR_NAME); + private final String TEST_FILE_NAME = "pipeline_tester.json"; + private final String TEST_FILE_DIR_NAME = "pipeline_tester_dir.json"; + private final String TEST_FILE_PREV_NAME = "pipeline_tester_prev.json"; + private final String TEST_FILE_BAD_NAME = "pipeline_tester_bad.json"; + private final String TEST_FILE_NAME_RESOLVED = "pipeline_tester_resolved.json"; + + private final String TEST_GP_FILE_1 = "globalPropertiesPluginData1.json"; + private final String TEST_GP_FILE_2 = "globalPropertiesPluginData2.json"; + private final String TEST_GP_FILE_3 = "globalPropertiesPluginData3.json"; + private final String TEST_GP_FILE_4 = "globalPropertiesPluginData4.json"; + + private final Path TEST_GP_FILE_1_PATH = getResolvedResourcePath(TEST_GP_FILE_1); + private final Path TEST_GP_FILE_2_PATH = getResolvedResourcePath(TEST_GP_FILE_2); + private final Path TEST_GP_FILE_3_PATH = getResolvedResourcePath(TEST_GP_FILE_3); + private final Path TEST_GP_FILE_4_PATH = getResolvedResourcePath(TEST_GP_FILE_4); + + private final Path getResolvedResourcePath(String path) { + return REOURCE_DIR.resolve(path).toAbsolutePath(); + } + + @Test + @UnitTestConstructor(target = PipelineTestSupport.class, args = { TranslationEngine.class, Message.class, + Class.class, Function.class, Path.class }) + public void testConstructor() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder().build(), TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + assertNotNull(testPipelineInputTestSupport); + } + + @Test + @UnitTestMethod(target = PipelineTestSupport.class, name = "createResolvedPipelineInputFile", args = { + Message.class, + String.class }) + public void testCreateResolvedPipelineInputFile() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder().build(), TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + TestPipelineInput testPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_NAME); + TestPipelineInput resolvedPipelineInput = testPipelineInputTestSupport + .getResolvedPipelineInput(testPipelineInput, false, false); + + String filePath = testPipelineInputTestSupport.createResolvedPipelineInputFile(resolvedPipelineInput, + TEST_FILE_NAME_RESOLVED); + + Path resolvedPath = Path.of(filePath); + + assertTrue(resolvedPath.isAbsolute()); + assertTrue(resolvedPath.toFile().exists()); + } + + @Test + @UnitTestMethod(target = PipelineTestSupport.class, name = "filesAreSame", args = { Class.class, Class.class, + Path.class, Path.class }) + public void testFilesAreSame() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder() + .addTranslator(GlobalPropertiesTranslator.getTranslator()) + .addTranslator(PropertiesTranslator.getTranslator()) + .addTranslator(ReportsTranslator.getTranslator()) + .build(), + TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + assertTrue(testPipelineInputTestSupport.filesAreSame(GlobalPropertiesPluginDataInput.class, + GlobalPropertiesPluginData.class, TEST_GP_FILE_1_PATH, TEST_GP_FILE_2_PATH)); + assertFalse(testPipelineInputTestSupport.filesAreSame(GlobalPropertiesPluginDataInput.class, + GlobalPropertiesPluginData.class, TEST_GP_FILE_1_PATH, TEST_GP_FILE_3_PATH)); + assertFalse(testPipelineInputTestSupport.filesAreSame(GlobalPropertiesPluginDataInput.class, + GlobalPropertiesPluginData.class, TEST_GP_FILE_2_PATH, TEST_GP_FILE_3_PATH)); + assertFalse(testPipelineInputTestSupport.filesAreSame(GlobalPropertiesPluginDataInput.class, + GlobalPropertiesPluginData.class, TEST_GP_FILE_3_PATH, TEST_GP_FILE_4_PATH)); + } + + @Test + @UnitTestMethod(target = PipelineTestSupport.class, name = "getResolvedPipelineInput", args = { Message.class, + boolean.class, + boolean.class }) + public void testGetResolvedPipelineInput() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder().build(), TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + TestPipelineInput unresolvedTestPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_NAME); + TestPipelineInput resolvedPipelineInput = testPipelineInputTestSupport + .getResolvedPipelineInput(unresolvedTestPipelineInput, false, false); + + TestSubPipelineInput testResolvedSubPipelineInput = resolvedPipelineInput.getTestPipelineInput(); + TestDimensionPipelineInput testResolvedDimensionPipelineInput = resolvedPipelineInput + .getTestDimensionPipelineInput(); + + TestSingleDimensionPipelineInput testResolvedSingleDimensionPipelineInput = testResolvedDimensionPipelineInput + .getTestSingleDimensionPipelineInput(); + TestMultiDimensionPipelineInput testResolvedMultiDimensionPipelineInput = testResolvedDimensionPipelineInput + .getTestMultiDimensionPipelineInput(); + + TestSubPipelineInput testUnresolvedSubPipelineInput = unresolvedTestPipelineInput + .getTestPipelineInput(); + TestDimensionPipelineInput testUnresolvedDimensionPipelineInput = unresolvedTestPipelineInput + .getTestDimensionPipelineInput(); + + TestSingleDimensionPipelineInput testUnresolvedSingleDimensionPipelineInput = testUnresolvedDimensionPipelineInput + .getTestSingleDimensionPipelineInput(); + TestMultiDimensionPipelineInput testUnresolvedMultiDimensionPipelineInput = testUnresolvedDimensionPipelineInput + .getTestMultiDimensionPipelineInput(); + + Path testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile1()); + Path expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile1()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile2()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile2()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile3()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile3()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSubPipelineInput.getTestDataFile4()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getTestDataFile4()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSubPipelineInput.getPluginDataFile()); + expectedPath = getResolvedResourcePath(testUnresolvedSubPipelineInput.getPluginDataFile()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSingleDimensionPipelineInput.getDimensionInstanceInput().getInputFile()); + expectedPath = getResolvedResourcePath( + testUnresolvedSingleDimensionPipelineInput.getDimensionInstanceInput().getInputFile()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(testResolvedSingleDimensionPipelineInput.getDimensionInstanceInput() + .getDimensionDataFile()); + expectedPath = getResolvedResourcePath( + testUnresolvedSingleDimensionPipelineInput.getDimensionInstanceInput() + .getDimensionDataFile()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + assertEquals(testUnresolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount(), + testResolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount()); + + for (int i = 0; i < testResolvedMultiDimensionPipelineInput.getDimensionInstanceInputCount(); i++) { + TestDimensionInstanceInput unresolvedDimInstance = testUnresolvedMultiDimensionPipelineInput + .getDimensionInstanceInput(i); + TestDimensionInstanceInput resolvedDimInstance = testResolvedMultiDimensionPipelineInput + .getDimensionInstanceInput(i); + + testPath = Path.of(resolvedDimInstance.getInputFile()); + expectedPath = getResolvedResourcePath(unresolvedDimInstance.getInputFile()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(resolvedDimInstance.getDimensionDataFile()); + expectedPath = getResolvedResourcePath(unresolvedDimInstance.getDimensionDataFile()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + } + + unresolvedTestPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_DIR_NAME); + resolvedPipelineInput = testPipelineInputTestSupport + .getResolvedPipelineInput(unresolvedTestPipelineInput, true, false); + + testPath = Path.of(resolvedPipelineInput.getInputDirectory()); + expectedPath = getResolvedResourcePath(unresolvedTestPipelineInput.getInputDirectory()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + testPath = Path.of(resolvedPipelineInput.getOutputDirectory()); + expectedPath = getResolvedResourcePath(unresolvedTestPipelineInput.getOutputDirectory()); + assertTrue(testPath.isAbsolute()); + assertEquals(expectedPath, testPath); + + unresolvedTestPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_PREV_NAME); + resolvedPipelineInput = testPipelineInputTestSupport + .getResolvedPipelineInput(unresolvedTestPipelineInput, false, true); + + assertTrue(resolvedPipelineInput.getRunningWithPreviousData()); + } + + @Test + @UnitTestMethod(target = PipelineTestSupport.class, name = "getUnresolvedPipelineInput", args = { + String.class }) + public void testGetUnresolvedPipelineInput() { + PipelineTestSupport testPipelineInputTestSupport = new PipelineTestSupport<>( + ProtobufTranslationEngine.builder().build(), TestPipelineInput.getDefaultInstance(), + TestPipelineInput.class, + this::getResolvedResourcePath, + TEST_OUTPUT_DIR); + + TestPipelineInput testPipelineInput = testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_NAME); + + TestSubPipelineInput testSubPipelineInput = testPipelineInput.getTestPipelineInput(); + TestDimensionPipelineInput testDimensionPipelineInput = testPipelineInput + .getTestDimensionPipelineInput(); + + TestSingleDimensionPipelineInput testSingleDimensionPipelineInput = testDimensionPipelineInput + .getTestSingleDimensionPipelineInput(); + TestMultiDimensionPipelineInput testMultiDimensionPipelineInput = testDimensionPipelineInput + .getTestMultiDimensionPipelineInput(); + + Path testPath = Path.of(testSubPipelineInput.getTestDataFile1()); + assertNotNull(testPath); + + testPath = Path.of(testSubPipelineInput.getTestDataFile2()); + assertNotNull(testPath); + + testPath = Path.of(testSubPipelineInput.getTestDataFile3()); + assertNotNull(testPath); + + testPath = Path.of(testSubPipelineInput.getTestDataFile4()); + assertNotNull(testPath); + + testPath = Path.of(testSubPipelineInput.getPluginDataFile()); + assertNotNull(testPath); + + testPath = Path.of(testSingleDimensionPipelineInput.getDimensionInstanceInput().getInputFile()); + assertNotNull(testPath); + + testPath = Path.of(testSingleDimensionPipelineInput.getDimensionInstanceInput().getDimensionDataFile()); + assertNotNull(testPath); + + for (TestDimensionInstanceInput testDimensionInstanceInput : testMultiDimensionPipelineInput + .getDimensionInstanceInputList()) { + testPath = Path.of(testDimensionInstanceInput.getInputFile()); + assertNotNull(testPath); + + testPath = Path.of(testDimensionInstanceInput.getDimensionDataFile()); + assertNotNull(testPath); + } + + // preconditions: + // file path does not exist + RuntimeException runtimeException = assertThrows(RuntimeException.class, () -> { + testPipelineInputTestSupport + .getUnresolvedPipelineInput("badFile.json"); + }); + + assertEquals( + "Provided path does not exist: " + getResolvedResourcePath("badFile.json").toAbsolutePath().toString(), + runtimeException.getMessage()); + + // json is bad/has unknown fields + runtimeException = assertThrows(RuntimeException.class, () -> { + testPipelineInputTestSupport + .getUnresolvedPipelineInput(TEST_FILE_BAD_NAME); + }); + + assertEquals(InvalidProtocolBufferException.class, + runtimeException.getCause().getClass()); + } +} diff --git a/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/unittestcoverage/UnitTestReport.java b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/unittestcoverage/UnitTestReport.java new file mode 100644 index 0000000..9c32e04 --- /dev/null +++ b/src/test/java/gov/hhs/aspr/ms/gcm/pipeline/unittestcoverage/UnitTestReport.java @@ -0,0 +1,24 @@ +package gov.hhs.aspr.ms.gcm.pipeline.unittestcoverage; + +public final class UnitTestReport { + + public static void main(final String[] args) { + + System.out.println("Missing Tests Report:"); + gov.hhs.aspr.ms.util.meta.unittestcoverage.reports.MissingTestsReport.run(args); + System.out.print("\n\n\n"); + + System.out.println("MetaInfo Report:"); + gov.hhs.aspr.ms.util.meta.unittestcoverage.reports.MetaInfoReport.run(args); + System.out.print("\n\n\n"); + + System.out.println("Incomplete Tests Report:"); + gov.hhs.aspr.ms.util.meta.unittestcoverage.reports.IncompleteClassReport.run(args); + System.out.print("\n\n\n"); + + System.out.println("Status Report:"); + gov.hhs.aspr.ms.util.meta.unittestcoverage.reports.StatusReport.run(args); + System.out.print("\n\n\n"); + } + +} diff --git a/src/test/resources/globalPropertiesPluginData1.json b/src/test/resources/globalPropertiesPluginData1.json new file mode 100644 index 0000000..1c30834 --- /dev/null +++ b/src/test/resources/globalPropertiesPluginData1.json @@ -0,0 +1,138 @@ +{ + "globalPropertyDefinitinions": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyDefinition": { + "type": "java.lang.Double", + "propertyValuesAreMutable": true + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_6_DOUBLE_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.0 + } + }, + "propertyTrackingPolicy": true + }], + "globalPropertyValues": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.5160930745117192 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }], + "version": "4.2.0" +} \ No newline at end of file diff --git a/src/test/resources/globalPropertiesPluginData2.json b/src/test/resources/globalPropertiesPluginData2.json new file mode 100644 index 0000000..1c30834 --- /dev/null +++ b/src/test/resources/globalPropertiesPluginData2.json @@ -0,0 +1,138 @@ +{ + "globalPropertyDefinitinions": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyDefinition": { + "type": "java.lang.Double", + "propertyValuesAreMutable": true + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_6_DOUBLE_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.0 + } + }, + "propertyTrackingPolicy": true + }], + "globalPropertyValues": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.5160930745117192 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }], + "version": "4.2.0" +} \ No newline at end of file diff --git a/src/test/resources/globalPropertiesPluginData3.json b/src/test/resources/globalPropertiesPluginData3.json new file mode 100644 index 0000000..a31f9a4 --- /dev/null +++ b/src/test/resources/globalPropertiesPluginData3.json @@ -0,0 +1,138 @@ +{ + "globalPropertyDefinitinions": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": false, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyDefinition": { + "type": "java.lang.Double", + "propertyValuesAreMutable": true + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_6_DOUBLE_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.0 + } + }, + "propertyTrackingPolicy": true + }], + "globalPropertyValues": [{ + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.5160930745117192 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }, { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }], + "version": "4.2.0" +} \ No newline at end of file diff --git a/src/test/resources/globalPropertiesPluginData4.json b/src/test/resources/globalPropertiesPluginData4.json new file mode 100644 index 0000000..ed07b42 --- /dev/null +++ b/src/test/resources/globalPropertiesPluginData4.json @@ -0,0 +1,151 @@ +{ + "globalPropertyDefinitinions": [ + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": true, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyDefinition": { + "propertyValuesAreMutable": false, + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyDefinition": { + "type": "java.lang.Double", + "propertyValuesAreMutable": true + }, + "propertyTrackingPolicy": true + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + } + }, + "propertyTrackingPolicy": true + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + } + }, + "propertyTrackingPolicy": true + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_6_DOUBLE_IMMUTABLE" + }, + "propertyDefinition": { + "defaultValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.0 + } + }, + "propertyTrackingPolicy": true + } + ], + "globalPropertyValues": [ + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_3_DOUBLE_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.DoubleValue", + "value": 0.5160930745117192 + }, + "propertyValueTime": 0.0 + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_5_INTEGER_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_2_INTEGER_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.Int32Value", + "value": 0 + }, + "propertyValueTime": 0.0 + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_4_BOOLEAN_IMMUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + }, + { + "propertyId": { + "@type": "type.googleapis.com/gov.hhs.aspr.ms.taskit.protobuf.WrapperEnumValue", + "enumTypeUrl": "gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.TestGlobalPropertyIdInput", + "value": "GLOBAL_PROPERTY_1_BOOLEAN_MUTABLE" + }, + "propertyValue": { + "@type": "type.googleapis.com/google.protobuf.BoolValue", + "value": false + }, + "propertyValueTime": 0.0 + } + ], + "version": "4.2.0" +} \ No newline at end of file diff --git a/src/test/resources/pipeline_tester.json b/src/test/resources/pipeline_tester.json new file mode 100644 index 0000000..11f8cc3 --- /dev/null +++ b/src/test/resources/pipeline_tester.json @@ -0,0 +1,49 @@ +{ + "inputDirectory": "rawInput", + "outputDirectory": "testOutput", + "testPipelineInput": { + "testDataFile1": "rawInput/blocks/testDataFile1.csv", + "testDataFile2": "rawInput/blocks/testDataFile2.csv", + "testDataFile3": "rawInput/blocks/testDataFile3.csv", + "testDataFile4": "rawInput/reports/testDataFile4.csv", + "pluginDataFile": "testOutput/testPluginData.json" + }, + "testDimensionPipelineInput": { + "testSingleDimensionPipelineInput": { + "dimensionInstanceInput": { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension1.csv", + "dimensionDataFile": "testOutput/testDimensionData1.json" + } + }, + "testMultiDimensionPipelineInput" : { + "dimensionInstanceInput": [ + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension2.csv", + "dimensionDataFile": "testOutput/testDimensionData2.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension3.csv", + "dimensionDataFile": "testOutput/testDimensionData3.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension4.csv", + "dimensionDataFile": "testOutput/testDimensionData4.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension5.csv", + "dimensionDataFile": "testOutput/testDimensionData5.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension6.csv", + "dimensionDataFile": "testOutput/testDimensionData6.json" + } + ] + } + } +} \ No newline at end of file diff --git a/src/test/resources/pipeline_tester_bad.json b/src/test/resources/pipeline_tester_bad.json new file mode 100644 index 0000000..fb7b067 --- /dev/null +++ b/src/test/resources/pipeline_tester_bad.json @@ -0,0 +1,50 @@ +{ + "badProp": false, + "inputDirectory": "rawInput", + "outputDirectory": "testOutput", + "testPipelineInput": { + "testDataFile1": "rawInput/blocks/testDataFile1.csv", + "testDataFile2": "rawInput/blocks/testDataFile2.csv", + "testDataFile3": "rawInput/blocks/testDataFile3.csv", + "testDataFile4": "rawInput/reports/testDataFile4.csv", + "pluginDataFile": "testOutput/testPluginData.json" + }, + "testDimensionPipelineInput": { + "testSingleDimensionPipelineInput": { + "dimensionInstanceInput": { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension1.csv", + "dimensionDataFile": "testOutput/testDimensionData1.json" + } + }, + "testMultiDimensionPipelineInput" : { + "dimensionInstanceInput": [ + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension2.csv", + "dimensionDataFile": "testOutput/testDimensionData2.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension3.csv", + "dimensionDataFile": "testOutput/testDimensionData3.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension4.csv", + "dimensionDataFile": "testOutput/testDimensionData4.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension5.csv", + "dimensionDataFile": "testOutput/testDimensionData5.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension6.csv", + "dimensionDataFile": "testOutput/testDimensionData6.json" + } + ] + } + } +} \ No newline at end of file diff --git a/src/test/resources/pipeline_tester_dir.json b/src/test/resources/pipeline_tester_dir.json new file mode 100644 index 0000000..1eadb7f --- /dev/null +++ b/src/test/resources/pipeline_tester_dir.json @@ -0,0 +1,49 @@ +{ + "inputDirectory": "rawInput", + "outputDirectory": "testOutput", + "testPipelineInput": { + "testDataFile1": "blocks/testDataFile1.csv", + "testDataFile2": "blocks/testDataFile2.csv", + "testDataFile3": "blocks/testDataFile3.csv", + "testDataFile4": "reports/testDataFile4.csv", + "pluginDataFile": "testPluginData.json" + }, + "testDimensionPipelineInput": { + "testSingleDimensionPipelineInput": { + "dimensionInstanceInput": { + "enabled": true, + "inputFile": "dimensions/test_dimension1.csv", + "dimensionDataFile": "testDimensionData1.json" + } + }, + "testMultiDimensionPipelineInput" : { + "dimensionInstanceInput": [ + { + "enabled": true, + "inputFile": "dimensions/test_dimension2.csv", + "dimensionDataFile": "testDimensionData2.json" + }, + { + "enabled": true, + "inputFile": "dimensions/test_dimension3.csv", + "dimensionDataFile": "testDimensionData3.json" + }, + { + "enabled": true, + "inputFile": "dimensions/test_dimension4.csv", + "dimensionDataFile": "testDimensionData4.json" + }, + { + "enabled": true, + "inputFile": "dimensions/test_dimension5.csv", + "dimensionDataFile": "testDimensionData5.json" + }, + { + "enabled": true, + "inputFile": "dimensions/test_dimension6.csv", + "dimensionDataFile": "testDimensionData6.json" + } + ] + } + } +} \ No newline at end of file diff --git a/src/test/resources/pipeline_tester_prev.json b/src/test/resources/pipeline_tester_prev.json new file mode 100644 index 0000000..b6260c8 --- /dev/null +++ b/src/test/resources/pipeline_tester_prev.json @@ -0,0 +1,48 @@ +{ + "runningWithPreviousData": true, + "testPipelineInput": { + "testDataFile1": "rawInput/blocks/testDataFile1.csv", + "testDataFile2": "rawInput/blocks/testDataFile2.csv", + "testDataFile3": "rawInput/blocks/testDataFile3.csv", + "testDataFile4": "rawInput/reports/testDataFile4.csv", + "pluginDataFile": "testOutput/testPluginData.json" + }, + "testDimensionPipelineInput": { + "testSingleDimensionPipelineInput": { + "dimensionInstanceInput": { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension1.csv", + "dimensionDataFile": "testOutput/testDimensionData1.json" + } + }, + "testMultiDimensionPipelineInput": { + "dimensionInstanceInput": [ + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension2.csv", + "dimensionDataFile": "testOutput/testDimensionData2.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension3.csv", + "dimensionDataFile": "testOutput/testDimensionData3.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension4.csv", + "dimensionDataFile": "testOutput/testDimensionData4.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension5.csv", + "dimensionDataFile": "testOutput/testDimensionData5.json" + }, + { + "enabled": true, + "inputFile": "rawInput/dimensions/test_dimension6.csv", + "dimensionDataFile": "testOutput/testDimensionData6.json" + } + ] + } + } +} \ No newline at end of file