added azure related code

Change-Id: Iec028f76f0260fa50a3c0eaa14536ea7dfcf5d72
Signed-off-by: Rohan Patel <rp5811@att.com>
diff --git a/otf-camunda/docker/Dockerfile b/otf-camunda/docker/Dockerfile
index d63564e..38a3ad0 100644
--- a/otf-camunda/docker/Dockerfile
+++ b/otf-camunda/docker/Dockerfile
@@ -9,8 +9,8 @@
 ENV OTF_MONGO_HOSTS=localhost:27017

 ENV OTF_MONGO_REPLICASET=rs0

 ENV OTF_MONGO_DATABASE=otf

-ENV OTF_CAMUNDA_DB_URL=localhost:3306/camunda

-ENV OTF_CAMUNDA_DB_USERNAME=root

+ENV OTF_CAMUNDA_DB_URL=localhost:3306/otf-camunda

+ENV OTF_CAMUNDA_DB_USERNAME=username

 ENV OTF_CAMUNDA_DB_PASSWORD=password

 ENV AAF_PERM_TYPE=type

 ENV CADI_HOSTNAME=localhost

diff --git a/otf-camunda/pom.xml b/otf-camunda/pom.xml
index ad4deb3..4fa0994 100644
--- a/otf-camunda/pom.xml
+++ b/otf-camunda/pom.xml
@@ -74,7 +74,7 @@
     </dependency>

     <dependency>

       <groupId>org.camunda.bpm.springboot</groupId>

-      <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>

+      <artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>

       <version>${camunda.springboot.version}</version>

     </dependency>

     <dependency>

@@ -292,12 +292,12 @@
 

     <cadi.version>2.1.10</cadi.version>

     <docker.registry>registry.hub.docker.io</docker.registry>

-    <camunda.version>7.10.0</camunda.version>

+    <camunda.version>7.10.0-ee</camunda.version>

     <camunda.bpm.assert.version>2.0-alpha2</camunda.bpm.assert.version>

     <camunda.bpm.base.version>7.10.0</camunda.bpm.base.version>

     <camunda.bpm.mail.version>1.1.0</camunda.bpm.mail.version>

     <camunda.bpm.reactor.version>2.1.2</camunda.bpm.reactor.version>

-    <camunda.bpm.version>7.10.4</camunda.bpm.version>

+    <camunda.bpm.version>7.10.4-ee</camunda.bpm.version>

     <camunda.bpm.external-task-client.version>1.1.1</camunda.bpm.external-task-client.version>

     <camunda.mockito.version>3.2.1</camunda.mockito.version>

     <camunda.spin.version>1.6.6</camunda.spin.version>

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/CallTestHeadDelegate.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/CallTestHeadDelegate.java
index 45511b0..b47dd13 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/CallTestHeadDelegate.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/CallTestHeadDelegate.java
@@ -224,8 +224,10 @@
 //    WorkflowTask.printWorkflowTaskResources();

   }

 

-  private void saveTestHeadResults(String businessKey) {

+  private void saveTestHeadResults(String businessKey, String groupId) {

     Query query = new Query();

+    //TODO: Update needs to be changed to work with Azure

+    query.addCriteria(Criteria.where("groupId").is(groupId));

     query.addCriteria(Criteria.where("businessKey").is(businessKey));

     Update update = new Update();

     update.set("testHeadResults", testHeadResults);

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/LogTestResultDelegate.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/LogTestResultDelegate.java
index 0ecb37e..8d01f8c 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/LogTestResultDelegate.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/LogTestResultDelegate.java
@@ -16,13 +16,13 @@
 

 package org.oran.otf.camunda.delegate.otf.common;

 

+import com.mongodb.client.result.UpdateResult;

 import org.oran.otf.camunda.exception.TestExecutionException;

 import org.oran.otf.camunda.model.ExecutionConstants;

 import org.oran.otf.camunda.workflow.utility.WorkflowUtility;

 import org.oran.otf.common.model.TestExecution;

 import org.oran.otf.common.repository.TestExecutionRepository;

 import org.oran.otf.common.utility.Utility;

-import com.mongodb.client.result.UpdateResult;

 

 import java.util.Arrays;

 import java.util.Date;

@@ -90,6 +90,8 @@
     // processBusinessKey from the delegate execution because it is saved to the database before the

     // user can modify the value.

     Query query = new Query();

+    //TODO: Update query needs to be changed for Azure

+    query.addCriteria((Criteria.where("groupId").is(testExecution.getGroupId())));

     query.addCriteria(Criteria.where("businessKey").is(execution.getProcessBusinessKey()));

     Update update = new Update();

     update.set("testResult", testExecution.getTestResult());

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/PostResultsToDMaaPDelegate.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/PostResultsToDMaaPDelegate.java
index 41b9d8a..c3395be 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/PostResultsToDMaaPDelegate.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/PostResultsToDMaaPDelegate.java
@@ -44,6 +44,7 @@
 import org.springframework.stereotype.Component;

 

 @Component

+@Conditional(value= FilterCondition.class)

 public class PostResultsToDMaaPDelegate implements JavaDelegate {

 

   private static Logger logger = LoggerFactory.getLogger(PostResultsToDMaaPDelegate.class);

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/AsynchronousTestInstanceCallable.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/AsynchronousTestInstanceCallable.java
index 680688c..67e8bd1 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/AsynchronousTestInstanceCallable.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/AsynchronousTestInstanceCallable.java
@@ -146,6 +146,8 @@
       // Add the testExecution to the parentTestExecution

       parentTestExecution.getTestInstanceResults().add(testExecution);

       Query query = new Query();

+      //TODO: Update for Azure

+      query.addCriteria((Criteria.where("groupId").is(parentTestExecution.getGroupId())));

       query.addCriteria(Criteria.where("_id").is(parentTestExecution.get_id()));

       // Also add businessKey as a criteria because the object won't be found if the business key

       // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/SynchronousTestInstanceCallable.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/SynchronousTestInstanceCallable.java
index cffdc1e..87559e9 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/SynchronousTestInstanceCallable.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/SynchronousTestInstanceCallable.java
@@ -164,6 +164,8 @@
       // Add the testExecution to the parentTestExecution

       parentTestExecution.getTestInstanceResults().add(testExecution);

       Query query = new Query();

+      //TODO: Update for Azure

+      query.addCriteria((Criteria.where("groupId").is(parentTestExecution.getGroupId())));

       query.addCriteria(Criteria.where("_id").is(parentTestExecution.get_id()));

       // Also add businessKey as a criteria because the object won't be found if the business key

       // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/TestHeadCallable.java b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/TestHeadCallable.java
index d0ee267..1121b8a 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/TestHeadCallable.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/delegate/otf/common/runnable/TestHeadCallable.java
@@ -209,6 +209,8 @@
 

   private void saveResult(TestExecution testExecution) {

     Query query = new Query();

+    //TODO: Update for Azure

+    query.addCriteria((Criteria.where("groupId").is(testExecution.getGroupId())));

     query.addCriteria(Criteria.where("_id").is(testExecution.get_id()));

     // Also add businessKey as a criteria because the object won't be found if the business key

     // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/listener/StartEventListener.java b/otf-camunda/src/main/java/org/oran/otf/camunda/listener/StartEventListener.java
index 9fa6d14..b8a7424 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/listener/StartEventListener.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/listener/StartEventListener.java
@@ -20,6 +20,7 @@
 import org.oran.otf.camunda.model.ExecutionConstants;

 import org.oran.otf.camunda.workflow.utility.WorkflowUtility;

 import org.oran.otf.common.model.TestExecution;

+import org.oran.otf.common.repository.TestExecutionRepository;

 import org.oran.otf.common.utility.Utility;

 import com.google.gson.JsonObject;

 import com.mongodb.client.result.UpdateResult;

@@ -83,8 +84,9 @@
     testExecution.setTestResult(result);

     testExecution.setProcessInstanceId(execution.getProcessInstanceId());

 

-

     Query query = new Query();

+    //TODO: Update needs new query for Azure

+    query.addCriteria((Criteria.where("groupId").is(testExecution.getGroupId())));

     query.addCriteria(Criteria.where("businessKey").is(execution.getProcessBusinessKey()));

     Update update = new Update();

     update.set("testResult", testExecution.getTestResult());

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/WorkflowProcessor.java b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/WorkflowProcessor.java
index 10a1dfd..3230fb7 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/WorkflowProcessor.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/WorkflowProcessor.java
@@ -345,6 +345,8 @@
             // available.

             testExecution.setProcessInstanceId(processInstance.getProcessInstanceId());

             Query query = new Query();

+            //TODO: Update for Azure

+            query.addCriteria((Criteria.where("groupId").is(testExecution.getGroupId())));

             query.addCriteria(Criteria.where("_id").is(testExecution.get_id()));

             // Also add businessKey as a criteria because the object won't be found if the business key

             // was somehow modified in the workflow.

@@ -407,6 +409,8 @@
             // available.

             testExecution.setProcessInstanceId(processInstance.getProcessInstanceId());

             Query query = new Query();

+            //TODO: Update for Azure

+            query.addCriteria((Criteria.where("groupId").is(testExecution.getGroupId())));

             query.addCriteria(Criteria.where("_id").is(testExecution.get_id()));

             // Also add businessKey as a criteria because the object won't be found if the business key

             // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/ExternalTaskIncidentHandler.java b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/ExternalTaskIncidentHandler.java
index 0e7d2ca..0cd4397 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/ExternalTaskIncidentHandler.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/ExternalTaskIncidentHandler.java
@@ -107,6 +107,7 @@
     testExecution.setTestResult(testResult);

     testExecution.setTestResultMessage(testResultMessage);

     Query query = new Query();

+    query.addCriteria(Criteria.where("groupId").is(testExecution.getGroupId()));

     query.addCriteria(Criteria.where("_id").is(testExecution.get_id()));

     // Also add businessKey as a criteria because the object won't be found if the business key

     // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/FailedJobIncidentHandler.java b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/FailedJobIncidentHandler.java
index f01d550..c4cdf0e 100644
--- a/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/FailedJobIncidentHandler.java
+++ b/otf-camunda/src/main/java/org/oran/otf/camunda/workflow/handler/FailedJobIncidentHandler.java
@@ -111,6 +111,7 @@
     testExecution.setTestResult(testResult);

     testExecution.setTestResultMessage(testResultMessage);

     Query query = new Query();

+    query.addCriteria(Criteria.where("groupId").is(testExecution.getGroupId()));

     query.addCriteria(Criteria.where("_id").is(testExecution.get_id()));

     // Also add businessKey as a criteria because the object won't be found if the business key

     // was somehow modified in the workflow.

diff --git a/otf-camunda/src/main/java/org/oran/otf/common/model/TestHead.java b/otf-camunda/src/main/java/org/oran/otf/common/model/TestHead.java
index 7f4bcbc..35bbc95 100644
--- a/otf-camunda/src/main/java/org/oran/otf/common/model/TestHead.java
+++ b/otf-camunda/src/main/java/org/oran/otf/common/model/TestHead.java
@@ -16,6 +16,7 @@
 

 package org.oran.otf.common.model;

 

+import javax.validation.constraints.NotNull;

 import org.oran.otf.common.utility.gson.Convert;

 import java.io.Serializable;

 import java.util.Date;

@@ -23,6 +24,7 @@
 

 import org.bson.types.ObjectId;

 import org.springframework.data.annotation.Id;

+import org.springframework.data.mongodb.core.index.CompoundIndex;

 import org.springframework.data.mongodb.core.index.Indexed;

 import org.springframework.data.mongodb.core.mapping.Document;

 

@@ -34,7 +36,8 @@
   @Id

   private ObjectId _id;

 

-  @Indexed(unique = true)

+  //@Indexed(unique = true)

+  @NotNull

   private String testHeadName;

 

   private String testHeadDescription;

diff --git a/otf-camunda/src/main/java/org/oran/otf/common/model/TestInstance.java b/otf-camunda/src/main/java/org/oran/otf/common/model/TestInstance.java
index 96fcfa9..39ea953 100644
--- a/otf-camunda/src/main/java/org/oran/otf/common/model/TestInstance.java
+++ b/otf-camunda/src/main/java/org/oran/otf/common/model/TestInstance.java
@@ -16,6 +16,7 @@
 

 package org.oran.otf.common.model;

 

+import javax.ws.rs.PATCH;

 import org.oran.otf.common.model.local.ParallelFlowInput;

 import org.oran.otf.common.utility.gson.Convert;

 import java.io.Serializable;

diff --git a/otf-camunda/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java b/otf-camunda/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
index 2a180bc..d36d3e1 100644
--- a/otf-camunda/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
+++ b/otf-camunda/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
@@ -147,7 +147,7 @@
 

         for(Group group : groupsToCheck)

         {

-            if(group.getParentGroupId() != null) // if there is a parent

+            if(group != null && group.getParentGroupId() != null) // if there is a parent

             {

                 String parentId = group.getParentGroupId().toString();

                 Group parentGroup = groupMap.get(parentId);

diff --git a/otf-camunda/src/main/java/org/oran/otf/spring/configuration/OTFMongoConfiguration.java b/otf-camunda/src/main/java/org/oran/otf/spring/configuration/OTFMongoConfiguration.java
index 665823f..5e034cf 100644
--- a/otf-camunda/src/main/java/org/oran/otf/spring/configuration/OTFMongoConfiguration.java
+++ b/otf-camunda/src/main/java/org/oran/otf/spring/configuration/OTFMongoConfiguration.java
@@ -57,7 +57,8 @@
         MongoCredential.createScramSha1Credential(username, database, password.toCharArray());

 

     MongoClientOptions options =

-        MongoClientOptions.builder().sslEnabled(false).requiredReplicaSetName(replicaSet).build();

+       // MongoClientOptions.builder().sslEnabled(false).requiredReplicaSetName(replicaSet).build();

+    MongoClientOptions.builder().sslEnabled(true).build();

 

     String[] hostArray = hosts.split(",");

     ArrayList<ServerAddress> hosts = new ArrayList<>();

diff --git a/otf-camunda/src/main/resources/application.yaml b/otf-camunda/src/main/resources/application.yaml
index bf92302..2147bb1 100644
--- a/otf-camunda/src/main/resources/application.yaml
+++ b/otf-camunda/src/main/resources/application.yaml
@@ -25,7 +25,7 @@
       username: ${OTF_CAMUNDA_DB_USERNAME}

       password: ${OTF_CAMUNDA_DB_PASSWORD}

   cadi:

-    enabled: true

+    enabled: false

     aaf-mech-id: ${AAF_ID}

     aaf-mech-password: ${AAF_MECH_PASSWORD}

     aaf-perm-type: ${AAF_PERM_TYPE}

@@ -64,11 +64,11 @@
   port.http: 8000

   tomcat.max-threads: 800

 #  ssl:

-    key-store-type: 'PKCS12'

-    key-store: ${OTF_CERT_PATH}

-    key-store-password: ${OTF_CERT_PASS}

+    #key-store-type: 'PKCS12'

+    #key-store: ${OTF_CERT_PATH}

+    #key-store-password: ${OTF_CERT_PASS}

 security:

-  https-only: true

+  https-only: false

   require-ssl: false

   server.port: 8443

   server.port.http: 8080

diff --git a/otf-frontend/Dockerfile b/otf-frontend/Dockerfile
index 6caf80d..35b68c7 100644
--- a/otf-frontend/Dockerfile
+++ b/otf-frontend/Dockerfile
@@ -14,6 +14,10 @@
 ENV CAMUNDAAPI_URL=https://localhost:31313/

 ENV CAMUNDAAPI_AAFID=username

 ENV CAMUNDAAPI_AAFPASSWORD=password

+ENV AZURE_STORAGE_ACCOUNT=otffiles

+ENV AZURE_STORAGE_CONTAINER=files

+ENV AZURE_STORAGE_KEY=key123

+ENV MONGO_CONNECTION_STRING=connection_string

 ENV MONGO_BASEURL=localhost:27017/

 ENV MONGO_DBOTF=otf

 ENV MONGO_REPLICASET=rs0

diff --git a/otf-frontend/client/config/karma.conf.js b/otf-frontend/client/config/karma.conf.js
index 3be39c4..74664d0 100644
--- a/otf-frontend/client/config/karma.conf.js
+++ b/otf-frontend/client/config/karma.conf.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 // Karma configuration file, see link for more information

 // https://karma-runner.github.io/1.0/config/configuration-file.html

 

diff --git a/otf-frontend/client/config/protractor.conf.js b/otf-frontend/client/config/protractor.conf.js
index b1a56c1..148a41f 100644
--- a/otf-frontend/client/config/protractor.conf.js
+++ b/otf-frontend/client/config/protractor.conf.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 // Protractor configuration file, see link for more information

 // https://github.com/angular/protractor/blob/master/lib/config.ts

 

diff --git a/otf-frontend/client/src/app/layout/modeler/modeler.component.ts b/otf-frontend/client/src/app/layout/modeler/modeler.component.ts
index c090769..613dd22 100644
--- a/otf-frontend/client/src/app/layout/modeler/modeler.component.ts
+++ b/otf-frontend/client/src/app/layout/modeler/modeler.component.ts
@@ -705,16 +705,17 @@
   //Get the xml of the default bpmn file

   async getDefaultFlow() {

     return new Promise((resolve, reject) => {

-      this._fileTransfer.get('5d0a5357e6624a3ef0d16164').subscribe(

-        data => {

-          let bpmn = new Buffer(data as Buffer);

-          resolve(bpmn.toString());

-        },

-        err => {

-          this.errorPopup(err.toString());

-          reject(err);

-        }

-      );

+      resolve("<?xml version=\"1.0\" encoding=\"UTF-8\"?\>\<bpmn:definitions targetNamespace=\"http:\/\/bpmn.io\/schema\/bpmn\" \>\<bpmn:process id=\"\" isExecutable=\"true\"\>\<bpmn:startEvent id=\"StartEvent_1\" /\>\</bpmn:process\>\<bpmndi:BPMNDiagram id=\"BPMNDiagram_1\"\>\<bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"Process_1ai7kus\"\>\<bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_1\"\>\<dc:Bounds x=\"179\" y=\"159\" width=\"36\" height=\"36\" /\>\</bpmndi:BPMNShape\>\</bpmndi:BPMNPlane\>\</bpmndi:BPMNDiagram\>\</bpmn:definitions\>")

+      // this._fileTransfer.get('5d0a5357e6624a3ef0d16164').subscribe(

+      //   data => {

+      //     let bpmn = new Buffer(data as Buffer);

+      //     resolve(bpmn.toString());

+      //   },

+      //   err => {

+      //     this.errorPopup(err.toString());

+      //     reject(err);

+      //   }

+      // );

     });

   }

 

@@ -730,6 +731,7 @@
       this._fileTransfer.get(this.ptd.currentInstance.bpmnFileId).subscribe(

         result => {

           let bpmn = new Buffer(result as Buffer);

+          console.log(bpmn.toString())

           resolve(bpmn.toString());

         },

         err => {

diff --git a/otf-frontend/client/src/app/shared/services/group.service.ts b/otf-frontend/client/src/app/shared/services/group.service.ts
index 477ae92..1d41e1e 100644
--- a/otf-frontend/client/src/app/shared/services/group.service.ts
+++ b/otf-frontend/client/src/app/shared/services/group.service.ts
@@ -129,7 +129,7 @@
       if (mappedArr.hasOwnProperty(_id)) {

         mappedElem = mappedArr[_id];

         // If the element is not at the root level, add it to its parent array of children.

-        if (mappedElem.parentGroupId) {

+        if (mappedElem.parentGroupId && mappedArr[mappedElem['parentGroupId']]) {

           mappedArr[mappedElem['parentGroupId']]['children'].push(mappedElem);

         }

         // If the element is at the root level, add it to first level elements array.

diff --git a/otf-frontend/package.json b/otf-frontend/package.json
index 2971bcb..7a107ae 100644
--- a/otf-frontend/package.json
+++ b/otf-frontend/package.json
@@ -44,6 +44,7 @@
     "@angular/platform-browser": "^7.0.2",

     "@angular/platform-browser-dynamic": "^7.0.2",

     "@angular/router": "^6.1.7",

+    "@azure/storage-blob": "^10.5.0",

     "@casl/ability": "^3.1.2",

     "@casl/angular": "^2.1.0",

     "@casl/mongoose": "^2.3.1",

@@ -86,7 +87,7 @@
     "express-rate-limit": "^3.3.2",

     "feathers-authentication-management": "^2.0.1",

     "feathers-hooks-common": "^4.17.14",

-    "feathers-mongoose": "^6.2.0",

+    "feathers-mongoose": "^8.1.0",

     "feathers-permissions": "^0.2.1",

     "file-saver": "^2.0.1",

     "font-awesome": "^4.7.0",

@@ -99,8 +100,8 @@
     "mat-progress-buttons": "^7.0.10",

     "material-design-icons": "^3.0.1",

     "moment": "^2.22.2",

-    "mongoose": "^5.6.4",

-    "mongoose-gridfs": "^0.5.0",

+    "mongoose": "^5.7.1",

+    "mongoose-gridfs": "^1.2.10",

     "multer": "^1.4.1",

     "ng-cli-pug-loader": "^0.1.7",

     "ng2-codemirror": "^1.1.3",

diff --git a/otf-frontend/server/config/custom-environment-variables.json b/otf-frontend/server/config/custom-environment-variables.json
index a261f9a..af499d3 100644
--- a/otf-frontend/server/config/custom-environment-variables.json
+++ b/otf-frontend/server/config/custom-environment-variables.json
@@ -13,12 +13,20 @@
         "aafId": "CAMUNDAAPI_AAFID",

         "aafPassword": "CAMUNDAAPI_AAFPASSWORD"

     },

+    "azure": {

+        "storage": {

+            "account": "AZURE_STORAGE_ACCOUNT",

+            "key": "AZURE_STORAGE_KEY",

+            "container": "AZURE_STORAGE_CONTAINER"

+        }

+    },

     "mongo": {

         "baseUrl": "MONGO_BASEURL",

         "dbOtf": "MONGO_DBOTF",

         "replicaSet": "MONGO_REPLICASET",

         "username": "MONGO_USERNAME",

-        "password": "MONGO_PASSWORD"

+        "password": "MONGO_PASSWORD",

+        "connectionString": "MONGO_CONNECTION_STRING"

     },

     "otf": {

       "url" : "OTF_URL",

diff --git a/otf-frontend/server/config/default.json b/otf-frontend/server/config/default.json
index dee3f8b..8e6a8b0 100644
--- a/otf-frontend/server/config/default.json
+++ b/otf-frontend/server/config/default.json
@@ -2,7 +2,7 @@
   "host": "0.0.0.0",

   "path": "otf/api/",

   "base-path": "otf/api/v1/",

-  "port": 80,

+  "port": 8080,

   "ssl": false,

   "public": "../../../client/dist/",

   "paginate": {

diff --git a/otf-frontend/server/src/agenda/agenda.js b/otf-frontend/server/src/agenda/agenda.js
index 5094b6b..9bcb532 100644
--- a/otf-frontend/server/src/agenda/agenda.js
+++ b/otf-frontend/server/src/agenda/agenda.js
@@ -20,8 +20,11 @@
 const jobTypes = ['test-execution-job'];

 const agenda = new Agenda({

 	db: {

-		address: 'mongodb://' + mongoData.username + ':' + mongoData.password + '@' + mongoData.baseUrl + mongoData.dbOtf + '?replicaSet=' + mongoData.replicaSet,

+		address: mongoData.connectionString,

 		collection: 'agenda'

+	},

+	sort: {

+		nextRunAt: 1

 	}

 });

 

diff --git a/otf-frontend/server/src/feathers/app.hooks.js b/otf-frontend/server/src/feathers/app.hooks.js
index 4cd08ac..159ff94 100644
--- a/otf-frontend/server/src/feathers/app.hooks.js
+++ b/otf-frontend/server/src/feathers/app.hooks.js
@@ -21,10 +21,11 @@
 const updatedBy = require('./hooks/updatedBy');

 const {iff, disallow, isProvider, skipRemainingHooks} = require('feathers-hooks-common');

 const { ObjectID } = require('mongodb');

+const shardKey = require('./hooks/insertShardKey.js');

 

 module.exports = {

 	before: {

-		all: [paginateOption(), skipRemainingHooks(context => !context.params.provider)],

+		all: [shardKey(), paginateOption(), skipRemainingHooks(context => !context.params.provider)],

 		find: [

 			function(context){

 				const {query} = context.params;

diff --git a/otf-frontend/server/src/feathers/hooks/delete-definition.js b/otf-frontend/server/src/feathers/hooks/delete-definition.js
index 718abb5..10e799f 100644
--- a/otf-frontend/server/src/feathers/hooks/delete-definition.js
+++ b/otf-frontend/server/src/feathers/hooks/delete-definition.js
@@ -16,6 +16,7 @@
 

 const util = require('../../lib/otf-util');

 const request = require('request');

+const errors = require('@feathersjs/errors');

 module.exports = function (options = {}) { // eslint-disable-line no-unused-vars

     return async context => {

         let options = {

@@ -40,7 +41,7 @@
         }).then(result => {

             

         }).catch(err => {

-            console.log(err);

+            throw new errors.GeneralError(err.body.message);

         });

     };

 };

diff --git a/otf-frontend/server/src/feathers/hooks/delete-version.js b/otf-frontend/server/src/feathers/hooks/delete-version.js
index d3c3ab4..50eddef 100644
--- a/otf-frontend/server/src/feathers/hooks/delete-version.js
+++ b/otf-frontend/server/src/feathers/hooks/delete-version.js
@@ -61,7 +61,7 @@
                             return Promise.reject(context.error);

                         }

                     }).catch(err => {

-                        

+                        throw new errors.GeneralError(err.body.message);

                     });

                 }

             });

diff --git a/otf-frontend/server/src/feathers/hooks/filters.js b/otf-frontend/server/src/feathers/hooks/filters.js
index d81cd3f..815633a 100644
--- a/otf-frontend/server/src/feathers/hooks/filters.js
+++ b/otf-frontend/server/src/feathers/hooks/filters.js
@@ -24,6 +24,9 @@
 module.exports.groupFilter = function (options = null) {

 	return async context => {

 

+		if (!context.params.provider) {

+			return Promise.resolve(context);

+		}

 		

 		switch(context.method){

 			case 'get':

@@ -56,17 +59,13 @@
 						context.app.services[context.app.get('base-path') + 'groups'].Model.aggregate([

 							{

 								$match: context.params.query

-							},

-							{

-								$graphLookup: {

-									from: "groups",

-									startWith: "$parentGroupId",

-									connectFromField: "parentGroupId",

-									connectToField: "_id",

-									as: "parentGroups"

+							}

+						]).then(async res => {

+							if(res.length){

+								for(let i = 0; i < res.length; i++){

+									res[i]['parentGroups'] = await getParentGroups(context.app.services[context.app.get('base-path') + 'groups'].Model, res[i]);

 								}

 							}

-						]).then(res => {

 							resolve(res);

 						}).catch(err => {

 							throw new errors.GeneralError(err);

@@ -127,6 +126,35 @@
 	};

 };

 

+getParentGroups = async function(model, group){

+	return new Promise(async (resolve, reject) => {

+		let parentGroups = [];

+		if(group.parentGroupId){

+			model.aggregate([

+				{

+					$match: {

+						'_id': group.parentGroupId

+					}

+				}

+			]).then(async res => {

+				if(res[0] && res[0].parentGroupId){

+					parentGroups.unshift(res[0]);

+					let parents = await getParentGroups(model, res[0]);

+					parents.forEach(e => {

+						parentGroups.unshift(e);

+					});

+				}

+				resolve(parentGroups);

+			}).catch(err => {

+				reject(err);

+			})

+		}else{

+			resolve();

+		}

+	});

+	

+}

+

 getChildGroups = async function(model, group){

 	return new Promise(async (resolve, reject) => {

 		let childGroups = [];

diff --git a/otf-frontend/server/src/feathers/hooks/insertShardKey.js b/otf-frontend/server/src/feathers/hooks/insertShardKey.js
new file mode 100644
index 0000000..6a6831c
--- /dev/null
+++ b/otf-frontend/server/src/feathers/hooks/insertShardKey.js
@@ -0,0 +1,57 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

+module.exports = function (service) { 

+    return async context => {

+        // If the method is find, get, or create, return

+        if(context.method == 'find' || context.method == 'get' || context.method == 'create'){

+            return context;

+        }

+

+        // If the id or service does not exist, return

+        if(!context.id || !context.service){

+            return context;

+        }

+

+        let serviceString;

+        if(service){

+            serviceString = context.app.get('base-path') + service;

+        }else{

+            serviceString = context.path;

+        }

+

+        if(!context.app.services[serviceString].Model){

+            return context;

+        }

+

+        // If the entity data hasnt been set, get and set it

+        if(!context.params.entityData){

+            context.params.entityData = await context.app.services[serviceString].get(context.id, { provider: undefined});

+        }

+

+        // Find the shard key from the model

+        let shardKeys = {};

+        Object.keys(context.app.services[serviceString].Model.schema.options.shardKey).forEach(key => {

+            shardKeys[key] = context.params.entityData[key];

+        })

+

+        // Add the shard keys to the query

+        Object.assign(context.params.query, shardKeys);

+

+        return context;

+

+    }

+}
\ No newline at end of file
diff --git a/otf-frontend/server/src/feathers/hooks/permissions/permissions.js b/otf-frontend/server/src/feathers/hooks/permissions/permissions.js
index 3659bde..14e764e 100644
--- a/otf-frontend/server/src/feathers/hooks/permissions/permissions.js
+++ b/otf-frontend/server/src/feathers/hooks/permissions/permissions.js
@@ -140,22 +140,25 @@
 			return context;

 		}

 

-		const params = Object.assign({}, context.params, { provider: null });

+		//see if the entity has already been pulled and stored, else get it

+		if(!context.params.entityData){

+			const params = Object.assign({}, context.params, { provider: null });

+			context.params.entityData = await service.get(context.id, params);

+		}

 

-		const result = await service.get(context.id, params);

-		throwUnlessCan(action, result);

+		throwUnlessCan(action, context.params.entityData);

 

 		if (action === 'get') {

-			context.result = pick(result, allowedFields);

+			context.result = pick(context.params.entityData, allowedFields);

 		}else{

 			if(context.data){

 				Object.keys(context.data).forEach(key => {

 					if(key == "$push"){

 						Object.keys(context.data['$push']).forEach(k => {

-							throwUnlessCan(action, result, k);

+							throwUnlessCan(action, context.params.entityData, k);

 						});

 					}else{

-						throwUnlessCan(action, result, key);

+						throwUnlessCan(action, context.params.entityData, key);

 					}

 				})

 			}

diff --git a/otf-frontend/server/src/feathers/index.js b/otf-frontend/server/src/feathers/index.js
index ad37c1b..dc4805e 100644
--- a/otf-frontend/server/src/feathers/index.js
+++ b/otf-frontend/server/src/feathers/index.js
@@ -39,6 +39,9 @@
 const channels = require('./channels');

 const authentication = require('./authentication');

 

+// Azure Storage

+const azureStorage = require('../lib/azure-storage');

+

 // Mongoose

 const mongoose = require('../lib/mongoose');

 const _mongoose = require('mongoose');

@@ -104,9 +107,11 @@
 // 	});

 // });

 

+// Configure Azure storage

+app.configure(azureStorage);

+

 // Configure Mongoose driver before setting up services that use Mongoose

 app.configure(mongoose);

-

 // Set up database dependent components once the connection is ready to prevent unexpected results

 _mongoose.connection.on('open', (ref) => {

 	app.configure(authentication);

diff --git a/otf-frontend/server/src/feathers/models/file.model.js b/otf-frontend/server/src/feathers/models/file.model.js
index a41d24c..f33e17b 100644
--- a/otf-frontend/server/src/feathers/models/file.model.js
+++ b/otf-frontend/server/src/feathers/models/file.model.js
@@ -14,16 +14,37 @@
 ##############################################################################*/

 

 

-const mongooseGridFS = require('mongoose-gridfs');

-

 module.exports = function (app) {

-	const mongoose = app.get('mongooseClient');

+	const mongooseClient = app.get('mongooseClient');

+	const { Schema } = mongooseClient;

+	const files = new Schema({//Esquema base de los usuarios.

+        length: {

+            type: Number

+        },

+        chunkSize: {

+            type: Number

+        },

+        uploadDate: {

+            type: Date

+        },

+        md5: {

+            type: String

+        },

+        filename: {

+            type: String

+        },

+        contentType: {

+            type: String

+        },

+        metadata: {

+            type: Object

+        },

+        path:{

+            type:String,

+            readonly:true

+        }

+    },{collection:`fs.files`, shardKey: { filename: 1 }});

+	

+	return mongooseClient.model('files', files);

 

-	const gridfs = mongooseGridFS({

-		collection: 'fs',

-		model: 'File',

-		mongooseConnection: mongoose.connection

-	});

-

-	return gridfs.model;

 };

diff --git a/otf-frontend/server/src/feathers/models/groups.model.js b/otf-frontend/server/src/feathers/models/groups.model.js
index d15894e..55b6469 100644
--- a/otf-frontend/server/src/feathers/models/groups.model.js
+++ b/otf-frontend/server/src/feathers/models/groups.model.js
@@ -32,6 +32,7 @@
 		ownerId: { type: Schema.Types.ObjectId, ref: 'users', required: true },

 		mechanizedIds: [String]

 	}, {

+		shardKey: { parentGroupId: 1},

 		timestamps: true

 	});

 

diff --git a/otf-frontend/server/src/feathers/models/jobs.model.js b/otf-frontend/server/src/feathers/models/jobs.model.js
index 35ad8b3..fe29ee0 100644
--- a/otf-frontend/server/src/feathers/models/jobs.model.js
+++ b/otf-frontend/server/src/feathers/models/jobs.model.js
@@ -38,6 +38,7 @@
 		lockedAt: { type: String },

 		lastRunAt: { type: String }

 	}, {

+		shardKey: { 'data.testSchedule._testInstanceId': 1 },

 		timestamps: true

 	});

 

diff --git a/otf-frontend/server/src/feathers/models/test-definitions.model.js b/otf-frontend/server/src/feathers/models/test-definitions.model.js
index 9e71a0f..dfa365a 100644
--- a/otf-frontend/server/src/feathers/models/test-definitions.model.js
+++ b/otf-frontend/server/src/feathers/models/test-definitions.model.js
@@ -48,8 +48,9 @@
 		updatedBy: { type: Schema.Types.ObjectId, ref: 'users'},

 		createdBy: { type: Schema.Types.ObjectId, ref: 'users'}

 	}, {

-	timestamps: true,

-	minimize: false

+		shardKey: { groupId: 1 },

+		timestamps: true,

+		minimize: false

 	});

 

 	

diff --git a/otf-frontend/server/src/feathers/models/test-executions.model.js b/otf-frontend/server/src/feathers/models/test-executions.model.js
index 2f152ac..2e289aa 100644
--- a/otf-frontend/server/src/feathers/models/test-executions.model.js
+++ b/otf-frontend/server/src/feathers/models/test-executions.model.js
@@ -44,6 +44,7 @@
 		historicTestDefinition: { type: Object }

 

 	}, {

+			shardKey: { groupId: 1 },

 			timestamps: false

 		});

 	

diff --git a/otf-frontend/server/src/feathers/models/test-heads.model.js b/otf-frontend/server/src/feathers/models/test-heads.model.js
index b1bb52d..b8b76e3 100644
--- a/otf-frontend/server/src/feathers/models/test-heads.model.js
+++ b/otf-frontend/server/src/feathers/models/test-heads.model.js
@@ -35,6 +35,7 @@
 		authorizationEnabled: { type: Boolean, default: false },

 		isPublic: { type: Boolean }

 	}, {

+		shardKey: { groupId: 1 },

 		timestamps: true

 	});

 

diff --git a/otf-frontend/server/src/feathers/models/test-instances.model.js b/otf-frontend/server/src/feathers/models/test-instances.model.js
index 1cb5f0e..3e3f4a7 100644
--- a/otf-frontend/server/src/feathers/models/test-instances.model.js
+++ b/otf-frontend/server/src/feathers/models/test-instances.model.js
@@ -49,6 +49,7 @@
 		updatedBy: { type: Schema.Types.ObjectId, ref: 'users' },

 		createdBy: { type: Schema.Types.ObjectId, ref: 'users' }

 	}, {

+			shardKey: { groupId: 1 },

 			timestamps: true,

 			minimize: false

 		});

diff --git a/otf-frontend/server/src/feathers/models/users.model.js b/otf-frontend/server/src/feathers/models/users.model.js
index aba50c1..3790b9e 100644
--- a/otf-frontend/server/src/feathers/models/users.model.js
+++ b/otf-frontend/server/src/feathers/models/users.model.js
@@ -38,6 +38,7 @@
 			testDefinitions: [{type: Schema.Types.ObjectId, ref: 'testDefinitions'}]

 		}, { _id: false})

 	}, {

+		shardKey: { email: 1 },

 		timestamps: true

 	});

 

diff --git a/otf-frontend/server/src/feathers/services/bpmn-upload/bpmn-upload.class.js b/otf-frontend/server/src/feathers/services/bpmn-upload/bpmn-upload.class.js
index fcc11e8..be683d4 100644
--- a/otf-frontend/server/src/feathers/services/bpmn-upload/bpmn-upload.class.js
+++ b/otf-frontend/server/src/feathers/services/bpmn-upload/bpmn-upload.class.js
@@ -149,7 +149,7 @@
 		//         console.log(err);

 		//     }

 		// Set as deployed

-		delete params.query;

+		params.query = {};

 

 		//check to see if the process definition Key was set

 		// if (!data.testDefinition.processDefinitionKey) {

diff --git a/otf-frontend/server/src/feathers/services/bpmn-validate/bpmn-validate.class.js b/otf-frontend/server/src/feathers/services/bpmn-validate/bpmn-validate.class.js
index d855145..eae2f7f 100644
--- a/otf-frontend/server/src/feathers/services/bpmn-validate/bpmn-validate.class.js
+++ b/otf-frontend/server/src/feathers/services/bpmn-validate/bpmn-validate.class.js
@@ -249,7 +249,7 @@
 			}

 		};

 		let options = {

-			url: this.options.app.get('otf').url + this.options.app.get('base-path') + 'file-transfer',

+			uri: this.options.app.get('otf').url + this.options.app.get('base-path') + 'file-transfer',

 			headers: {

 				'Authorization': params.headers.Authorization,

 				'Content-Type': "multipart/form-data"

diff --git a/otf-frontend/server/src/feathers/services/execute/execute.hooks.js b/otf-frontend/server/src/feathers/services/execute/execute.hooks.js
index f64d812..9132e57 100644
--- a/otf-frontend/server/src/feathers/services/execute/execute.hooks.js
+++ b/otf-frontend/server/src/feathers/services/execute/execute.hooks.js
@@ -58,7 +58,7 @@
 	before: {

 		all: [authenticate('jwt'), permissions('execute')],

 		find: [ throwError(new errors.MethodNotAllowed()) ],

-		get: [ throwError(new errors.MethodNotAllowed())],

+		get: [ ],

 		create: [

 			(context) => {

 				context.data.executorId = context.params.user._id;

diff --git a/otf-frontend/server/src/feathers/services/file-transfer/file-transfer.class.js b/otf-frontend/server/src/feathers/services/file-transfer/file-transfer.class.js
index 0ac6670..9638922 100644
--- a/otf-frontend/server/src/feathers/services/file-transfer/file-transfer.class.js
+++ b/otf-frontend/server/src/feathers/services/file-transfer/file-transfer.class.js
@@ -16,20 +16,28 @@
 

 const Response = require('http-response-object');

 const Readable = require('stream').Readable;

-const mongooseGridFS = require('mongoose-gridfs');

+const { createModel } = require('mongoose-gridfs');

 const AdmZip = require('adm-zip');

 const errors = require('@feathersjs/errors');

+const mongoose = require('mongoose');

+const ObjectID = require('mongodb').ObjectID;

+const {

+	Aborter,

+	BlockBlobURL,

+	BlobURL,

+	downloadBlobToBuffer,

+	uploadStreamToBlockBlob

+  } = require("@azure/storage-blob");

+

 

 class Service {

 	constructor (options) {

 		this.options = options || {};

-		this.mongoose = this.options.app.get('mongooseClient');

-		this.gridfs = mongooseGridFS({

-			collection: 'fs',

-			model: 'File',

-			mongooseConnection: this.mongoose.connection

-		});

-		this.FileModel = this.gridfs.model;

+		// this.File = createModel({

+		// 	collection: 'fs',

+		// 	model: 'File',

+		// 	mongooseConnection: mongoose.connection

+		// });

 	}

 

 	async find (params) {

@@ -37,14 +45,30 @@
 	}

 

 	async get (id, params) {

-		let content = await this.callReadFile(id).then(res => {

-			return res;

-		});

-

-		if(params.query && params.query.robot){

-			content = await this.createRobotResponse(content);

+		if(!id){

+			throw new errors.BadRequest("File id is required");

 		}

-		return content;

+

+		// Get Blob url

+		const blob = BlobURL.fromContainerURL(this.options.app.get('azureStorageContainerUrl'), id);

+		const stats = await blob.getProperties().catch(err => {

+			throw new errors.NotFound();

+		});

+		// const content = await blob.download(Aborter.none, 0);

+		const buffer = Buffer.alloc(stats.contentLength);

+		await downloadBlobToBuffer(

+			Aborter.timeout(30 * 60 * 1000),

+			buffer,

+			blob,

+			0,

+			undefined,

+			{

+			  blockSize: 4 * 1024 * 1024, // 4MB block size

+			  parallelism: 20, // 20 concurrency

+			}

+		  );

+

+		return buffer;

 	}

 

 	async create (data, params) {

@@ -54,31 +78,37 @@
             throw new BadRequest("No files found to upload")

         }

 

-        let promises = [];

-

+		let promises = [];

+		

         files.forEach(file => {

-            let promise = new Promise( (resolve, reject) => {

+            let promise = new Promise(async (resolve, reject) => {

 

-                let stream = new Readable();

-                stream.push(file.buffer);

-                stream.push(null);

+				let exists, filename, blob, blockBlob;

+				// Creates the file id and checks that there isn't already a file with that name

+				do {

 

-            	this.FileModel.write(

-            		{

-            			filename: file.originalname,

-            			contentType: file.mimeType

-            		},

-            		stream,

-            		function (error, savedAttachment) {

-            			if (error) {

-            				logger.error(error);

-            				reject(error);

-            			} else {

-                            stream.destroy();

-                            resolve(savedAttachment);

-            			}

-                    }

-                );

+					filename = ObjectID().toString();

+					

+					blob = BlobURL.fromContainerURL(this.options.app.get('azureStorageContainerUrl'), filename);

+					blockBlob = BlockBlobURL.fromBlobURL(blob);

+					exists = await blockBlob.getProperties().catch(err => {

+						if(err.statusCode == 404){

+							exists = false;

+						}

+					});

+

+				} while (exists);

+	

+				blockBlob.upload(Aborter.none, file.buffer.toString(), file.size).then(

+					result => {

+						result._id = filename;

+						resolve(result);

+					}

+				).catch(

+					error => {

+						reject(error);

+					}

+				);

 

             })

 

@@ -90,6 +120,8 @@
         return result;

 	}

 

+	

+

 	async update (id, data, params) {

 		return new Response(200, {});

 	}

@@ -99,13 +131,13 @@
 	}

 

 	async remove (id, params) {

-		let err = await this.callUnlinkFile(id).then(err => {

-            return err;

-        });

+		// let err = await this.callUnlinkFile(id).then(err => {

+        //     return err;

+        // });

 

-        if(err){

-            throw errors.GeneralError(err);

-        }        

+        // if(err){

+        //     throw errors.GeneralError(err);

+        // }        

 

         return new Response(200, {});

 	}

diff --git a/otf-frontend/server/src/feathers/services/jobs/jobs.hooks.js b/otf-frontend/server/src/feathers/services/jobs/jobs.hooks.js
index eec6d19..0844bd5 100644
--- a/otf-frontend/server/src/feathers/services/jobs/jobs.hooks.js
+++ b/otf-frontend/server/src/feathers/services/jobs/jobs.hooks.js
@@ -119,7 +119,7 @@
 			(context) => { console.log("AFTER PERMISSIONS")},

 			canExecute(), 

 			async (context) => {

-				const fullUrl = this.options.app.get('otf').url + context.app.get('base-path') + 'schedule-test';

+				const fullUrl = context.app.get('otf').url + context.app.get('base-path') + 'schedule-test';

 

 				context.data.executorId = context.params.user._id;

 

@@ -155,7 +155,7 @@
 			permissions('jobs'),

 			canExecute(),

 			async function (context) {

-			const fullUrl = this.options.app.get('otf').url + context.app.get('base-path') + 'cancel-test';

+			const fullUrl = context.app.get('otf').url + context.app.get('base-path') + 'cancel-test';

 

 			if (context.id == null || context.params.user._id == null ||

 				utils.isValidObjectId(context.id) || utils.isValidObjectId(context.params.user._id)) {

diff --git a/otf-frontend/server/src/feathers/services/users/users.service.js b/otf-frontend/server/src/feathers/services/users/users.service.js
index b4350bb..981f114 100644
--- a/otf-frontend/server/src/feathers/services/users/users.service.js
+++ b/otf-frontend/server/src/feathers/services/users/users.service.js
@@ -31,29 +31,9 @@
 		paginate

 	};

 

-	const mongoConfig = app.get('mongo');

-	const rateLimitConfig = app.get('rate-limit');

-

-	const createUserLimiter = new RateLimit({

-		store: new MongoStore({

-			uri: 'mongodb://' + mongoConfig.username + ':' + mongoConfig.password + '@' + mongoConfig.baseUrl +

-				mongoConfig.dbOtf + '?replicaSet=' + mongoConfig.replicaSet,

-			collectionName: rateLimitConfig.mongoStore.collection

-		}),

-		max: app.get('rate-limit').services.users.max,

-		windowsMs: app.get('rate-limit').services.users.windowMs,

-		message: app.get('rate-limit').services.users.message

-	});

-

 	// Initialize our service with any options it requires,

 	// and limit any POST methods.

-	app.use(app.get('base-path') + 'users', (req, res, next) => {

-		if (req.method === 'POST') {

-			createUserLimiter(req, res, next);

-		} else {

-			next();

-		}

-	}, createService(options));

+	app.use(app.get('base-path') + 'users', createService(options));

 

 	// Get our initialized service so that we can register hooks

 	const service = app.service(app.get('base-path') + 'users');

diff --git a/otf-frontend/server/src/lib/azure-storage.js b/otf-frontend/server/src/lib/azure-storage.js
new file mode 100644
index 0000000..29102b6
--- /dev/null
+++ b/otf-frontend/server/src/lib/azure-storage.js
@@ -0,0 +1,51 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

+const {

+    ServiceURL,

+    StorageURL,

+    SharedKeyCredential,

+    TokenCredential,

+    ContainerURL

+  } = require("@azure/storage-blob");

+

+module.exports = function(app) {

+    // Enter your storage account name and shared key

+    const account = app.get('azure').storage.account;

+    const accountKey = app.get('azure').storage.key;

+    const container = app.get('azure').storage.container;

+  

+    // Use SharedKeyCredential with storage account and account key

+    const sharedKeyCredential = new SharedKeyCredential(account, accountKey);

+  

+    // Use TokenCredential with OAuth token

+    const tokenCredential = new TokenCredential("token");

+    tokenCredential.token = "renewedToken"; // Renew the token by updating token field of token credential

+  

+    // Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline

+    const pipeline = StorageURL.newPipeline(sharedKeyCredential);

+  

+    // List containers

+    const serviceURL = new ServiceURL(

+      // When using AnonymousCredential, following url should include a valid SAS or support public access

+      `https://${account}.blob.core.windows.net`,

+      pipeline

+    );

+

+    const containerURL = ContainerURL.fromServiceURL(serviceURL, container);

+

+    app.set('azureStorageContainerUrl', containerURL);

+}
\ No newline at end of file
diff --git a/otf-frontend/server/src/lib/mongoose.js b/otf-frontend/server/src/lib/mongoose.js
index a8d5b9d..e3bd0d1 100644
--- a/otf-frontend/server/src/lib/mongoose.js
+++ b/otf-frontend/server/src/lib/mongoose.js
@@ -18,9 +18,8 @@
 

 module.exports = function (app) {

 	const mongoData = app.get('mongo');

-	const connectionString = 'mongodb://' + mongoData.username + ':' + mongoData.password + '@' + mongoData.baseUrl + mongoData.dbOtf + '?replicaSet=' + mongoData.replicaSet;

 

-	mongoose.connect(connectionString, { useNewUrlParser: true }).then(null, error => {

+	mongoose.connect(mongoData.connectionString, { useNewUrlParser: true, useFindAndModify: false, useUnifiedTopology: true, useCreateIndex: true }).then(null, error => {

 		console.log('caught', error.message);

 	});

 	mongoose.Promise = global.Promise;

diff --git a/otf-frontend/server/test/app.test.js b/otf-frontend/server/test/app.test.js
index 67338c3..378377a 100644
--- a/otf-frontend/server/test/app.test.js
+++ b/otf-frontend/server/test/app.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const rp = require('request-promise');

 const url = require('url');

diff --git a/otf-frontend/server/test/hooks/group-filter.test.js b/otf-frontend/server/test/hooks/group-filter.test.js
index 71d02c6..d6e352f 100644
--- a/otf-frontend/server/test/hooks/group-filter.test.js
+++ b/otf-frontend/server/test/hooks/group-filter.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const feathers = require('@feathersjs/feathers');

 const groupFilter = require('../../src/hooks/group-filter');

diff --git a/otf-frontend/server/test/services/bpmn-upload.test.js b/otf-frontend/server/test/services/bpmn-upload.test.js
index 23d1ff0..7ade3b5 100644
--- a/otf-frontend/server/test/services/bpmn-upload.test.js
+++ b/otf-frontend/server/test/services/bpmn-upload.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/bpmn-validate.test.js b/otf-frontend/server/test/services/bpmn-validate.test.js
index fb00767..bebe886 100644
--- a/otf-frontend/server/test/services/bpmn-validate.test.js
+++ b/otf-frontend/server/test/services/bpmn-validate.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/groups-m.test.js b/otf-frontend/server/test/services/groups-m.test.js
index 6e46510..4a1af5a 100644
--- a/otf-frontend/server/test/services/groups-m.test.js
+++ b/otf-frontend/server/test/services/groups-m.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/groups.test.js b/otf-frontend/server/test/services/groups.test.js
index c66c9c7..59d13ad 100644
--- a/otf-frontend/server/test/services/groups.test.js
+++ b/otf-frontend/server/test/services/groups.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/health.test.js b/otf-frontend/server/test/services/health.test.js
index 212f034..5c6963b 100644
--- a/otf-frontend/server/test/services/health.test.js
+++ b/otf-frontend/server/test/services/health.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/strategy-upload.test.js b/otf-frontend/server/test/services/strategy-upload.test.js
index 034e933..8fa04e1 100644
--- a/otf-frontend/server/test/services/strategy-upload.test.js
+++ b/otf-frontend/server/test/services/strategy-upload.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/test-definition.test.js b/otf-frontend/server/test/services/test-definition.test.js
index 556d710..9b004b3 100644
--- a/otf-frontend/server/test/services/test-definition.test.js
+++ b/otf-frontend/server/test/services/test-definition.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/test-heads.test.js b/otf-frontend/server/test/services/test-heads.test.js
index 44fa679..f3b845a 100644
--- a/otf-frontend/server/test/services/test-heads.test.js
+++ b/otf-frontend/server/test/services/test-heads.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/test-instances.test.js b/otf-frontend/server/test/services/test-instances.test.js
index 2db66b9..e59da74 100644
--- a/otf-frontend/server/test/services/test-instances.test.js
+++ b/otf-frontend/server/test/services/test-instances.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/test-requests.test.js b/otf-frontend/server/test/services/test-requests.test.js
index 51304e5..8b96702 100644
--- a/otf-frontend/server/test/services/test-requests.test.js
+++ b/otf-frontend/server/test/services/test-requests.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/test-strategies.test.js b/otf-frontend/server/test/services/test-strategies.test.js
index 35bf0d5..7917e28 100644
--- a/otf-frontend/server/test/services/test-strategies.test.js
+++ b/otf-frontend/server/test/services/test-strategies.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/tests.test.js b/otf-frontend/server/test/services/tests.test.js
index 0d03d13..8594bdd 100644
--- a/otf-frontend/server/test/services/tests.test.js
+++ b/otf-frontend/server/test/services/tests.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-frontend/server/test/services/users.test.js b/otf-frontend/server/test/services/users.test.js
index bed24e0..aec91c4 100644
--- a/otf-frontend/server/test/services/users.test.js
+++ b/otf-frontend/server/test/services/users.test.js
@@ -1,3 +1,19 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #

+#                                                                              #

+#   Licensed under the Apache License, Version 2.0 (the "License");            #

+#   you may not use this file except in compliance with the License.           #

+#   You may obtain a copy of the License at                                    #

+#                                                                              #

+#       http://www.apache.org/licenses/LICENSE-2.0                             #

+#                                                                              #

+#   Unless required by applicable law or agreed to in writing, software        #

+#   distributed under the License is distributed on an "AS IS" BASIS,          #

+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #

+#   See the License for the specific language governing permissions and        #

+#   limitations under the License.                                             #

+##############################################################################*/

+

+

 const assert = require('assert');

 const app = require('../../src/app');

 

diff --git a/otf-service-api/pom.xml b/otf-service-api/pom.xml
index 46b4b21..fda9ed3 100644
--- a/otf-service-api/pom.xml
+++ b/otf-service-api/pom.xml
@@ -302,7 +302,7 @@
     <dependency>

       <artifactId>httpmime</artifactId>

       <groupId>org.apache.httpcomponents</groupId>

-      <version>4.5.7</version>

+      <version>4.5.7-SNAPSHOT</version>

     </dependency>

 

     <dependency>

diff --git a/otf-service-api/src/main/java/org/oran/otf/api/config/DataConfig.java b/otf-service-api/src/main/java/org/oran/otf/api/config/DataConfig.java
index 0546a7d..31d4e9e 100644
--- a/otf-service-api/src/main/java/org/oran/otf/api/config/DataConfig.java
+++ b/otf-service-api/src/main/java/org/oran/otf/api/config/DataConfig.java
@@ -62,7 +62,7 @@
         MongoCredential.createScramSha1Credential(username, database, password.toCharArray());

 

     MongoClientOptions options =

-        MongoClientOptions.builder().sslEnabled(false).requiredReplicaSetName(replicaSet).build();

+        MongoClientOptions.builder().sslEnabled(true).build();

 

     String[] hostArray = hosts.split(",");

     ArrayList<ServerAddress> hosts = new ArrayList<>();

diff --git a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestInstanceServiceImpl.java b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestInstanceServiceImpl.java
index d171206..bdc2607 100644
--- a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestInstanceServiceImpl.java
+++ b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestInstanceServiceImpl.java
@@ -748,11 +748,7 @@
     }

 

     private boolean isOtfMechanizedIdentifier(String email) {

-        return email.equalsIgnoreCase("email@localhost")

-                || email.equalsIgnoreCase("email@localhost")

-                || email.equalsIgnoreCase("email@localhost")

-                || email.equalsIgnoreCase("email@localhost")

-                || email.equalsIgnoreCase("email@localhost");

+        return email.equalsIgnoreCase(System.getenv("AAF_ID"));

     }

 

     private BpmnInstance findBpmnInstance(TestDefinition testDefinition, int version, boolean latest)

diff --git a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestStrategyServiceImpl.java b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestStrategyServiceImpl.java
index 13d125a..afc0f24 100644
--- a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestStrategyServiceImpl.java
+++ b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/TestStrategyServiceImpl.java
@@ -108,7 +108,7 @@
     //			logger.error(Utilities.getStackTrace(e));

     //		}

 

-    // If a test definition id is supplied, the request intends to update an existing test

+    // If a test definition id is supplied, the request intends to  updatean existing test

     // definition.

     if (request.getTestDefinitionId() != null) {

       // Check if the test definition exists in the database.

@@ -212,8 +212,7 @@
 

   private boolean isAuthorized(String authorization) {

     User user = Utilities.findUserByAuthHeader(authorization, userRepository);

-    return (user.getEmail().equalsIgnoreCase("email@localhost")

-        || user.getEmail().equalsIgnoreCase("email@localhost"));

+    return (user.getEmail().equalsIgnoreCase(System.getenv("AAF_ID")));

   }

 

   private DeployTestStrategyRequest mapToDeployTestStrategyRequest(String body) {

diff --git a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/VirtualTestHeadServiceImpl.java b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/VirtualTestHeadServiceImpl.java
index d2a662b..8bf53ff 100644
--- a/otf-service-api/src/main/java/org/oran/otf/api/service/impl/VirtualTestHeadServiceImpl.java
+++ b/otf-service-api/src/main/java/org/oran/otf/api/service/impl/VirtualTestHeadServiceImpl.java
@@ -100,7 +100,7 @@
     }

 

     private Response updateTestHeadFields(TestHead testHead, TestHead newTestHead, User user) {

-        Query select = Query.query(Criteria.where("_id").is(testHead.get_id()));

+        Query select = Query.query(Criteria.where("_id").is(testHead.get_id())).addCriteria(Criteria.where("groupId").is(testHead.getGroupId()));

         Update update = new Update();

 

         if (newTestHead.getTestHeadName() != null) {

diff --git a/otf-service-api/src/main/java/org/oran/otf/common/model/TestHead.java b/otf-service-api/src/main/java/org/oran/otf/common/model/TestHead.java
index 7f4bcbc..780ec36 100644
--- a/otf-service-api/src/main/java/org/oran/otf/common/model/TestHead.java
+++ b/otf-service-api/src/main/java/org/oran/otf/common/model/TestHead.java
@@ -34,7 +34,7 @@
   @Id

   private ObjectId _id;

 

-  @Indexed(unique = true)

+  //@Indexed(unique = true)

   private String testHeadName;

 

   private String testHeadDescription;

diff --git a/otf-service-api/src/main/java/org/oran/otf/common/utility/database/TestExecutionUtility.java b/otf-service-api/src/main/java/org/oran/otf/common/utility/database/TestExecutionUtility.java
index c54359f..db242bb 100644
--- a/otf-service-api/src/main/java/org/oran/otf/common/utility/database/TestExecutionUtility.java
+++ b/otf-service-api/src/main/java/org/oran/otf/common/utility/database/TestExecutionUtility.java
@@ -28,6 +28,7 @@
   public static void saveTestResult(

       MongoTemplate mongoOperation, TestExecution execution, String testResult) {

     Query query = new Query();

+    query.addCriteria(Criteria.where("groupId").is(execution.getGroupId()));

     query.addCriteria(Criteria.where("businessKey").is(execution.getBusinessKey()));

     Update update = new Update();

     update.set("testResult", testResult);

diff --git a/otf-service-api/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java b/otf-service-api/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
index e8cdfea..2c3dac1 100644
--- a/otf-service-api/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
+++ b/otf-service-api/src/main/java/org/oran/otf/common/utility/permissions/PermissionUtil.java
@@ -146,7 +146,7 @@
 

         for(Group group : groupsToCheck)

         {

-            if(group.getParentGroupId() != null) // if there is a parent

+            if(group != null && group.getParentGroupId() != null) // if there is a parent

             {

                 String parentId = group.getParentGroupId().toString();

                 Group parentGroup = groupMap.get(parentId);

diff --git a/otf-service-api/src/main/resources/application.properties b/otf-service-api/src/main/resources/application.properties
index 0a68a60..1cce69d 100644
--- a/otf-service-api/src/main/resources/application.properties
+++ b/otf-service-api/src/main/resources/application.properties
@@ -3,9 +3,9 @@
 server.port.http=8080

 security.require-ssl=false

 

-server.ssl.key-store-type=PKCS12

-server.ssl.key-store=${OTF_CERT_PATH}

-server.ssl.key-store-password=${OTF_CERT_PASS}

+#server.ssl.key-store-type=PKCS12

+#server.ssl.key-store=${OTF_CERT_PATH}

+#server.ssl.key-store-password=${OTF_CERT_PASS}

 #server.servlet.context-path=/otf/api

 #spring.jersey.application-path=/otf

 #springfox.documentation.swagger.v2.path=/otf/api/swagger.json

@@ -29,12 +29,12 @@
 

 spring.resources.add-mappings=true

 

-ssl.flag =${https-only.flag:true}

+ssl.flag =false

 #springfox.documentation.auto-startup=false

 #springfox.documentation.swagger.v2.path=/otf/swagger.json

 

 #config

-aaf.enabled=true

+aaf.enabled=false

 aaf.call-timeout=10000

 aaf.conn-timeout=6000

 aaf.default-realm=localhost

diff --git a/otf-service-api/src/test/java/org/oran/otf/api/tests/shared/MemoryDatabase.java b/otf-service-api/src/test/java/org/oran/otf/api/tests/shared/MemoryDatabase.java
index 2c17abb..7b2a262 100644
--- a/otf-service-api/src/test/java/org/oran/otf/api/tests/shared/MemoryDatabase.java
+++ b/otf-service-api/src/test/java/org/oran/otf/api/tests/shared/MemoryDatabase.java
@@ -129,7 +129,7 @@
       user = new User();

       user.setFirstName("Mech");

       user.setLastName("Id");

-      user.setEmail("email@localhost");

+      user.setEmail(System.getenv("AAF_ID"));

       mongoTemplate.save(user, "users");

       user = mongoTemplate.findOne(userQuery, User.class);

     }