http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTenantUserTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTenantUserTestCase.java
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTenantUserTestCase.java
new file mode 100644
index 0000000..048df0e
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTenantUserTestCase.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.stratos.python.cartridge.agent.integration.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.domain.LoadBalancingIPType;
+import org.apache.stratos.messaging.domain.topology.*;
+import 
org.apache.stratos.messaging.event.instance.notifier.ArtifactUpdatedEvent;
+import org.apache.stratos.messaging.event.topology.CompleteTopologyEvent;
+import org.apache.stratos.messaging.event.topology.MemberInitializedEvent;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertTrue;
+
+public class ADCMTAppTenantUserTestCase extends PythonAgentIntegrationTest {
+    private static final Log log = 
LogFactory.getLog(ADCMTAppTenantUserTestCase.class);
+    private static final int ADC_TIMEOUT = 180000;
+    private static final String APPLICATION_PATH = 
"/tmp/ADCMTAppTenantUserTestCase";
+    private static final String CLUSTER_ID = "tomcat.domain";
+    private static final String DEPLOYMENT_POLICY_NAME = "deployment-policy-4";
+    private static final String AUTOSCALING_POLICY_NAME = 
"autoscaling-policy-4";
+    private static final String APP_ID = "application-4";
+    private static final String MEMBER_ID = "tomcat.member-1";
+    private static final String CLUSTER_INSTANCE_ID = "cluster-1-instance-1";
+    private static final String NETWORK_PARTITION_ID = "network-partition-1";
+    private static final String PARTITION_ID = "partition-1";
+    private static final String TENANT_ID = "4";
+    private static final String SERVICE_NAME = "tomcat-mt";
+    private boolean hasADCTestCompleted = false;
+
+    public ADCMTAppTenantUserTestCase() throws IOException {
+    }
+
+    @BeforeMethod
+    public void setupADCMTAppTest() throws Exception {
+        log.info("Setting up ADCMTAppTenantUserTestCase");
+        // Set jndi.properties.dir system property for initializing event 
publishers and receivers
+        System.setProperty("jndi.properties.dir", getCommonResourcesPath());
+
+        // start Python agent with configurations provided in resource path
+        super.setup();
+
+        // Simulate server socket
+        startServerSocket(8080);
+    }
+
+    /**
+     * TearDown method for test method testPythonCartridgeAgent
+     */
+    @AfterMethod
+    public void tearDownADCMTAppTest() {
+        // TODO: app path is duplicated in Java test and payload
+        tearDown(APPLICATION_PATH);
+    }
+
+    @Test(timeOut = ADC_TIMEOUT)
+    public void testADCForMTApps() {
+        startCommunicatorThread();
+        assertAgentActivation();
+        Thread adcTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                log.info("Running ADC MT Test thread...");
+                // Send artifact updated event
+                publishEvent(getArtifactUpdatedEventForPublicRepo());
+                log.info("Publishing artifact updated event for repo: " +
+                        getArtifactUpdatedEventForPublicRepo().getRepoURL());
+
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed() && !hasADCTestCompleted) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Git clone executed")) {
+                                log.info("Agent has completed git clone. 
Asserting the operation...");
+                                
assertRepoClone(getArtifactUpdatedEventForPublicRepo());
+                                hasADCTestCompleted = true;
+                            }
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        adcTestThread.start();
+
+        while (!hasADCTestCompleted) {
+            // wait until the instance activated event is received.
+            sleep(1000);
+        }
+    }
+
+    private void assertAgentActivation() {
+        Thread startupTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (!eventReceiverInitiated) {
+                    sleep(1000);
+                }
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed()) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Subscribed to 'topology/#'")) {
+                                sleep(2000);
+                                // Send complete topology event
+                                log.info("Publishing complete topology 
event...");
+                                Topology topology = createTestTopology();
+                                CompleteTopologyEvent completeTopologyEvent = 
new CompleteTopologyEvent(topology);
+                                publishEvent(completeTopologyEvent);
+                                log.info("Complete topology event published");
+
+                                // Publish member initialized event
+                                log.info("Publishing member initialized 
event...");
+                                MemberInitializedEvent memberInitializedEvent 
= new MemberInitializedEvent(
+                                        SERVICE_NAME, CLUSTER_ID, 
CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID,
+                                        PARTITION_ID
+                                );
+                                publishEvent(memberInitializedEvent);
+                                log.info("Member initialized event published");
+                            }
+
+                            // Send artifact updated event to activate the 
instance first
+                            if (line.contains("Artifact repository found")) {
+                                
publishEvent(getArtifactUpdatedEventForPublicRepo());
+                                log.info("Artifact updated event published");
+                            }
+                            log.info(line);
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        startupTestThread.start();
+
+        while (!instanceStarted || !instanceActivated) {
+            // wait until the instance activated event is received.
+            // this will assert whether instance got activated within timeout 
period; no need for explicit assertions
+            sleep(2000);
+        }
+    }
+
+    private ArtifactUpdatedEvent getArtifactUpdatedEventForPublicRepo() {
+        ArtifactUpdatedEvent publicRepoEvent = 
createTestArtifactUpdatedEvent();
+        
publicRepoEvent.setRepoURL("https://bitbucket.org/testapache2211/opentestrepo1.git";);
+        return publicRepoEvent;
+    }
+
+    private void assertRepoClone(ArtifactUpdatedEvent artifactUpdatedEvent) {
+        File file = new File(APPLICATION_PATH + 
"/repository/tenants/4/test1.txt");
+        assertTrue("Git clone failed for repo [url] " + 
artifactUpdatedEvent.getRepoURL(),
+                file.exists());
+    }
+
+    private static ArtifactUpdatedEvent createTestArtifactUpdatedEvent() {
+        ArtifactUpdatedEvent artifactUpdatedEvent = new ArtifactUpdatedEvent();
+        artifactUpdatedEvent.setClusterId(CLUSTER_ID);
+        artifactUpdatedEvent.setTenantId(TENANT_ID);
+        return artifactUpdatedEvent;
+    }
+
+    /**
+     * Create test topology
+     *
+     * @return
+     */
+    private Topology createTestTopology() {
+        Topology topology = new Topology();
+        Service service = new Service(SERVICE_NAME, ServiceType.SingleTenant);
+        topology.addService(service);
+
+        Cluster cluster = new Cluster(service.getServiceName(), CLUSTER_ID, 
DEPLOYMENT_POLICY_NAME,
+                AUTOSCALING_POLICY_NAME, APP_ID);
+        service.addCluster(cluster);
+
+        Member member = new Member(service.getServiceName(), 
cluster.getClusterId(), MEMBER_ID,
+                CLUSTER_INSTANCE_ID, NETWORK_PARTITION_ID, PARTITION_ID, 
LoadBalancingIPType.Private,
+                System.currentTimeMillis());
+
+        member.setDefaultPrivateIP("10.0.0.1");
+        member.setDefaultPublicIP("20.0.0.1");
+        Properties properties = new Properties();
+        properties.setProperty("prop1", "value1");
+        member.setProperties(properties);
+        member.setStatus(MemberStatus.Created);
+        cluster.addMember(member);
+
+        return topology;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTestCase.java
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTestCase.java
new file mode 100644
index 0000000..e0636eb
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCMTAppTestCase.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.stratos.python.cartridge.agent.integration.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.domain.LoadBalancingIPType;
+import org.apache.stratos.messaging.domain.topology.*;
+import 
org.apache.stratos.messaging.event.instance.notifier.ArtifactUpdatedEvent;
+import org.apache.stratos.messaging.event.topology.CompleteTopologyEvent;
+import org.apache.stratos.messaging.event.topology.MemberInitializedEvent;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertTrue;
+
+public class ADCMTAppTestCase extends PythonAgentIntegrationTest {
+    private static final Log log = LogFactory.getLog(ADCMTAppTestCase.class);
+    private static final int ADC_TIMEOUT = 180000;
+    private static final String APPLICATION_PATH = "/tmp/ADCMTAppTestCase";
+    private static final String CLUSTER_ID = "tomcat.domain";
+    private static final String DEPLOYMENT_POLICY_NAME = "deployment-policy-3";
+    private static final String AUTOSCALING_POLICY_NAME = 
"autoscaling-policy-3";
+    private static final String APP_ID = "application-3";
+    private static final String MEMBER_ID = "tomcat.member-1";
+    private static final String CLUSTER_INSTANCE_ID = "cluster-1-instance-1";
+    private static final String NETWORK_PARTITION_ID = "network-partition-1";
+    private static final String PARTITION_ID = "partition-1";
+    private static final String TENANT_ID = "-1234";
+    private static final String SERVICE_NAME = "tomcat-mt";
+
+    private boolean hasADCTestCompleted = false;
+
+    public ADCMTAppTestCase() throws IOException {
+    }
+
+    @BeforeMethod
+    public void setupADCMTAppTest() throws Exception {
+        log.info("Setting up ADCMTAppTestCase");
+        // Set jndi.properties.dir system property for initializing event 
publishers and receivers
+        System.setProperty("jndi.properties.dir", getCommonResourcesPath());
+
+        // start Python agent with configurations provided in resource path
+        super.setup();
+
+        // Simulate server socket
+        startServerSocket(8080);
+    }
+
+    /**
+     * TearDown method for test method testPythonCartridgeAgent
+     */
+    @AfterMethod
+    public void tearDownADCMTAppTest() {
+        // TODO: app path is duplicated in Java test and payload
+        tearDown(APPLICATION_PATH);
+    }
+
+    @Test(timeOut = ADC_TIMEOUT)
+    public void testADCForMTApps() {
+        startCommunicatorThread();
+        assertAgentActivation();
+        Thread adcTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                log.info("Running ADC MT Test thread...");
+                // Send artifact updated event
+                publishEvent(getArtifactUpdatedEventForPublicRepo());
+                log.info("Publishing artifact updated event for repo: " +
+                        getArtifactUpdatedEventForPublicRepo().getRepoURL());
+
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed() && !hasADCTestCompleted) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Git clone executed")) {
+                                log.info("Agent has completed git clone. 
Asserting the operation...");
+                                
assertRepoClone(getArtifactUpdatedEventForPublicRepo());
+                                hasADCTestCompleted = true;
+                            }
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        adcTestThread.start();
+
+        while (!hasADCTestCompleted) {
+            // wait until the instance activated event is received.
+            sleep(1000);
+        }
+    }
+
+    private void assertAgentActivation() {
+        Thread startupTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (!eventReceiverInitiated) {
+                    sleep(1000);
+                }
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed()) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Subscribed to 'topology/#'")) {
+                                sleep(2000);
+                                // Send complete topology event
+                                log.info("Publishing complete topology 
event...");
+                                Topology topology = createTestTopology();
+                                CompleteTopologyEvent completeTopologyEvent = 
new CompleteTopologyEvent(topology);
+                                publishEvent(completeTopologyEvent);
+                                log.info("Complete topology event published");
+
+                                // Publish member initialized event
+                                log.info("Publishing member initialized 
event...");
+                                MemberInitializedEvent memberInitializedEvent 
= new MemberInitializedEvent(
+                                        SERVICE_NAME, CLUSTER_ID, 
CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID,
+                                        PARTITION_ID
+                                );
+                                publishEvent(memberInitializedEvent);
+                                log.info("Member initialized event published");
+                            }
+
+                            // Send artifact updated event to activate the 
instance first
+                            if (line.contains("Artifact repository found")) {
+                                
publishEvent(getArtifactUpdatedEventForPublicRepo());
+                                log.info("Artifact updated event published");
+                            }
+                            log.info(line);
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        startupTestThread.start();
+
+        while (!instanceStarted || !instanceActivated) {
+            // wait until the instance activated event is received.
+            // this will assert whether instance got activated within timeout 
period; no need for explicit assertions
+            sleep(2000);
+        }
+    }
+
+    private ArtifactUpdatedEvent getArtifactUpdatedEventForPublicRepo() {
+        ArtifactUpdatedEvent publicRepoEvent = 
createTestArtifactUpdatedEvent();
+        
publicRepoEvent.setRepoURL("https://bitbucket.org/testapache2211/opentestrepo1.git";);
+        return publicRepoEvent;
+    }
+
+    private void assertRepoClone(ArtifactUpdatedEvent artifactUpdatedEvent) {
+        File file = new File(APPLICATION_PATH + 
"/repository/deployment/server/test1.txt");
+        assertTrue("Git clone failed for repo [url] " + 
artifactUpdatedEvent.getRepoURL(),
+                file.exists());
+    }
+
+    private static ArtifactUpdatedEvent createTestArtifactUpdatedEvent() {
+        ArtifactUpdatedEvent artifactUpdatedEvent = new ArtifactUpdatedEvent();
+        artifactUpdatedEvent.setClusterId(CLUSTER_ID);
+        artifactUpdatedEvent.setTenantId(TENANT_ID);
+        return artifactUpdatedEvent;
+    }
+
+    /**
+     * Create test topology
+     *
+     * @return
+     */
+    private Topology createTestTopology() {
+        Topology topology = new Topology();
+        Service service = new Service(SERVICE_NAME, ServiceType.SingleTenant);
+        topology.addService(service);
+
+        Cluster cluster = new Cluster(service.getServiceName(), CLUSTER_ID, 
DEPLOYMENT_POLICY_NAME,
+                AUTOSCALING_POLICY_NAME, APP_ID);
+        service.addCluster(cluster);
+
+        Member member = new Member(service.getServiceName(), 
cluster.getClusterId(), MEMBER_ID,
+                CLUSTER_INSTANCE_ID, NETWORK_PARTITION_ID, PARTITION_ID, 
LoadBalancingIPType.Private,
+                System.currentTimeMillis());
+
+        member.setDefaultPrivateIP("10.0.0.1");
+        member.setDefaultPublicIP("20.0.0.1");
+        Properties properties = new Properties();
+        properties.setProperty("prop1", "value1");
+        member.setProperties(properties);
+        member.setStatus(MemberStatus.Created);
+        cluster.addMember(member);
+        return topology;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCTestCase.java
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCTestCase.java
new file mode 100755
index 0000000..0ac54fa
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/ADCTestCase.java
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.stratos.python.cartridge.agent.integration.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.domain.LoadBalancingIPType;
+import org.apache.stratos.messaging.domain.topology.*;
+import 
org.apache.stratos.messaging.event.instance.notifier.ArtifactUpdatedEvent;
+import org.apache.stratos.messaging.event.topology.CompleteTopologyEvent;
+import org.apache.stratos.messaging.event.topology.MemberInitializedEvent;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+import static junit.framework.Assert.assertTrue;
+
+public class ADCTestCase extends PythonAgentIntegrationTest {
+    private static final Log log = LogFactory.getLog(ADCTestCase.class);
+    private static final int ADC_TIMEOUT = 180000;
+    private static final String APPLICATION_PATH = "/tmp/ADCTestCase";
+    private static final String CLUSTER_ID = "tomcat.domain";
+    private static final String DEPLOYMENT_POLICY_NAME = "deployment-policy-2";
+    private static final String AUTOSCALING_POLICY_NAME = 
"autoscaling-policy-2";
+    private static final String APP_ID = "application-2";
+    private static final String MEMBER_ID = "tomcat.member-1";
+    private static final String CLUSTER_INSTANCE_ID = "cluster-1-instance-1";
+    private static final String NETWORK_PARTITION_ID = "network-partition-1";
+    private static final String PARTITION_ID = "partition-1";
+    private static final String TENANT_ID = "-1234";
+    private static final String SERVICE_NAME = "tomcat";
+
+    private boolean hasADCTestCompleted = false;
+
+    public ADCTestCase() throws IOException {
+    }
+
+    @BeforeMethod
+    public void setupADCTest() throws Exception {
+        log.info("Setting up ADCTestCase");
+        // Set jndi.properties.dir system property for initializing event 
publishers and receivers
+        System.setProperty("jndi.properties.dir", getCommonResourcesPath());
+
+        // start Python agent with configurations provided in resource path
+        super.setup();
+
+        // Simulate server socket
+        startServerSocket(8080);
+    }
+
+    /**
+     * TearDown method for test method testPythonCartridgeAgent
+     */
+    @AfterMethod
+    public void tearDownADCTest() {
+        // TODO: app path is duplicated in Java test and payload
+        tearDown(APPLICATION_PATH);
+    }
+
+
+    @Test(timeOut = ADC_TIMEOUT)
+    public void testADC() {
+        startCommunicatorThread();
+        assertAgentActivation();
+        Thread adcTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                log.info("Running ADC Test thread...");
+                // Send artifact updated event
+                publishEvent(getArtifactUpdatedEventForPrivateRepo());
+                log.info("Publishing artifact updated event for repo: " +
+                        getArtifactUpdatedEventForPrivateRepo().getRepoURL());
+
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed() && !hasADCTestCompleted) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Git clone executed")) {
+                                log.info("Agent has completed git clone. 
Asserting the operation...");
+                                
assertRepoClone(getArtifactUpdatedEventForPrivateRepo());
+                                File file = new File(APPLICATION_PATH + 
"/pca-live-" + UUID.randomUUID());
+                                try {
+                                    file.createNewFile();
+                                }
+                                catch (IOException e) {
+                                    log.error("Could not create file", e);
+                                }
+                            }
+                            if (line.contains("Pushed artifacts for tenant")) {
+                                log.info("ADC Test completed");
+                                hasADCTestCompleted = true;
+                            }
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        adcTestThread.start();
+
+        while (!hasADCTestCompleted) {
+            // wait until the instance activated event is received.
+            sleep(1000);
+        }
+    }
+
+    private void assertAgentActivation() {
+        Thread startupTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (!eventReceiverInitiated) {
+                    sleep(1000);
+                }
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed()) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Subscribed to 'topology/#'")) {
+                                sleep(2000);
+                                // Send complete topology event
+                                log.info("Publishing complete topology 
event...");
+                                Topology topology = createTestTopology();
+                                CompleteTopologyEvent completeTopologyEvent = 
new CompleteTopologyEvent(topology);
+                                publishEvent(completeTopologyEvent);
+                                log.info("Complete topology event published");
+
+                                // Publish member initialized event
+                                log.info("Publishing member initialized 
event...");
+                                MemberInitializedEvent memberInitializedEvent 
= new MemberInitializedEvent(
+                                        SERVICE_NAME, CLUSTER_ID, 
CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID,
+                                        PARTITION_ID
+                                );
+                                publishEvent(memberInitializedEvent);
+                                log.info("Member initialized event published");
+                            }
+
+                            // Send artifact updated event to activate the 
instance first
+                            if (line.contains("Artifact repository found")) {
+                                
publishEvent(getArtifactUpdatedEventForPrivateRepo());
+                                log.info("Artifact updated event published");
+                            }
+                            log.info(line);
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+        startupTestThread.start();
+
+        while (!instanceStarted || !instanceActivated) {
+            // wait until the instance activated event is received.
+            // this will assert whether instance got activated within timeout 
period; no need for explicit assertions
+            sleep(2000);
+        }
+    }
+
+    private void assertRepoClone(ArtifactUpdatedEvent artifactUpdatedEvent) {
+        File file = new File(APPLICATION_PATH + "/README.text");
+        assertTrue("Git clone failed for repo [url] " + 
artifactUpdatedEvent.getRepoURL(),
+                file.exists());
+    }
+
+
+    public static ArtifactUpdatedEvent getArtifactUpdatedEventForPublicRepo() {
+        ArtifactUpdatedEvent publicRepoEvent = 
createTestArtifactUpdatedEvent();
+        
publicRepoEvent.setRepoURL("https://bitbucket.org/testapache2211/opentestrepo1.git";);
+        return publicRepoEvent;
+    }
+
+    public static ArtifactUpdatedEvent getArtifactUpdatedEventForPrivateRepo() 
{
+        ArtifactUpdatedEvent privateRepoEvent = 
createTestArtifactUpdatedEvent();
+        
privateRepoEvent.setRepoURL("https://bitbucket.org/testapache2211/testrepo.git";);
+        privateRepoEvent.setRepoUserName("testapache2211");
+        privateRepoEvent.setRepoPassword("RExPDGa4GkPJj4kJDzSROQ==");
+        return privateRepoEvent;
+    }
+
+    private static ArtifactUpdatedEvent createTestArtifactUpdatedEvent() {
+        ArtifactUpdatedEvent artifactUpdatedEvent = new ArtifactUpdatedEvent();
+        artifactUpdatedEvent.setClusterId(CLUSTER_ID);
+        artifactUpdatedEvent.setTenantId(TENANT_ID);
+        return artifactUpdatedEvent;
+    }
+
+    /**
+     * Create test topology
+     *
+     * @return
+     */
+    private Topology createTestTopology() {
+        Topology topology = new Topology();
+        Service service = new Service(SERVICE_NAME, ServiceType.SingleTenant);
+        topology.addService(service);
+
+        Cluster cluster = new Cluster(service.getServiceName(), CLUSTER_ID, 
DEPLOYMENT_POLICY_NAME,
+                AUTOSCALING_POLICY_NAME, APP_ID);
+        service.addCluster(cluster);
+
+        Member member = new Member(service.getServiceName(), 
cluster.getClusterId(), MEMBER_ID,
+                CLUSTER_INSTANCE_ID, NETWORK_PARTITION_ID, PARTITION_ID, 
LoadBalancingIPType.Private,
+                System.currentTimeMillis());
+
+        member.setDefaultPrivateIP("10.0.0.1");
+        member.setDefaultPublicIP("20.0.0.1");
+        Properties properties = new Properties();
+        properties.setProperty("prop1", "value1");
+        member.setProperties(properties);
+        member.setStatus(MemberStatus.Created);
+        cluster.addMember(member);
+        return topology;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/AgentStartupTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/AgentStartupTestCase.java
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/AgentStartupTestCase.java
new file mode 100755
index 0000000..bc2f48a
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/AgentStartupTestCase.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.stratos.python.cartridge.agent.integration.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.domain.LoadBalancingIPType;
+import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.event.topology.CompleteTopologyEvent;
+import org.apache.stratos.messaging.event.topology.MemberInitializedEvent;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class AgentStartupTestCase extends PythonAgentIntegrationTest {
+    private static final Log log = 
LogFactory.getLog(AgentStartupTestCase.class);
+    private static final int STARTUP_TIMEOUT = 120000;
+    private static final String CLUSTER_ID = "php.php.domain";
+    private static final String DEPLOYMENT_POLICY_NAME = "deployment-policy-1";
+    private static final String AUTOSCALING_POLICY_NAME = 
"autoscaling-policy-1";
+    private static final String APP_ID = "application-1";
+    private static final String MEMBER_ID = "php.member-1";
+    private static final String CLUSTER_INSTANCE_ID = "cluster-1-instance-1";
+    private static final String NETWORK_PARTITION_ID = "network-partition-1";
+    private static final String PARTITION_ID = "partition-1";
+    private static final String TENANT_ID = "-1234";
+    private static final String SERVICE_NAME = "php";
+    private boolean startupTestCompleted = false;
+
+    public AgentStartupTestCase() throws IOException {
+    }
+
+    @BeforeMethod
+    public void setupAgentStartupTest() throws Exception {
+        log.info("Setting up AgentStartupTestCase");
+        // Set jndi.properties.dir system property for initializing event 
publishers and receivers
+        System.setProperty("jndi.properties.dir", getCommonResourcesPath());
+
+        // start Python agent with configurations provided in resource path
+        super.setup();
+
+        // Simulate server socket
+        startServerSocket(8080);
+    }
+
+
+    /**
+     * TearDown method for test method testPythonCartridgeAgent
+     */
+    @AfterMethod
+    public void tearDownAgentStartupTest() {
+        tearDown();
+    }
+
+    @Test(timeOut = STARTUP_TIMEOUT)
+    public void testPythonCartridgeAgent() {
+        startCommunicatorThread();
+        Thread startupTestThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (!eventReceiverInitiated) {
+                    sleep(2000);
+                }
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed()) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Subscribed to 'topology/#'")) {
+                                sleep(2000);
+                                // Send complete topology event
+                                log.info("Publishing complete topology 
event...");
+                                Topology topology = createTestTopology();
+                                CompleteTopologyEvent completeTopologyEvent = 
new CompleteTopologyEvent(topology);
+                                publishEvent(completeTopologyEvent);
+                                log.info("Complete topology event published");
+
+                                // Publish member initialized event
+                                log.info("Publishing member initialized 
event...");
+                                MemberInitializedEvent memberInitializedEvent 
= new MemberInitializedEvent(
+                                        SERVICE_NAME, CLUSTER_ID, 
CLUSTER_INSTANCE_ID, MEMBER_ID, NETWORK_PARTITION_ID,
+                                        PARTITION_ID
+                                );
+                                publishEvent(memberInitializedEvent);
+                                log.info("Member initialized event published");
+                            }
+                            // TODO: properly mock the CEP server
+                            if (line.contains("Published event to thrift 
stream")) {
+                                startupTestCompleted = true;
+                            }
+                        }
+                    }
+                    sleep(1000);
+                }
+            }
+        });
+
+        startupTestThread.start();
+
+        while (!instanceStarted || !instanceActivated || 
!startupTestCompleted) {
+            // wait until the instance activated event is received.
+            // this will assert whether instance got activated within timeout 
period; no need for explicit assertions
+            sleep(2000);
+        }
+    }
+
+
+    /**
+     * Create test topology
+     *
+     * @return
+     */
+    private Topology createTestTopology() {
+        Topology topology = new Topology();
+        Service service = new Service(SERVICE_NAME, ServiceType.SingleTenant);
+        topology.addService(service);
+
+        Cluster cluster = new Cluster(service.getServiceName(), CLUSTER_ID, 
DEPLOYMENT_POLICY_NAME,
+                AUTOSCALING_POLICY_NAME, APP_ID);
+        service.addCluster(cluster);
+
+        Member member = new Member(service.getServiceName(), 
cluster.getClusterId(), MEMBER_ID,
+                CLUSTER_INSTANCE_ID, NETWORK_PARTITION_ID, PARTITION_ID, 
LoadBalancingIPType.Private,
+                System.currentTimeMillis());
+
+        member.setDefaultPrivateIP("10.0.0.1");
+        member.setDefaultPublicIP("20.0.0.1");
+        Properties properties = new Properties();
+        properties.setProperty("prop1", "value1");
+        member.setProperties(properties);
+        member.setStatus(MemberStatus.Created);
+        cluster.addMember(member);
+        return topology;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
new file mode 100644
index 0000000..96ade59
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/java/org/apache/stratos/python/cartridge/agent/integration/tests/PythonAgentIntegrationTest.java
@@ -0,0 +1,491 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.stratos.python.cartridge.agent.integration.tests;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.commons.exec.*;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.threading.StratosThreadPool;
+import org.apache.stratos.messaging.broker.publish.EventPublisher;
+import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
+import org.apache.stratos.messaging.event.Event;
+import 
org.apache.stratos.messaging.listener.instance.status.InstanceActivatedEventListener;
+import 
org.apache.stratos.messaging.listener.instance.status.InstanceStartedEventListener;
+import 
org.apache.stratos.messaging.message.receiver.instance.status.InstanceStatusEventReceiver;
+import 
org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
+import org.apache.stratos.messaging.util.MessagingUtil;
+import 
org.apache.stratos.python.cartridge.agent.integration.common.ThriftTestServer;
+
+import java.io.*;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class PythonAgentIntegrationTest {
+    protected final Properties integrationProperties = new Properties();
+    public static final String PATH_SEP = File.separator;
+    private static final Log log = 
LogFactory.getLog(PythonAgentIntegrationTest.class);
+    protected BrokerService broker;
+
+    public final long TIMEOUT = 5 * 60000;
+    public static final String NEW_LINE = System.getProperty("line.separator");
+    public static final String ACTIVEMQ_AMQP_BIND_ADDRESS = 
"activemq.amqp.bind.address";
+    public static final String ACTIVEMQ_MQTT_BIND_ADDRESS = 
"activemq.mqtt.bind.address";
+    public static final String CEP_PORT = "cep.port";
+    public static final String CEP_SSL_PORT = "cep.ssl.port";
+    public static final String DISTRIBUTION_NAME = "distribution.name";
+    protected final UUID PYTHON_AGENT_DIR_NAME = UUID.randomUUID();
+
+    protected Map<Integer, ServerSocket> serverSocketMap = new HashMap<>();
+    protected Map<String, Executor> executorList = new HashMap<String, 
Executor>();
+
+    protected int cepPort;
+    protected int cepSSLPort;
+    protected String amqpBindAddress;
+    protected String mqttBindAddress;
+    protected String distributionName;
+
+    protected boolean eventReceiverInitiated = false;
+    protected TopologyEventReceiver topologyEventReceiver;
+    protected InstanceStatusEventReceiver instanceStatusEventReceiver;
+    protected boolean instanceStarted;
+    protected boolean instanceActivated;
+    protected ByteArrayOutputStreamLocal outputStream;
+    private ThriftTestServer thriftTestServer;
+
+    /**
+     * Setup method for test method testPythonCartridgeAgent
+     */
+    protected void setup() throws Exception {
+        // start ActiveMQ test server
+        startBroker();
+
+        if (!this.eventReceiverInitiated) {
+            ExecutorService executorService = 
StratosThreadPool.getExecutorService("TEST_THREAD_POOL", 15);
+            topologyEventReceiver = new TopologyEventReceiver();
+            topologyEventReceiver.setExecutorService(executorService);
+            topologyEventReceiver.execute();
+
+            instanceStatusEventReceiver = new InstanceStatusEventReceiver();
+            instanceStatusEventReceiver.setExecutorService(executorService);
+            instanceStatusEventReceiver.execute();
+
+            this.instanceStarted = false;
+            instanceStatusEventReceiver.addEventListener(new 
InstanceStartedEventListener() {
+                @Override
+                protected void onEvent(Event event) {
+                    log.info("Instance started event received");
+                    instanceStarted = true;
+                }
+            });
+
+            this.instanceActivated = false;
+            instanceStatusEventReceiver.addEventListener(new 
InstanceActivatedEventListener() {
+                @Override
+                protected void onEvent(Event event) {
+                    log.info("Instance activated event received");
+                    instanceActivated = true;
+                }
+            });
+
+            this.eventReceiverInitiated = true;
+        }
+
+        // Start CEP Thrift test server
+        thriftTestServer = new ThriftTestServer();
+
+        File file =
+                new File(getResourcesPath() + PATH_SEP + "common" + PATH_SEP + 
"stratos-health-stream-def.json");
+        FileInputStream fis = new FileInputStream(file);
+        byte[] data = new byte[(int) file.length()];
+        fis.read(data);
+        fis.close();
+        String str = new String(data, "UTF-8");
+        if (str.equals("")) {
+            log.warn("Stream definition of health stat stream is empty. Thrift 
server will not function properly");
+        }
+        thriftTestServer.addStreamDefinition(str, -1234);
+        // start with non-ssl port; test server will automatically bind to ssl 
port
+        thriftTestServer.start(cepPort);
+        log.info("Started Thrift server with stream definition: " + str);
+
+        String agentPath = setupPythonAgent();
+        log.info("Python agent working directory name: " + 
PYTHON_AGENT_DIR_NAME);
+        log.info("Starting python cartridge agent...");
+        this.outputStream = executeCommand("python " + agentPath + PATH_SEP + 
"agent.py");
+    }
+
+
+    protected void tearDown() {
+        tearDown(null);
+    }
+
+    /**
+     * TearDown method for test method testPythonCartridgeAgent
+     */
+    protected void tearDown(String sourcePath) {
+        for (Map.Entry<String, Executor> entry : executorList.entrySet()) {
+            try {
+                String commandText = entry.getKey();
+                Executor executor = entry.getValue();
+                log.info("Terminating process: " + commandText);
+                executor.setExitValue(0);
+                executor.getWatchdog().destroyProcess();
+            }
+            catch (Exception ignore) {
+            }
+        }
+        // wait until everything cleans up to avoid connection errors
+        sleep(1000);
+        for (ServerSocket serverSocket : serverSocketMap.values()) {
+            try {
+                log.info("Stopping socket server: " + 
serverSocket.getLocalSocketAddress());
+                serverSocket.close();
+            }
+            catch (IOException ignore) {
+            }
+        }
+        try {
+            if (thriftTestServer != null) {
+                thriftTestServer.stop();
+            }
+        }
+        catch (Exception ignore) {
+        }
+
+        if (sourcePath != null) {
+            try {
+                log.info("Deleting source checkout folder...");
+                FileUtils.deleteDirectory(new File(sourcePath));
+            }
+            catch (Exception ignore) {
+            }
+        }
+        this.instanceStatusEventReceiver.terminate();
+        this.topologyEventReceiver.terminate();
+
+        this.instanceActivated = false;
+        this.instanceStarted = false;
+        try {
+            broker.stop();
+            broker = null;
+        }
+        catch (Exception ignore) {
+        }
+        // TODO: use thread synchronization and assert all connections are 
properly closed
+        // leave some room to clear up active connections
+        sleep(1000);
+    }
+
+    public PythonAgentIntegrationTest() throws IOException {
+        integrationProperties
+                .load(PythonAgentIntegrationTest.class
+                        .getResourceAsStream(PATH_SEP + 
"integration-test.properties"));
+        distributionName = 
integrationProperties.getProperty(DISTRIBUTION_NAME);
+        amqpBindAddress = 
integrationProperties.getProperty(ACTIVEMQ_AMQP_BIND_ADDRESS);
+        mqttBindAddress = 
integrationProperties.getProperty(ACTIVEMQ_MQTT_BIND_ADDRESS);
+        cepPort = 
Integer.parseInt(integrationProperties.getProperty(CEP_PORT));
+        cepSSLPort = 
Integer.parseInt(integrationProperties.getProperty(CEP_SSL_PORT));
+        log.info("PCA integration properties: " + 
integrationProperties.toString());
+    }
+
+    protected void startBroker() throws Exception {
+        broker = new BrokerService();
+        broker.addConnector(amqpBindAddress);
+        broker.addConnector(mqttBindAddress);
+        broker.setBrokerName("testBroker");
+        broker.setDataDirectory(
+                
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." + PATH_SEP +
+                        PYTHON_AGENT_DIR_NAME + PATH_SEP + "activemq-data");
+        broker.start();
+        log.info("Broker service started!");
+    }
+
+    protected void startCommunicatorThread() {
+        Thread communicatorThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                List<String> outputLines = new ArrayList<String>();
+                while (!outputStream.isClosed()) {
+                    List<String> newLines = getNewLines(outputLines, 
outputStream.toString());
+                    if (newLines.size() > 0) {
+                        for (String line : newLines) {
+                            if (line.contains("Exception in thread") || 
line.contains("ERROR")) {
+                                try {
+                                    throw new RuntimeException(line);
+                                }
+                                catch (Exception e) {
+                                    log.error("ERROR found in PCA log", e);
+                                }
+                            }
+                            log.info("[PCA] " + line);
+                        }
+                    }
+                    sleep(100);
+                }
+            }
+        });
+        communicatorThread.start();
+    }
+
+    /**
+     * Start server socket
+     *
+     * @param port
+     */
+    protected void startServerSocket(final int port) {
+        Thread socketThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    ServerSocket serverSocket = new ServerSocket(port);
+                    serverSocketMap.put(port, serverSocket);
+                    log.info("Server socket started on port: " + port);
+                    Socket socket = serverSocket.accept();
+                    log.info("Client connected to [port] " + port);
+
+                    InputStream is = socket.getInputStream();
+                    byte[] buffer = new byte[1024];
+                    int read;
+                    while (!socket.isClosed()) {
+                        if ((read = is.read(buffer)) != -1) {
+                            String output = new String(buffer, 0, read);
+                            log.info("Message received for [port] " + port + 
", [message] " + output);
+                        }
+                    }
+                }
+                catch (IOException e) {
+                    String message = "Could not start server socket: [port] " 
+ port;
+                    log.error(message, e);
+                    throw new RuntimeException(message, e);
+                }
+            }
+        });
+        socketThread.start();
+    }
+
+    public static String getCommonResourcesPath() {
+        return 
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." + PATH_SEP +
+                ".." + PATH_SEP + "src" + PATH_SEP + "test" + PATH_SEP + 
"resources" + PATH_SEP + "common";
+    }
+
+
+    public static String getResourcesPath() {
+        return 
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." + PATH_SEP +
+                ".." + PATH_SEP + "src" + PATH_SEP + "test" + PATH_SEP + 
"resources";
+    }
+
+    protected String getTestCaseResourcesPath() {
+        return 
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + ".." + 
PATH_SEP + ".." + PATH_SEP +
+                "src" + PATH_SEP + "test" + PATH_SEP + "resources" + PATH_SEP 
+ this.getClass().getSimpleName();
+    }
+
+    /**
+     * Copy python agent distribution to a new folder, extract it and copy 
sample configuration files
+     *
+     * @return
+     */
+    protected String setupPythonAgent() {
+        try {
+            log.info("Setting up python cartridge agent...");
+
+
+            String srcAgentPath = 
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() +
+                    PATH_SEP + ".." + PATH_SEP + ".." + PATH_SEP + ".." + 
PATH_SEP + ".." + PATH_SEP + "distribution" +
+                    PATH_SEP + "target" + PATH_SEP + distributionName + ".zip";
+            String unzipDestPath =
+                    
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." + PATH_SEP +
+                            PYTHON_AGENT_DIR_NAME + PATH_SEP;
+            //FileUtils.copyFile(new File(srcAgentPath), new 
File(destAgentPath));
+            unzip(srcAgentPath, unzipDestPath);
+            String destAgentPath = 
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." +
+                    PATH_SEP + PYTHON_AGENT_DIR_NAME + PATH_SEP + 
distributionName;
+
+            String srcAgentConfPath = getTestCaseResourcesPath() + PATH_SEP + 
"agent.conf";
+            String destAgentConfPath = destAgentPath + PATH_SEP + "agent.conf";
+            FileUtils.copyFile(new File(srcAgentConfPath), new 
File(destAgentConfPath));
+
+            String srcLoggingIniPath = getTestCaseResourcesPath() + PATH_SEP + 
"logging.ini";
+            String destLoggingIniPath = destAgentPath + PATH_SEP + 
"logging.ini";
+            FileUtils.copyFile(new File(srcLoggingIniPath), new 
File(destLoggingIniPath));
+
+            String srcPayloadPath = getTestCaseResourcesPath() + PATH_SEP + 
"payload";
+            String destPayloadPath = destAgentPath + PATH_SEP + "payload";
+            FileUtils.copyDirectory(new File(srcPayloadPath), new 
File(destPayloadPath));
+
+            File extensionsPath = new File(destAgentPath + PATH_SEP + 
"extensions" + PATH_SEP + "bash");
+            File[] extensions = extensionsPath.listFiles();
+            log.info("Changing extension scripts permissions in: " + 
extensionsPath.getAbsolutePath());
+            assert extensions != null;
+            for (File extension : extensions) {
+                extension.setExecutable(true);
+            }
+
+            log.info("Python cartridge agent setup completed");
+
+            return destAgentPath;
+        }
+        catch (Exception e) {
+            String message = "Could not copy cartridge agent distribution";
+            log.error(message, e);
+            throw new RuntimeException(message, e);
+        }
+    }
+
+    private void unzip(String zipFilePath, String destDirectory) throws 
IOException {
+        File destDir = new File(destDirectory);
+        if (!destDir.exists()) {
+            destDir.mkdir();
+        }
+        ZipInputStream zipIn = new ZipInputStream(new 
FileInputStream(zipFilePath));
+        ZipEntry entry = zipIn.getNextEntry();
+        // iterates over entries in the zip file
+        while (entry != null) {
+            String filePath = destDirectory + File.separator + entry.getName();
+            if (!entry.isDirectory()) {
+                // if the entry is a file, extracts it
+                extractFile(zipIn, filePath);
+            } else {
+                // if the entry is a directory, make the directory
+                File dir = new File(filePath);
+                dir.mkdir();
+            }
+            zipIn.closeEntry();
+            entry = zipIn.getNextEntry();
+        }
+        zipIn.close();
+    }
+
+    private void extractFile(ZipInputStream zipIn, String filePath) throws 
IOException {
+        BufferedOutputStream bos = new BufferedOutputStream(new 
FileOutputStream(filePath));
+        byte[] bytesIn = new byte[4096];
+        int read = 0;
+        while ((read = zipIn.read(bytesIn)) != -1) {
+            bos.write(bytesIn, 0, read);
+        }
+        bos.close();
+    }
+
+    /**
+     * Execute shell command
+     *
+     * @param commandText
+     */
+    protected ByteArrayOutputStreamLocal executeCommand(final String 
commandText) {
+        final ByteArrayOutputStreamLocal outputStream = new 
ByteArrayOutputStreamLocal();
+        try {
+            CommandLine commandline = CommandLine.parse(commandText);
+            DefaultExecutor exec = new DefaultExecutor();
+            PumpStreamHandler streamHandler = new 
PumpStreamHandler(outputStream);
+            exec.setWorkingDirectory(new File(
+                    
PythonAgentIntegrationTest.class.getResource(PATH_SEP).getPath() + PATH_SEP + 
".." + PATH_SEP +
+                            PYTHON_AGENT_DIR_NAME));
+            exec.setStreamHandler(streamHandler);
+            ExecuteWatchdog watchdog = new ExecuteWatchdog(TIMEOUT);
+            exec.setWatchdog(watchdog);
+            exec.execute(commandline, new ExecuteResultHandler() {
+                @Override
+                public void onProcessComplete(int i) {
+                    log.info(commandText + " process completed");
+                }
+
+                @Override
+                public void onProcessFailed(ExecuteException e) {
+                    log.error(commandText + " process failed", e);
+                }
+            });
+            executorList.put(commandText, exec);
+            return outputStream;
+        }
+        catch (Exception e) {
+            log.error(outputStream.toString(), e);
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Sleep current thread
+     *
+     * @param time
+     */
+    protected void sleep(long time) {
+        try {
+            Thread.sleep(time);
+        }
+        catch (InterruptedException ignore) {
+        }
+    }
+
+    /**
+     * Return new lines found in the output
+     *
+     * @param currentOutputLines current output lines
+     * @param output             output
+     * @return
+     */
+    protected List<String> getNewLines(List<String> currentOutputLines, String 
output) {
+        List<String> newLines = new ArrayList<String>();
+
+        if (StringUtils.isNotBlank(output)) {
+            String[] lines = output.split(NEW_LINE);
+            for (String line : lines) {
+                if (!currentOutputLines.contains(line)) {
+                    currentOutputLines.add(line);
+                    newLines.add(line);
+                }
+            }
+        }
+        return newLines;
+    }
+
+    /**
+     * Publish messaging event
+     *
+     * @param event
+     */
+    protected void publishEvent(Event event) {
+        String topicName = MessagingUtil.getMessageTopicName(event);
+        EventPublisher eventPublisher = 
EventPublisherPool.getPublisher(topicName);
+        eventPublisher.publish(event);
+    }
+
+
+    /**
+     * Implements ByteArrayOutputStream.isClosed() method
+     */
+    protected class ByteArrayOutputStreamLocal extends 
org.apache.commons.io.output.ByteArrayOutputStream {
+        private boolean closed;
+
+        @Override
+        public void close() throws IOException {
+            super.close();
+            closed = true;
+        }
+
+        public boolean isClosed() {
+            return closed;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/agent.conf
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/agent.conf
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/agent.conf
new file mode 100755
index 0000000..f945968
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/agent.conf
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+[agent]
+mb.ip                                 =localhost
+mb.port                               =1885
+listen.address                        =localhost
+thrift.receiver.ip                    =localhost
+thrift.receiver.port                  =7712
+thrift.server.admin.username          =admin
+thrift.server.admin.password          =admin
+cep.stats.publisher.enabled           =true
+lb.private.ip                         =
+lb.public.ip                          =
+enable.artifact.update                =true
+auto.commit                           =true
+auto.checkout                         =true
+artifact.update.interval              =15
+artifact.clone.retries                =5
+artifact.clone.interval               =10
+port.check.timeout                    =600000
+enable.data.publisher                 =false
+monitoring.server.ip                  =localhost
+monitoring.server.port                =7612
+monitoring.server.secure.port         =7712
+monitoring.server.admin.username      =admin
+monitoring.server.admin.password      =admin
+log.file.paths                        
=/tmp/agent.screen-adc-mt-tenant-user-test.log
+metadata.service.url                  =https://localhost:9443
+super.tenant.repository.path          =/repository/deployment/server/
+tenant.repository.path                =/repository/tenants/

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/logging.ini
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/logging.ini
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/logging.ini
new file mode 100755
index 0000000..15cad9b
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/logging.ini
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+
+[formatters]
+keys=default
+
+[formatter_default]
+format=[%(asctime)s] %(levelname)s {%(filename)s:%(funcName)s} - %(message)s
+class=logging.Formatter
+
+[handlers]
+keys=console, error_file, log_file
+
+[handler_console]
+class=logging.StreamHandler
+formatter=default
+args=tuple()
+
+[handler_log_file]
+class=logging.FileHandler
+level=DEBUG
+formatter=default
+args=("agent.log", "w")
+
+[handler_error_file]
+class=logging.FileHandler
+level=ERROR
+formatter=default
+args=("error.log", "w")
+
+[loggers]
+keys=root
+
+[logger_root]
+level=DEBUG
+formatter=default
+handlers=console,error_file,log_file
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/payload/launch-params
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/payload/launch-params
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/payload/launch-params
new file mode 100755
index 0000000..ffc0b62
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTenantUserTestCase/payload/launch-params
@@ -0,0 +1 @@
+APPLICATION_ID=application-4,SERVICE_NAME=tomcat-mt,HOST_NAME=tomcat.stratos.org,MULTITENANT=true,TENANT_ID=4,TENANT_RANGE=*,CARTRIDGE_ALIAS=tomcat,CLUSTER_ID=tomcat.domain,CLUSTER_INSTANCE_ID=cluster-1-instance-1,CARTRIDGE_KEY=PUjpXCLujDhYr5A6,DEPLOYMENT=default,REPO_URL=https://github.com/imesh/stratos-php-applications.git,PORTS=8080,PUPPET_IP=127.0.0.1,PUPPET_HOSTNAME=puppet.apache.stratos.org,PUPPET_ENV=false,MEMBER_ID=tomcat.member-1,LB_CLUSTER_ID=null,NETWORK_PARTITION_ID=network-p1,PARTITION_ID=p1,APPLICATION_PATH=/tmp/ADCMTAppTenantUserTestCase,MIN_COUNT=1,INTERNAL=false,CLUSTERING_PRIMARY_KEY=A,LOG_FILE_PATHS=/tmp/temp.log,PERSISTENCE_MAPPING=null

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/agent.conf
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/agent.conf
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/agent.conf
new file mode 100755
index 0000000..6444c2e
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/agent.conf
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+[agent]
+mb.ip                                 =localhost
+mb.port                               =1885
+listen.address                        =localhost
+thrift.receiver.ip                    =localhost
+thrift.receiver.port                  =7712
+thrift.server.admin.username          =admin
+thrift.server.admin.password          =admin
+cep.stats.publisher.enabled           =true
+lb.private.ip                         =
+lb.public.ip                          =
+enable.artifact.update                =true
+auto.commit                           =true
+auto.checkout                         =true
+artifact.update.interval              =15
+artifact.clone.retries                =5
+artifact.clone.interval               =10
+port.check.timeout                    =600000
+enable.data.publisher                 =false
+monitoring.server.ip                  =localhost
+monitoring.server.port                =7612
+monitoring.server.secure.port         =7712
+monitoring.server.admin.username      =admin
+monitoring.server.admin.password      =admin
+log.file.paths                        =/tmp/agent.screen-adc-mt-app-test.log
+metadata.service.url                  =https://localhost:9443
+super.tenant.repository.path          =/repository/deployment/server/
+tenant.repository.path                =/repository/tenants/

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/logging.ini
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/logging.ini
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/logging.ini
new file mode 100755
index 0000000..15cad9b
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/logging.ini
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+
+[formatters]
+keys=default
+
+[formatter_default]
+format=[%(asctime)s] %(levelname)s {%(filename)s:%(funcName)s} - %(message)s
+class=logging.Formatter
+
+[handlers]
+keys=console, error_file, log_file
+
+[handler_console]
+class=logging.StreamHandler
+formatter=default
+args=tuple()
+
+[handler_log_file]
+class=logging.FileHandler
+level=DEBUG
+formatter=default
+args=("agent.log", "w")
+
+[handler_error_file]
+class=logging.FileHandler
+level=ERROR
+formatter=default
+args=("error.log", "w")
+
+[loggers]
+keys=root
+
+[logger_root]
+level=DEBUG
+formatter=default
+handlers=console,error_file,log_file
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/payload/launch-params
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/payload/launch-params
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/payload/launch-params
new file mode 100755
index 0000000..056b4f2
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCMTAppTestCase/payload/launch-params
@@ -0,0 +1 @@
+APPLICATION_ID=application-3,SERVICE_NAME=tomcat-mt,HOST_NAME=tomcat.stratos.org,MULTITENANT=true,TENANT_ID=-1234,TENANT_RANGE=*,CARTRIDGE_ALIAS=tomcat,CLUSTER_ID=tomcat.domain,CLUSTER_INSTANCE_ID=cluster-1-instance-1,CARTRIDGE_KEY=PUjpXCLujDhYr5A6,DEPLOYMENT=default,REPO_URL=https://github.com/imesh/stratos-php-applications.git,PORTS=8080,PUPPET_IP=127.0.0.1,PUPPET_HOSTNAME=puppet.apache.stratos.org,PUPPET_ENV=false,MEMBER_ID=tomcat.member-1,LB_CLUSTER_ID=null,NETWORK_PARTITION_ID=network-p1,PARTITION_ID=p1,APPLICATION_PATH=/tmp/ADCMTAppTestCase,MIN_COUNT=1,INTERNAL=false,CLUSTERING_PRIMARY_KEY=A,LOG_FILE_PATHS=/tmp/temp.log,PERSISTENCE_MAPPING=null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/agent.conf
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/agent.conf
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/agent.conf
new file mode 100755
index 0000000..fd3e423
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/agent.conf
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+[agent]
+mb.ip                                 =localhost
+mb.port                               =1885
+listen.address                        =localhost
+thrift.receiver.ip                    =localhost
+thrift.receiver.port                  =7712
+thrift.server.admin.username          =admin
+thrift.server.admin.password          =admin
+cep.stats.publisher.enabled           =true
+lb.private.ip                         =
+lb.public.ip                          =
+enable.artifact.update                =true
+auto.commit                           =true
+auto.checkout                         =true
+artifact.update.interval              =15
+artifact.clone.retries                =5
+artifact.clone.interval               =10
+port.check.timeout                    =600000
+enable.data.publisher                 =false
+monitoring.server.ip                  =localhost
+monitoring.server.port                =7612
+monitoring.server.secure.port         =7712
+monitoring.server.admin.username      =admin
+monitoring.server.admin.password      =admin
+log.file.paths                        =/tmp/agent.screen-adc-test.log
+metadata.service.url                  =https://localhost:9443
+super.tenant.repository.path          =/repository/deployment/server/
+tenant.repository.path                =/repository/tenants/

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/logging.ini
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/logging.ini
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/logging.ini
new file mode 100755
index 0000000..15cad9b
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/logging.ini
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+
+[formatters]
+keys=default
+
+[formatter_default]
+format=[%(asctime)s] %(levelname)s {%(filename)s:%(funcName)s} - %(message)s
+class=logging.Formatter
+
+[handlers]
+keys=console, error_file, log_file
+
+[handler_console]
+class=logging.StreamHandler
+formatter=default
+args=tuple()
+
+[handler_log_file]
+class=logging.FileHandler
+level=DEBUG
+formatter=default
+args=("agent.log", "w")
+
+[handler_error_file]
+class=logging.FileHandler
+level=ERROR
+formatter=default
+args=("error.log", "w")
+
+[loggers]
+keys=root
+
+[logger_root]
+level=DEBUG
+formatter=default
+handlers=console,error_file,log_file
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/payload/launch-params
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/payload/launch-params
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/payload/launch-params
new file mode 100755
index 0000000..4a4e1d9
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/ADCTestCase/payload/launch-params
@@ -0,0 +1 @@
+APPLICATION_ID=application1,SERVICE_NAME=tomcat,HOST_NAME=tomcat.stratos.org,MULTITENANT=false,TENANT_ID=-1234,TENANT_RANGE=*,CARTRIDGE_ALIAS=tomcat,CLUSTER_ID=tomcat.domain,CLUSTER_INSTANCE_ID=cluster-1-instance-1,CARTRIDGE_KEY=PUjpXCLujDhYr5A6,DEPLOYMENT=default,REPO_URL=https://github.com/imesh/stratos-php-applications.git,PORTS=8080,PUPPET_IP=127.0.0.1,PUPPET_HOSTNAME=puppet.apache.stratos.org,PUPPET_ENV=false,MEMBER_ID=tomcat.member-1,LB_CLUSTER_ID=null,NETWORK_PARTITION_ID=network-p1,PARTITION_ID=p1,APPLICATION_PATH=/tmp/ADCTestCase,MIN_COUNT=1,INTERNAL=false,CLUSTERING_PRIMARY_KEY=A,LOG_FILE_PATHS=/tmp/temp.log,PERSISTENCE_MAPPING=null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/agent.conf
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/agent.conf
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/agent.conf
new file mode 100755
index 0000000..0038b7d
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/agent.conf
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+[agent]
+mb.ip                                 =localhost
+mb.port                               =1885
+listen.address                        =localhost
+thrift.receiver.ip                    =localhost
+thrift.receiver.port                  =7712
+thrift.server.admin.username          =admin
+thrift.server.admin.password          =admin
+cep.stats.publisher.enabled           =true
+lb.private.ip                         =
+lb.public.ip                          =
+enable.artifact.update                =true
+auto.commit                           =true
+auto.checkout                         =true
+artifact.update.interval              =15
+artifact.clone.retries                =5
+artifact.clone.interval               =10
+port.check.timeout                    =600000
+enable.data.publisher                 =false
+monitoring.server.ip                  =localhost
+monitoring.server.port                =7612
+monitoring.server.secure.port         =7712
+monitoring.server.admin.username      =admin
+monitoring.server.admin.password      =admin
+log.file.paths                        =/tmp/agent.screen-startup-test.log
+metadata.service.url                  =https://localhost:9443
+super.tenant.repository.path          =
+tenant.repository.path                =

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/logging.ini
----------------------------------------------------------------------
diff --git 
a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/logging.ini
 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/logging.ini
new file mode 100755
index 0000000..15cad9b
--- /dev/null
+++ 
b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/logging.ini
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+
+[formatters]
+keys=default
+
+[formatter_default]
+format=[%(asctime)s] %(levelname)s {%(filename)s:%(funcName)s} - %(message)s
+class=logging.Formatter
+
+[handlers]
+keys=console, error_file, log_file
+
+[handler_console]
+class=logging.StreamHandler
+formatter=default
+args=tuple()
+
+[handler_log_file]
+class=logging.FileHandler
+level=DEBUG
+formatter=default
+args=("agent.log", "w")
+
+[handler_error_file]
+class=logging.FileHandler
+level=ERROR
+formatter=default
+args=("error.log", "w")
+
+[loggers]
+keys=root
+
+[logger_root]
+level=DEBUG
+formatter=default
+handlers=console,error_file,log_file
\ No newline at end of file

Reply via email to