Skip to content

Commit

Permalink
update tests to work with new taskit (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
bischoffz authored Mar 5, 2024
1 parent b398bb7 commit 74d9712
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void testSimulationStateTranslator() {
ProtobufTranslationEngine.builder().addTranslator(NucleusTranslator.getTranslator()).build())
.addInputFilePath(filePath.resolve(fileName), SimulationStateInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), SimulationState.class, TranslationEngineType.PROTOBUF)
.build();

double startTime = 5;
Expand All @@ -43,7 +42,8 @@ public void testSimulationStateTranslator() {
.setBaseDate(LocalDate.of(2023, 4, 12))
.build();

translatorController.writeOutput(exptectedSimulationState);
translatorController.writeOutput(exptectedSimulationState, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand All @@ -64,8 +64,6 @@ public void testExperimentParameterDataTranslator() {
ProtobufTranslationEngine.builder().addTranslator(NucleusTranslator.getTranslator()).build())
.addInputFilePath(filePath.resolve(fileName), ExperimentParameterDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), ExperimentParameterData.class,
TranslationEngineType.PROTOBUF)
.build();

ExperimentParameterData.Builder builder = ExperimentParameterData.builder()
Expand All @@ -80,11 +78,13 @@ public void testExperimentParameterDataTranslator() {

ExperimentParameterData expectedExperimentParameterData = builder.build();

translatorController.writeOutput(expectedExperimentParameterData);
translatorController.writeOutput(expectedExperimentParameterData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

ExperimentParameterData actualExperimentParameterData = translatorController.getFirstObject(ExperimentParameterData.class);
ExperimentParameterData actualExperimentParameterData = translatorController
.getFirstObject(ExperimentParameterData.class);

assertEquals(expectedExperimentParameterData, actualExperimentParameterData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ public void testGlobalPropertiesPluginDataIntegration() {
.addTranslationEngine(protobufTranslationEngine)
.addInputFilePath(filePath.resolve(fileName), GlobalPropertiesPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), GlobalPropertiesPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

GlobalPropertiesPluginData expectedPluginData = GlobalPropertiesTestPluginFactory
.getStandardGlobalPropertiesPluginData(8368397106493368066L);

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down Expand Up @@ -81,8 +80,6 @@ public void testGlobalPropertyReportPluginDataIntegration() {
.addTranslationEngine(protobufTranslationEngine)
.addInputFilePath(filePath.resolve(fileName), GlobalPropertyReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), GlobalPropertyReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

RandomGenerator randomGenerator = RandomGeneratorProvider.getRandomGenerator(524805676405822016L);
Expand All @@ -102,7 +99,8 @@ public void testGlobalPropertyReportPluginDataIntegration() {

GlobalPropertyReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void testGroupsTranslator() {
.addTranslationEngine(protobufTranslationEngine)
.addInputFilePath(filePath.resolve(fileName), GroupsPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), GroupsPluginData.class, TranslationEngineType.PROTOBUF)
.build();

long seed = 524805676405822016L;
Expand All @@ -80,7 +79,8 @@ public void testGroupsTranslator() {

expectedPluginDatas.add(expectedPluginData);

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();
}

Expand Down Expand Up @@ -112,8 +112,6 @@ public void testGroupPropertyReportTranslatorSpec() {
.addTranslationEngine(protobufTranslationEngine)
.addInputFilePath(filePath.resolve(fileName), GroupPropertyReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), GroupPropertyReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

RandomGenerator randomGenerator = RandomGeneratorProvider.getRandomGenerator(524805676405822016L);
Expand All @@ -136,7 +134,8 @@ public void testGroupPropertyReportTranslatorSpec() {

GroupPropertyReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public void testMaterialsTranslator() {
.build())
.addInputFilePath(filePath.resolve(fileName), MaterialsPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), MaterialsPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

int numBatches = 50;
Expand All @@ -63,7 +61,8 @@ public void testMaterialsTranslator() {

MaterialsPluginData expectedPluginData = MaterialsTestPluginFactory.getStandardMaterialsPluginData(numBatches,
numStages, numBatchesInStage, seed);
translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();
MaterialsPluginData actualPluginData = translatorController.getFirstObject(MaterialsPluginData.class);
Expand All @@ -90,8 +89,6 @@ public void testBatchStatusReportPluginDataTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), BatchStatusReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), BatchStatusReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

BatchStatusReportPluginData.Builder builder = BatchStatusReportPluginData.builder();
Expand All @@ -102,7 +99,8 @@ public void testBatchStatusReportPluginDataTranslatorSpec() {

BatchStatusReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down Expand Up @@ -131,8 +129,6 @@ public void testMaterialsProducerPropertyReportPluginDataTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), MaterialsProducerPropertyReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), MaterialsProducerPropertyReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

MaterialsProducerPropertyReportPluginData.Builder builder = MaterialsProducerPropertyReportPluginData.builder();
Expand All @@ -142,7 +138,8 @@ public void testMaterialsProducerPropertyReportPluginDataTranslatorSpec() {

MaterialsProducerPropertyReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down Expand Up @@ -171,8 +168,6 @@ public void testMaterialsProducerResourceReportPluginDataTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), MaterialsProducerResourceReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), MaterialsProducerResourceReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

MaterialsProducerResourceReportPluginData.Builder builder = MaterialsProducerResourceReportPluginData.builder();
Expand All @@ -183,7 +178,8 @@ public void testMaterialsProducerResourceReportPluginDataTranslatorSpec() {

MaterialsProducerResourceReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

MaterialsProducerResourceReportPluginData actualPluginData = translatorController
Expand Down Expand Up @@ -211,8 +207,6 @@ public void testStageReportPluginDataTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), StageReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), StageReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

StageReportPluginData.Builder builder = StageReportPluginData.builder();
Expand All @@ -223,7 +217,8 @@ public void testStageReportPluginDataTranslatorSpec() {

StageReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

StageReportPluginData actualPluginData = translatorController.getFirstObject(StageReportPluginData.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ public void testGroupsTranslator() {
.build())
.addInputFilePath(filePath.resolve(fileName), PartitionsPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PartitionsPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

PartitionsPluginData expectedPluginData = PartitionsPluginData.builder().setRunContinuitySupport(true).build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

translatorController.readInput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void testPeopleTranslator() {
ProtobufTranslationEngine.builder().addTranslator(PeopleTranslator.getTranslator()).build())
.addInputFilePath(filePath.resolve(fileName), PeoplePluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PeoplePluginData.class, TranslationEngineType.PROTOBUF)
.build();

PeoplePluginData.Builder builder = PeoplePluginData.builder();
Expand All @@ -48,7 +47,8 @@ public void testPeopleTranslator() {

PeoplePluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

PeoplePluginData actualPluginData = translatorController.getFirstObject(PeoplePluginData.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public void testPersonPropertiesTranslator() {
.build())
.addInputFilePath(filePath.resolve(fileName), PersonPropertiesPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PersonPropertiesPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

long seed = 4684903523797799712L;
Expand All @@ -69,7 +67,8 @@ public void testPersonPropertiesTranslator() {
PersonPropertiesPluginData expectedPluginData = PersonPropertiesTestPluginFactory
.getStandardPersonPropertiesPluginData(people, seed);

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

PersonPropertiesPluginData actualPluginData = translatorController
Expand All @@ -95,8 +94,6 @@ public void testPersonPropertyReportTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), PersonPropertyReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PersonPropertyReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

long seed = 4684903523797799712L;
Expand All @@ -122,7 +119,8 @@ public void testPersonPropertyReportTranslatorSpec() {

PersonPropertyReportPluginData expectedPluginData = personPropertyReportPluginDataBuilder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

PersonPropertyReportPluginData actualPluginData = translatorController
Expand All @@ -148,8 +146,6 @@ public void testPersonInteractionReportTranslatorSpec() {
.build())
.addInputFilePath(filePath.resolve(fileName), PersonPropertyInteractionReportPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PersonPropertyInteractionReportPluginData.class,
TranslationEngineType.PROTOBUF)
.build();

long seed = 4684903523797799712L;
Expand All @@ -172,7 +168,8 @@ public void testPersonInteractionReportTranslatorSpec() {

PersonPropertyInteractionReportPluginData expectedPluginData = builder.build();

translatorController.writeOutput(expectedPluginData);
translatorController.writeOutput(expectedPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

PersonPropertyInteractionReportPluginData actualPluginData = translatorController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ private void createPluginData(int population) {
.addTranslationEngine(this.protobufTranslationEngine)
.addInputFilePath(filePath.resolve(fileName), PersonPropertiesPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PersonPropertiesPluginDataInput.class,
TranslationEngineType.PROTOBUF)
.build();

List<PersonId> people = new ArrayList<>();
Expand All @@ -74,10 +72,12 @@ public void convertPluginDataToInput() {
System.gc();
}

private void writeOutput() {
private void writeOutput(int population) {
String fileName = "personPropertiesPluginData_mt-" + population + ".json";
this.timeElapser.reset();

this.translationController.writeOutput(this.inputPluginData);
this.translationController.writeOutput(this.inputPluginData, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);

double elapsedTime = this.timeElapser.getElapsedMilliSeconds();
this.times.concat(elapsedTime + ",");
Expand Down Expand Up @@ -112,7 +112,7 @@ public static void main(String[] args) {
test.appendToTimeString(new String(i + ","));
test.createPluginData(i);
test.convertPluginDataToInput();
test.writeOutput();
test.writeOutput(i);
test.readInput();
System.out.println(test.times);
test.clearTimesString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public void testPropertyValueMapTranslator() {
ProtobufTranslationEngine.builder().addTranslator(PropertiesTranslator.getTranslator()).build())
.addInputFilePath(filePath.resolve(fileName), PropertyDefinitionInput.class,
TranslationEngineType.PROTOBUF)
.addOutputFilePath(filePath.resolve(fileName), PropertyDefinition.class, TranslationEngineType.PROTOBUF)
.build();

PropertyDefinition expectedPropertyDefinition = PropertyDefinition.builder()
Expand All @@ -39,7 +38,8 @@ public void testPropertyValueMapTranslator() {
.setType(String.class)
.build();

translatorController.writeOutput(expectedPropertyDefinition);
translatorController.writeOutput(expectedPropertyDefinition, filePath.resolve(fileName),
TranslationEngineType.PROTOBUF);
translatorController.readInput();

PropertyDefinition actualPropertyDefiniton = translatorController.getFirstObject(PropertyDefinition.class);
Expand Down
Loading

0 comments on commit 74d9712

Please sign in to comment.