diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Cdm/Relationship/RelationshipTest.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Cdm/Relationship/RelationshipTest.cs index 7064daf76d..132c62dee8 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Cdm/Relationship/RelationshipTest.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Cdm/Relationship/RelationshipTest.cs @@ -268,7 +268,7 @@ public async Task TestRelationshipToDifferentNamespace() var corpus = TestHelper.GetLocalCorpus(testsSubpath, "TestRelationshipToDifferentNamespace"); // entity B will be in a different namespace - corpus.Storage.Mount("differentNamespace", new LocalAdapter($"{TestHelper.GetInputFolderPath(testsSubpath, "TestRelationshipToDifferentNamespace")}\\differentNamespace")); + corpus.Storage.Mount("differentNamespace", new LocalAdapter($"{TestHelper.GetInputFolderPath(testsSubpath, "TestRelationshipToDifferentNamespace")}/differentNamespace")); var manifest = await corpus.FetchObjectAsync("local:/main.manifest.cdm.json"); diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/ModelJson/DataPartitionTests.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/ModelJson/DataPartitionTests.cs index cf5fa92bba..3ae55843ee 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/ModelJson/DataPartitionTests.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/ModelJson/DataPartitionTests.cs @@ -39,7 +39,7 @@ public async Task TestModelJsonDataPartitionLocationConsistency() var convertedToModelJson = await modelJsonPersistence.ManifestPersistence.ToData(manifestRead, null, null); string location = (convertedToModelJson.Entities[0]["partitions"][0]["location"] as JValue).Value(); // Model Json uses absolute adapter path. - Assert.IsTrue(location.Contains("\\TestData\\Persistence\\ModelJson\\DataPartition\\TestModelJsonDataPartitionLocationConsistency\\Input\\EpisodeOfCare\\partition-data.csv")); + Assert.IsTrue(location.Contains(Path.Combine("TestData", "Persistence", "ModelJson", "DataPartition", "TestModelJsonDataPartitionLocationConsistency", "Input", "EpisodeOfCare", "partition-data.csv"))); var cdmCorpus2 = TestHelper.GetLocalCorpus(testsSubpath, "TestModelJsonDataPartitionLocationConsistency"); var manifestAfterConvertion = await modelJsonPersistence.ManifestPersistence.FromObject(cdmCorpus2.Ctx, convertedToModelJson, cdmCorpus2.Storage.FetchRootFolder("local")); diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Storage/LocalAdapterTests.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Storage/LocalAdapterTests.cs index 81795d4f8b..33e0c7f3a1 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Storage/LocalAdapterTests.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Storage/LocalAdapterTests.cs @@ -3,6 +3,8 @@ namespace Microsoft.CommonDataModel.ObjectModel.Tests.Storage { + using System; + using System.IO; using Microsoft.CommonDataModel.ObjectModel.Storage; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -15,11 +17,16 @@ public class LocalAdapterTests [TestMethod] public void TestCreateAdapterPath() { - var adapter = new LocalAdapter("C:/some/dir"); + string rootPath = OperatingSystem.IsWindows() ? "C:\\" : "/"; + string fullPath = Path.Combine(rootPath, "some", "dir"); + + var adapter = new LocalAdapter(fullPath); string pathWithLeadingSlash = adapter.CreateAdapterPath("/folder"); string pathWithoutLeadingSlash = adapter.CreateAdapterPath("folder"); - Assert.AreEqual(pathWithLeadingSlash, "C:\\some\\dir\\folder"); + string fullPathWithFolder = Path.Combine(fullPath, "folder"); + + Assert.AreEqual(pathWithLeadingSlash, fullPathWithFolder); Assert.AreEqual(pathWithLeadingSlash, pathWithoutLeadingSlash); // A null corpus path should return a null adapter path diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/ManifestPersistence.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/ManifestPersistence.cs index e8999f0297..d8380b65c9 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/ManifestPersistence.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/ManifestPersistence.cs @@ -7,6 +7,7 @@ namespace Microsoft.CommonDataModel.ObjectModel.Persistence.ModelJson using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; + using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.CommonDataModel.ObjectModel.Cdm; @@ -291,8 +292,9 @@ public async static Task ToData(CdmManifestDefinition instance, ResolveOp var referenceModelIdAsString = referenceModelId.ToString(); var referenceModelLocation = referenceModel["location"]; var referenceModelLocationAsString = referenceModelLocation.ToString(); - referenceModels.Add(referenceModelIdAsString, referenceModelLocationAsString); - referenceEntityLocations.Add(referenceModelLocationAsString, referenceModelIdAsString); + var referenceModelLocationAsStringNormalized = Regex.Replace(referenceModelLocationAsString, @"\\+", "/"); + referenceModels.Add(referenceModelIdAsString, referenceModelLocationAsStringNormalized); + referenceEntityLocations.Add(referenceModelLocationAsStringNormalized, referenceModelIdAsString); } } diff --git a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-CSharp.json b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-CSharp.json index 126ece3300..9e8737d63c 100644 --- a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-CSharp.json +++ b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-CSharp.json @@ -5,7 +5,7 @@ "type": "local", "namespace": "local", "config": { - "root": "../../../../../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder" + "root": "../../../../../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder" } }, { diff --git a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Java.json b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Java.json index 19d474d738..864fcac791 100644 --- a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Java.json +++ b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Java.json @@ -5,7 +5,7 @@ "type": "local", "namespace": "local", "config": { - "root": "../../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder" + "root": "../../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder" } }, { diff --git a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Python.json b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Python.json index 8c5817a7ae..717eaf8c46 100644 --- a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Python.json +++ b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-Python.json @@ -5,7 +5,7 @@ "type": "local", "namespace": "local", "config": { - "root": "../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder" + "root": "../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder" } }, { diff --git a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-TypeScript.json b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-TypeScript.json index aab3b1885a..80e24f34fb 100644 --- a/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-TypeScript.json +++ b/objectModel/TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/config-TypeScript.json @@ -5,7 +5,7 @@ "type": "local", "namespace": "local", "config": { - "root": "../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder" + "root": "../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder" } }, {