Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<CdmManifestDefinition>("local:/main.manifest.cdm.json");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
// 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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -291,8 +292,9 @@ public async static Task<Model> 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "local",
"namespace": "local",
"config": {
"root": "../../../../../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder"
"root": "../../../../../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "local",
"namespace": "local",
"config": {
"root": "../../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder"
"root": "../../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "local",
"namespace": "local",
"config": {
"root": "../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder"
"root": "../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "local",
"namespace": "local",
"config": {
"root": "../TestData\\Storage\\TestLoadingConfigAndTryingToFetchManifest\\Input\\SubFolder"
"root": "../TestData/Storage/TestLoadingConfigAndTryingToFetchManifest/Input/SubFolder"
}
},
{
Expand Down