diff --git a/VectoCommon/VectoCommon/Hashing/VectoComponents.cs b/VectoCommon/VectoCommon/Hashing/VectoComponents.cs index cf4150dab29158655bef5c174170228c02eff4a1..f825f89aa1dbdb3b09457cd4ad4ad7d7bcfdb7e3 100644 --- a/VectoCommon/VectoCommon/Hashing/VectoComponents.cs +++ b/VectoCommon/VectoCommon/Hashing/VectoComponents.cs @@ -53,7 +53,8 @@ namespace TUGraz.VectoCommon.Hashing CapacitorSystem, ElectricMachineSystem, IEPC, - ADC + ADC, + CertifiedAeroReduction } public static class VectoComponentsExtensionMethods @@ -97,6 +98,8 @@ namespace TUGraz.VectoCommon.Hashing return XMLNames.Component_IEPC; case VectoComponents.ADC: return XMLNames.Component_ADC; + case VectoComponents.CertifiedAeroReduction: + return XMLNames.Component_CertifiedAeroReduction; default: throw new ArgumentOutOfRangeException("VectoComponents", component, null); } @@ -141,6 +144,8 @@ namespace TUGraz.VectoCommon.Hashing return "IEPC-"; case VectoComponents.ADC: return "ADC-"; + case VectoComponents.CertifiedAeroReduction: + return "AERO-"; default: throw new ArgumentOutOfRangeException("VectoComponents", component, null); } diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs index 5800ec7894830c20237281b5584cd496a26fd7af..3d834ede7d9b0d85507ef5de73bc241e3ea294bb 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs +++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs @@ -1554,6 +1554,15 @@ namespace TUGraz.VectoCommon.Resources { } } + /// <summary> + /// Looks up a localized string similar to CertifiedAeroReduction. + /// </summary> + public static string Component_CertifiedAeroReduction { + get { + return ResourceManager.GetString("Component_CertifiedAeroReduction", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Creator. /// </summary> diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.resx b/VectoCommon/VectoCommon/Resources/XMLNames.resx index 1663d199908c98bc550f8e5b7e803266017f29d4..8aa653f6d3f2043aacd26b5c22c9ab8dc8cf3f36 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.resx +++ b/VectoCommon/VectoCommon/Resources/XMLNames.resx @@ -1878,4 +1878,7 @@ <data name="Component_IEPC" xml:space="preserve"> <value>IEPC</value> </data> + <data name="Component_CertifiedAeroReduction" xml:space="preserve"> + <value>CertifiedAeroReduction</value> + </data> </root> \ No newline at end of file diff --git a/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Sorted/TrailerAerodynamicDevice.xml b/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Sorted/TrailerAerodynamicDevice.xml new file mode 100644 index 0000000000000000000000000000000000000000..e56c873e89ed8f0fe787aa68382eb31256db42f6 --- /dev/null +++ b/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Sorted/TrailerAerodynamicDevice.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:VectoInputDeclaration xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.7" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" +xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.2="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.2" +xmlns:v2.7="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.7" xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationComponent:DEV:v2.7" + xmlns:di="http://www.w3.org/2000/09/xmldsig#" schemaVersion="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationComponent v:\VectoCore\VectoCore\Resources\XSD/VectoDeclarationComponent.xsd"> + <tns:CertifiedAeroReduction > + <Data xsi:type="CertifiedAeroDataDeclarationType" id="AERO-asdf"> + <Manufacturer>Generic Manufacturer</Manufacturer> + <Model>Generic Tyre Model</Model> + <CertificationNumber>e12*0815/8051*2017/05T0000*00</CertificationNumber> + <Date>2017-02-15T11:00:00Z</Date> + <CertifiedAerodynamicReduction0>1.00</CertifiedAerodynamicReduction0> + <CertifiedAerodynamicReduction3>2.00</CertifiedAerodynamicReduction3> + <CertifiedAerodynamicReduction6>3.00</CertifiedAerodynamicReduction6> + <CertifiedAerodynamicReduction9>4.00</CertifiedAerodynamicReduction9> + <ApplicableVehicleGroups> + <ApplicableVehicleGroup>1123</ApplicableVehicleGroup> + <ApplicableVehicleGroup>2356</ApplicableVehicleGroup> + <ApplicableVehicleGroup>4356</ApplicableVehicleGroup> + </ApplicableVehicleGroups> + </Data> + <Signature> + <di:Reference URI="#AERO-asdf"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>3YVNlu+1souB/4IwePLPoBwhiJormfqMNRxQaZ75wvM=</di:DigestValue> + </di:Reference> + </Signature> + </tns:CertifiedAeroReduction> +</tns:VectoInputDeclaration> diff --git a/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Unsorted/TrailerAerodynamicDevice.xml b/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Unsorted/TrailerAerodynamicDevice.xml new file mode 100644 index 0000000000000000000000000000000000000000..9c42d57627a93df60a55c47652790860658027a6 --- /dev/null +++ b/VectoCommon/VectoHashingTest/Testdata/XML/Sort/Component/Unsorted/TrailerAerodynamicDevice.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:VectoInputDeclaration xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.7" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" +xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.2="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.2" +xmlns:v2.7="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.7" xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationComponent:DEV:v2.7" + xmlns:di="http://www.w3.org/2000/09/xmldsig#" schemaVersion="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationComponent v:\VectoCore\VectoCore\Resources\XSD/VectoDeclarationComponent.xsd"> + <tns:CertifiedAeroReduction > + <Data xsi:type="CertifiedAeroDataDeclarationType" id="AERO-asdf"> + <Manufacturer>Generic Manufacturer</Manufacturer> + <Model>Generic Tyre Model</Model> + <CertificationNumber>e12*0815/8051*2017/05T0000*00</CertificationNumber> + <Date>2017-02-15T11:00:00Z</Date> + <CertifiedAerodynamicReduction0>1.00</CertifiedAerodynamicReduction0> + <CertifiedAerodynamicReduction3>2.00</CertifiedAerodynamicReduction3> + <CertifiedAerodynamicReduction6>3.00</CertifiedAerodynamicReduction6> + <CertifiedAerodynamicReduction9>4.00</CertifiedAerodynamicReduction9> + <ApplicableVehicleGroups> + <ApplicableVehicleGroup>4356</ApplicableVehicleGroup> + <ApplicableVehicleGroup>1123</ApplicableVehicleGroup> + <ApplicableVehicleGroup>2356</ApplicableVehicleGroup> + </ApplicableVehicleGroups> + </Data> + <Signature> + <di:Reference URI="#AERO-asdf"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>3YVNlu+1souB/4IwePLPoBwhiJormfqMNRxQaZ75wvM=</di:DigestValue> + </di:Reference> + </Signature> + </tns:CertifiedAeroReduction> +</tns:VectoInputDeclaration> diff --git a/VectoCommon/VectoHashingTest/VectoHashSortTest.cs b/VectoCommon/VectoHashingTest/VectoHashSortTest.cs index a87b9df60d1932d19f34bfedb245b0758e22dcdc..8e0c36bbb9d3d87d6042970e546e1e05ee8ae4db 100644 --- a/VectoCommon/VectoHashingTest/VectoHashSortTest.cs +++ b/VectoCommon/VectoHashingTest/VectoHashSortTest.cs @@ -24,11 +24,11 @@ namespace VectoHashingTest xmlInputReader = _kernel.Get<IXMLInputDataReader>(); } - [TestCase(@"Testdata\XML\Sort\Axlegear.xml")] + [TestCase(SortedComponentPath + "TrailerAerodynamicDevice.xml")] public void TestHash(string filePath) { var loadedFile = VectoHash.Load(filePath); - var hash = loadedFile.ComputeHash(VectoComponents.Axlegear); + var hash = loadedFile.ComputeHash(VectoComponents.CertifiedAeroReduction); } [TestCase("ttvMnXYdQrEAu47QEO2AKyfzOdPSlcdsR/MrmH/mX+k=", SortedComponentPath + "Engine.xml"), @@ -134,5 +134,14 @@ namespace VectoHashingTest var loadedFile = VectoHash.Load(filePath); Assert.AreEqual(expectedHash, loadedFile.ComputeHash(VectoComponents.IEPC)); } + + [TestCase("3YVNlu+1souB/4IwePLPoBwhiJormfqMNRxQaZ75wvM=", SortedComponentPath + "TrailerAerodynamicDevice.xml"), + TestCase("3YVNlu+1souB/4IwePLPoBwhiJormfqMNRxQaZ75wvM=", UnsortedComponentPath + "TrailerAerodynamicDevice.xml")] + public void TestTrailerAerodynamicDeviceSort(string expectedHash, string filePath) + { + var loadedFile = VectoHash.Load(filePath); + Assert.AreEqual(expectedHash, loadedFile.ComputeHash(VectoComponents.CertifiedAeroReduction)); + } + } } diff --git a/VectoCommon/VectoHashingTest/VectoHashingTest.csproj b/VectoCommon/VectoHashingTest/VectoHashingTest.csproj index 7a23a60d721c39935336c8a7225152d3daad3433..4b7926d5a032a0975793d44ca468db40cc56abd7 100644 --- a/VectoCommon/VectoHashingTest/VectoHashingTest.csproj +++ b/VectoCommon/VectoHashingTest/VectoHashingTest.csproj @@ -114,6 +114,9 @@ <Content Include="Testdata\XML\Sort\Component\Sorted\IEPC_StdValues.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="Testdata\XML\Sort\Component\Sorted\TrailerAerodynamicDevice.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="Testdata\XML\Sort\Component\Unsorted\ADC.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> @@ -183,6 +186,9 @@ <Content Include="Testdata\XML\Sort\Component\Unsorted\TorqueConverter.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="Testdata\XML\Sort\Component\Unsorted\TrailerAerodynamicDevice.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="Testdata\XML\ToHash\multiple_components.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content>