Skip to content

Commit

Permalink
now everything is pretty, but still needs some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Huber committed Aug 30, 2018
1 parent b1348ad commit 4524b3b
Show file tree
Hide file tree
Showing 179 changed files with 9,481 additions and 7,543 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"esversion": 6,
"bitwise": true,
"curly": false,
"eqeqeq": false,
Expand Down
4 changes: 2 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"printWidth": 80,
"parser": "typescript",
"parser": "flow",
"arrowParens" : "always",
"tabWidth": 2,
"useTabs":false,
"semi":true,
"singleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"requirePragma": true,
"requirePragma": false,
"insertPragma": true,
"proseWrap": "never"
}
94 changes: 51 additions & 43 deletions bin/azurite
Original file line number Diff line number Diff line change
@@ -1,59 +1,67 @@
#!/usr/bin/env node

'use strict';
"use strict";

const BbPromise = require('bluebird');
const BbPromise = require("bluebird");

process.on('unhandledRejection', (e) => {
console.error('**PANIC** Something unexpected happened! Emulator may be in an inconsistent state!');
console.error(e);
process.on("unhandledRejection", (e) => {
console.error(
"**PANIC** Something unexpected happened! Emulator may be in an inconsistent state!"
);
console.error(e);
});
process.noDeprecation = true;

(() => BbPromise.resolve().then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require('minimist')(process.argv.slice(2)),
env = require('./../lib/core/env'),
cli = require('./../lib/core/cli');
(() =>
BbPromise.resolve()
.then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require("minimist")(process.argv.slice(2)),
env = require("./../lib/core/env"),
cli = require("./../lib/core/cli");

return env.init(argv)
return env
.init(argv)
.then(() => {
if (!env.silent) {
cli.asciiGreeting();
}
if (!env.silent) {
cli.asciiGreeting();
}
})
.then(() => {
// Forking individual modules to spread them across different cores if possible
// and restarting them automatically in case of a crash.
const fork = require('child_process').fork;

(function forkBlobModule(code, signal) {
const mod = fork(env.blobModulePath, process.argv);
mod.on('exit', forkBlobModule);
})();
(function forkQueueModule(code, signal) {
const mod = fork(env.queueModulePath, process.argv);
mod.on('exit', forkQueueModule);
})();
(function forkTableModule(code, signal) {
const mod = fork(env.tableModulePath, process.argv);
mod.on('exit', forkTableModule);
})();
// Forking individual modules to spread them across different cores if possible
// and restarting them automatically in case of a crash.
const fork = require("child_process").fork;

(function forkBlobModule(code, signal) {
const mod = fork(env.blobModulePath, process.argv);
mod.on("exit", forkBlobModule);
})();
(function forkQueueModule(code, signal) {
const mod = fork(env.queueModulePath, process.argv);
mod.on("exit", forkQueueModule);
})();
(function forkTableModule(code, signal) {
const mod = fork(env.tableModulePath, process.argv);
mod.on("exit", forkTableModule);
})();
});
}).catch(e => {
process.exitCode = 1;
console.error(e);
}))();
})
.catch((e) => {
process.exitCode = 1;
console.error(e);
}))();

// If this is a child process (e.g. forked by NPM through '$ npm start') we are propagating the signals from the
// If this is a child process (e.g. forked by NPM through '$ npm start') we are propagating the signals from the
// parent (i.e. NPM) to exit from this process and its child processes.
process.on('SIGINT', () => { // e.g. STRG+C
process.exitCode = 1;
process.exit();
process.on("SIGINT", () => {
// e.g. STRG+C
process.exitCode = 1;
process.exit();
});

process.on('SIGTERM', () => { // e.g. end process from taskmanager
process.exitCode = 1;
process.exit();
});
process.on("SIGTERM", () => {
// e.g. end process from taskmanager
process.exitCode = 1;
process.exit();
});
37 changes: 21 additions & 16 deletions bin/blob
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
#!/usr/bin/env node

'use strict';
"use strict";

const BbPromise = require('bluebird');
const BbPromise = require("bluebird");

process.on('unhandledRejection', (e) => {
console.error('**PANIC** Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!');
console.error(e);
process.on("unhandledRejection", (e) => {
console.error(
"**PANIC** Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!"
);
console.error(e);
});
process.noDeprecation = true;

(() => BbPromise.resolve().then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require('minimist')(process.argv.slice(2));
const A = require('../lib/AzuriteBlob'),
azurite = new A();
azurite.init(argv);
}).catch(e => {
process.exitCode = 1;
console.error(e);
}))();
(() =>
BbPromise.resolve()
.then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require("minimist")(process.argv.slice(2));
const A = require("../lib/AzuriteBlob"),
azurite = new A();
azurite.init(argv);
})
.catch((e) => {
process.exitCode = 1;
console.error(e);
}))();
37 changes: 21 additions & 16 deletions bin/queue
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
#!/usr/bin/env node

'use strict';
"use strict";

const BbPromise = require('bluebird');
const BbPromise = require("bluebird");

process.on('unhandledRejection', (e) => {
console.error('**PANIC** Something unexpected happened! Queue Storage Emulator may be in an inconsistent state!');
console.error(e);
process.on("unhandledRejection", (e) => {
console.error(
"**PANIC** Something unexpected happened! Queue Storage Emulator may be in an inconsistent state!"
);
console.error(e);
});
process.noDeprecation = true;

(() => BbPromise.resolve().then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require('minimist')(process.argv.slice(2));
const A = require('../lib/AzuriteQueue'),
azurite = new A();
azurite.init(argv);
}).catch(e => {
process.exitCode = 1;
console.error(e);
}))();
(() =>
BbPromise.resolve()
.then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require("minimist")(process.argv.slice(2));
const A = require("../lib/AzuriteQueue"),
azurite = new A();
azurite.init(argv);
})
.catch((e) => {
process.exitCode = 1;
console.error(e);
}))();
37 changes: 21 additions & 16 deletions bin/table
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
#!/usr/bin/env node

'use strict';
"use strict";

const BbPromise = require('bluebird');
const BbPromise = require("bluebird");

process.on('unhandledRejection', (e) => {
console.error('**PANIC** Something unexpected happened! Table Storage Emulator may be in an inconsistent state!');
console.error(e);
process.on("unhandledRejection", (e) => {
console.error(
"**PANIC** Something unexpected happened! Table Storage Emulator may be in an inconsistent state!"
);
console.error(e);
});
process.noDeprecation = true;

(() => BbPromise.resolve().then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require('minimist')(process.argv.slice(2));
const A = require('../lib/AzuriteTable'),
azurite = new A();
azurite.init(argv);
}).catch(e => {
process.exitCode = 1;
console.error(e);
}))();
(() =>
BbPromise.resolve()
.then(() => {
// requiring here so that if anything went wrong,
// during require, it will be caught.
const argv = require("minimist")(process.argv.slice(2));
const A = require("../lib/AzuriteTable"),
azurite = new A();
azurite.init(argv);
})
.catch((e) => {
process.exitCode = 1;
console.error(e);
}))();
56 changes: 32 additions & 24 deletions externaltests/azure-storage-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,44 @@
* NOCK_OFF=true
* AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
* this is automatically handled via env-cmd in the package.json for npm run test
*
* @format
*/

const fs = require('fs'),
path = require('path'),
Azurite = require('./../lib/AzuriteBlob');
const fs = require("fs"),
path = require("path"),
Azurite = require("./../lib/AzuriteBlob");

function requireTestDir(dir) {
fs.readdirSync('./externaltests/azure-storage-node/test' + dir).map((file) => {
if(file.endsWith('.js')) require('./azure-storage-node/test' + dir + path.sep + file.slice(0,-3));
})
fs.readdirSync("./externaltests/azure-storage-node/test" + dir).map(
(file) => {
if (file.endsWith(".js"))
require("./azure-storage-node/test" +
dir +
path.sep +
file.slice(0, -3));
}
);
}

describe('azure-storage-node tests', () => {
const azurite = new Azurite();
before(() => {
const location = path.join(process.env.AZURITE_LOCATION, 'AZURE-STORAGE');
return azurite.init({ l: location, silent: 'true', overwrite: 'true' });
});
describe("azure-storage-node tests", () => {
const azurite = new Azurite();
before(() => {
const location = path.join(process.env.AZURITE_LOCATION, "AZURE-STORAGE");
return azurite.init({ l: location, silent: "true", overwrite: "true" });
});

//requireTestDir('');
// Currently runs azure-storage tests individually, until we implement a playlist definition
// require('./azure-storage-node/test/services/blob/blobservice-archive-tests');
require('./azure-storage-node/test/services/blob/blobservice-container-tests');
// require('./azure-storage-node/test/services/blob/blobservice-lease-tests');
// require('./azure-storage-node/test/services/blob/blobservice-sse-tests');
// require('./azure-storage-node/test/services/blob/blobservice-tests');
// require('./azure-storage-node/test/services/blob/blobservice-uploaddownload-tests');
// require('./azure-storage-node/test/services/blob/blobservice-uploaddownload-scale-tests');
//requireTestDir('');
// Currently runs azure-storage tests individually, until we implement a playlist definition
// require('./azure-storage-node/test/services/blob/blobservice-archive-tests');
require("./azure-storage-node/test/services/blob/blobservice-container-tests");
// require('./azure-storage-node/test/services/blob/blobservice-lease-tests');
// require('./azure-storage-node/test/services/blob/blobservice-sse-tests');
// require('./azure-storage-node/test/services/blob/blobservice-tests');
// require('./azure-storage-node/test/services/blob/blobservice-uploaddownload-tests');
// require('./azure-storage-node/test/services/blob/blobservice-uploaddownload-scale-tests');

after(() => {
return azurite.close();
});
after(() => {
return azurite.close();
});
});
Loading

0 comments on commit 4524b3b

Please sign in to comment.