mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Adding SQL Edge project template (#13558)
* Checkpoint * removing flag for not creating subfolder * Adding Edge template * Removing janky map function * Adding templates for additional objects * Updating tests, fixing bug * Added Edge project icon * Updating strings to Drew-approved text * Cleaning up template scripts and Edge project template names
This commit is contained in:
@@ -16,6 +16,7 @@ import { PublishDatabaseDialog } from '../../dialogs/publishDatabaseDialog';
|
||||
import { Project } from '../../models/project';
|
||||
import { ProjectsController } from '../../controllers/projectController';
|
||||
import { IPublishSettings, IGenerateScriptSettings } from '../../models/IPublishSettings';
|
||||
import { emptySqlDatabaseProjectTypeId } from '../../common/constants';
|
||||
|
||||
describe.skip('Publish Database Dialog', () => {
|
||||
before(async function (): Promise<void> {
|
||||
@@ -27,7 +28,13 @@ describe.skip('Publish Database Dialog', () => {
|
||||
const projController = new ProjectsController();
|
||||
const projFileDir = path.join(os.tmpdir(), `TestProject_${new Date().getTime()}`);
|
||||
|
||||
const projFilePath = await projController.createNewProject('TestProjectName', vscode.Uri.file(projFileDir), true, 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575');
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
folderUri: vscode.Uri.file(projFileDir),
|
||||
projectTypeId: emptySqlDatabaseProjectTypeId,
|
||||
projectGuid: 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575'
|
||||
});
|
||||
|
||||
const project = new Project(projFilePath);
|
||||
const publishDatabaseDialog = new PublishDatabaseDialog(project);
|
||||
publishDatabaseDialog.openDialog();
|
||||
@@ -39,7 +46,13 @@ describe.skip('Publish Database Dialog', () => {
|
||||
const projFolder = `TestProject_${new Date().getTime()}`;
|
||||
const projFileDir = path.join(os.tmpdir(), projFolder);
|
||||
|
||||
const projFilePath = await projController.createNewProject('TestProjectName', vscode.Uri.file(projFileDir), true, 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575');
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
folderUri: vscode.Uri.file(projFileDir),
|
||||
projectTypeId: emptySqlDatabaseProjectTypeId,
|
||||
projectGuid: 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575'
|
||||
});
|
||||
|
||||
const project = new Project(projFilePath);
|
||||
|
||||
const publishDatabaseDialog = new PublishDatabaseDialog(project);
|
||||
@@ -55,7 +68,7 @@ describe.skip('Publish Database Dialog', () => {
|
||||
|
||||
let profile: IPublishSettings | IGenerateScriptSettings | undefined;
|
||||
|
||||
const expectedPublish: IPublishSettings = {
|
||||
const expectedPublish: IPublishSettings = {
|
||||
databaseName: 'MockDatabaseName',
|
||||
connectionUri: 'Mock|Connection|Uri',
|
||||
upgradeExisting: true,
|
||||
|
||||
@@ -54,7 +54,12 @@ describe('ProjectsController', function (): void {
|
||||
const projController = new ProjectsController();
|
||||
const projFileDir = path.join(os.tmpdir(), `TestProject_${new Date().getTime()}`);
|
||||
|
||||
const projFilePath = await projController.createNewProject('TestProjectName', vscode.Uri.file(projFileDir), false, 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575');
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
folderUri: vscode.Uri.file(projFileDir),
|
||||
projectTypeId: constants.emptySqlDatabaseProjectTypeId,
|
||||
projectGuid: 'BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575'
|
||||
});
|
||||
|
||||
let projFileText = (await fs.readFile(projFilePath)).toString();
|
||||
|
||||
@@ -152,6 +157,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should delete nested ProjectEntry from node', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(templates.newSqlProjectTemplate);
|
||||
|
||||
const setupResult = await setupDeleteExcludeTest(proj);
|
||||
const scriptEntry = setupResult[0], projTreeRoot = setupResult[1], preDeployEntry = setupResult[2], postDeployEntry = setupResult[3], noneEntry = setupResult[4];
|
||||
|
||||
@@ -436,7 +442,15 @@ describe('ProjectsController', function (): void {
|
||||
const createProjectFromDatabaseDialog = TypeMoq.Mock.ofType(CreateProjectFromDatabaseDialog, undefined, undefined, undefined);
|
||||
createProjectFromDatabaseDialog.callBase = true;
|
||||
createProjectFromDatabaseDialog.setup(x => x.handleCreateButtonClick()).returns(async () => {
|
||||
await projController.object.createProjectFromDatabaseCallback( { serverId: 'My Id', database: 'My Database', projName: 'testProject', filePath: 'testLocation', version: '1.0.0.0', extractTarget: mssql.ExtractTarget['schemaObjectType'] });
|
||||
await projController.object.createProjectFromDatabaseCallback({
|
||||
serverId: 'My Id',
|
||||
database: 'My Database',
|
||||
projName: 'testProject',
|
||||
filePath: 'testLocation',
|
||||
version: '1.0.0.0',
|
||||
extractTarget: mssql.ExtractTarget['schemaObjectType']
|
||||
});
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ describe('Templates: loading templates from disk', function (): void {
|
||||
});
|
||||
|
||||
it('Should throw error when attempting to use templates before loaded from file', async function (): Promise<void> {
|
||||
await shouldThrowSpecificError(() => templates.projectScriptTypeMap(), 'Templates must be loaded from file before attempting to use.');
|
||||
await shouldThrowSpecificError(() => templates.projectScriptTypes(), 'Templates must be loaded from file before attempting to use.');
|
||||
await shouldThrowSpecificError(() => templates.get('foobar'), 'Templates must be loaded from file before attempting to use.');
|
||||
await shouldThrowSpecificError(() => templates.get('foobar'), 'Templates must be loaded from file before attempting to use.');
|
||||
});
|
||||
|
||||
it('Should load all templates from files', async function (): Promise<void> {
|
||||
@@ -23,7 +23,7 @@ describe('Templates: loading templates from disk', function (): void {
|
||||
|
||||
// check expected counts
|
||||
|
||||
const numScriptObjectTypes = 7;
|
||||
const numScriptObjectTypes = 10;
|
||||
|
||||
should(templates.projectScriptTypes().length).equal(numScriptObjectTypes);
|
||||
should(Object.keys(templates.projectScriptTypes()).length).equal(numScriptObjectTypes);
|
||||
|
||||
@@ -28,6 +28,7 @@ export async function shouldThrowSpecificError(block: Function, expectedMessage:
|
||||
}
|
||||
|
||||
export async function createTestSqlProjFile(contents: string, folderPath?: string): Promise<string> {
|
||||
folderPath = folderPath ?? path.join(await generateTestFolderPath(), 'TestProject');
|
||||
return await createTestFile(contents, 'TestProject.sqlproj', folderPath);
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ export async function createTestDataSources(contents: string, folderPath?: strin
|
||||
}
|
||||
|
||||
export async function generateTestFolderPath(): Promise<string> {
|
||||
const folderPath = path.join(os.tmpdir(), `TestProject_${new Date().getTime()}`);
|
||||
const folderPath = path.join(os.tmpdir(), `TestRun_${new Date().getTime()}`);
|
||||
await fs.mkdir(folderPath, { recursive: true });
|
||||
|
||||
return folderPath;
|
||||
@@ -55,6 +56,7 @@ export async function createTestFile(contents: string, fileName: string, folderP
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* TestFolder directory structure
|
||||
* - file1.sql
|
||||
|
||||
Reference in New Issue
Block a user