diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index a5e3340..e00bb1e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -38,21 +38,26 @@
 @Profile("!test")
 public class ASDCControllerSingleton {
 
+    private static final Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
+    private final ASDCController asdcController;
 
     @Autowired
-    private ASDCController asdcController;
-    private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
-
-
+    public ASDCControllerSingleton(final ASDCController asdcController) {
+        this.asdcController = asdcController;
+    }
 
     @Scheduled(fixedRate = 50000)
     public void periodicControllerTask() {
         try {
-            int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+            final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
             asdcController.setControllerName("mso-controller" + randomNumber);
-            asdcController.initASDC();
-        } catch (ASDCControllerException e) {
-            logger.error("Exception occurred", e);
+            if (asdcController.isStopped()) {
+                logger.info("{} not running will try to initialize it, currrent status: {}",
+                        asdcController.getClass().getName(), asdcController.getControllerStatus());
+                asdcController.initASDC();
+            }
+        } catch (final ASDCControllerException controllerException) {
+            logger.error("Exception occurred", controllerException);
         }
     }
 
@@ -60,8 +65,8 @@
     private void terminate() {
         try {
             asdcController.closeASDC();
-        } catch (ASDCControllerException e) {
-            logger.error("Exception occurred", e);
+        } catch (final ASDCControllerException controllerException) {
+            logger.error("Exception occurred", controllerException);
         }
     }
 
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
index eb2957c..2c83472 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
@@ -35,7 +35,6 @@
 @EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
 public class Application {
     private static final Logger logger = LoggerFactory.getLogger(Application.class);
-    private static final String MSO_CONFIG_PATH = "mso.config.path";
     private static final String LOGS_DIR = "logs_dir";
 
     @Autowired
@@ -47,11 +46,6 @@
         }
     }
 
-    private static void setConfigPath() {
-        if (System.getProperty(MSO_CONFIG_PATH) == null)
-            System.getProperties().setProperty(MSO_CONFIG_PATH, ".");
-    }
-
     @PostConstruct
     private void deployActivities() {
         try {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
index 9025069..22265a0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
@@ -24,7 +24,9 @@
 import javax.ws.rs.ApplicationPath;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.onap.so.asdc.client.test.rest.ASDCRestInterface;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
 import io.swagger.jaxrs.config.BeanConfig;
 import io.swagger.jaxrs.listing.ApiListingResource;
 import io.swagger.jaxrs.listing.SwaggerSerializers;
@@ -33,6 +35,12 @@
 @ApplicationPath("/test")
 public class JerseyConfiguration extends ResourceConfig {
 
+    private Environment environment;
+
+    @Autowired
+    public JerseyConfiguration(final Environment environment) {
+        this.environment = environment;
+    }
 
     @PostConstruct
     public void setUp() {
@@ -40,10 +48,10 @@
         register(ApiListingResource.class);
         register(SwaggerSerializers.class);
 
-        BeanConfig beanConfig = new BeanConfig();
+        final BeanConfig beanConfig = new BeanConfig();
         beanConfig.setVersion("1.0.2");
         beanConfig.setSchemes(new String[] {"http"});
-        beanConfig.setHost("localhost:8080");
+        beanConfig.setHost("localhost:" + environment.getProperty("server.port"));
         beanConfig.setBasePath("/mso");
         beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
         beanConfig.setPrettyPrint(true);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 563291c..3b9406a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -196,11 +196,9 @@
      * @throws IOException In case of issues when trying to load the key file
      */
     public void initASDC() throws ASDCControllerException {
-        String event = "Initialize the ASDC Controller";
-        logger.debug(event);
-        if (this.getControllerStatus() != ASDCControllerStatus.STOPPED) {
-            String endEvent = "The controller is already initialized, call the closeASDC method first";
-            throw new ASDCControllerException(endEvent);
+        logger.debug("Initialize the ASDC Controller");
+        if (!isStopped()) {
+            throw new ASDCControllerException("The controller is already initialized, call the closeASDC method first");
         }
 
         if (asdcConfig != null) {
@@ -238,6 +236,13 @@
     }
 
     /**
+     * @return true if controller is stopped
+     */
+    public boolean isStopped() {
+        return this.getControllerStatus() == ASDCControllerStatus.STOPPED;
+    }
+
+    /**
      * This method closes the ASDC Controller and the ASDC Client.
      *
      * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because it's currently
@@ -245,7 +250,7 @@
      */
     public void closeASDC() throws ASDCControllerException {
 
-        if (this.getControllerStatus() == ASDCControllerStatus.BUSY) {
+        if (isBusy()) {
             throw new ASDCControllerException("Cannot close the ASDC controller as it's currently in BUSY state");
         }
         if (this.distributionClient != null) {
@@ -261,6 +266,13 @@
         this.changeControllerStatus(ASDCControllerStatus.STOPPED);
     }
 
+    /**
+     * @return true if controller is currently processing notification
+     */
+    public boolean isBusy() {
+        return this.getControllerStatus() == ASDCControllerStatus.BUSY;
+    }
+
     protected boolean checkResourceAlreadyDeployed(ResourceStructure resource, boolean serviceDeployed)
             throws ArtifactInstallerException {
 
@@ -713,12 +725,6 @@
 
         try {
             this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
-            IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact();
-            String filePath =
-                    msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName();
-            File csarFile = new File(filePath);
-
-
             if (isCsarAlreadyDeployed(iNotif, toscaResourceStructure)) {
                 return;
             }
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index 56690a8..24e1887 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -23,7 +23,6 @@
 package org.onap.so.asdc.client.test.rest;
 
 
-import java.io.IOException;
 import javax.transaction.Transactional;
 import javax.ws.rs.HeaderParam;
 import javax.ws.rs.POST;
@@ -31,15 +30,14 @@
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.onap.so.logger.LoggingAnchor;
+import javax.ws.rs.core.Response.Status;
 import org.onap.so.asdc.client.ASDCController;
-import org.onap.so.asdc.client.exceptions.ASDCControllerException;
-import org.onap.so.asdc.client.exceptions.ASDCParametersException;
 import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
-import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
 import org.onap.so.asdc.client.test.emulators.JsonStatusData;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
 import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
 import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.logger.MessageEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,13 +46,15 @@
 import org.springframework.stereotype.Component;
 
 /**
- * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on
- * jboss without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step
- * and simulates both the notification step as well as the artifact download step.
+ * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service
+ * without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step and
+ * simulates both the notification step as well as the artifact download step.
  * <p>
- * i.e. http://localhost:8080/asdc/treatNotification/v1
+ * i.e. http://localhost:8085/test/treatNotification/v1
  * <p>
- * i.e. http://localhost:8080/asdc/statusData/v1
+ * i.e. http://localhost:8085/test/statusData/v1
+ * 
+ * This interface is also used in CSIT to simulate a distribution of a service, without using SDC
  *
  * @author jm5423
  */
@@ -66,48 +66,75 @@
 
     private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class);
 
-    @Autowired
-    private ASDCController asdcController;
+    private final ASDCController asdcController;
+
+    private final ToscaResourceInstaller toscaInstaller;
 
     @Autowired
-    private ToscaResourceInstaller toscaInstaller;
+    public ASDCRestInterface(final ASDCController asdcController, final ToscaResourceInstaller toscaInstaller) {
+        this.asdcController = asdcController;
+        this.toscaInstaller = toscaInstaller;
+    }
 
     @POST
     @Path("/treatNotification/v1")
     @Produces(MediaType.APPLICATION_JSON)
     @Transactional
-    public Response invokeASDCService(NotificationDataImpl request,
-            @HeaderParam("resource-location") String resourceLocation)
-            throws ASDCControllerException, ASDCParametersException, IOException {
-        DistributionClientEmulator distributionClientEmulator = new DistributionClientEmulator(resourceLocation);
+    public Response invokeASDCService(final NotificationDataImpl request,
+            @HeaderParam("resource-location") final String resourceLocation) {
 
-        asdcController.setControllerName("asdc-controller1");
-        asdcController.setDistributionClient(distributionClientEmulator);
-        asdcController.initASDC();
-        asdcController.treatNotification(request);
-        asdcController.closeASDC();
-        return Response.status(200).build();
+        try {
+            logger.info("Received message : {}", request);
+            logger.info("resource-location : {}", resourceLocation);
+            final DistributionClientEmulator distributionClientEmulator =
+                    getDistributionClientEmulator(resourceLocation);
+
+            asdcController.setControllerName("asdc-controller1");
+            asdcController.setDistributionClient(distributionClientEmulator);
+
+            if (asdcController.isStopped()) {
+                logger.info("{} not running will try to initialize it, currrent status: {}",
+                        asdcController.getClass().getName(), asdcController.getControllerStatus());
+                asdcController.initASDC();
+            }
+
+            asdcController.treatNotification(request);
+
+            if (!asdcController.isBusy()) {
+                asdcController.closeASDC();
+            }
+
+            return Response.status(Status.OK).build();
+        } catch (final Exception exception) {
+            logger.error("Unable to process notification request", exception);
+            return Response.status(Status.INTERNAL_SERVER_ERROR).build();
+        }
+
+    }
+
+    private DistributionClientEmulator getDistributionClientEmulator(final String resourceLocation) {
+        return new DistributionClientEmulator(resourceLocation);
     }
 
     @POST
     @Path("/statusData/v1")
     @Produces(MediaType.APPLICATION_JSON)
     @Transactional
-    public Response invokeASDCStatusData(String request) {
+    public Response invokeASDCStatusData(final String request) {
 
         try {
-            DistributionClientEmulator distributionClientEmulator =
-                    new DistributionClientEmulator("resource-examples/");
-            JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
+            final DistributionClientEmulator distributionClientEmulator =
+                    getDistributionClientEmulator("resource-examples/");
+            final JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
 
-            ASDCController controller = new ASDCController("asdc-controller1", distributionClientEmulator);
-            controller.initASDC();
+            asdcController.setDistributionClient(distributionClientEmulator);
+            asdcController.initASDC();
             toscaInstaller.installTheComponentStatus(statusData);
-            controller.closeASDC();
+            asdcController.closeASDC();
 
             logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
                     statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.info("Error caught " + e.getMessage());
             logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
                     "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
