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

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

Merge pull request #480 in VECTO/vecto-sim from...

Merge pull request #480 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-542-reduce-overspeed-to-2.5km-h-declaration to develop

* commit 'b09f74fe':
  adapting ignore file
  adapt expected values
  change overspeed to 2.5km/h
parents 1364201a b09f74fe
No related branches found
No related tags found
No related merge requests found
......@@ -197,3 +197,4 @@ VectoCore/VectoCoreTest/TestData/XML/XSD/
VectoCommon/VectoHashingTest/Testdata/XML/XSD/
VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/**.vmod
VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/**.vsum
Coverage/
......@@ -29,37 +29,37 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Xml;
namespace TUGraz.VectoHashing.Impl
{
public class XMLHashProvider
{
public static XmlDocument ComputeHash(XmlDocument doc, string elementId)
{
if (doc == null) {
throw new Exception("Invalid Document");
}
var signedXml = new SignedXml(doc);
var reference = new Reference("#" + elementId) {
DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256"
};
reference.AddTransform(new XmlDsigVectoTransform());
reference.AddTransform(new XmlDsigExcC14NTransform());
signedXml.AddReference(reference);
signedXml.ComputeSignature(HMAC.Create());
var xmlDigitalSignature = reference.GetXml();
var sigdoc = new XmlDocument();
sigdoc.CreateElement("Signature");
sigdoc.AppendChild(sigdoc.ImportNode(xmlDigitalSignature, true));
return sigdoc;
}
}
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Xml;
namespace TUGraz.VectoHashing.Impl
{
public class XMLHashProvider
{
public static XmlDocument ComputeHash(XmlDocument doc, string elementId)
{
if (doc == null) {
throw new Exception("Invalid Document");
}
var signedXml = new SignedXml(doc);
var reference = new Reference("#" + elementId) {
DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256"
};
reference.AddTransform(new XmlDsigVectoTransform());
reference.AddTransform(new XmlDsigExcC14NTransform());
signedXml.AddReference(reference);
signedXml.ComputeSignature(HMAC.Create());
var xmlDigitalSignature = reference.GetXml();
var sigdoc = new XmlDocument();
sigdoc.CreateElement("Signature");
sigdoc.AppendChild(sigdoc.ImportNode(xmlDigitalSignature, true));
return sigdoc;
}
}
}
\ No newline at end of file
......@@ -118,7 +118,7 @@ namespace TUGraz.VectoCore.Models.Declaration
};
public static readonly MeterPerSecond MinSpeed = 50.KMPHtoMeterPerSecond();
public static readonly MeterPerSecond OverSpeed = 5.KMPHtoMeterPerSecond();
public static readonly MeterPerSecond OverSpeed = 2.5.KMPHtoMeterPerSecond();
public static readonly MeterPerSecond UnderSpeed = 5.KMPHtoMeterPerSecond();
}
......
......@@ -43,16 +43,16 @@ namespace TUGraz.VectoCore.Tests.Integration
public class FuelTypesTest
{
[TestCase(FuelType.DieselCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006886, 9392.6020,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006886, 9391.5411,
TestName = "Diesel LH Low"),
TestCase(FuelType.EthanolCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.00040262, 5653.1586,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.00040262, 5652.5200,
TestName = "Ethanol LH Low"),
TestCase(FuelType.DieselCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0007971, 10871.1489,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0007971, 10877.1820,
TestName = "Diesel LH Ref"),
TestCase(FuelType.EthanolCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004660, 6543.0568,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004660, 6546.6880,
TestName = "Ethanol LH Ref"),]
public void TestFuelTypesCO2(FuelType fuelType, string jobName, int runIdx, double expectedCo2, double expectedMJ)
{
......
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