diff --git a/src/Microsoft.SqlTools.ServiceLayer/Scripting/Scripter.cs b/src/Microsoft.SqlTools.ServiceLayer/Scripting/Scripter.cs index 4ef66863..a20e1d5c 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Scripting/Scripter.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Scripting/Scripter.cs @@ -52,9 +52,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting // Mapping the object types for scripting objectScriptMap.Add("table", "Table"); objectScriptMap.Add("view", "View"); + objectScriptMap.Add("function", "Function"); objectScriptMap.Add("storedprocedure", "Procedure"); objectScriptMap.Add("userdefinedfunction", "Function"); - objectScriptMap.Add("userdefineddataType", "Type"); + objectScriptMap.Add("tablevaluedfunction", "Function"); + objectScriptMap.Add("userdefineddatatype", "Type"); objectScriptMap.Add("user", "User"); objectScriptMap.Add("default", "Default"); objectScriptMap.Add("rule", "Rule"); @@ -66,7 +68,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting objectScriptMap.Add("xmlschemacollection", "Xml Schema Collection"); objectScriptMap.Add("schema", "Schema"); objectScriptMap.Add("planguide", "sp_create_plan_guide"); - objectScriptMap.Add("userdefinedType", "Type"); + objectScriptMap.Add("userdefinedtype", "Type"); objectScriptMap.Add("userdefinedaggregate", "Aggregate"); objectScriptMap.Add("fulltextcatalog", "Fulltext Catalog"); objectScriptMap.Add("userdefinedtabletype", "Type"); diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs index 82d52d33..d32a51b8 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs @@ -97,7 +97,7 @@ GO"; string objectName = "spt_monitor"; string schemaName = null; - string objectType = "TABLE"; + string objectType = "Table"; // Get locations for valid table object Location[] locations = scripter.GetSqlObjectDefinition(objectName, schemaName, objectType); @@ -139,7 +139,7 @@ GO"; string objectName = "spt_monitor"; string schemaName = "dbo"; - string objectType = "TABLE"; + string objectType = "Table"; // Get locations for valid table object with schema name Location[] locations = scripter.GetSqlObjectDefinition(objectName, schemaName, objectType); @@ -260,7 +260,7 @@ GO"; Scripter scripter = new Scripter(serverConnection, connInfo); string objectName = "objects"; string schemaName = "sys"; - string objectType = "VIEW"; + string objectType = "View"; Location[] locations = scripter.GetSqlObjectDefinition(objectName, schemaName, objectType); Assert.NotNull(locations); @@ -401,7 +401,7 @@ GO"; [Fact] public async Task GetTableValuedFunctionDefinitionWithSchemaNameSuccessTest() { - await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, TableValuedFunctionTypeName); + await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, ScalarValuedFunctionTypeName); } /// @@ -444,7 +444,7 @@ GO"; [Fact] public async Task GetTableValuedFunctionDefinitionWithoutSchemaNameSuccessTest() { - await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, TableValuedFunctionTypeName, null); + await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, ScalarValuedFunctionTypeName, null); } diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestDriver.Tests/SqlScriptPublishModelTests.cs b/test/Microsoft.SqlTools.ServiceLayer.TestDriver.Tests/SqlScriptPublishModelTests.cs index 693a552f..4dd47206 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestDriver.Tests/SqlScriptPublishModelTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.TestDriver.Tests/SqlScriptPublishModelTests.cs @@ -217,7 +217,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests } [Fact] - public async Task ScriptSchemaCancel() + public async void ScriptSchemaCancel() { using (TestServiceDriverProvider testService = new TestServiceDriverProvider()) { @@ -228,11 +228,12 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests ScriptOptions = new ScriptOptions { TypeOfDataToScript = "SchemaAndData", - }, + } }; - ScriptingResult result = await testService.Script(requestParams); - ScriptingCancelResult cancelResult = await testService.CancelScript(result.OperationId); + var result = Task.Run(() => testService.Script(requestParams)); + ScriptingProgressNotificationParams progressParams = await testService.Driver.WaitForEvent(ScriptingProgressNotificationEvent.Type, TimeSpan.FromSeconds(10)); + Task.Run(() => testService.CancelScript(progressParams.OperationId)); ScriptingCompleteParams cancelEvent = await testService.Driver.WaitForEvent(ScriptingCompleteEvent.Type, TimeSpan.FromSeconds(10)); Assert.True(cancelEvent.Canceled); }