diff --git a/.gitignore b/.gitignore
index 8f9122b..2b89e71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -235,3 +235,6 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/
+
+# Jetbrains Rider
+.idea/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 74300b9..ad4ba0a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,23 @@
language: csharp
-dotnet: 2.1.4
-
+dist: bionic
env:
- FrameworkPathOverride=/usr/lib/mono/4.5/
jobs:
include:
- - stage: test
+ - stage: Run Tests
+ before_install:
+ - wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
+ - sudo dpkg -i packages-microsoft-prod.deb
+ - sudo apt-get update
+ - sudo apt-get install -y dotnet-sdk-3.1
+ - sudo apt-get install -y dotnet-sdk-2.1
mono: none
script:
+ - dotnet --list-sdks
- dotnet test ./PluginTest/PluginTest.csproj -c Release
- dotnet test ./AcceptanceTest/AcceptanceTest.csproj -c Release
+
- stage: deploy
if: tag =~ ^v\d+\.\d+\.\d+
mono: 5.8.0
diff --git a/ADMPlugin.sln b/ADMPlugin.sln
index 4cf7f7f..f973998 100644
--- a/ADMPlugin.sln
+++ b/ADMPlugin.sln
@@ -11,6 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "TestUtilit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AcceptanceTest", "AcceptanceTest\AcceptanceTest.csproj", "{B0DECFAC-9297-4764-9CE7-91D0D66276AD}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{4EC051D9-5084-410F-A659-97B596975AEF}"
+ProjectSection(SolutionItems) = preProject
+ .travis.yml = .travis.yml
+EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -40,4 +45,6 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {97C57A24-3EF5-4CF0-B193-6B0E7A98234D}
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
EndGlobal
diff --git a/ADMPlugin/ADMPlugin.csproj b/ADMPlugin/ADMPlugin.csproj
index fd9b1b6..9ebc6a6 100644
--- a/ADMPlugin/ADMPlugin.csproj
+++ b/ADMPlugin/ADMPlugin.csproj
@@ -12,8 +12,11 @@
AgGateway.ADAPT.ADMPlugin
1.0.0.0
+
+
+
-
+
diff --git a/ADMPlugin/Json/NetCoreApp31CompatibleVersionConverter.cs b/ADMPlugin/Json/NetCoreApp31CompatibleVersionConverter.cs
new file mode 100644
index 0000000..0cba97d
--- /dev/null
+++ b/ADMPlugin/Json/NetCoreApp31CompatibleVersionConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace AgGateway.ADAPT.ADMPlugin.Json
+{
+ public class NetCoreApp31CompatibleVersionConverter : JsonConverter
+ {
+ public override void WriteJson(JsonWriter writer, Version value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override Version ReadJson(JsonReader reader, Type objectType, Version existingValue, bool hasExistingValue,
+ JsonSerializer serializer)
+ {
+ if (existingValue != null)
+ return existingValue;
+
+ var versionJObject = JToken.ReadFrom(reader);
+
+ if (Version.TryParse(versionJObject.ToString(), out var version))
+ return version;
+
+
+ var versionString = $"{versionJObject.Value("Major")}.{versionJObject.Value("Minor")}.{versionJObject.Value("Build")}.{versionJObject.Value("Revision")}";
+ return Version.Parse(versionString);
+ }
+ }
+}
diff --git a/ADMPlugin/Protobuf/V1/LoggedData/OperationDataType.cs b/ADMPlugin/Protobuf/V1/LoggedData/OperationDataType.cs
index 656d476..c70f39e 100644
--- a/ADMPlugin/Protobuf/V1/LoggedData/OperationDataType.cs
+++ b/ADMPlugin/Protobuf/V1/LoggedData/OperationDataType.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
using ProtoBuf.Meta;
namespace AgGateway.ADAPT.ADMPlugin.Protobuf.V1.LoggedData
@@ -9,17 +6,18 @@ public static class OperationDataType
{
public static void Configure(RuntimeTypeModel model)
{
- var type = model.Add(typeof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData), Constants.UseDefaults);
- type.AddField(60, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.Id));
- type.AddField(63, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.LoadId));
- type.AddField(64, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.OperationType));
- type.AddField(65, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.PrescriptionId));
- type.AddField(66, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.ProductIds));
- type.AddField(67, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.VarietyLocatorId));
- type.AddField(68, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.WorkItemOperationId));
- type.AddField(69, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.MaxDepth));
- type.AddField(70, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.SpatialRecordCount));
- type.AddField(551, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.EquipmentConfigurationIds));
+ var type = model.Add(typeof(ApplicationDataModel.LoggedData.OperationData), Constants.UseDefaults);
+ type.AddField(60, nameof(ApplicationDataModel.LoggedData.OperationData.Id));
+ type.AddField(63, nameof(ApplicationDataModel.LoggedData.OperationData.LoadId));
+ type.AddField(64, nameof(ApplicationDataModel.LoggedData.OperationData.OperationType));
+ type.AddField(65, nameof(ApplicationDataModel.LoggedData.OperationData.PrescriptionId));
+ type.AddField(66, nameof(ApplicationDataModel.LoggedData.OperationData.ProductIds));
+ type.AddField(67, nameof(ApplicationDataModel.LoggedData.OperationData.VarietyLocatorId));
+ type.AddField(68, nameof(ApplicationDataModel.LoggedData.OperationData.WorkItemOperationId));
+ type.AddField(69, nameof(ApplicationDataModel.LoggedData.OperationData.MaxDepth));
+ type.AddField(70, nameof(ApplicationDataModel.LoggedData.OperationData.SpatialRecordCount));
+ type.AddField(551, nameof(ApplicationDataModel.LoggedData.OperationData.EquipmentConfigurationIds));
+ type.AddField(598, nameof(ApplicationDataModel.LoggedData.OperationData.ContextItems));
}
}
}
diff --git a/ADMPlugin/Protobuf/V2/LoggedData/LoggedDataType.cs b/ADMPlugin/Protobuf/V2/LoggedData/LoggedDataType.cs
index f13a80b..7a37bf3 100644
--- a/ADMPlugin/Protobuf/V2/LoggedData/LoggedDataType.cs
+++ b/ADMPlugin/Protobuf/V2/LoggedData/LoggedDataType.cs
@@ -24,6 +24,7 @@ public static void Configure(RuntimeTypeModel model)
type.AddField(6, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.LoggedData.SummaryId));
type.AddField(7, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.LoggedData.Notes));
type.AddField(8, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.LoggedData.OperationData));
+ type.AddField(22, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.LoggedData.CalibrationFactors));
type.AddField(21, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.LoggedData.Description));
}
}
diff --git a/ADMPlugin/Protobuf/V2/LoggedData/OperationDataType.cs b/ADMPlugin/Protobuf/V2/LoggedData/OperationDataType.cs
index f109ff9..1ee6281 100644
--- a/ADMPlugin/Protobuf/V2/LoggedData/OperationDataType.cs
+++ b/ADMPlugin/Protobuf/V2/LoggedData/OperationDataType.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
using ProtoBuf.Meta;
namespace AgGateway.ADAPT.ADMPlugin.Protobuf.V2.LoggedData
@@ -9,17 +6,18 @@ public static class OperationDataType
{
public static void Configure(RuntimeTypeModel model)
{
- var type = model.Add(typeof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData), Constants.UseDefaults);
- type.AddField(1, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.Id));
- type.AddField(2, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.LoadId));
- type.AddField(3, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.OperationType));
- type.AddField(4, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.PrescriptionId));
- type.AddField(5, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.ProductIds));
- type.AddField(6, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.VarietyLocatorId));
- type.AddField(7, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.WorkItemOperationId));
- type.AddField(8, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.MaxDepth));
- type.AddField(9, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.SpatialRecordCount));
- type.AddField(10, nameof(AgGateway.ADAPT.ApplicationDataModel.LoggedData.OperationData.EquipmentConfigurationIds));
+ var type = model.Add(typeof(ApplicationDataModel.LoggedData.OperationData), Constants.UseDefaults);
+ type.AddField(1, nameof(ApplicationDataModel.LoggedData.OperationData.Id));
+ type.AddField(2, nameof(ApplicationDataModel.LoggedData.OperationData.LoadId));
+ type.AddField(3, nameof(ApplicationDataModel.LoggedData.OperationData.OperationType));
+ type.AddField(4, nameof(ApplicationDataModel.LoggedData.OperationData.PrescriptionId));
+ type.AddField(5, nameof(ApplicationDataModel.LoggedData.OperationData.ProductIds));
+ type.AddField(6, nameof(ApplicationDataModel.LoggedData.OperationData.VarietyLocatorId));
+ type.AddField(7, nameof(ApplicationDataModel.LoggedData.OperationData.WorkItemOperationId));
+ type.AddField(8, nameof(ApplicationDataModel.LoggedData.OperationData.MaxDepth));
+ type.AddField(9, nameof(ApplicationDataModel.LoggedData.OperationData.SpatialRecordCount));
+ type.AddField(10, nameof(ApplicationDataModel.LoggedData.OperationData.EquipmentConfigurationIds));
+ type.AddField(11, nameof(ApplicationDataModel.LoggedData.OperationData.ContextItems));
}
}
}
diff --git a/ADMPlugin/Serializers/VersionInfoSerializer.cs b/ADMPlugin/Serializers/VersionInfoSerializer.cs
index 7b36132..91e0b2e 100644
--- a/ADMPlugin/Serializers/VersionInfoSerializer.cs
+++ b/ADMPlugin/Serializers/VersionInfoSerializer.cs
@@ -1,8 +1,6 @@
-using System;
-using System.Collections.Generic;
using System.IO;
using System.Reflection;
-using System.Text;
+using AgGateway.ADAPT.ADMPlugin.Json;
using AgGateway.ADAPT.ADMPlugin.Models;
using Newtonsoft.Json;
@@ -39,7 +37,7 @@ public AdmVersionInfo Deserialize(string dataPath)
var fileString = File.ReadAllText(filePath);
- var model = JsonConvert.DeserializeObject(fileString);
+ var model = JsonConvert.DeserializeObject(fileString, new NetCoreApp31CompatibleVersionConverter());
return model;
}
}
diff --git a/AcceptanceTest/AcceptanceTest.csproj b/AcceptanceTest/AcceptanceTest.csproj
index f4c6940..b968bd2 100644
--- a/AcceptanceTest/AcceptanceTest.csproj
+++ b/AcceptanceTest/AcceptanceTest.csproj
@@ -1,7 +1,7 @@
-
+
Exe
- netcoreapp2.0
+ netcoreapp2.0;netcoreapp3.1
0.0.0
Copyright (C) 2015-19 AgGateway and ADAPT Contributors
@@ -13,7 +13,7 @@
AgGateway.ADAPT.AcceptanceTest
-
+
diff --git a/PluginTest/PluginTest.csproj b/PluginTest/PluginTest.csproj
index 33e96ae..9f10a22 100644
--- a/PluginTest/PluginTest.csproj
+++ b/PluginTest/PluginTest.csproj
@@ -1,7 +1,7 @@
-
+
Exe
- netcoreapp2.0
+ netcoreapp2.0;netcoreapp3.1
0.0.0
Copyright (C) 2015-19 AgGateway and ADAPT Contributors
@@ -13,7 +13,7 @@
AgGateway.ADAPT.PluginTest
-
+
diff --git a/PluginTest/Serializers/AdmSerializerTest.cs b/PluginTest/Serializers/AdmSerializerTest.cs
index d1a6937..e462450 100644
--- a/PluginTest/Serializers/AdmSerializerTest.cs
+++ b/PluginTest/Serializers/AdmSerializerTest.cs
@@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using AgGateway.ADAPT.ADMPlugin;
using AgGateway.ADAPT.ApplicationDataModel.ADM;
-using AgGateway.ADAPT.ApplicationDataModel.Equipment;
-using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
using AgGateway.ADAPT.ApplicationDataModel.ReferenceLayers;
using Moq;
-using Newtonsoft.Json;
using NUnit.Framework;
-using AgGateway.ADAPT.TestUtilities;
using AgGateway.ADAPT.ADMPlugin.Serializers;
using AgGateway.ADAPT.ADMPlugin.Models;
using AgGateway.ADAPT.ADMPlugin.Json;
diff --git a/PluginTest/Serializers/VersionInfoSerializerTest.cs b/PluginTest/Serializers/VersionInfoSerializerTest.cs
index b7c37aa..42c263f 100644
--- a/PluginTest/Serializers/VersionInfoSerializerTest.cs
+++ b/PluginTest/Serializers/VersionInfoSerializerTest.cs
@@ -8,85 +8,117 @@
namespace AgGateway.ADAPT.PluginTest.Serializers
{
- [TestFixture]
- public class VersionInfoSerializerTest
- {
- private string _tempPath;
-
- [SetUp]
- public void Setup()
- {
- _tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
- }
-
- [Test]
- public void SerializeCreatesDestinationPath()
- {
- var serializer = new VersionInfoSerializer();
- serializer.Serialize(SerializationVersionEnum.V1, _tempPath);
-
- Assert.IsTrue(Directory.Exists(_tempPath));
- }
-
- [Test]
- public void GivenFilenameWhenWriteFileThenFileExists()
- {
- var serializer = new VersionInfoSerializer();
- serializer.Serialize(SerializationVersionEnum.V1, _tempPath);
-
- Assert.That(File.Exists(Path.Combine(_tempPath, DatacardConstants.VersionFile)), Is.True);
- }
-
- [Test]
- public void GivenFilenameWhenSerializeDeserializeThenFileContainsCorrectVersionInfo()
- {
- var serializationVersion = SerializationVersionEnum.V1;
- var expectedVersion = typeof(Plugin).Assembly.GetName().Version;
-
- var serializer = new VersionInfoSerializer();
- serializer.Serialize(serializationVersion, _tempPath);
- var result = serializer.Deserialize(_tempPath);
-
- Assert.That(result.PluginVersion, Is.EqualTo(expectedVersion));
- Assert.That(result.SerializationVersion, Is.EqualTo(serializationVersion));
- }
-
- [Test]
- public void GivenFilenameWhenDeserialzieThenCorrectVersionInfo()
- {
- var versionInfo = new AdmVersionInfo
- {
- PluginVersion = new Version("1.2.3.4"),
- SerializationVersion = SerializationVersionEnum.V1
- };
- Directory.CreateDirectory(_tempPath);
- File.WriteAllText(Path.Combine(_tempPath, DatacardConstants.VersionFile), JsonConvert.SerializeObject(versionInfo));
-
- var serializer = new VersionInfoSerializer();
- var result = serializer.Deserialize(_tempPath);
-
- Assert.That(result.PluginVersion, Is.EqualTo(versionInfo.PluginVersion));
- Assert.That(result.SerializationVersion, Is.EqualTo(versionInfo.SerializationVersion));
- }
-
- [Test]
- public void GivenFilenameThatDoesNotExistWhenReadThenNull()
- {
- var filename = Path.Combine(_tempPath, DatacardConstants.VersionFile);
-
- var serializer = new VersionInfoSerializer();
- var model = serializer.Deserialize(filename);
-
- Assert.That(model, Is.Null);
- }
-
- [TearDown]
- public void Teardown()
+ [TestFixture]
+ public class VersionInfoSerializerTest
{
- if (Directory.Exists(_tempPath))
- {
- Directory.Delete(_tempPath, true);
- }
+ private string _tempPath;
+
+ [SetUp]
+ public void Setup()
+ {
+ _tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ }
+
+ [Test]
+ public void SerializeCreatesDestinationPath()
+ {
+ var serializer = new VersionInfoSerializer();
+ serializer.Serialize(SerializationVersionEnum.V1, _tempPath);
+
+ Assert.IsTrue(Directory.Exists(_tempPath));
+ }
+
+ [Test]
+ public void GivenFilenameWhenWriteFileThenFileExists()
+ {
+ var serializer = new VersionInfoSerializer();
+ serializer.Serialize(SerializationVersionEnum.V1, _tempPath);
+
+ Assert.That(File.Exists(Path.Combine(_tempPath, DatacardConstants.VersionFile)), Is.True);
+ }
+
+ [Test]
+ public void GivenFilenameWhenSerializeDeserializeThenFileContainsCorrectVersionInfo()
+ {
+ var serializationVersion = SerializationVersionEnum.V1;
+ var expectedVersion = typeof(Plugin).Assembly.GetName().Version;
+
+ var serializer = new VersionInfoSerializer();
+ serializer.Serialize(serializationVersion, _tempPath);
+ var result = serializer.Deserialize(_tempPath);
+
+ Assert.That(result.PluginVersion, Is.EqualTo(expectedVersion));
+ Assert.That(result.SerializationVersion, Is.EqualTo(serializationVersion));
+ }
+
+ [Test]
+ public void GivenFilenameWhenDeserialzieThenCorrectVersionInfo()
+ {
+ var versionInfo = new AdmVersionInfo
+ {
+ PluginVersion = new Version("1.2.3.4"),
+ SerializationVersion = SerializationVersionEnum.V1
+ };
+ Directory.CreateDirectory(_tempPath);
+ File.WriteAllText(Path.Combine(_tempPath, DatacardConstants.VersionFile),
+ JsonConvert.SerializeObject(versionInfo));
+
+ var serializer = new VersionInfoSerializer();
+ var result = serializer.Deserialize(_tempPath);
+
+ Assert.That(result.PluginVersion, Is.EqualTo(versionInfo.PluginVersion));
+ Assert.That(result.SerializationVersion, Is.EqualTo(versionInfo.SerializationVersion));
+ }
+
+ [Test]
+ public void GivenFilenameThatDoesNotExistWhenReadThenNull()
+ {
+ var filename = Path.Combine(_tempPath, DatacardConstants.VersionFile);
+
+ var serializer = new VersionInfoSerializer();
+ var model = serializer.Deserialize(filename);
+
+ Assert.That(model, Is.Null);
+ }
+
+ [Test]
+ public void GivenVersionFileWrittenInPreNetCoreApp31FormatWhenReadThenCorrectVersionReturned()
+ {
+ var preNetCoreApp31Json =
+ "{\"AdmVersion\":null,\"PluginVersion\":{\"Major\":1,\"Minor\":2,\"Build\":3,\"Revision\":4,\"MajorRevision\":0,\"MinorRevision\":0},\"SerializationVersion\":1}";
+
+ Directory.CreateDirectory(_tempPath);
+ var filename = Path.Combine(_tempPath, DatacardConstants.VersionFile);
+ File.WriteAllText(filename, preNetCoreApp31Json);
+
+ var serializer = new VersionInfoSerializer();
+ var model = serializer.Deserialize(_tempPath);
+
+ Assert.That(model.PluginVersion, Is.EqualTo(new Version(1, 2, 3, 4)));
+ }
+
+ [Test]
+ public void GivenVersionFileWrittenInPostNetCoreApp31FormatWhenReadThenCorrectVersionReturned()
+ {
+ var postNetCoreApp31Json = "{\"AdmVersion\":null,\"PluginVersion\":\"1.2.3.4\",\"SerializationVersion\":1}";
+
+ Directory.CreateDirectory(_tempPath);
+ var filename = Path.Combine(_tempPath, DatacardConstants.VersionFile);
+ File.WriteAllText(filename, postNetCoreApp31Json);
+
+ var serializer = new VersionInfoSerializer();
+ var model = serializer.Deserialize(_tempPath);
+
+ Assert.That(model.PluginVersion, Is.EqualTo(new Version(1, 2, 3, 4)));
+ }
+
+ [TearDown]
+ public void Teardown()
+ {
+ if (Directory.Exists(_tempPath))
+ {
+ Directory.Delete(_tempPath, true);
+ }
+ }
}
- }
}
diff --git a/TestUtilities/TestUtilities.csproj b/TestUtilities/TestUtilities.csproj
index c7657cf..c0cd5e4 100644
--- a/TestUtilities/TestUtilities.csproj
+++ b/TestUtilities/TestUtilities.csproj
@@ -1,7 +1,7 @@
-
+
- netcoreapp2.0
+ netcoreapp2.0;netcoreapp3.1
Copyright (C) 2015-19 AgGateway and ADAPT Contributors
0.0.0.0
0.0.0