Change deploy to publish in sql project codebase (#11144)

* change deploy to publish

* rename to IPublishSettings

* change a few more profiles to settings
This commit is contained in:
Kim Santiago
2020-06-30 19:23:03 -07:00
committed by GitHub
parent 2b5ae5e3a8
commit 1e805a4156
10 changed files with 107 additions and 107 deletions

View File

@@ -53,15 +53,14 @@ export function deleteConfirmation(toDelete: string) { return localize('deleteCo
export function deleteConfirmationContents(toDelete: string) { return localize('deleteConfirmationContents', "Are you sure you want to delete {0} and all of its contents?", toDelete); }
// Deploy dialog strings
// Publish dialog strings
export const deployDialogName = localize('deployDialogName', "Publish Database");
export const deployDialogOkButtonText = localize('deployDialogOkButtonText', "Publish");
export const publishDialogName = localize('publishDialogName', "Publish Database");
export const publishDialogOkButtonText = localize('publishDialogOkButtonText', "Publish");
export const cancelButtonText = localize('cancelButtonText', "Cancel");
export const generateScriptButtonText = localize('generateScriptButtonText', "Generate Script");
export const targetDatabaseSettings = localize('targetDatabaseSettings', "Target Database Settings");
export const databaseNameLabel = localize('databaseNameLabel', "Database");
export const deployScriptNameLabel = localize('deployScriptName', "Publish script name");
export const targetConnectionLabel = localize('targetConnectionLabel', "Target Connection");
export const editConnectionButtonText = localize('editConnectionButtonText', "Edit");
export const clearButtonText = localize('clearButtonText', "Clear");
@@ -101,7 +100,7 @@ export const databaseNameRequired = localize('databaseNameRequired', "Database n
export const invalidDataSchemaProvider = localize('invalidDataSchemaProvider', "Invalid DSP in .sqlproj file");
export const invalidDatabaseReference = localize('invalidDatabaseReference', "Invalid database reference in .sqlproj file");
export const databaseSelectionRequired = localize('databaseSelectionRequired', "Database selection is required to import a project");
export const unableToCreateDeploymentConnection = localize('unableToCreateDeploymentConnection', "Unable to construct connection");
export const unableToCreatePublishConnection = localize('unableToCreatePublishConnection', "Unable to construct connection");
export const databaseReferenceAlreadyExists = localize('databaseReferenceAlreadyExists', "A reference to this database already exists in this project");
export function projectAlreadyOpened(path: string) { return localize('projectAlreadyOpened', "Project '{0}' is already opened.", path); }
export function projectAlreadyExists(name: string, path: string) { return localize('projectAlreadyExists', "A project named {0} already exists in {1}.", name, path); }

View File

@@ -52,7 +52,7 @@ export default class MainController implements Disposable {
this.apiWrapper.registerCommand('sqlDatabaseProjects.properties', async (node: BaseProjectTreeItem) => { await this.apiWrapper.showErrorMessage(`Properties not yet implemented: ${node.uri.path}`); }); // TODO
this.apiWrapper.registerCommand('sqlDatabaseProjects.build', async (node: BaseProjectTreeItem) => { await this.projectsController.buildProject(node); });
this.apiWrapper.registerCommand('sqlDatabaseProjects.deploy', async (node: BaseProjectTreeItem) => { await this.projectsController.deployProject(node); });
this.apiWrapper.registerCommand('sqlDatabaseProjects.publish', async (node: BaseProjectTreeItem) => { await this.projectsController.publishProject(node); });
this.apiWrapper.registerCommand('sqlDatabaseProjects.schemaCompare', async (node: BaseProjectTreeItem) => { await this.projectsController.schemaCompare(node); });
this.apiWrapper.registerCommand('sqlDatabaseProjects.importDatabase', async (profile: azdata.IConnectionProfile) => { await this.projectsController.importNewDatabaseProject(profile); });

View File

@@ -17,11 +17,11 @@ import { Uri, QuickPickItem, WorkspaceFolder, extensions, Extension } from 'vsco
import { IConnectionProfile, TaskExecutionMode } from 'azdata';
import { promises as fs } from 'fs';
import { ApiWrapper } from '../common/apiWrapper';
import { DeployDatabaseDialog } from '../dialogs/deployDatabaseDialog';
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
import { Project, DatabaseReferenceLocation, SystemDatabase, TargetPlatform, ProjectEntry, reservedProjectFolders } from '../models/project';
import { SqlDatabaseProjectTreeViewProvider } from './databaseProjectTreeViewProvider';
import { FolderNode, FileNode } from '../models/tree/fileFolderTreeItem';
import { IDeploymentProfile, IGenerateScriptProfile, PublishSettings } from '../models/IDeploymentProfile';
import { IPublishSettings, IGenerateScriptSettings, PublishProfile } from '../models/IPublishSettings';
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
import { ImportDataModel } from '../models/api/import';
@@ -185,50 +185,50 @@ export class ProjectsController {
}
/**
* Builds and deploys a project
* Builds and publishes a project
* @param treeNode a treeItem in a project's hierarchy, to be used to obtain a Project
*/
public async deployProject(treeNode: BaseProjectTreeItem): Promise<DeployDatabaseDialog>;
public async publishProject(treeNode: BaseProjectTreeItem): Promise<PublishDatabaseDialog>;
/**
* Builds and deploys a project
* @param project Project to be built and deployed
* Builds and publishes a project
* @param project Project to be built and published
*/
public async deployProject(project: Project): Promise<DeployDatabaseDialog>;
public async deployProject(context: Project | BaseProjectTreeItem): Promise<DeployDatabaseDialog> {
public async publishProject(project: Project): Promise<PublishDatabaseDialog>;
public async publishProject(context: Project | BaseProjectTreeItem): Promise<PublishDatabaseDialog> {
const project: Project = this.getProjectFromContext(context);
let deployDatabaseDialog = this.getDeployDialog(project);
let publishDatabaseDialog = this.getPublishDialog(project);
deployDatabaseDialog.deploy = async (proj, prof) => await this.executionCallback(proj, prof);
deployDatabaseDialog.generateScript = async (proj, prof) => await this.executionCallback(proj, prof);
deployDatabaseDialog.readPublishProfile = async (profileUri) => await this.readPublishProfile(profileUri);
publishDatabaseDialog.publish = async (proj, prof) => await this.executionCallback(proj, prof);
publishDatabaseDialog.generateScript = async (proj, prof) => await this.executionCallback(proj, prof);
publishDatabaseDialog.readPublishProfile = async (profileUri) => await this.readPublishProfile(profileUri);
deployDatabaseDialog.openDialog();
publishDatabaseDialog.openDialog();
return deployDatabaseDialog;
return publishDatabaseDialog;
}
public async executionCallback(project: Project, profile: IDeploymentProfile | IGenerateScriptProfile): Promise<mssql.DacFxResult | undefined> {
public async executionCallback(project: Project, settings: IPublishSettings | IGenerateScriptSettings): Promise<mssql.DacFxResult | undefined> {
const dacpacPath = await this.buildProject(project);
if (!dacpacPath) {
return undefined; // buildProject() handles displaying the error
}
// copy dacpac to temp location before deployment
// copy dacpac to temp location before publishing
const tempPath = path.join(os.tmpdir(), `${path.parse(dacpacPath).name}_${new Date().getTime()}${constants.sqlprojExtension}`);
await fs.copyFile(dacpacPath, tempPath);
const dacFxService = await this.getDaxFxService();
if ((<IDeploymentProfile>profile).upgradeExisting) {
return await dacFxService.deployDacpac(tempPath, profile.databaseName, (<IDeploymentProfile>profile).upgradeExisting, profile.connectionUri, TaskExecutionMode.execute, profile.sqlCmdVariables);
if ((<IPublishSettings>settings).upgradeExisting) {
return await dacFxService.deployDacpac(tempPath, settings.databaseName, (<IPublishSettings>settings).upgradeExisting, settings.connectionUri, TaskExecutionMode.execute, settings.sqlCmdVariables);
}
else {
return await dacFxService.generateDeployScript(tempPath, profile.databaseName, profile.connectionUri, TaskExecutionMode.script, profile.sqlCmdVariables);
return await dacFxService.generateDeployScript(tempPath, settings.databaseName, settings.connectionUri, TaskExecutionMode.script, settings.sqlCmdVariables);
}
}
public async readPublishProfile(profileUri: Uri): Promise<PublishSettings> {
public async readPublishProfile(profileUri: Uri): Promise<PublishProfile> {
const profileText = await fs.readFile(profileUri.fsPath);
const profileXmlDoc = new xmldom.DOMParser().parseFromString(profileText.toString());
@@ -544,8 +544,8 @@ export class ProjectsController {
//#region Helper methods
public getDeployDialog(project: Project): DeployDatabaseDialog {
return new DeployDatabaseDialog(this.apiWrapper, project);
public getPublishDialog(project: Project): PublishDatabaseDialog {
return new PublishDatabaseDialog(this.apiWrapper, project);
}
public async updateProjectForRoundTrip(project: Project) {

View File

@@ -11,16 +11,16 @@ import * as utils from '../common/utils';
import { Project } from '../models/project';
import { SqlConnectionDataSource } from '../models/dataSources/sqlConnectionStringSource';
import { ApiWrapper } from '../common/apiWrapper';
import { IDeploymentProfile, IGenerateScriptProfile } from '../models/IDeploymentProfile';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
interface DataSourceDropdownValue extends azdata.CategoryValue {
dataSource: SqlConnectionDataSource;
database: string;
}
export class DeployDatabaseDialog {
export class PublishDatabaseDialog {
public dialog: azdata.window.Dialog;
public deployTab: azdata.window.DialogTab;
public publishTab: azdata.window.DialogTab;
private targetConnectionTextBox: azdata.InputBoxComponent | undefined;
private targetConnectionFormComponent: azdata.FormComponent | undefined;
private dataSourcesFormComponent: azdata.FormComponent | undefined;
@@ -38,20 +38,20 @@ export class DeployDatabaseDialog {
private toDispose: vscode.Disposable[] = [];
public deploy: ((proj: Project, profile: IDeploymentProfile) => any) | undefined;
public generateScript: ((proj: Project, profile: IGenerateScriptProfile) => any) | undefined;
public publish: ((proj: Project, profile: IPublishSettings) => any) | undefined;
public generateScript: ((proj: Project, profile: IGenerateScriptSettings) => any) | undefined;
public readPublishProfile: ((profileUri: vscode.Uri) => any) | undefined;
constructor(private apiWrapper: ApiWrapper, private project: Project) {
this.dialog = azdata.window.createModelViewDialog(constants.deployDialogName);
this.deployTab = azdata.window.createTab(constants.deployDialogName);
this.dialog = azdata.window.createModelViewDialog(constants.publishDialogName);
this.publishTab = azdata.window.createTab(constants.publishDialogName);
}
public openDialog(): void {
this.initializeDialog();
this.dialog.okButton.label = constants.deployDialogOkButtonText;
this.dialog.okButton.label = constants.publishDialogOkButtonText;
this.dialog.okButton.enabled = false;
this.toDispose.push(this.dialog.okButton.onClick(async () => await this.deployClick()));
this.toDispose.push(this.dialog.okButton.onClick(async () => await this.publishClick()));
this.dialog.cancelButton.label = constants.cancelButtonText;
@@ -70,12 +70,12 @@ export class DeployDatabaseDialog {
}
private initializeDialog(): void {
this.initializeDeployTab();
this.dialog.content = [this.deployTab];
this.initializePublishTab();
this.dialog.content = [this.publishTab];
}
private initializeDeployTab(): void {
this.deployTab.registerContent(async view => {
private initializePublishTab(): void {
this.publishTab.registerContent(async view => {
// TODO : enable using this when data source creation is enabled
this.createRadioButtons(view);
@@ -189,13 +189,13 @@ export class DeployDatabaseDialog {
return await this.apiWrapper.getUriForConnection(connId);
}
catch (err) {
throw new Error(constants.unableToCreateDeploymentConnection + ': ' + utils.getErrorMessage(err));
throw new Error(constants.unableToCreatePublishConnection + ': ' + utils.getErrorMessage(err));
}
}
public async deployClick(): Promise<void> {
const sqlCmdVars = this.getSqlCmdVariablesForDeploy();
const profile: IDeploymentProfile = {
public async publishClick(): Promise<void> {
const sqlCmdVars = this.getSqlCmdVariablesForPublish();
const settings: IPublishSettings = {
databaseName: this.getTargetDatabaseName(),
upgradeExisting: true,
connectionUri: await this.getConnectionUri(),
@@ -203,14 +203,14 @@ export class DeployDatabaseDialog {
};
this.apiWrapper.closeDialog(this.dialog);
await this.deploy!(this.project, profile);
await this.publish!(this.project, settings);
this.dispose();
}
public async generateScriptClick(): Promise<void> {
const sqlCmdVars = this.getSqlCmdVariablesForDeploy();
const profile: IGenerateScriptProfile = {
const sqlCmdVars = this.getSqlCmdVariablesForPublish();
const settings: IGenerateScriptSettings = {
databaseName: this.getTargetDatabaseName(),
connectionUri: await this.getConnectionUri(),
sqlCmdVariables: sqlCmdVars
@@ -219,13 +219,13 @@ export class DeployDatabaseDialog {
this.apiWrapper.closeDialog(this.dialog);
if (this.generateScript) {
await this.generateScript!(this.project, profile);
await this.generateScript!(this.project, settings);
}
this.dispose();
}
private getSqlCmdVariablesForDeploy(): Record<string, string> {
private getSqlCmdVariablesForPublish(): Record<string, string> {
// get SQLCMD variables from project
let sqlCmdVariables = { ...this.project.sqlCmdVariables };
@@ -421,7 +421,7 @@ export class DeployDatabaseDialog {
const result = await this.readPublishProfile(fileUris[0]);
(<azdata.InputBoxComponent>this.targetDatabaseTextBox).value = result.databaseName;
this.profileSqlCmdVars = result.sqlCmdVariables;
const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForDeploy());
const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForPublish());
(<azdata.TableComponent>this.sqlCmdVariablesTable).updateProperties({
data: data

View File

@@ -3,20 +3,21 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface IDeploymentProfile {
export interface IPublishSettings {
databaseName: string;
connectionUri: string;
upgradeExisting: boolean;
sqlCmdVariables?: Record<string, string>;
}
export interface IGenerateScriptProfile {
export interface IGenerateScriptSettings {
databaseName: string;
connectionUri: string;
sqlCmdVariables?: Record<string, string>;
}
export interface PublishSettings {
// only reading db name and SQLCMD vars from profile for now
export interface PublishProfile {
databaseName: string;
sqlCmdVariables: Record<string, string>;
}

View File

@@ -19,9 +19,9 @@ import { ProjectsController } from '../controllers/projectController';
import { promises as fs } from 'fs';
import { createContext, TestContext, mockDacFxResult } from './testContext';
import { Project, SystemDatabase, ProjectEntry, reservedProjectFolders } from '../models/project';
import { DeployDatabaseDialog } from '../dialogs/deployDatabaseDialog';
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
import { ApiWrapper } from '../common/apiWrapper';
import { IDeploymentProfile, IGenerateScriptProfile } from '../models/IDeploymentProfile';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
import { exists } from '../common/utils';
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
import { FolderNode } from '../models/tree/fileFolderTreeItem';
@@ -219,41 +219,41 @@ describe('ProjectsController: project controller operations', function (): void
});
});
describe('Deployment and deployment script generation', function (): void {
it('Deploy dialog should open from ProjectController', async function (): Promise<void> {
describe('Publishing and script generation', function (): void {
it('Publish dialog should open from ProjectController', async function (): Promise<void> {
let opened = false;
let deployDialog = TypeMoq.Mock.ofType(DeployDatabaseDialog);
deployDialog.setup(x => x.openDialog()).returns(() => { opened = true; });
let publishDialog = TypeMoq.Mock.ofType(PublishDatabaseDialog);
publishDialog.setup(x => x.openDialog()).returns(() => { opened = true; });
let projController = TypeMoq.Mock.ofType(ProjectsController);
projController.callBase = true;
projController.setup(x => x.getDeployDialog(TypeMoq.It.isAny())).returns(() => deployDialog.object);
projController.setup(x => x.getPublishDialog(TypeMoq.It.isAny())).returns(() => publishDialog.object);
await projController.object.deployProject(new Project('FakePath'));
await projController.object.publishProject(new Project('FakePath'));
should(opened).equal(true);
});
it('Callbacks are hooked up and called from Deploy dialog', async function (): Promise<void> {
it('Callbacks are hooked up and called from Publish dialog', async function (): Promise<void> {
const projPath = path.dirname(await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline));
await testUtils.createTestDataSources(baselines.openDataSourcesBaseline, projPath);
const proj = new Project(projPath);
const deployHoller = 'hello from callback for deploy()';
const publishHoller = 'hello from callback for publish()';
const generateHoller = 'hello from callback for generateScript()';
const profileHoller = 'hello from callback for readPublishProfile()';
let holler = 'nothing';
let deployDialog = TypeMoq.Mock.ofType(DeployDatabaseDialog, undefined, undefined, new ApiWrapper(), proj);
deployDialog.callBase = true;
deployDialog.setup(x => x.getConnectionUri()).returns(async () => 'fake|connection|uri');
let publishDialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, new ApiWrapper(), proj);
publishDialog.callBase = true;
publishDialog.setup(x => x.getConnectionUri()).returns(async () => 'fake|connection|uri');
let projController = TypeMoq.Mock.ofType(ProjectsController);
projController.callBase = true;
projController.setup(x => x.getDeployDialog(TypeMoq.It.isAny())).returns(() => deployDialog.object);
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IDeploymentProfile => true))).returns(async () => {
holler = deployHoller;
projController.setup(x => x.getPublishDialog(TypeMoq.It.isAny())).returns(() => publishDialog.object);
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IPublishSettings => true))).returns(async () => {
holler = publishHoller;
return undefined;
});
projController.setup(x => x.readPublishProfile(TypeMoq.It.isAny())).returns(async () => {
@@ -264,22 +264,22 @@ describe('ProjectsController: project controller operations', function (): void
};
});
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IGenerateScriptProfile => true))).returns(async () => {
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IGenerateScriptSettings => true))).returns(async () => {
holler = generateHoller;
return undefined;
});
let dialog = await projController.object.deployProject(proj);
await dialog.deployClick();
let dialog = await projController.object.publishProject(proj);
await dialog.publishClick();
should(holler).equal(deployHoller, 'executionCallback() is supposed to have been setup and called for Deploy scenario');
should(holler).equal(publishHoller, 'executionCallback() is supposed to have been setup and called for Publish scenario');
dialog = await projController.object.deployProject(proj);
dialog = await projController.object.publishProject(proj);
await dialog.generateScriptClick();
should(holler).equal(generateHoller, 'executionCallback() is supposed to have been setup and called for GenerateScript scenario');
dialog = await projController.object.deployProject(proj);
dialog = await projController.object.publishProject(proj);
await projController.object.readPublishProfile(vscode.Uri.parse('test'));
should(holler).equal(profileHoller, 'executionCallback() is supposed to have been setup and called for ReadPublishProfile scenario');
@@ -296,15 +296,15 @@ describe('ProjectsController: project controller operations', function (): void
should(result.sqlCmdVariables['ProdDatabaseName']).equal('MyProdDatabase');
});
it('Should copy dacpac to temp folder before deploying', async function (): Promise<void> {
it('Should copy dacpac to temp folder before publishing', async function (): Promise<void> {
const fakeDacpacContents = 'SwiftFlewHiawathasArrow';
let postCopyContents = '';
let builtDacpacPath = '';
let deployedDacpacPath = '';
let publishedDacpacPath = '';
testContext.dacFxService.setup(x => x.generateDeployScript(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(async (p) => {
deployedDacpacPath = p;
postCopyContents = (await fs.readFile(deployedDacpacPath)).toString();
publishedDacpacPath = p;
postCopyContents = (await fs.readFile(publishedDacpacPath)).toString();
return Promise.resolve(mockDacFxResult);
});
@@ -321,9 +321,9 @@ describe('ProjectsController: project controller operations', function (): void
await projController.object.executionCallback(new Project(''), { connectionUri: '', databaseName: '' });
should(builtDacpacPath).not.equal('', 'built dacpac path should be set');
should(deployedDacpacPath).not.equal('', 'deployed dacpac path should be set');
should(builtDacpacPath).not.equal(deployedDacpacPath, 'built and deployed dacpac paths should be different');
should(postCopyContents).equal(fakeDacpacContents, 'contents of built and deployed dacpacs should match');
should(publishedDacpacPath).not.equal('', 'published dacpac path should be set');
should(builtDacpacPath).not.equal(publishedDacpacPath, 'built and published dacpac paths should be different');
should(postCopyContents).equal(fakeDacpacContents, 'contents of built and published dacpacs should match');
});
});
});

View File

@@ -9,20 +9,20 @@ import * as os from 'os';
import * as vscode from 'vscode';
import * as baselines from './baselines/baselines';
import * as templates from '../templates/templates';
import * as testUtils from '../test/testUtils';
import * as testUtils from './testUtils';
import * as TypeMoq from 'typemoq';
import { DeployDatabaseDialog } from '../dialogs/deployDatabaseDialog';
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
import { Project } from '../models/project';
import { SqlDatabaseProjectTreeViewProvider } from '../controllers/databaseProjectTreeViewProvider';
import { ProjectsController } from '../controllers/projectController';
import { createContext, TestContext } from './testContext';
import { IDeploymentProfile, IGenerateScriptProfile } from '../models/IDeploymentProfile';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
let testContext: TestContext;
describe.skip('Deploy Database Dialog', () => {
describe.skip('Publish Database Dialog', () => {
before(async function (): Promise<void> {
await templates.loadTemplates(path.join(__dirname, '..', '..', 'resources', 'templates'));
await baselines.loadBaselines();
@@ -38,9 +38,9 @@ describe.skip('Deploy Database Dialog', () => {
const projFilePath = await projController.createNewProject('TestProjectName', vscode.Uri.file(projFileDir), true, 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575');
const project = new Project(projFilePath);
const deployDatabaseDialog = new DeployDatabaseDialog(testContext.apiWrapper.object, project);
deployDatabaseDialog.openDialog();
should.notEqual(deployDatabaseDialog.deployTab, undefined);
const publishDatabaseDialog = new PublishDatabaseDialog(testContext.apiWrapper.object, project);
publishDatabaseDialog.openDialog();
should.notEqual(publishDatabaseDialog.publishTab, undefined);
});
it('Should create default database name correctly ', async function (): Promise<void> {
@@ -51,20 +51,20 @@ describe.skip('Deploy Database Dialog', () => {
const projFilePath = await projController.createNewProject('TestProjectName', vscode.Uri.file(projFileDir), true, 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575');
const project = new Project(projFilePath);
const deployDatabaseDialog = new DeployDatabaseDialog(testContext.apiWrapper.object, project);
should.equal(deployDatabaseDialog.getDefaultDatabaseName(), project.projectFileName);
const publishDatabaseDialog = new PublishDatabaseDialog(testContext.apiWrapper.object, project);
should.equal(publishDatabaseDialog.getDefaultDatabaseName(), project.projectFileName);
});
it('Should include all info in deployment profile', async function (): Promise<void> {
it('Should include all info in publish profile', async function (): Promise<void> {
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
const dialog = TypeMoq.Mock.ofType(DeployDatabaseDialog, undefined, undefined, testContext.apiWrapper.object, proj);
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, testContext.apiWrapper.object, proj);
dialog.setup(x => x.getConnectionUri()).returns(async () => { return 'Mock|Connection|Uri'; });
dialog.setup(x => x.getTargetDatabaseName()).returns(() => 'MockDatabaseName');
dialog.callBase = true;
let profile: IDeploymentProfile | IGenerateScriptProfile | undefined;
let profile: IPublishSettings | IGenerateScriptSettings | undefined;
const expectedDeploy: IDeploymentProfile = {
const expectedPublish: IPublishSettings = {
databaseName: 'MockDatabaseName',
connectionUri: 'Mock|Connection|Uri',
upgradeExisting: true,
@@ -74,12 +74,12 @@ describe.skip('Deploy Database Dialog', () => {
}
};
dialog.object.deploy = async (_, prof) => { profile = prof; };
await dialog.object.deployClick();
dialog.object.publish = async (_, prof) => { profile = prof; };
await dialog.object.publishClick();
should(profile).deepEqual(expectedDeploy);
should(profile).deepEqual(expectedPublish);
const expectedGenScript: IGenerateScriptProfile = {
const expectedGenScript: IGenerateScriptSettings = {
databaseName: 'MockDatabaseName',
connectionUri: 'Mock|Connection|Uri',
sqlCmdVariables: {