From b1de01871a715dad1dac0419e3828ab75b0065e5 Mon Sep 17 00:00:00 2001 From: Raphael Kalchgruber <kalchgruber@ivt.tugraz.at> Date: Wed, 1 Mar 2023 12:10:56 +0100 Subject: [PATCH] rename of classes, removal of 09 --- .../IFollowUpSimulatorFactoryCreator.cs | 16 ++++++++++++++-- .../SimulatorFactoryDeclaration.cs | 15 ++++++++++----- .../DeclarationReports/VTPReport/XMLVTPReport.cs | 3 +++ ...s => XMLDeclarationReportCompletedVehicle.cs} | 6 +++--- .../XML/XMLDeclarationReportFactory.cs | 8 ++++---- ....cs => XMLDeclarationReportInterimVehicle.cs} | 4 ++-- ....cs => XMLDeclarationReportPrimaryVehicle.cs} | 4 ++-- .../Multistage/MultistageVehicleTest.cs | 6 +++++- .../VectoMockup/Reports/MockupReportFactory.cs | 3 ++- .../Reports/XMLDeclarationMockupPrimaryReport.cs | 5 ++--- ...XMLDeclarationMockupReportCompletedVehicle.cs | 4 ++-- 11 files changed, 49 insertions(+), 25 deletions(-) rename VectoCore/VectoCore/OutputData/XML/{XMLDeclarationReportCompletedVehicle_09.cs => XMLDeclarationReportCompletedVehicle.cs} (95%) rename VectoCore/VectoCore/OutputData/XML/{XMLDeclarationReportInterimVehicle_09.cs => XMLDeclarationReportInterimVehicle.cs} (94%) rename VectoCore/VectoCore/OutputData/XML/{XMLDeclarationReportPrimaryVehicle_09.cs => XMLDeclarationReportPrimaryVehicle.cs} (94%) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/IFollowUpSimulatorFactoryCreator.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/IFollowUpSimulatorFactoryCreator.cs index 234b01ae10..775cf9c369 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/IFollowUpSimulatorFactoryCreator.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/IFollowUpSimulatorFactoryCreator.cs @@ -8,6 +8,9 @@ using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.XML; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformationFile.CustomerInformationFile_0_9; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportXMLTypeWriter; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1; namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory { @@ -54,22 +57,31 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory private readonly IDeclarationReport _originalDeclarationReport; private readonly IDeclarationInputDataProvider _currentStageInputData; + private readonly IManufacturerReportFactory _mrfFactory; + private readonly IVIFReportFactory _vifFactory; + public InterimAfterPrimaryFactoryCreator(IMultistagePrimaryAndStageInputDataProvider originalStageInputData, IOutputDataWriter originalReportWriter, IDeclarationReport originalDeclarationReport, ISimulatorFactoryFactory simFactoryFactory, - IXMLInputDataReader inputDataReader, bool validate) : base(simFactoryFactory, validate) + IXMLInputDataReader inputDataReader, + IManufacturerReportFactory mrfFactory, + IVIFReportFactory vifFactory, + bool validate) : base(simFactoryFactory, validate) { _originalStageInputData = originalStageInputData; _inputDataReader = inputDataReader; _originalReportWriter = originalReportWriter; _originalDeclarationReport = originalDeclarationReport; + _mrfFactory = mrfFactory; + _vifFactory = vifFactory; + _currentStageOutputDataWriter = new TempFileOutputWriter(originalReportWriter, ReportType.DeclarationReportManufacturerXML) ; _currentStageDeclarationReport = - new XMLDeclarationReportPrimaryVehicle_09(_currentStageOutputDataWriter); + new XMLDeclarationReportPrimaryVehicle(_currentStageOutputDataWriter,_mrfFactory, _vifFactory); _currentStageInputData = originalStageInputData.PrimaryVehicle; } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactoryDeclaration.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactoryDeclaration.cs index 57130ddcfa..3fc5aa35ee 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactoryDeclaration.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactoryDeclaration.cs @@ -10,6 +10,8 @@ using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.XML; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportXMLTypeWriter; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1; namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory { @@ -21,6 +23,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory private IDeclarationReport _currentStageDeclarationReport; private IVTPReport _currentStageVTPReport; protected readonly IXMLDeclarationReportFactory _xmlDeclarationReportFactory; + private IVIFReportFactory _vifFactory; + private IManufacturerReportFactory _mrfFactory; public SimulatorFactoryDeclaration(IInputDataProvider dataProvider, @@ -31,13 +35,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory IXMLInputDataReader xmlInputDataReader, ISimulatorFactoryFactory simulatorFactoryFactory, IXMLDeclarationReportFactory xmlDeclarationReportFactory, - IVectoRunDataFactoryFactory runDataFactoryFactory - ) : base(ExecutionMode.Declaration, writer, validate) + IVectoRunDataFactoryFactory runDataFactoryFactory, IVIFReportFactory vifFactory, IManufacturerReportFactory mrfFactory) : base(ExecutionMode.Declaration, writer, validate) { _xmlInputDataReader = xmlInputDataReader; _simFactoryFactory = simulatorFactoryFactory; _currentStageInputData = dataProvider; _xmlDeclarationReportFactory = xmlDeclarationReportFactory; + _vifFactory = vifFactory; + _mrfFactory = mrfFactory; _currentStageDeclarationReport = declarationReport ?? xmlDeclarationReportFactory.CreateReport(dataProvider, writer); @@ -84,7 +89,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory IXMLInputDataReader xmlInputDataReader, ISimulatorFactoryFactory simulatorFactoryFactory, IXMLDeclarationReportFactory xmlDeclarationReportFactory, - IVectoRunDataFactoryFactory runDataFactoryFactory) : this( + IVectoRunDataFactoryFactory runDataFactoryFactory, IVIFReportFactory vifFactory, IManufacturerReportFactory mrfFactory) : this( dataProvider: dataProvider, declarationReport: null, writer: writer, @@ -93,7 +98,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory xmlInputDataReader: xmlInputDataReader, simulatorFactoryFactory: simulatorFactoryFactory, xmlDeclarationReportFactory: xmlDeclarationReportFactory, - runDataFactoryFactory: runDataFactoryFactory) + runDataFactoryFactory: runDataFactoryFactory, vifFactory: vifFactory, mrfFactory: mrfFactory) { } @@ -125,7 +130,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory multistagePrimaryAndStageInputDataProvider, ReportWriter, currentStageDeclarationReport, - _simFactoryFactory, _xmlInputDataReader, Validate); + _simFactoryFactory, _xmlInputDataReader, _mrfFactory, _vifFactory, Validate); case IMultistageVIFInputData multistageVifInputData: if (multistageVifInputData.VehicleInputData != null) { return new CompletedAfterInterimPrimaryFactoryCreator( diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VTPReport/XMLVTPReport.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VTPReport/XMLVTPReport.cs index 826aee0066..9273061e21 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VTPReport/XMLVTPReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VTPReport/XMLVTPReport.cs @@ -32,6 +32,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Xml; using System.Xml.Linq; using NLog.Config; @@ -56,6 +57,8 @@ using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCore.Models.SimulationComponent.Impl; using LogManager = NLog.LogManager; +[assembly: InternalsVisibleTo("VectoCoreTest")] + namespace TUGraz.VectoCore.OutputData.XML { internal class XMLVTPReport : DeclarationReport<XMLVTPReport.ResultEntry>, IVTPReport diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle_09.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle.cs similarity index 95% rename from VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle_09.cs rename to VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle.cs index 897d7e22e9..94fe556a13 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle_09.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportCompletedVehicle.cs @@ -19,11 +19,11 @@ namespace TUGraz.VectoCore.OutputData.XML /// <summary> /// Create MRF and CIF of the complete(d) step /// </summary> - public class XMLDeclarationReportCompletedVehicle_09 : XMLDeclarationReport + public class XMLDeclarationReportCompletedVehicle : XMLDeclarationReport { #region Constructors - //public XMLDeclarationReportCompletedVehicle_09(IReportWriter writer) : base(writer) { } - public XMLDeclarationReportCompletedVehicle_09(IReportWriter writer, IManufacturerReportFactory mrfFactory, + //public XMLDeclarationReportCompletedVehicle(IReportWriter writer) : base(writer) { } + public XMLDeclarationReportCompletedVehicle(IReportWriter writer, IManufacturerReportFactory mrfFactory, ICustomerInformationFileFactory cifFactory, IVIFReportFactory vifFactory) : base(writer, mrfFactory, cifFactory) { diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportFactory.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportFactory.cs index 9e3fe51470..e631cd8e07 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportFactory.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportFactory.cs @@ -69,14 +69,14 @@ namespace TUGraz.VectoCore.OutputData.XML { if (multistageVifInputData.VehicleInputData == null) { - var reportCompleted = new XMLDeclarationReportCompletedVehicle_09(outputDataWriter, _mrfFactory, _cifFactory, _vifFactory) + var reportCompleted = new XMLDeclarationReportCompletedVehicle(outputDataWriter, _mrfFactory, _cifFactory, _vifFactory) { PrimaryVehicleReportInputData = multistageVifInputData.MultistageJobInputData.JobInputData.PrimaryVehicle, }; return reportCompleted; } else { - var report = new XMLDeclarationReportInterimVehicle_09(outputDataWriter, _mrfFactory, _cifFactory, _vifFactory, _vifInterimFactory); + var report = new XMLDeclarationReportInterimVehicle(outputDataWriter, _mrfFactory, _cifFactory, _vifFactory, _vifInterimFactory); return report; } } @@ -94,12 +94,12 @@ namespace TUGraz.VectoCore.OutputData.XML switch (declarationInputDataProvider.JobInputData.Vehicle.VehicleCategory) { case VehicleCategory.HeavyBusCompletedVehicle: - return new XMLDeclarationReportCompletedVehicle_09(outputDataWriter) + return new XMLDeclarationReportCompletedVehicle(outputDataWriter,_mrfFactory,_cifFactory,_vifFactory) { PrimaryVehicleReportInputData = declarationInputDataProvider.PrimaryVehicleData, }; case VehicleCategory.HeavyBusPrimaryVehicle: - return new XMLDeclarationReportPrimaryVehicle_09(outputDataWriter); + return new XMLDeclarationReportPrimaryVehicle(outputDataWriter, _mrfFactory, _vifFactory); default: break; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle_09.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle.cs similarity index 94% rename from VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle_09.cs rename to VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle.cs index 68d621f805..e252ed1f39 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle_09.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportInterimVehicle.cs @@ -13,14 +13,14 @@ namespace TUGraz.VectoCore.OutputData.XML /// <summary> /// Create VIF of an interim (or the complete(d) step /// </summary> - public class XMLDeclarationReportInterimVehicle_09 : XMLDeclarationReport + public class XMLDeclarationReportInterimVehicle : XMLDeclarationReport { protected readonly IVIFReportFactory _vifFactory; protected IXMLMultistepIntermediateReport MultistepIntermediateBusReport; protected readonly IVIFReportInterimFactory _interimFactory; - public XMLDeclarationReportInterimVehicle_09(IReportWriter writer, + public XMLDeclarationReportInterimVehicle(IReportWriter writer, IManufacturerReportFactory mrfFactory, ICustomerInformationFileFactory cifFactory, IVIFReportFactory vifFactory, IVIFReportInterimFactory interimFactory) : base(writer, mrfFactory, cifFactory) diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle_09.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle.cs similarity index 94% rename from VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle_09.cs rename to VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle.cs index 1dc4298633..a45cdf4f7d 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle_09.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportPrimaryVehicle.cs @@ -12,7 +12,7 @@ namespace TUGraz.VectoCore.OutputData.XML /// <summary> /// Create MRF and VIF for primary bus /// </summary> - public class XMLDeclarationReportPrimaryVehicle_09 : XMLDeclarationReport + public class XMLDeclarationReportPrimaryVehicle : XMLDeclarationReport { private readonly IVIFReportFactory _vifFactory; @@ -24,7 +24,7 @@ namespace TUGraz.VectoCore.OutputData.XML public override XDocument PrimaryVehicleReport => VehicleInformationFile?.Report; - public XMLDeclarationReportPrimaryVehicle_09(IReportWriter writer, + public XMLDeclarationReportPrimaryVehicle(IReportWriter writer, IManufacturerReportFactory mrfFactory, IVIFReportFactory vifFactory) : base(writer, mrfFactory, null) { diff --git a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageVehicleTest.cs b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageVehicleTest.cs index 5a00ac0d06..1e30eb8c6d 100644 --- a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageVehicleTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageVehicleTest.cs @@ -22,6 +22,8 @@ using TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.XML; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportXMLTypeWriter; +using TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1; using TUGraz.VectoCore.Tests.Integration.Declaration; using TUGraz.VectoCore.Tests.Models.Simulation; using TUGraz.VectoCore.Utils; @@ -427,7 +429,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage var writer = new FileOutputWriter(outputFile); - var xmlreport = new XMLDeclarationReportPrimaryVehicle_09(writer); + var mrfFactory = _kernel.Get<IManufacturerReportFactory>(); + var vifFactory = _kernel.Get<IVIFReportFactory>(); + var xmlreport = new XMLDeclarationReportPrimaryVehicle(writer, mrfFactory, vifFactory); var factory = SimulatorFactory.CreateSimulatorFactory(ExecutionMode.Declaration, inputData, writer, xmlreport); factory.WriteModalResults = true; factory.Validate = false; diff --git a/VectoMockup/VectoMockup/Reports/MockupReportFactory.cs b/VectoMockup/VectoMockup/Reports/MockupReportFactory.cs index 9f6d8f16f2..e841f6e9fc 100644 --- a/VectoMockup/VectoMockup/Reports/MockupReportFactory.cs +++ b/VectoMockup/VectoMockup/Reports/MockupReportFactory.cs @@ -106,7 +106,8 @@ namespace TUGraz.VectoMockup.Reports { case VehicleCategory.HeavyBusCompletedVehicle: throw new NotImplementedException(); - return new XMLDeclarationReportCompletedVehicle_09(outputDataWriter) + return new XMLDeclarationReportCompletedVehicle(outputDataWriter, _mrfFactory, _cifFactory, + _vifFactory) { PrimaryVehicleReportInputData = declarationInputDataProvider.PrimaryVehicleData, }; diff --git a/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupPrimaryReport.cs b/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupPrimaryReport.cs index be9a19230f..774218a674 100644 --- a/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupPrimaryReport.cs +++ b/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupPrimaryReport.cs @@ -15,7 +15,7 @@ namespace TUGraz.VectoMockup.Reports /// <summary> /// Create MRF and VIF for primary bus /// </summary> - public class XMLDeclarationMockupPrimaryReport : XMLDeclarationReportPrimaryVehicle_09 + public class XMLDeclarationMockupPrimaryReport : XMLDeclarationReportPrimaryVehicle { private readonly bool _exempted; @@ -25,13 +25,12 @@ namespace TUGraz.VectoMockup.Reports IVIFReportFactory vifFactory, bool exempted) : base(writer, mrfFactory, - cifFactory, vifFactory) { _exempted = exempted; } - #region Overrides of XMLDeclarationReportPrimaryVehicle_09 + #region Overrides of XMLDeclarationReportPrimaryVehicle protected override void DoStoreResult(ResultEntry entry, VectoRunData runData, IModalDataContainer modData) { diff --git a/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupReportCompletedVehicle.cs b/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupReportCompletedVehicle.cs index 1e7169b8ad..cc77d3ef77 100644 --- a/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupReportCompletedVehicle.cs +++ b/VectoMockup/VectoMockup/Reports/XMLDeclarationMockupReportCompletedVehicle.cs @@ -21,7 +21,7 @@ namespace TUGraz.VectoMockup.Reports /// <summary> /// Create VIF of an interim (or the complete(d) step /// </summary> - public class XMLDeclarationMockupReportInterimVehicle : XMLDeclarationReportInterimVehicle_09 + public class XMLDeclarationMockupReportInterimVehicle : XMLDeclarationReportInterimVehicle { private readonly bool _exempted; @@ -38,7 +38,7 @@ namespace TUGraz.VectoMockup.Reports /// <summary> /// Create MRF and CIF of the complete(d) step /// </summary> - public class XMLDeclarationMockupReportCompletedVehicle : XMLDeclarationReportCompletedVehicle_09 + public class XMLDeclarationMockupReportCompletedVehicle : XMLDeclarationReportCompletedVehicle { //private readonly IManufacturerReportFactory _mrfFactory; //private readonly ICustomerInformationFileFactory _cifFactory; -- GitLab