Create Container tested
This commit is contained in:
1 parent
31a22bec3f
commit
27bc8ac267
3 files changed
+46
-15
No files matched your search
@@ -1,8 +1,5 @@
|
||||
exports.newTeamSetup = function newTeamSetup() {
|
||||
|
||||
CONSOLE_LOG = true;
|
||||
LOG_FILE_CONTENT = false;
|
||||
|
||||
let thisObject = {
|
||||
newTeam: newTeam,
|
||||
initialize: initialize
|
||||
@@ -61,11 +58,24 @@
|
||||
console.log("[ERROR] TeamSetup -> newTeam -> createContainer -> onContainerCreated -> Could not create the container. ");
|
||||
console.log("[ERROR] TeamSetup -> newTeam -> createContainer -> onContainerCreated -> err.message = " + err.message);
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
if (err.message === "ContainerAlreadyExists") {
|
||||
|
||||
let err = {
|
||||
resutl: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
message: "Team Name already taken"
|
||||
};
|
||||
|
||||
callBackFunction(err);
|
||||
|
||||
} else {
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
addToEcosystem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-10
@@ -87,9 +87,9 @@
|
||||
|
||||
if (err !== null || text === null) {
|
||||
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> err = " + JSON.stringify(err)); }
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> Returning an empty JSON object string. "); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> err = " + JSON.stringify(err)); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> readData -> onFileReceived -> Returning an empty JSON object string. "); }
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
@@ -157,8 +157,8 @@
|
||||
|
||||
if (err !== null || text === null) {
|
||||
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> writeData -> onFileCreated -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> writeData -> onFileCreated -> err = " + JSON.stringify(err)); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> writeData -> onFileCreated -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> writeData -> onFileCreated -> err = " + JSON.stringify(err)); }
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
@@ -180,7 +180,7 @@
|
||||
}
|
||||
|
||||
|
||||
function createContainer(pContainerName, pPath, pFile, pFileContent, callBackFunction) {
|
||||
function createContainer(pContainerName, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -207,22 +207,42 @@
|
||||
|
||||
let blobService = storage.createBlobService(connectionString);
|
||||
|
||||
pContainerName.toLowerCase();
|
||||
let containerName = pContainerName.toLowerCase();
|
||||
|
||||
blobService.createContainer(pContainerName, onContainerCreated);
|
||||
blobService.createContainer(containerName, onContainerCreated);
|
||||
|
||||
function onContainerCreated(err) {
|
||||
|
||||
if (err) {
|
||||
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> createContainer -> onContainerCreated -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_LOG === true) { console.log("[ERROR] Storage -> createContainer -> onContainerCreated -> err = " + JSON.stringify(err)); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> createContainer -> onContainerCreated -> Error Received from Storage Library. "); }
|
||||
if (CONSOLE_ERROR_LOG === true) { console.log("[ERROR] Storage -> createContainer -> onContainerCreated -> err = " + JSON.stringify(err)); }
|
||||
|
||||
|
||||
/* ContainerAlreadyExists check */
|
||||
|
||||
if (JSON.stringify(err).indexOf("ContainerAlreadyExists") > 0) {
|
||||
|
||||
let err = {
|
||||
resutl: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
message: "ContainerAlreadyExists"
|
||||
};
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user