Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6,907 changes: 2 additions & 6,905 deletions docs/bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<metadata>

<id>Microsoft.CommonDataModel.ObjectModel.Adapter.Adls.All</id>
<version>1.1.0</version>
<version>1.1.1</version>
<description>The ADLS adapter implementation for the Microsoft Common Data Model Object Model.</description>

<authors>Microsoft</authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45;net462</TargetFrameworks>
<version>1.1.0</version>
<version>1.1.1</version>
<Description>The ADLS adapter implementation for the Microsoft Common Data Model Object Model.</Description>

<Authors>Microsoft</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<metadata>

<id>Microsoft.CommonDataModel.ObjectModel.Adapter.Adls</id>
<version>1.1.0</version>
<version>1.1.1</version>
<description>The ADLS adapter implementation for the Microsoft Common Data Model Object Model.</description>

<authors>Microsoft</authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,29 @@ public async Task TestDocumentForceReload()
Assert.IsNotNull(reloadedEntity);
}

/// <summary>
/// Tests if the DocumentVersion is set on the resolved document
/// </summary>
[TestMethod]
public async Task TestDocumentVersionSetOnResolution()
{
var testName = "TestDocumentVersionSetOnResolution";
var corpus = TestHelper.GetLocalCorpus(testsSubpath, testName);

var manifest = await corpus.FetchObjectAsync<CdmManifestDefinition>("local:/default.manifest.cdm.json");
var document = await corpus.FetchObjectAsync<CdmDocumentDefinition>("local:/Person.cdm.json");

Assert.AreEqual("2.1.3", manifest.DocumentVersion);
Assert.AreEqual("1.5", document.DocumentVersion);

var resManifest = await manifest.CreateResolvedManifestAsync($"res-{manifest.Name}", null);
var resEntity = await corpus.FetchObjectAsync<CdmEntityDefinition>(resManifest.Entities[0].EntityPath, resManifest);
var resDocument = resEntity.InDocument;

Assert.AreEqual("2.1.3", resManifest.DocumentVersion);
Assert.AreEqual("1.5", resDocument.DocumentVersion);
}

/// <summary>
/// Sets the document's isDirty flag to true and reset the importPriority.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task ResolveEntities()
cdmCorpus.RootPath = testInputPath;
cdmCorpus.Storage.Mount("local", new LocalAdapter(testInputPath));
cdmCorpus.Storage.DefaultNamespace = "local";
var entities = this.GetAllEntities(cdmCorpus);
var entities = await this.GetAllEntities(cdmCorpus);
var entityResolutionTimes = new List<Tuple<string, long>>();
foreach (var data in entities)
{
Expand All @@ -70,7 +70,7 @@ public async Task ResolveEntities()

Assert.Performance(1000, entityResolutionTimes[0].Item2);
var total = entityResolutionTimes.Sum(data => data.Item2);
Assert.Performance(2000, total);
Assert.Performance(5000, total);
}

/// <summary>
Expand All @@ -86,7 +86,7 @@ public async Task ResolveEntitiesWrt()
((CdmCorpusDefinition)cdmCorpus).RootPath = testInputPath;
cdmCorpus.Storage.Mount("local", new LocalAdapter(testInputPath));
cdmCorpus.Storage.DefaultNamespace = "local";
var entities = this.GetAllEntities(cdmCorpus);
var entities = await this.GetAllEntities(cdmCorpus);
var incomingReferences = new Dictionary<CdmEntityDefinition, List<CdmEntityDefinition>>();
foreach (var data in entities)
{
Expand Down Expand Up @@ -142,9 +142,9 @@ public async Task ResolveEntitiesWrt()
Trace.WriteLine($"{data.Item1}:{data.Item2}");
}

Assert.Performance(1000, entityResolutionTimes[0].Item2);
Assert.Performance(4000, entityResolutionTimes[0].Item2);
var total = entityResolutionTimes.Sum(data => data.Item2);
Assert.Performance(4200, total);
Assert.Performance(5000, total);
}

/// <summary>
Expand Down Expand Up @@ -181,7 +181,7 @@ private async Task<List<CdmEntityDefinition>> GetEntityReferences(CdmEntityDefin
/// </summary>
/// <param name="cdmCorpus"> The instance of the CDM corpus to use. </param>
/// <returns> The list of entities present. </returns>
private List<Tuple<CdmEntityDefinition, CdmDocumentDefinition>> GetAllEntities(CdmCorpusDefinition cdmCorpus)
private async Task<List<Tuple<CdmEntityDefinition, CdmDocumentDefinition>>> GetAllEntities(CdmCorpusDefinition cdmCorpus)
{
cdmCorpus.SetEventCallback(new EventCallback { Invoke = CommonDataModelLoader.ConsoleStatusReport }, CdmStatusLevel.Warning);
Console.WriteLine("reading source files");
Expand All @@ -190,10 +190,10 @@ private List<Tuple<CdmEntityDefinition, CdmDocumentDefinition>> GetAllEntities(C
var folders = Directory.GetDirectories(cdmCorpus.RootPath).ToList().ConvertAll(Path.GetFileName);
foreach (var folder in folders)
{
CommonDataModelLoader.LoadCorpusFolder(cdmCorpus, rootFolder.ChildFolders.Add(folder), new List<string> { "analyticalCommon" }, string.Empty).GetAwaiter().GetResult();
await CommonDataModelLoader.LoadCorpusFolder(cdmCorpus, rootFolder.ChildFolders.Add(folder), new List<string> { "analyticalCommon" }, string.Empty);
}

CommonDataModelLoader.ResolveLocalCorpus(cdmCorpus, CdmValidationStep.MinimumForResolving).GetAwaiter().GetResult();
await CommonDataModelLoader.ResolveLocalCorpus(cdmCorpus, CdmValidationStep.MinimumForResolving);

var entities = new List<Tuple<CdmEntityDefinition, CdmDocumentDefinition>>();
Action<CdmFolderDefinition> seekEntities = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.Cdm;
using Microsoft.CommonDataModel.ObjectModel.Enums;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Multiple test classes in projections test the attribute context tree generated for various scenarios.
Expand Down Expand Up @@ -144,7 +145,7 @@ private void GetArgumentValuesAsString(CdmArgumentDefinition args)
/// <param name="expectedOutputPath"></param>
/// <param name="entityName"></param>
/// <param name="resolvedEntity"></param>
public static void ValidateAttributeContext(CdmCorpusDefinition corpus, string expectedOutputPath, string entityName, CdmEntityDefinition resolvedEntity)
public static async Task ValidateAttributeContext(CdmCorpusDefinition corpus, string expectedOutputPath, string entityName, CdmEntityDefinition resolvedEntity)
{
if (resolvedEntity.AttributeContext != null)
{
Expand All @@ -160,7 +161,7 @@ public static void ValidateAttributeContext(CdmCorpusDefinition corpus, string e
// Save Actual AttrCtx_*.txt and Resolved_*.cdm.json
string actualText = attrCtxUtil.GetAttributeContextStrings(resolvedEntity, resolvedEntity.AttributeContext);
File.WriteAllText(actualStringFilePath, actualText);
resolvedEntity.InDocument.SaveAsAsync($"Resolved_{entityName}.cdm.json", saveReferenced: false).GetAwaiter().GetResult();
await resolvedEntity.InDocument.SaveAsAsync($"Resolved_{entityName}.cdm.json", saveReferenced: false);

// Test if Actual is Equal to Expected
Assert.AreEqual(expectedText.Replace("\r\n", "\n"), actualText.Replace("\r\n", "\n"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.Cdm;
using Microsoft.CommonDataModel.ObjectModel.Enums;
using Microsoft.CommonDataModel.ObjectModel.ResolvedModel;
using Microsoft.CommonDataModel.ObjectModel.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

/// <summary>
/// Unit test for CardinalitySetting functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.ResolvedModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -27,40 +27,38 @@ public class ExpressionTreeUnitTest
[TestMethod]
public void TestEvaluateExpression()
{
InputValues input = new InputValues()
InputValues inputValues = new InputValues()
{
maxCardinality = 1,
minCardinality = 0,
maxDepth = 32,
nextDepth = 1,
noMaxDepth = true,
isArray = true,
normalized = false,
referenceOnly = true,
structured = true
MaxCardinality = 1,
MinCardinality = 0,
MaxDepth = 32,
NextDepth = 1,
NoMaxDepth = true,
IsArray = true,
Normalized = false,
ReferenceOnly = true,
Structured = true
};

List<Tuple<string, string>> exprAndExpectedResultList = new List<Tuple<string, string>>();
List<Tuple<string, bool>> exprAndExpectedResultList = new List<Tuple<string, bool>>();
{
exprAndExpectedResultList.Add(new Tuple<string, string>("(cardinality.maximum > 1) && (!referenceOnly)", "False"));
exprAndExpectedResultList.Add(new Tuple<string, string>("", "False"));
exprAndExpectedResultList.Add(new Tuple<string, string>(" ", "False"));
exprAndExpectedResultList.Add(new Tuple<string, string>("always", "True"));
exprAndExpectedResultList.Add(new Tuple<string, string>("!structured", "False"));
exprAndExpectedResultList.Add(new Tuple<string, string>("referenceOnly || (depth > 5)", "True"));
exprAndExpectedResultList.Add(new Tuple<string, string>("!(referenceOnly)", "False"));
exprAndExpectedResultList.Add(new Tuple<string, string>("!(normalized && cardinality.maximum > 1)", "True"));
exprAndExpectedResultList.Add(new Tuple<string, string>("true", "True"));
exprAndExpectedResultList.Add(new Tuple<string, string>("(((true==true)))", "True"));
exprAndExpectedResultList.Add(new Tuple<string, string>("!(normalized && isArray) || noMaxDepth", "False"));
exprAndExpectedResultList.Add(new Tuple<string, bool>("(cardinality.maximum > 1) && (!referenceOnly)", false));
exprAndExpectedResultList.Add(new Tuple<string, bool>("", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>(" ", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("always", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("!structured", false));
exprAndExpectedResultList.Add(new Tuple<string, bool>("referenceOnly || (depth > 5)", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("!(referenceOnly)", false));
exprAndExpectedResultList.Add(new Tuple<string, bool>("!(normalized && cardinality.maximum > 1)", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("true", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("(((true==true)))", true));
exprAndExpectedResultList.Add(new Tuple<string, bool>("!(normalized && isArray) || noMaxDepth", false));
}

foreach (var item in exprAndExpectedResultList)
{
ExpressionTree tree = new ExpressionTree();
Node treeTop = tree.ConstructExpressionTree(item.Item1);
string expected = item.Item2;
string actual = ExpressionTree.EvaluateExpressionTree(treeTop, input).ToString();
bool actual = ExpressionTree.EvaluateCondition(item.Item1, inputValues);
bool expected = item.Item2;

Assert.AreEqual(expected, actual);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task TestAllOperations()
Assert.IsNotNull(entTestEntityStringReference);
CdmEntityDefinition resolvedTestEntityStringReference = await ProjectionTestUtils.GetResolvedEntity(corpus, entTestEntityStringReference, new List<string> { "referenceOnly" });
Assert.IsNotNull(resolvedTestEntityStringReference);
AttributeContextUtil.ValidateAttributeContext(corpus, expectedOutputPath, entityName, resolvedTestEntityStringReference);
await AttributeContextUtil.ValidateAttributeContext(corpus, expectedOutputPath, entityName, resolvedTestEntityStringReference);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.ResolvedModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.Cdm;
using Microsoft.CommonDataModel.ObjectModel.Enums;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm
namespace Microsoft.CommonDataModel.ObjectModel.Tests.Cdm.Projection
{
using Microsoft.CommonDataModel.ObjectModel.Cdm;
using Microsoft.CommonDataModel.ObjectModel.Enums;
Expand Down
Loading