From 0f60e4757b4b1a4ca43cd43bf5f4b6409dae4e85 Mon Sep 17 00:00:00 2001 From: "harald.martini@student.tugraz.at" <harald.martini@student.tugraz.at> Date: Mon, 20 Sep 2021 11:10:06 +0200 Subject: [PATCH] Added Testcase for CompletedExempted without TPMLM --- .../Multistage/MultistageMultipleRunsTest.cs | 75 +++++++++---------- .../Multistage/newVifExempted-noTPMLM.vecto | 13 ++++ ...le-exempted_input_completewithoutTMPLM.xml | 20 +++++ VectoCore/VectoCoreTest/VectoCoreTest.csproj | 3 + 4 files changed, 72 insertions(+), 39 deletions(-) create mode 100644 VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifExempted-noTPMLM.vecto create mode 100644 VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-exempted_input_completewithoutTMPLM.xml diff --git a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs index 763a61d510..f90b6bed15 100644 --- a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs @@ -23,6 +23,11 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage private const string CompletedDiesel = TestDataDir + "newVifCompletedConventional.vecto"; private const string CompletedExempted = TestDataDir + "newVifExempted.vecto"; + private const string CompletedExemptedWithoutTPMLM = TestDataDir + "newVifExempted-noTPMLM.vecto"; + + + + private const string InterimExempted = TestDataDir + "newVifExemptedIncomplete.vecto"; private const string InterimDiesel = TestDataDir + "newVifInterimDiesel.vecto"; @@ -66,14 +71,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage [Test]//, Timeout(3000)] public void ExemptedPrimaryAndCompletedTest() { - var inputFile = Path.GetFullPath(CompletedExempted); - var input = JSONInputDataFactory.ReadJsonJob(inputFile); - StartSimulation(input); - _jobContainer.WaitFinished(); - //while (!_jobContainer.AllCompleted) { - // //Busy wait - //} + StartSimulation(CompletedExempted); var writtenFiles = GetWrittenFiles(); ShowWrittenFiles(writtenFiles); @@ -82,26 +81,31 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLFullReportName)); Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLCustomerReportName)); Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLMultistageReportFileName)); - } - - [Test]//, Timeout(3000)] - public void ExemptedPrimaryAndInterimTest() + [Test] + public void ExemptedPrimaryAndCompletedWithoutTPMLMTest() { - var inputFile = Path.GetFullPath(InterimExempted); - var input = JSONInputDataFactory.ReadJsonJob(inputFile); - StartSimulation(input); - _jobContainer.WaitFinished(); - //while (!_jobContainer.AllCompleted) - //{ - // //Busy wait - //} + StartSimulation(CompletedExemptedWithoutTPMLM); var writtenFiles = GetWrittenFiles(); ShowWrittenFiles(writtenFiles); + Assert.IsTrue(writtenFiles.Contains(_tempFileOutputWriter.XMLFullReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLFullReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLCustomerReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLMultistageReportFileName)); + } + + [Test]//, Timeout(3000)] + public void ExemptedPrimaryAndInterimTest() + { + StartSimulation(InterimExempted); + + var writtenFiles = GetWrittenFiles(); + ShowWrittenFiles(writtenFiles); + Assert.IsTrue(writtenFiles.Contains(_tempFileOutputWriter.XMLFullReportName)); Assert.IsFalse(writtenFiles.Contains(_fileoutputWriter.XMLFullReportName)); Assert.IsFalse(writtenFiles.Contains(_fileoutputWriter.XMLCustomerReportName)); @@ -124,16 +128,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage [Test, Timeout(1000 * 20 * 60)] public void PrimaryAndCompletedTest() { - var inputFile = Path.GetFullPath(CompletedDiesel); - var input = JSONInputDataFactory.ReadJsonJob(inputFile); - StartSimulation(input); - - _jobContainer.WaitFinished(); - //while (!_jobContainer.AllCompleted) - //{ - // //Busy wait - - //} + StartSimulation(CompletedDiesel); var writtenFiles = GetWrittenFiles(); ShowWrittenFiles(writtenFiles); @@ -150,17 +145,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage [Test, Timeout(1000 * 10 * 60)] public void PrimaryAndInterimTest() { - var inputFile = Path.GetFullPath(InterimDiesel); - var input = JSONInputDataFactory.ReadJsonJob(inputFile); - - - StartSimulation(input); + StartSimulation(InterimDiesel); - _jobContainer.WaitFinished(); - //while (!_jobContainer.AllCompleted) - //{ - // //Busy wait - //} var writtenFiles = GetWrittenFiles(); ShowWrittenFiles(writtenFiles); @@ -171,6 +157,17 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLMultistageReportFileName)); } + private void StartSimulation(string path) + { + var inputFile = Path.GetFullPath(path); + var input = JSONInputDataFactory.ReadJsonJob(inputFile); + + + StartSimulation(input); + + _jobContainer.WaitFinished(); + } + private void StartSimulation(IInputDataProvider input) { diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifExempted-noTPMLM.vecto b/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifExempted-noTPMLM.vecto new file mode 100644 index 0000000000..906a800378 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifExempted-noTPMLM.vecto @@ -0,0 +1,13 @@ +{ + "Header": { + "CreatedBy": "Harry", + "Date": "2021-08-25T00:00:00+02:00", + "AppVersion": "Vecto3GUI2020", + "FileVersion": 10 + }, + "Body": { + "PrimaryVehicle": "..\\..\\XML\\XMLReaderDeclaration\\SchemaVersion2.10\\exempted_primary_heavyBus.xml", + "InterimStage": "..\\..\\XML\\XMLReaderDeclaration\\SchemaVersion2.10\\vecto_vehicle-exempted_input_completewithoutTMPLM.xml", + "Completed": false + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-exempted_input_completewithoutTMPLM.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-exempted_input_completewithoutTMPLM.xml new file mode 100644 index 0000000000..86e59b3a7a --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-exempted_input_completewithoutTMPLM.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<tns:VectoInputDeclaration xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v2.0" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.10.2" schemaVersion="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationJob V:\VectoCore\VectoCore\Resources\XSD\VectoDeclarationJob.xsd"> + <v2.0:Vehicle id="VEH-1234567890" xsi:type="Vehicle_Exempted_CompletedBusDeclarationType"> + <Manufacturer>Some Manufacturer</Manufacturer> + <ManufacturerAddress>Infinite Loop</ManufacturerAddress> + <VIN>VEH-1234567891</VIN> + <Date>2021-09-19T22:00:00Z</Date> + <Model>Sample Bus Model 2</Model> + <LegislativeCategory>M3</LegislativeCategory> + <CorrectedActualMass>7000</CorrectedActualMass> + <ClassBus>A</ClassBus> + <NumberPassengerSeatsLowerDeck>10</NumberPassengerSeatsLowerDeck> + <NumberPassengersStandingLowerDeck>0</NumberPassengersStandingLowerDeck> + <NumberPassengerSeatsUpperDeck>20</NumberPassengerSeatsUpperDeck> + <NumberPassengersStandingUpperDeck>0</NumberPassengersStandingUpperDeck> + <BodyworkCode>CE</BodyworkCode> + <LowEntry>false</LowEntry> + <HeightIntegratedBody>2500</HeightIntegratedBody> + </v2.0:Vehicle> +</tns:VectoInputDeclaration> \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 294f405059..d96754280f 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -2362,6 +2362,9 @@ <None Include="TestData\Integration\Multistage\newVifCompletedConventional.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="TestData\Integration\Multistage\newVifExempted-noTPMLM.vecto"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> <None Include="TestData\Integration\Multistage\newVifExempted.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> -- GitLab