Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 8961a591 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Pull request #932: Feature/VECTO-1698 co2standardsgroup in cif for vocational vehicles

Merge in VECTO/vecto-sim from VECTO/mq_vecto-sim:feature/VECTO-1698-co2standardsgroup-in-cif-for-vocational-vehicles to develop

* commit 'd455b7ab':
  set CO2Standards Group to N/A for vocational vehicles
  adding testcase to check CO2Standards Group is set to N/A for vocational vehicles
parents 21ab825d d455b7ab
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ using TUGraz.VectoCommon.InputData; ...@@ -41,6 +41,7 @@ using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.Simulation.Impl;
...@@ -101,7 +102,7 @@ namespace TUGraz.VectoCore.OutputData.XML ...@@ -101,7 +102,7 @@ namespace TUGraz.VectoCore.OutputData.XML
exempted ? ExemptedData(modelData) : new[] { exempted ? ExemptedData(modelData) : new[] {
new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()), new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()),
new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()), new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()),
new XElement(tns + XMLNames.Report_CO2StandardsGroup, DeclarationReport.WeightingGroup.ToXMLFormat()), new XElement(tns + XMLNames.Report_CO2StandardsGroup, modelData.VehicleData.VocationalVehicle ? Constants.NOT_AVAILABLE : DeclarationReport.WeightingGroup.ToXMLFormat()),
new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle), new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle),
new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab), new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab),
GetADAS(modelData.VehicleData.InputData.ADAS) GetADAS(modelData.VehicleData.InputData.ADAS)
......
...@@ -41,6 +41,7 @@ using TUGraz.VectoCommon.InputData; ...@@ -41,6 +41,7 @@ using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.Simulation.Impl;
...@@ -97,7 +98,7 @@ namespace TUGraz.VectoCore.OutputData.XML ...@@ -97,7 +98,7 @@ namespace TUGraz.VectoCore.OutputData.XML
: new[] { : new[] {
new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()), new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()),
new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()), new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()),
new XElement(tns + XMLNames.Report_CO2StandardsGroup, DeclarationReport.WeightingGroup.ToXMLFormat()), new XElement(tns + XMLNames.Report_CO2StandardsGroup, modelData.VehicleData.VocationalVehicle ? Constants.NOT_AVAILABLE : DeclarationReport.WeightingGroup.ToXMLFormat()),
new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle), new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle),
new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab), new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab),
new XElement(tns + XMLNames.Vehicle_PTO, modelData.PTO != null), new XElement(tns + XMLNames.Vehicle_PTO, modelData.PTO != null),
......
...@@ -32,16 +32,23 @@ ...@@ -32,16 +32,23 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml;
using System.Xml.XPath;
using Ninject; using Ninject;
using NUnit.Framework; using NUnit.Framework;
using NUnit.Framework.Internal; using NUnit.Framework.Internal;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.FileIO.XML; using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration;
using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.OutputData;
using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.FileIO;
using TUGraz.VectoCore.Tests.Integration.Declaration;
using TUGraz.VectoCore.Tests.Models.Simulation; using TUGraz.VectoCore.Tests.Models.Simulation;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Tests.Integration namespace TUGraz.VectoCore.Tests.Integration
{ {
...@@ -91,5 +98,44 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -91,5 +98,44 @@ namespace TUGraz.VectoCore.Tests.Integration
var progress = jobContainer.GetProgress(); var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error))); Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
} }
[Category("LongRunning")]
[TestCase(Class4Vocational, 4),
TestCase(Class5Vocational, 2)]
public void VocationalTestCO2StandardsGroup(string filename, int numRuns)
{
var writer = new MockDeclarationWriter(filename);
var inputData = xmlInputReader.CreateDeclaration(filename);
var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) {
WriteModalResults = true,
ActualModalData = true,
ValidateComponentHashes = false
};
var jobContainer = new JobContainer(new MockSumWriter());
var runs = factory.SimulationRuns().ToList();
Assert.AreEqual(numRuns, runs.Count);
foreach (var run in runs) {
jobContainer.AddRun(run);
}
//jobContainer.AddRuns(factory);
jobContainer.Execute();
jobContainer.WaitFinished();
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
foreach (var reportType in new[]{ReportType.DeclarationReportCustomerXML, ReportType.DeclarationReportManufacturerXML}) {
var rpt = writer.GetReport(reportType);
var vocationalNode = rpt.XPathSelectElement(XMLHelper.QueryLocalName(XMLNames.Vehicle_VocationalVehicle));
Assert.NotNull(vocationalNode);
Assert.IsTrue(XmlConvert.ToBoolean(vocationalNode.Value));
var co2StandardsNode = rpt.XPathSelectElement(XMLHelper.QueryLocalName(XMLNames.Report_CO2StandardsGroup));
Assert.NotNull(co2StandardsNode);
Assert.AreEqual(Constants.NOT_AVAILABLE, co2StandardsNode.Value);
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment