Feature/serialization exe (#442)

* Initial changes to have serialization generate its own .exe

* Removed additional project from sln file

* remove all references to removed temporary project

* Moved shared contracts into own dll and fixed imports. Addressed PR comments

* Undid having a separate contracts project since that'll be a task for later on. Moved dbcellvalue and saveresultsrequest to Hosting, where they will be imported and shared by the service layer and serialization projects

* Switched backslashes in project reference in csproj file to forward slashes for consistency

* Moved necessary contracts back to service layer. Refactored CommandOptions to reduce code duplication. Addressed miscellaneous PR suggestions

* Accidentally left these files out of previous commit

* Initialized loggers for serialization and credentials with the logging directory provided by the cmd line arg, if there is one

* Changed default log directory paths for serialization and credentials. Removed unnecessary cast and added a copyright

* Changed name of generated executable for serialization service

* removed unnecessary object cast

* removing unnecessary imports and addressing other PR comments
This commit is contained in:
Henry Phan
2017-09-05 16:21:42 -07:00
committed by GitHub
parent 22ccac98ae
commit 784f4c5d05
26 changed files with 425 additions and 177 deletions

View File

@@ -3,8 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.ServiceLayer.Utility;
using System.IO;
using Microsoft.SqlTools.ServiceLayer.Utility;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
@@ -18,7 +18,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void LoggingEnabledWhenFlagProvided()
{
var args = new string[] {"--enable-logging"};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.NotNull(options);
Assert.True(options.EnableLogging);
@@ -30,7 +30,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void LoggingDisabledWhenFlagNotProvided()
{
var args = new string[] {};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.NotNull(options);
Assert.False(options.EnableLogging);
@@ -42,7 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void UsageIsShownWhenHelpFlagProvided()
{
var args = new string[] {"--help"};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.NotNull(options);
Assert.True(options.ShouldExit);
@@ -53,7 +53,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void UsageIsShownWhenBadArgumentsProvided()
{
var args = new string[] {"--unknown-argument", "/bad-argument"};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.NotNull(options);
Assert.True(options.ShouldExit);
@@ -64,7 +64,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void DefaultValuesAreUsedWhenNoArgumentsAreProvided()
{
var args = new string[] {};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.NotNull(options);
Assert.False(options.EnableLogging);
@@ -79,7 +79,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void LocaleSetWhenProvided(string locale)
{
var args = new string[] {"--locale", locale};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args); ;
// Asserting all options were properly set
Assert.NotNull(options);
@@ -92,7 +92,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
{
string locale = "invalid";
var args = new string[] { "--locale", locale };
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
// Asserting all options were properly set
Assert.NotNull(options);
@@ -103,7 +103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
public void LocaleNotSetWhenNotProvided()
{
var args = new string[] {};
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
// Asserting all options were properly set
Assert.NotNull(options);
@@ -117,7 +117,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
{
string logDir = Directory.GetCurrentDirectory();
var args = new string[] { "--log-dir", logDir };
CommandOptions options = new CommandOptions(args);
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
// Asserting all options were properly set
Assert.NotNull(options);

View File

@@ -7,8 +7,6 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text.RegularExpressions;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.SqlParser.SqlCodeDom;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
using Xunit;