You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/09/15 17:15:13 UTC

[1/4] stratos git commit: Fixing PCA live tests and PCA conflicts

Repository: stratos
Updated Branches:
  refs/heads/stratos-4.1.x 08433049e -> 42c388bc4


http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/payload/launch-params
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/payload/launch-params b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/payload/launch-params
new file mode 100755
index 0000000..1b44343
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/AgentStartupTestCase/payload/launch-params
@@ -0,0 +1 @@
+APPLICATION_ID=application-1,APPLICATION_PATH=/tmp/AgentStartupTestCase,BASH=/bin/bash,BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath,BASH_ALIASES=(),BASH_ARGC=(),BASH_ARGV=(),BASH_CMDS=(),BASH_LINENO=([0]="0"),BASH_SOURCE=([0]="/usr/local/bin/populate-user-data.sh"),BASH_VERSINFO=([0]="4" [1]="3" [2]="30" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu"),BASH_VERSION='4.3.30(1)-release',CARTRIDGE_ALIAS=mytomcat,CARTRIDGE_KEY=PUjpXCLujDhYr5A6,CATALINA_HOME=/opt/tomcat,CEP_IP=54.179.197.243,CEP_PORT=7711,CLUSTER_ID=php.php.domain,CLUSTER_INSTANCE_ID=cluster-1-instance-1,DEPENDENCY_CLUSTER_IDS=myphp.php.domain,DEPLOYMENT=default,DIRSTACK=(),EUID=0,GROUPS=(),GROUP_NAME=null,HOME=/root,HOSTNAME=mytomcat-tomcat-domain3bd3cd47-b95d-475a-aa11-3e3ddc089d49,HOSTTYPE=x86_64,HOST_NAME=mytomcat.tomcat.stratos.org,IFS=' 	,',INSTANCE_ID=null,INTERNAL=false,JAVA_HOME=/opt/jdk1.7.0_67,KUBERNETES_CLUSTER_ID=kubernetes-cluste
 r-1,KUBERNETES_PORT=tcp://10.100.0.2:443,KUBERNETES_PORT_443_TCP=tcp://10.100.0.2:443,KUBERNETES_PORT_443_TCP_ADDR=10.100.0.2,KUBERNETES_PORT_443_TCP_PORT=443,KUBERNETES_PORT_443_TCP_PROTO=tcp,KUBERNETES_RO_PORT=tcp://10.100.0.1:80,KUBERNETES_RO_PORT_80_TCP=tcp://10.100.0.1:80,KUBERNETES_RO_PORT_80_TCP_ADDR=10.100.0.1,KUBERNETES_RO_PORT_80_TCP_PORT=80,KUBERNETES_RO_PORT_80_TCP_PROTO=tcp,KUBERNETES_RO_SERVICE_HOST=10.100.0.1,KUBERNETES_RO_SERVICE_PORT=80,KUBERNETES_SERVICE_HOST=10.100.0.2,KUBERNETES_SERVICE_PORT=443,LB_CLUSTER_ID=null,LOG_LEVEL=DEBUG,MACHTYPE=x86_64-pc-linux-gnu,MB_IP=54.179.197.243,MB_PORT=1883,MEMBER_ID=php.member-1,MIN_COUNT=1,MULTITENANT=false,MYPHP_PHP_DOMAIN_1_PORT=tcp://10.100.171.218:4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP=tcp://10.100.171.218:4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_ADDR=10.100.171.218,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_PORT=4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_PROTO=tcp,MYPHP_PHP_DOMAIN_1_SERVICE_HOST=10.100.171.218,MYPHP_PHP_DOMAIN_1_SERVICE_POR
 T=4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT=tcp://10.100.16.250:4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP=tcp://10.100.16.250:4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_ADDR=10.100.16.250,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_PORT=4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_PROTO=tcp,MYTOMCAT_TOMCAT_DOMAIN_1_SERVICE_HOST=10.100.16.250,MYTOMCAT_TOMCAT_DOMAIN_1_SERVICE_PORT=4500,NETWORK_PARTITION_ID=network-partition-1,OPTERR=1,OPTIND=1,OSTYPE=linux-gnu,PARTITION_ID=partition-1,PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin,PIPESTATUS=([0]="0"),PORTS=8080,POSIXLY_CORRECT=y,PPID=14,PRIMARY=false,PROVIDER=apache,PS4='+ ',PUPPET_DNS_AVAILABLE=null,PUPPET_ENV=false,PUPPET_HOSTNAME=puppet.apache.stratos.org,PUPPET_IP=127.0.0.1,PWD=/opt,SERVICE_NAME=php,SHELL=/bin/bash,SHELLOPTS=braceexpand:hashall:interactive-comments:posix,SHLVL=2,TENANT_ID=-1234,TENANT_RANGE='*',TERM=dumb,TOKEN=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOi04NzI0ODEyNDEsInN1YiI6ImFkbWluIiwiYXpwIjoid3I5SllVaDNtTXd6bVhHVl
 lqWmVIWnhCV2xFYSIsImFwcElkIjoic2luZ2xlX2dyb3VwX3YxIiwiYXVkIjpbIndyOUpZVWgzbU13em1YR1ZZalplSFp4QldsRWEiXSwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQzXC9vYXV0aDJlbmRwb2ludHNcL3Rva2VuIiwiaWF0IjotODcyNDgwMjQwfQ.OSa1gIXUT9amhk1YEU02Yc3JtUYqanzrXh5K1YyvRXcpSiY2Ccn2BfJO0hILF5UooRcGBihzfX3979NRcvGwcUDUvOUJ0eaGPmxFZYbu0nr3xD8lhAO3fa1QYsKAvMnMdwyu2uSgSp6R6EUdVleiwlabUoDsuEcKGkIAn_VQvG0,UID=0,_=posix,LVS_VIRTUAL_IP=192.168.0.40|255.255.255.0
\ 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/common/client-truststore.jks
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/client-truststore.jks b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/client-truststore.jks
new file mode 100644
index 0000000..2d22c24
Binary files /dev/null and b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/client-truststore.jks differ

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/data-bridge-config.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/data-bridge-config.xml b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/data-bridge-config.xml
new file mode 100644
index 0000000..13ca54c
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/data-bridge-config.xml
@@ -0,0 +1,75 @@
+<!--
+  ~ 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.
+  -->
+
+<dataBridgeConfiguration>
+
+    <workerThreads>10</workerThreads>
+    <eventBufferCapacity>10000</eventBufferCapacity>
+    <clientTimeoutMin>30</clientTimeoutMin>
+
+    <dataReceiver name="Thrift">
+        <config name="tcpPort">7611</config>
+        <config name="sslPort">7711</config>
+    </dataReceiver>
+
+    <dataReceiver name="Binary">
+        <config name="tcpPort">9611</config>
+        <config name="sslPort">9711</config>
+        <config name="sslReceiverThreadPoolSize">100</config>
+        <config name="tcpReceiverThreadPoolSize">100</config>
+    </dataReceiver>
+
+    <!--<streamDefinitions>
+        <streamDefinition>
+            {
+             'name':'org.wso2.esb.MediatorStatistics',
+             'version':'1.3.0',
+             'nickName': 'Stock Quote Information',
+             'description': 'Some Desc',
+             'metaData':[
+             {'name':'ipAdd','type':'STRING'}
+             ],
+             'payloadData':[
+             {'name':'symbol','type':'STRING'},
+             {'name':'price','type':'DOUBLE'},
+             {'name':'volume','type':'INT'},
+             {'name':'max','type':'DOUBLE'},
+             {'name':'min','type':'Double'}
+             ]
+            }
+        </streamDefinition>
+        <streamDefinition domainName="wso2">
+            {
+             'name':'org.wso2.esb.MediatorStatistics',
+             'version':'1.3.4',
+             'nickName': 'Stock Quote Information',
+             'description': 'Some Other Desc',
+             'metaData':[
+             {'name':'ipAdd','type':'STRING'}
+             ],
+             'payloadData':[
+             {'name':'symbol','type':'STRING'},
+             {'name':'price','type':'DOUBLE'},
+             {'name':'volume','type':'INT'}
+             ]
+            }
+        </streamDefinition>
+    </streamDefinitions>-->
+
+</dataBridgeConfiguration>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/jndi.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/jndi.properties b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/jndi.properties
new file mode 100755
index 0000000..beefe3c
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/jndi.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+connectionfactoryName=TopicConnectionFactory
+java.naming.provider.url=tcp://localhost:61617
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/log4j.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/log4j.properties b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/log4j.properties
new file mode 100755
index 0000000..c0c6e78
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/log4j.properties
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+# Set root logger level and appenders
+log4j.rootLogger=INFO, CONSOLE_APPENDER, FILE_APPENDER
+
+# CONSOLE_APPENDER is set to be a ConsoleAppender.
+log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender
+
+# The standard error log where all the warnings, errors and fatal errors will be logged
+log4j.appender.FILE_APPENDER=org.apache.log4j.FileAppender
+log4j.appender.FILE_APPENDER.File=cartridge-agent.log
+log4j.appender.FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n
+log4j.appender.FILE_APPENDER.threshold=DEBUG
+
+# CONSOLE_APPENDER uses PatternLayout.
+log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=[%d{ISO8601}] %5p - [%c{1}] %m%n
+
+log4j.logger.org.apache.stratos.cartridge.agent=INFO
+log4j.logger.org.apache.stratos.messaging=INFO
+log4j.logger.org.apache.stratos.common.util=DEBUG
+log4j.logger.org.wso2.andes.client=ERROR
+log4j.logger.org.apache.activemq.jndi.ActiveMQInitialContextFactory=ERROR
\ 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/common/stratos-health-stream-def.json
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/stratos-health-stream-def.json b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/stratos-health-stream-def.json
new file mode 100644
index 0000000..4d36c19
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/stratos-health-stream-def.json
@@ -0,0 +1 @@
+{"name":"cartridge_agent_health_stats","version":"1.0.0","nickName":"agent health stats","description":"agent health stats","payloadData":[{"name":"cluster_id", "type": "STRING"},{"name":"cluster_instance_id", "type": "STRING"},{"name":"network_partition_id", "type": "STRING"},{"name":"member_id", "type": "STRING"},{"name":"partition_id", "type": "STRING"},{"name":"health_description", "type": "STRING"},{"name":"value", "type": "DOUBLE"}]}

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/thrift-agent-config.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/thrift-agent-config.xml b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/thrift-agent-config.xml
new file mode 100644
index 0000000..dbb2ba3
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/thrift-agent-config.xml
@@ -0,0 +1,64 @@
+<!--
+  ~ 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.
+  -->
+
+<DataAgentsConfiguration>
+    <Agent>
+        <Name>Thrift</Name>
+        <DataEndpointClass>org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint</DataEndpointClass>
+        <!--<TrustSore>src/main/resources/client-truststore.jks</TrustSore>-->
+        <!--<TrustSorePassword>wso2carbon</TrustSorePassword>-->
+        <QueueSize>32768</QueueSize>
+        <BatchSize>200</BatchSize>
+        <CorePoolSize>5</CorePoolSize>
+        <MaxPoolSize>10</MaxPoolSize>
+        <SocketTimeoutMS>30000</SocketTimeoutMS>
+        <KeepAliveTimeInPool>20</KeepAliveTimeInPool>
+        <ReconnectionInterval>30</ReconnectionInterval>
+        <MaxTransportPoolSize>250</MaxTransportPoolSize>
+        <MaxIdleConnections>250</MaxIdleConnections>
+        <EvictionTimePeriod>5500</EvictionTimePeriod>
+        <MinIdleTimeInPool>5000</MinIdleTimeInPool>
+        <SecureMaxTransportPoolSize>250</SecureMaxTransportPoolSize>
+        <SecureMaxIdleConnections>250</SecureMaxIdleConnections>
+        <SecureEvictionTimePeriod>5500</SecureEvictionTimePeriod>
+        <SecureMinIdleTimeInPool>5000</SecureMinIdleTimeInPool>
+    </Agent>
+
+    <Agent>
+        <Name>Binary</Name>
+        <DataEndpointClass>org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint</DataEndpointClass>
+        <!--<TrustSore>src/main/resources/client-truststore.jks</TrustSore>-->
+        <!--<TrustSorePassword>wso2carbon</TrustSorePassword>-->
+        <QueueSize>32768</QueueSize>
+        <BatchSize>200</BatchSize>
+        <CorePoolSize>5</CorePoolSize>
+        <MaxPoolSize>10</MaxPoolSize>
+        <SocketTimeoutMS>30000</SocketTimeoutMS>
+        <KeepAliveTimeInPool>20</KeepAliveTimeInPool>
+        <ReconnectionInterval>30</ReconnectionInterval>
+        <MaxTransportPoolSize>250</MaxTransportPoolSize>
+        <MaxIdleConnections>250</MaxIdleConnections>
+        <EvictionTimePeriod>5500</EvictionTimePeriod>
+        <MinIdleTimeInPool>5000</MinIdleTimeInPool>
+        <SecureMaxTransportPoolSize>250</SecureMaxTransportPoolSize>
+        <SecureMaxIdleConnections>250</SecureMaxIdleConnections>
+        <SecureEvictionTimePeriod>5500</SecureEvictionTimePeriod>
+        <SecureMinIdleTimeInPool>5000</SecureMinIdleTimeInPool>
+    </Agent>
+</DataAgentsConfiguration>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/wso2carbon.jks
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/wso2carbon.jks b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/wso2carbon.jks
new file mode 100644
index 0000000..7942c53
Binary files /dev/null and b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/common/wso2carbon.jks differ

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-conf/integration-test.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-conf/integration-test.properties b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-conf/integration-test.properties
new file mode 100755
index 0000000..332441a
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-conf/integration-test.properties
@@ -0,0 +1,27 @@
+# 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.
+
+# Stratos distribution properties added via filters during the build
+distribution.version=${project.version}
+distribution.name=${python.cartridge.agent.distribution.name}-${project.version}
+activemq.amqp.bind.address=tcp://localhost:61617
+activemq.mqtt.bind.address=mqtt://localhost:1885
+cep.port=7612
+cep.ssl.port=7712
+stratos.endpoint=http://localhost:9763
+stratos.admin.username=admin
+stratos.admin.password=admin
\ 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/test-suite-all.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-all.xml b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-all.xml
new file mode 100755
index 0000000..d8e342f
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-all.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="PythonCartridgeAgentTestSuite">
+    <test name="all" preserve-order="true" parallel="false">
+        <groups>
+            <run>
+                <exclude name="failed"/>
+                <exclude name="disabled"/>
+            </run>
+        </groups>
+
+        <packages>
+            <package name="org.apache.stratos.python.cartridge.agent.integration.tests.*"/>
+        </packages>
+    </test>
+</suite>
\ 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/test-suite-smoke.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-smoke.xml b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-smoke.xml
new file mode 100755
index 0000000..b1e4633
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/src/test/resources/test-suite-smoke.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="PythonCartridgeAgentSmokeTestSuite">
+    <test name="all" preserve-order="true" parallel="false">
+        <groups>
+            <run>
+                <include name="smoke"/>
+                <exclude name="failed"/>
+                <exclude name="disabled"/>
+            </run>
+        </groups>
+
+        <packages>
+            <package name="org.apache.stratos.python.cartridge.agent.integration.tests.*"/>
+        </packages>
+    </test>
+</suite>
\ No newline at end of file


[3/4] stratos git commit: Fixing PCA live tests and PCA conflicts

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonAgentTestManager.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonAgentTestManager.java b/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonAgentTestManager.java
deleted file mode 100644
index 5ba6c6a..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonAgentTestManager.java
+++ /dev/null
@@ -1,461 +0,0 @@
-package org.apache.stratos.python.cartridge.agent.test;/*
- * 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.
- */
-
-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 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 PythonAgentTestManager {
-    protected final Properties integrationProperties = new Properties();
-    private static final Log log = LogFactory.getLog(PythonAgentTestManager.class);
-    protected BrokerService broker = new BrokerService();
-
-    public final long TIMEOUT = 180000;
-    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 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 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;
-
-    /**
-     * Setup method for test method testPythonCartridgeAgent
-     */
-    protected void setup(String resourcePath) {
-        try {
-            startBroker();
-        }
-        catch (Exception e) {
-            log.error("Error while starting MB", e);
-            return;
-        }
-        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;
-        }
-        // Simulate CEP Thrift server
-        //startServerSocket(cepPort);
-        // TODO: create a mock thrift server; sockets will not work with health stats publisher
-        String agentPath = setupPythonAgent(resourcePath);
-        log.info("Python agent working directory name: " + PYTHON_AGENT_DIR_NAME);
-        log.info("Starting python cartridge agent...");
-        this.outputStream = executeCommand("python " + agentPath + "/agent.py > " +
-                PythonAgentTestManager.class.getResource(File.separator).getPath() + "/../" + PYTHON_AGENT_DIR_NAME +
-                "/cartridge-agent-console.log");
-    }
-
-
-    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 {
-            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();
-        }
-        catch (Exception e) {
-            log.error("Error while stopping the broker service", e);
-        }
-    }
-
-    public PythonAgentTestManager() {
-        try {
-            integrationProperties
-                    .load(PythonAgentTestManager.class.getResourceAsStream("/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));
-            log.info("PCA integration properties: " + integrationProperties.toString());
-        }
-        catch (IOException e) {
-            log.error("Error loading integration-test.properties file from classpath. Please make sure that file " +
-                    "exists in classpath.", e);
-        }
-    }
-
-    protected void startBroker() throws Exception {
-        broker.addConnector(amqpBindAddress);
-        broker.addConnector(mqttBindAddress);
-        broker.setBrokerName("testBroker");
-        broker.setDataDirectory(
-                PythonAgentTestManager.class.getResource("/").getPath() + "/../" + PYTHON_AGENT_DIR_NAME +
-                        "/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(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() {
-                while (true) { // do this infinitely until test is complete
-                    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 (true) {
-                            if (socket.isClosed()) {
-                                log.info("Socket for [port] " + port + " has been closed.");
-                                break;
-                            }
-                            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();
-    }
-
-
-    protected static String getResourcesPath() {
-        return PythonAgentTestManager.class.getResource("/").getPath() + "/../../src/test/resources";
-    }
-
-    protected static String getResourcesPath(String resourcesPath) {
-        return PythonAgentTestManager.class.getResource("/").getPath() + "/../../src/test/resources" + resourcesPath;
-    }
-
-    /**
-     * Copy python agent distribution to a new folder, extract it and copy sample configuration files
-     *
-     * @return
-     */
-    protected String setupPythonAgent(String resourcesPath) {
-        try {
-            log.info("Setting up python cartridge agent...");
-
-
-            String srcAgentPath = PythonAgentTestManager.class.getResource("/").getPath() +
-                    "/../../../distribution/target/" + distributionName + ".zip";
-            String unzipDestPath =
-                    PythonAgentTestManager.class.getResource("/").getPath() + "/../" + PYTHON_AGENT_DIR_NAME + "/";
-            //FileUtils.copyFile(new File(srcAgentPath), new File(destAgentPath));
-            unzip(srcAgentPath, unzipDestPath);
-            String destAgentPath = PythonAgentTestManager.class.getResource("/").getPath() + "/../" +
-                    PYTHON_AGENT_DIR_NAME + "/" + distributionName;
-
-            String srcAgentConfPath = getResourcesPath(resourcesPath) + "/agent.conf";
-            String destAgentConfPath = destAgentPath + "/agent.conf";
-            FileUtils.copyFile(new File(srcAgentConfPath), new File(destAgentConfPath));
-
-            String srcLoggingIniPath = getResourcesPath(resourcesPath) + "/logging.ini";
-            String destLoggingIniPath = destAgentPath + "/logging.ini";
-            FileUtils.copyFile(new File(srcLoggingIniPath), new File(destLoggingIniPath));
-
-            String srcPayloadPath = getResourcesPath(resourcesPath) + "/payload";
-            String destPayloadPath = destAgentPath + "/payload";
-            FileUtils.copyDirectory(new File(srcPayloadPath), new File(destPayloadPath));
-
-            log.info("Changing extension scripts permissions");
-            File extensionsPath = new File(destAgentPath + "/extensions/bash");
-            File[] extensions = extensionsPath.listFiles();
-            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(
-                    PythonAgentTestManager.class.getResource("/").getPath() + "/../" + 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/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/log4j.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/log4j.properties
deleted file mode 100755
index c0c6e78..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# 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.
-#
-
-# Set root logger level and appenders
-log4j.rootLogger=INFO, CONSOLE_APPENDER, FILE_APPENDER
-
-# CONSOLE_APPENDER is set to be a ConsoleAppender.
-log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender
-
-# The standard error log where all the warnings, errors and fatal errors will be logged
-log4j.appender.FILE_APPENDER=org.apache.log4j.FileAppender
-log4j.appender.FILE_APPENDER.File=cartridge-agent.log
-log4j.appender.FILE_APPENDER.layout=org.apache.log4j.PatternLayout
-log4j.appender.FILE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n
-log4j.appender.FILE_APPENDER.threshold=DEBUG
-
-# CONSOLE_APPENDER uses PatternLayout.
-log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=[%d{ISO8601}] %5p - [%c{1}] %m%n
-
-log4j.logger.org.apache.stratos.cartridge.agent=INFO
-log4j.logger.org.apache.stratos.messaging=INFO
-log4j.logger.org.apache.stratos.common.util=DEBUG
-log4j.logger.org.wso2.andes.client=ERROR
-log4j.logger.org.apache.activemq.jndi.ActiveMQInitialContextFactory=ERROR
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing1.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing1.xml b/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing1.xml
deleted file mode 100755
index c102914..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing1.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="PythonCartridgeAgentIntegrationSuite1">
-    <test name="PCATest">
-        <classes>
-            <class name="org.apache.stratos.python.cartridge.agent.test.AgentStartupTest"/>
-        </classes>
-    </test>
-</suite>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing2.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing2.xml b/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing2.xml
deleted file mode 100755
index c292953..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="PythonCartridgeAgentIntegrationSuite2">
-    <test name="PCATest">
-        <classes>
-            <class name="org.apache.stratos.python.cartridge.agent.test.ADCTest"/>
-        </classes>
-    </test>
-</suite>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing3.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing3.xml b/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing3.xml
deleted file mode 100755
index f20cf20..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing3.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="PythonCartridgeAgentIntegrationSuite3">
-    <test name="PCATest">
-        <classes>
-            <class name="org.apache.stratos.python.cartridge.agent.test.ADCMTAppTest"/>
-        </classes>
-    </test>
-</suite>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing4.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing4.xml b/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing4.xml
deleted file mode 100755
index 6462774..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/pca-testing4.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="PythonCartridgeAgentIntegrationSuite4">
-    <test name="PCATest">
-        <classes>
-            <class name="org.apache.stratos.python.cartridge.agent.test.ADCMTAppTenantUserTest"/>
-        </classes>
-    </test>
-</suite>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/agent.conf
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/agent.conf b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/agent.conf
deleted file mode 100755
index eae5003..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/agent.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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                           =false
-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          =/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/src/test/resources/suite-1/jndi.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/jndi.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/jndi.properties
deleted file mode 100755
index beefe3c..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/jndi.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-connectionfactoryName=TopicConnectionFactory
-java.naming.provider.url=tcp://localhost:61617
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/logging.ini
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/logging.ini b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/logging.ini
deleted file mode 100755
index 15cad9b..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/logging.ini
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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/src/test/resources/suite-1/payload/launch-params
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/payload/launch-params b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/payload/launch-params
deleted file mode 100755
index 5b98406..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-1/payload/launch-params
+++ /dev/null
@@ -1 +0,0 @@
-APPLICATION_ID=application-1,APPLICATION_PATH=/tmp/pca-test-suite-1,BASH=/bin/bash,BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath,BASH_ALIASES=(),BASH_ARGC=(),BASH_ARGV=(),BASH_CMDS=(),BASH_LINENO=([0]="0"),BASH_SOURCE=([0]="/usr/local/bin/populate-user-data.sh"),BASH_VERSINFO=([0]="4" [1]="3" [2]="30" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu"),BASH_VERSION='4.3.30(1)-release',CARTRIDGE_ALIAS=mytomcat,CARTRIDGE_KEY=PUjpXCLujDhYr5A6,CATALINA_HOME=/opt/tomcat,CEP_IP=54.179.197.243,CEP_PORT=7711,CLUSTER_ID=php.php.domain,CLUSTER_INSTANCE_ID=cluster-1-instance-1,DEPENDENCY_CLUSTER_IDS=myphp.php.domain,DEPLOYMENT=default,DIRSTACK=(),EUID=0,GROUPS=(),GROUP_NAME=null,HOME=/root,HOSTNAME=mytomcat-tomcat-domain3bd3cd47-b95d-475a-aa11-3e3ddc089d49,HOSTTYPE=x86_64,HOST_NAME=mytomcat.tomcat.stratos.org,IFS=' 	,',INSTANCE_ID=null,INTERNAL=false,JAVA_HOME=/opt/jdk1.7.0_67,KUBERNETES_CLUSTER_ID=kubernetes-cluster-1,
 KUBERNETES_PORT=tcp://10.100.0.2:443,KUBERNETES_PORT_443_TCP=tcp://10.100.0.2:443,KUBERNETES_PORT_443_TCP_ADDR=10.100.0.2,KUBERNETES_PORT_443_TCP_PORT=443,KUBERNETES_PORT_443_TCP_PROTO=tcp,KUBERNETES_RO_PORT=tcp://10.100.0.1:80,KUBERNETES_RO_PORT_80_TCP=tcp://10.100.0.1:80,KUBERNETES_RO_PORT_80_TCP_ADDR=10.100.0.1,KUBERNETES_RO_PORT_80_TCP_PORT=80,KUBERNETES_RO_PORT_80_TCP_PROTO=tcp,KUBERNETES_RO_SERVICE_HOST=10.100.0.1,KUBERNETES_RO_SERVICE_PORT=80,KUBERNETES_SERVICE_HOST=10.100.0.2,KUBERNETES_SERVICE_PORT=443,LB_CLUSTER_ID=null,LOG_LEVEL=DEBUG,MACHTYPE=x86_64-pc-linux-gnu,MB_IP=54.179.197.243,MB_PORT=1883,MEMBER_ID=php.member-1,MIN_COUNT=1,MULTITENANT=false,MYPHP_PHP_DOMAIN_1_PORT=tcp://10.100.171.218:4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP=tcp://10.100.171.218:4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_ADDR=10.100.171.218,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_PORT=4500,MYPHP_PHP_DOMAIN_1_PORT_4500_TCP_PROTO=tcp,MYPHP_PHP_DOMAIN_1_SERVICE_HOST=10.100.171.218,MYPHP_PHP_DOMAIN_1_SERVICE_PORT=45
 00,MYTOMCAT_TOMCAT_DOMAIN_1_PORT=tcp://10.100.16.250:4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP=tcp://10.100.16.250:4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_ADDR=10.100.16.250,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_PORT=4500,MYTOMCAT_TOMCAT_DOMAIN_1_PORT_4500_TCP_PROTO=tcp,MYTOMCAT_TOMCAT_DOMAIN_1_SERVICE_HOST=10.100.16.250,MYTOMCAT_TOMCAT_DOMAIN_1_SERVICE_PORT=4500,NETWORK_PARTITION_ID=network-partition-1,OPTERR=1,OPTIND=1,OSTYPE=linux-gnu,PARTITION_ID=partition-1,PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin,PIPESTATUS=([0]="0"),PORTS=8080,POSIXLY_CORRECT=y,PPID=14,PRIMARY=false,PROVIDER=apache,PS4='+ ',PUPPET_DNS_AVAILABLE=null,PUPPET_ENV=false,PUPPET_HOSTNAME=puppet.apache.stratos.org,PUPPET_IP=127.0.0.1,PWD=/opt,SERVICE_NAME=php,SHELL=/bin/bash,SHELLOPTS=braceexpand:hashall:interactive-comments:posix,SHLVL=2,TENANT_ID=-1234,TENANT_RANGE='*',TERM=dumb,TOKEN=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOi04NzI0ODEyNDEsInN1YiI6ImFkbWluIiwiYXpwIjoid3I5SllVaDNtTXd6bVhHVllqWm
 VIWnhCV2xFYSIsImFwcElkIjoic2luZ2xlX2dyb3VwX3YxIiwiYXVkIjpbIndyOUpZVWgzbU13em1YR1ZZalplSFp4QldsRWEiXSwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQzXC9vYXV0aDJlbmRwb2ludHNcL3Rva2VuIiwiaWF0IjotODcyNDgwMjQwfQ.OSa1gIXUT9amhk1YEU02Yc3JtUYqanzrXh5K1YyvRXcpSiY2Ccn2BfJO0hILF5UooRcGBihzfX3979NRcvGwcUDUvOUJ0eaGPmxFZYbu0nr3xD8lhAO3fa1QYsKAvMnMdwyu2uSgSp6R6EUdVleiwlabUoDsuEcKGkIAn_VQvG0,UID=0,_=posix,LVS_VIRTUAL_IP=192.168.0.40|255.255.255.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/agent.conf
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/agent.conf b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/agent.conf
deleted file mode 100755
index fd3e423..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/agent.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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/src/test/resources/suite-2/jndi.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/jndi.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/jndi.properties
deleted file mode 100755
index beefe3c..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/jndi.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-connectionfactoryName=TopicConnectionFactory
-java.naming.provider.url=tcp://localhost:61617
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/logging.ini
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/logging.ini b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/logging.ini
deleted file mode 100755
index 15cad9b..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/logging.ini
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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/src/test/resources/suite-2/payload/launch-params
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/payload/launch-params b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/payload/launch-params
deleted file mode 100755
index aa4fcc3..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-2/payload/launch-params
+++ /dev/null
@@ -1 +0,0 @@
-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/pca-test-suite-2,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/src/test/resources/suite-3/agent.conf
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/agent.conf b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/agent.conf
deleted file mode 100755
index 0ee1dce..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/agent.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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-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/src/test/resources/suite-3/jndi.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/jndi.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/jndi.properties
deleted file mode 100755
index beefe3c..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/jndi.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-connectionfactoryName=TopicConnectionFactory
-java.naming.provider.url=tcp://localhost:61617
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/logging.ini
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/logging.ini b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/logging.ini
deleted file mode 100755
index 15cad9b..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/logging.ini
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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/src/test/resources/suite-3/payload/launch-params
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/payload/launch-params b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/payload/launch-params
deleted file mode 100755
index ed8c67f..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-3/payload/launch-params
+++ /dev/null
@@ -1 +0,0 @@
-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/pca-test-suite-3,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/src/test/resources/suite-4/agent.conf
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/agent.conf b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/agent.conf
deleted file mode 100755
index f945968..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/agent.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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/src/test/resources/suite-4/jndi.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/jndi.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/jndi.properties
deleted file mode 100755
index beefe3c..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/jndi.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-connectionfactoryName=TopicConnectionFactory
-java.naming.provider.url=tcp://localhost:61617
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/logging.ini
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/logging.ini b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/logging.ini
deleted file mode 100755
index 15cad9b..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/logging.ini
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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/src/test/resources/suite-4/payload/launch-params
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/payload/launch-params b/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/payload/launch-params
deleted file mode 100755
index b701066..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/suite-4/payload/launch-params
+++ /dev/null
@@ -1 +0,0 @@
-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/pca-test-suite-4,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/src/test/resources/test-conf/integration-test.properties
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/resources/test-conf/integration-test.properties b/products/python-cartridge-agent/modules/integration/src/test/resources/test-conf/integration-test.properties
deleted file mode 100755
index 1242841..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/resources/test-conf/integration-test.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-# Stratos distribution properties added via filters during the build
-distribution.version=${project.version}
-distribution.name=${python.cartridge.agent.distribution.name}-${project.version}
-activemq.amqp.bind.address=tcp://localhost:61617
-activemq.mqtt.bind.address=mqtt://localhost:1885
-cep.port=7712
-stratos.endpoint=http://localhost:9763
-stratos.admin.username=admin
-stratos.admin.password=admin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-common/pom.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-common/pom.xml b/products/python-cartridge-agent/modules/integration/test-common/pom.xml
new file mode 100755
index 0000000..8636a96
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-common/pom.xml
@@ -0,0 +1,94 @@
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>python-cartridge-agent-integration</artifactId>
+        <version>4.1.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.stratos.python.cartridge.agent.integration.common</artifactId>
+    <packaging>jar</packaging>
+    <name>Python Cartridge Agent - Integration Common Module</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-exec</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.messaging</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.commons</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.commons.thrift</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.agent.thrift</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-all</artifactId>
+            <version>5.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-mqtt</artifactId>
+            <version>5.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon.analytics-common</groupId>
+            <artifactId>org.wso2.carbon.databridge.receiver.thrift</artifactId>
+            <version>${carbon.analytics.common.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon.analytics-common</groupId>
+            <artifactId>org.wso2.carbon.databridge.receiver.binary</artifactId>
+            <version>${carbon.analytics.common.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon.analytics-common</groupId>
+            <artifactId>org.wso2.carbon.databridge.core</artifactId>
+            <version>${carbon.analytics.common.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon.analytics-common</groupId>
+            <artifactId>org.wso2.carbon.databridge.commons</artifactId>
+            <version>${carbon.analytics.common.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/DataPublisherTestUtil.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/DataPublisherTestUtil.java b/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/DataPublisherTestUtil.java
new file mode 100644
index 0000000..1e7ae86
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/DataPublisherTestUtil.java
@@ -0,0 +1,54 @@
+/*
+ * 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.common;
+
+import java.io.File;
+
+public class DataPublisherTestUtil {
+    public static final String LOCAL_HOST = "localhost";
+    public static final String PATH_SEP = File.separator;
+
+    public static void setTrustStoreParams() {
+        String trustStore = DataPublisherTestUtil.getCommonResourcesPath();
+        System.setProperty("javax.net.ssl.trustStore", trustStore + File.separator + "client-truststore.jks");
+        System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
+    }
+
+    public static void setKeyStoreParams() {
+        String keyStore = DataPublisherTestUtil.getCommonResourcesPath();
+        System.setProperty("Security.KeyStore.Location", keyStore + File.separator + "wso2carbon.jks");
+        System.setProperty("Security.KeyStore.Password", "wso2carbon");
+    }
+
+    public static String getDataAgentConfigPath() {
+        String filePath = DataPublisherTestUtil.getCommonResourcesPath();
+        return filePath + File.separator + "data-agent-config.xml";
+    }
+
+    public static String getDataBridgeConfigPath() {
+        String filePath = DataPublisherTestUtil.getCommonResourcesPath();
+        return filePath + File.separator + "data-bridge-config.xml";
+    }
+
+    public static String getCommonResourcesPath() {
+        return DataPublisherTestUtil.class.getResource(PATH_SEP).getPath() + PATH_SEP + ".." + PATH_SEP + ".." +
+                PATH_SEP + "src" + PATH_SEP + "test" + PATH_SEP + "resources" + PATH_SEP + "common";
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/ThriftTestServer.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/ThriftTestServer.java b/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/ThriftTestServer.java
new file mode 100644
index 0000000..6bbc65a
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-common/src/main/java/org/apache/stratos/python/cartridge/agent/integration/common/ThriftTestServer.java
@@ -0,0 +1,215 @@
+/*
+ * 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.common;
+
+import org.apache.log4j.Logger;
+import org.wso2.carbon.databridge.commons.Credentials;
+import org.wso2.carbon.databridge.commons.Event;
+import org.wso2.carbon.databridge.commons.StreamDefinition;
+import org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException;
+import org.wso2.carbon.databridge.commons.utils.EventDefinitionConverterUtils;
+import org.wso2.carbon.databridge.core.AgentCallback;
+import org.wso2.carbon.databridge.core.DataBridge;
+import org.wso2.carbon.databridge.core.Utils.AgentSession;
+import org.wso2.carbon.databridge.core.definitionstore.InMemoryStreamDefinitionStore;
+import org.wso2.carbon.databridge.core.exception.DataBridgeException;
+import org.wso2.carbon.databridge.core.exception.StreamDefinitionStoreException;
+import org.wso2.carbon.databridge.core.internal.authentication.AuthenticationHandler;
+import org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver;
+import org.wso2.carbon.user.api.UserStoreException;
+
+import java.net.SocketException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class ThriftTestServer {
+    Logger log = Logger.getLogger(ThriftTestServer.class);
+    ThriftDataReceiver thriftDataReceiver;
+    InMemoryStreamDefinitionStore streamDefinitionStore;
+    AtomicInteger numberOfEventsReceived;
+    RestarterThread restarterThread;
+
+    public void startTestServer() throws DataBridgeException, InterruptedException {
+        ThriftTestServer thriftTestServer = new ThriftTestServer();
+        thriftTestServer.start(7611);
+        Thread.sleep(100000000);
+        thriftTestServer.stop();
+    }
+
+
+    public void addStreamDefinition(StreamDefinition streamDefinition, int tenantId)
+            throws StreamDefinitionStoreException {
+        streamDefinitionStore.saveStreamDefinitionToStore(streamDefinition, tenantId);
+    }
+
+    public void addStreamDefinition(String streamDefinitionStr, int tenantId)
+            throws StreamDefinitionStoreException, MalformedStreamDefinitionException {
+        StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr);
+        getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId);
+    }
+
+    private InMemoryStreamDefinitionStore getStreamDefinitionStore() {
+        if (streamDefinitionStore == null) {
+            streamDefinitionStore = new InMemoryStreamDefinitionStore();
+        }
+        return streamDefinitionStore;
+    }
+
+    public void start(int receiverPort) throws DataBridgeException {
+        DataPublisherTestUtil.setKeyStoreParams();
+        streamDefinitionStore = getStreamDefinitionStore();
+        numberOfEventsReceived = new AtomicInteger(0);
+        DataBridge databridge = new DataBridge(new AuthenticationHandler() {
+            @Override
+            public boolean authenticate(String userName,
+                                        String password) {
+                log.info("Thrift authentication returning true");
+                return true;// allays authenticate to true
+
+            }
+
+            @Override
+            public String getTenantDomain(String userName) {
+                return "admin";
+            }
+
+            @Override
+            public int getTenantId(String tenantDomain) throws UserStoreException {
+                return -1234;
+            }
+
+            @Override
+            public void initContext(AgentSession agentSession) {
+                //To change body of implemented methods use File | Settings | File Templates.
+                log.info("Initializing Thrift agent context");
+            }
+
+            @Override
+            public void destroyContext(AgentSession agentSession) {
+
+            }
+        }, streamDefinitionStore, DataPublisherTestUtil.getDataBridgeConfigPath());
+
+        thriftDataReceiver = new ThriftDataReceiver(receiverPort, databridge);
+
+        databridge.subscribe(new AgentCallback() {
+            int totalSize = 0;
+
+            public void definedStream(StreamDefinition streamDefinition,
+                                      int tenantId) {
+                log.info("StreamDefinition " + streamDefinition);
+            }
+
+            @Override
+            public void removeStream(StreamDefinition streamDefinition, int tenantId) {
+                log.info("StreamDefinition remove " + streamDefinition);
+            }
+
+            @Override
+            public void receive(List<Event> eventList, Credentials credentials) {
+                numberOfEventsReceived.addAndGet(eventList.size());
+                log.info("Received events : " + numberOfEventsReceived);
+//                log.info("eventListSize=" + eventList.size() + " eventList " + eventList + " for username " + credentials.getUsername());
+            }
+
+        });
+
+        String address = "localhost";
+        log.info("Test Server starting on " + address);
+        thriftDataReceiver.start(address);
+        log.info("Test Server Started");
+    }
+
+    public int getNumberOfEventsReceived() {
+        if (numberOfEventsReceived != null) {
+            return numberOfEventsReceived.get();
+        } else {
+            return 0;
+        }
+    }
+
+    public void resetReceivedEvents() {
+        numberOfEventsReceived.set(0);
+    }
+
+    public void stop() {
+        thriftDataReceiver.stop();
+        log.info("Test Server Stopped");
+    }
+
+    public void stopAndStartDuration(int port, long stopAfterTimeMilliSeconds, long startAfterTimeMS)
+            throws SocketException, DataBridgeException {
+        restarterThread = new RestarterThread(port, stopAfterTimeMilliSeconds, startAfterTimeMS);
+        Thread thread = new Thread(restarterThread);
+        thread.start();
+    }
+
+    public int getEventsReceivedBeforeLastRestart() {
+        return restarterThread.eventReceived;
+    }
+
+
+    class RestarterThread implements Runnable {
+        int eventReceived;
+        int port;
+
+        long stopAfterTimeMilliSeconds;
+        long startAfterTimeMS;
+
+        RestarterThread(int port, long stopAfterTime, long startAfterTime) {
+            this.port = port;
+            stopAfterTimeMilliSeconds = stopAfterTime;
+            startAfterTimeMS = startAfterTime;
+        }
+
+        @Override
+        public void run() {
+            try {
+                Thread.sleep(stopAfterTimeMilliSeconds);
+            }
+            catch (InterruptedException e) {
+            }
+            if (thriftDataReceiver != null) {
+                thriftDataReceiver.stop();
+            }
+
+            eventReceived = getNumberOfEventsReceived();
+
+            log.info("Number of events received in server shutdown :" + eventReceived);
+            try {
+                Thread.sleep(startAfterTimeMS);
+            }
+            catch (InterruptedException e) {
+            }
+
+            try {
+                if (thriftDataReceiver != null) {
+                    thriftDataReceiver.start(DataPublisherTestUtil.LOCAL_HOST);
+                } else {
+                    start(port);
+                }
+            }
+            catch (DataBridgeException e) {
+                log.error(e);
+            }
+
+        }
+    }
+}
\ 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/pom.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/test-integration/pom.xml b/products/python-cartridge-agent/modules/integration/test-integration/pom.xml
new file mode 100755
index 0000000..5095a85
--- /dev/null
+++ b/products/python-cartridge-agent/modules/integration/test-integration/pom.xml
@@ -0,0 +1,168 @@
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>python-cartridge-agent-integration</artifactId>
+        <version>4.1.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>python-agent-test-integration</artifactId>
+    <packaging>jar</packaging>
+    <name>Python Cartridge Agent - Integration Tests</name>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/test/resources/test-conf</directory>
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/test/resources/common</directory>
+            </resource>
+        </resources>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>**/*</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>live</id>
+            <build>
+                <resources>
+                    <resource>
+                        <directory>src/test/resources/test-conf</directory>
+                        <filtering>true</filtering>
+                    </resource>
+                </resources>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>**/*</exclude>
+                            </excludes>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>default-test</id>
+                                <goals>
+                                    <goal>test</goal>
+                                </goals>
+                                <inherited>false</inherited>
+                                <configuration>
+                                    <suiteXmlFiles>
+                                        <suiteXmlFile>${suiteFile}</suiteXmlFile>
+                                    </suiteXmlFiles>
+                                    <workingDirectory>${basedir}/target</workingDirectory>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>test-jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.python.cartridge.agent.integration.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-exec</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-all</artifactId>
+            <version>5.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-mqtt</artifactId>
+            <version>5.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.messaging</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.commons</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.commons.thrift</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.wso2.carbon</groupId>
+                    <artifactId>org.wso2.carbon.databridge.agent.thrift</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+    <properties>
+        <suiteFile>${basedir}/src/test/resources/test-suite-all.xml</suiteFile>
+    </properties>
+</project>
\ No newline at end of file


[2/4] stratos git commit: Fixing PCA live tests and PCA conflicts

Posted by ra...@apache.org.
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


[4/4] stratos git commit: Fixing PCA live tests and PCA conflicts

Posted by ra...@apache.org.
Fixing PCA live tests and PCA conflicts


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/42c388bc
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/42c388bc
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/42c388bc

Branch: refs/heads/stratos-4.1.x
Commit: 42c388bc460e7825f57f8386a39aa4478a1e8e19
Parents: 0843304
Author: Akila Perera <ra...@gmail.com>
Authored: Tue Sep 15 20:44:30 2015 +0530
Committer: Akila Perera <ra...@gmail.com>
Committed: Tue Sep 15 20:44:40 2015 +0530

----------------------------------------------------------------------
 .../cartridge.agent/cartridge.agent/config.py   |  15 +-
 .../extensions/py/ExtensionExecutor.py          |   2 +-
 .../thrift/thrift/transport/TSSLSocket.py       | 357 +++++++-------
 .../cartridge.agent/modules/util/log.py         |   2 +-
 .../cartridge.agent/publisher.py                |   2 +-
 pom.xml                                         |   1 +
 .../distribution/src/main/assembly/bin.xml      |   5 +-
 .../modules/integration/pom.xml                 | 200 +-------
 .../test/ADCMTAppTenantUserTest.java            | 213 --------
 .../test/ADCMTAppTest.java                      | 213 --------
 .../python.cartridge.agent/test/ADCTest.java    | 235 ---------
 .../test/AgentStartupTest.java                  | 154 ------
 .../test/PythonAgentTestManager.java            | 461 -----------------
 .../src/test/resources/log4j.properties         |  41 --
 .../src/test/resources/pca-testing1.xml         |  29 --
 .../src/test/resources/pca-testing2.xml         |  29 --
 .../src/test/resources/pca-testing3.xml         |  29 --
 .../src/test/resources/pca-testing4.xml         |  29 --
 .../src/test/resources/suite-1/agent.conf       |  45 --
 .../src/test/resources/suite-1/jndi.properties  |  22 -
 .../src/test/resources/suite-1/logging.ini      |  52 --
 .../resources/suite-1/payload/launch-params     |   1 -
 .../src/test/resources/suite-2/agent.conf       |  45 --
 .../src/test/resources/suite-2/jndi.properties  |  22 -
 .../src/test/resources/suite-2/logging.ini      |  52 --
 .../resources/suite-2/payload/launch-params     |   1 -
 .../src/test/resources/suite-3/agent.conf       |  45 --
 .../src/test/resources/suite-3/jndi.properties  |  22 -
 .../src/test/resources/suite-3/logging.ini      |  52 --
 .../resources/suite-3/payload/launch-params     |   1 -
 .../src/test/resources/suite-4/agent.conf       |  45 --
 .../src/test/resources/suite-4/jndi.properties  |  22 -
 .../src/test/resources/suite-4/logging.ini      |  52 --
 .../resources/suite-4/payload/launch-params     |   1 -
 .../test-conf/integration-test.properties       |  26 -
 .../modules/integration/test-common/pom.xml     |  94 ++++
 .../common/DataPublisherTestUtil.java           |  54 ++
 .../integration/common/ThriftTestServer.java    | 215 ++++++++
 .../integration/test-integration/pom.xml        | 168 +++++++
 .../tests/ADCMTAppTenantUserTestCase.java       | 217 ++++++++
 .../integration/tests/ADCMTAppTestCase.java     | 218 ++++++++
 .../agent/integration/tests/ADCTestCase.java    | 239 +++++++++
 .../integration/tests/AgentStartupTestCase.java | 157 ++++++
 .../tests/PythonAgentIntegrationTest.java       | 491 +++++++++++++++++++
 .../ADCMTAppTenantUserTestCase/agent.conf       |  45 ++
 .../ADCMTAppTenantUserTestCase/logging.ini      |  52 ++
 .../payload/launch-params                       |   1 +
 .../test/resources/ADCMTAppTestCase/agent.conf  |  45 ++
 .../test/resources/ADCMTAppTestCase/logging.ini |  52 ++
 .../ADCMTAppTestCase/payload/launch-params      |   1 +
 .../src/test/resources/ADCTestCase/agent.conf   |  45 ++
 .../src/test/resources/ADCTestCase/logging.ini  |  52 ++
 .../resources/ADCTestCase/payload/launch-params |   1 +
 .../resources/AgentStartupTestCase/agent.conf   |  45 ++
 .../resources/AgentStartupTestCase/logging.ini  |  52 ++
 .../AgentStartupTestCase/payload/launch-params  |   1 +
 .../test/resources/common/client-truststore.jks | Bin 0 -> 37935 bytes
 .../resources/common/data-bridge-config.xml     |  75 +++
 .../src/test/resources/common/jndi.properties   |  22 +
 .../src/test/resources/common/log4j.properties  |  41 ++
 .../common/stratos-health-stream-def.json       |   1 +
 .../resources/common/thrift-agent-config.xml    |  64 +++
 .../src/test/resources/common/wso2carbon.jks    | Bin 0 -> 33260 bytes
 .../test-conf/integration-test.properties       |  27 +
 .../src/test/resources/test-suite-all.xml       |  36 ++
 .../src/test/resources/test-suite-smoke.xml     |  37 ++
 66 files changed, 2755 insertions(+), 2316 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
index fdf3880..31da21f 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/config.py
@@ -18,11 +18,12 @@
 import ConfigParser
 import os
 
+from yapsy.PluginManager import PluginManager
+
 from modules.util.log import LogFactory
 from exception import ParameterNotFoundException
 import constants
 from plugins.contracts import ICartridgeAgentPlugin, IArtifactManagementPlugin, IHealthStatReaderPlugin
-from yapsy.PluginManager import PluginManager
 
 
 class Config:
@@ -134,18 +135,20 @@ class Config:
         :rtype: ConfigParser.SafeConfigParser()
         """
 
-        conf_file_path = os.path.abspath(os.path.dirname(__file__)).split("modules")[0] + "/agent.conf"
+        conf_file_path = os.path.abspath(os.path.dirname(__file__)) + "/agent.conf"
         Config.log.debug("Config file path : %r" % conf_file_path)
 
         properties = ConfigParser.SafeConfigParser()
         properties.read(conf_file_path)
 
         # set calculated values
-        param_file = os.path.abspath(os.path.dirname(__file__)).split("modules")[0] + "/payload/launch-params"
+        param_file = os.path.abspath(os.path.dirname(__file__)) + "/payload/launch-params"
+        Config.log.debug("param_file: %r" % param_file)
         properties.set("agent", constants.PARAM_FILE_PATH, param_file)
-        plugins_dir = os.path.abspath(os.path.dirname(__file__)).split("modules")[0] + "/plugins"
+        plugins_dir = os.path.abspath(os.path.dirname(__file__)) + "/plugins"
+        Config.log.debug("plugins_dir: %r" % plugins_dir)
         properties.set("agent", constants.PLUGINS_DIR, plugins_dir)
-        plugins_dir = os.path.abspath(os.path.dirname(__file__)).split("modules")[0] + "/extensions/py"
+        plugins_dir = os.path.abspath(os.path.dirname(__file__)) + "/extensions/py"
         properties.set("agent", constants.EXTENSIONS_DIR, plugins_dir)
 
         return properties
@@ -264,7 +267,7 @@ class Config:
             Config.application_id = Config.read_property(constants.APPLICATION_ID)
             Config.service_name = Config.read_property(constants.SERVICE_NAME)
             Config.cluster_id = Config.read_property(constants.CLUSTER_ID)
-            Config.ports = Config.read_property(constants.PORTS).replace("'","").split("|")
+            Config.ports = Config.read_property(constants.PORTS).replace("'", "").split("|")
             Config.is_multiTenant = Config.read_property(constants.MULTITENANT)
             Config.tenant_id = Config.read_property(constants.TENANT_ID)
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
index 9c958da..655afc4 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
@@ -51,7 +51,7 @@ class ExtensionExecutor(ICartridgeAgentPlugin):
         """
         log = LogFactory().get_log(__name__)
 
-        working_dir = os.path.abspath(os.path.dirname(__file__)).split("modules")[0]
+        working_dir = os.path.abspath(os.path.dirname(__file__))
         command = working_dir[:-2] + "bash/" + bash_file
         current_env_vars = os.environ.copy()
         extension_values.update(current_env_vars)

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
index df35be4..9bb9771 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
@@ -26,189 +26,192 @@ from TTransport import TTransportException
 
 
 class TSSLSocket(TSocket.TSocket):
-  """
-  SSL implementation of client-side TSocket
-
-  This class creates outbound sockets wrapped using the
-  python standard ssl module for encrypted connections.
-
-  The protocol used is set using the class variable
-  SSL_VERSION, which must be one of ssl.PROTOCOL_* and
-  defaults to  ssl.PROTOCOL_TLSv1 for greatest security.
-  """
-  SSL_VERSION = ssl.PROTOCOL_TLSv1
-
-  def __init__(self,
-               host='localhost',
-               port=9090,
-               validate=True,
-               ca_certs=None,
-               keyfile=None,
-               certfile=None,
-               unix_socket=None):
-    """Create SSL TSocket
-
-    @param validate: Set to False to disable SSL certificate validation
-    @type validate: bool
-    @param ca_certs: Filename to the Certificate Authority pem file, possibly a
-    file downloaded from: http://curl.haxx.se/ca/cacert.pem  This is passed to
-    the ssl_wrap function as the 'ca_certs' parameter.
-    @type ca_certs: str
-    @param keyfile: The private key
-    @type keyfile: str
-    @param certfile: The cert file
-    @type certfile: str
-    
-    Raises an IOError exception if validate is True and the ca_certs file is
-    None, not present or unreadable.
     """
-    self.validate = validate
-    self.is_valid = False
-    self.peercert = None
-    if not validate:
-      self.cert_reqs = ssl.CERT_NONE
-    else:
-      self.cert_reqs = ssl.CERT_REQUIRED
-    self.ca_certs = ca_certs
-    self.keyfile = keyfile
-    self.certfile = certfile
-    if validate:
-      if ca_certs is None or not os.access(ca_certs, os.R_OK):
-        raise IOError('Certificate Authority ca_certs file "%s" '
-                      'is not readable, cannot validate SSL '
-                      'certificates.' % (ca_certs))
-    TSocket.TSocket.__init__(self, host, port, unix_socket)
-
-  def open(self):
-    try:
-      res0 = self._resolveAddr()
-      for res in res0:
-        sock_family, sock_type = res[0:2]
-        ip_port = res[4]
-        plain_sock = socket.socket(sock_family, sock_type)
-        self.handle = ssl.wrap_socket(plain_sock,
-                                      ssl_version=self.SSL_VERSION,
-                                      do_handshake_on_connect=True,
-                                      ca_certs=self.ca_certs,
-                                      keyfile=self.keyfile,
-                                      certfile=self.certfile,
-                                      cert_reqs=self.cert_reqs)
-        self.handle.settimeout(self._timeout)
+    SSL implementation of client-side TSocket
+
+    This class creates outbound sockets wrapped using the
+    python standard ssl module for encrypted connections.
+
+    The protocol used is set using the class variable
+    SSL_VERSION, which must be one of ssl.PROTOCOL_* and
+    defaults to  ssl.PROTOCOL_TLSv1 for greatest security.
+    """
+    SSL_VERSION = ssl.PROTOCOL_TLSv1
+    CIPHERS = "DEFAULT:!ECDH"
+
+    def __init__(self,
+                 host='localhost',
+                 port=9090,
+                 validate=True,
+                 ca_certs=None,
+                 keyfile=None,
+                 certfile=None,
+                 unix_socket=None):
+        """Create SSL TSocket
+
+        @param validate: Set to False to disable SSL certificate validation
+        @type validate: bool
+        @param ca_certs: Filename to the Certificate Authority pem file, possibly a
+        file downloaded from: http://curl.haxx.se/ca/cacert.pem  This is passed to
+        the ssl_wrap function as the 'ca_certs' parameter.
+        @type ca_certs: str
+        @param keyfile: The private key
+        @type keyfile: str
+        @param certfile: The cert file
+        @type certfile: str
+
+        Raises an IOError exception if validate is True and the ca_certs file is
+        None, not present or unreadable.
+        """
+        TSocket.TSocket.__init__(self, host, port, unix_socket)
+
+        self.validate = validate
+        self.is_valid = False
+        self.peercert = None
+        if not validate:
+            self.cert_reqs = ssl.CERT_NONE
+        else:
+            self.cert_reqs = ssl.CERT_REQUIRED
+        self.ca_certs = ca_certs
+        self.keyfile = keyfile
+        self.certfile = certfile
+        if validate:
+            if ca_certs is None or not os.access(ca_certs, os.R_OK):
+                raise IOError('Certificate Authority ca_certs file "%s" '
+                              'is not readable, cannot validate SSL '
+                              'certificates.' % (ca_certs))
+
+    def open(self):
         try:
-          self.handle.connect(ip_port)
+            res0 = self._resolveAddr()
+            for res in res0:
+                sock_family, sock_type = res[0:2]
+                ip_port = res[4]
+                plain_sock = socket.socket(sock_family, sock_type)
+                self.handle = ssl.wrap_socket(plain_sock,
+                                              ssl_version=TSSLSocket.SSL_VERSION,
+                                              do_handshake_on_connect=True,
+                                              ca_certs=self.ca_certs,
+                                              keyfile=self.keyfile,
+                                              certfile=self.certfile,
+                                              cert_reqs=self.cert_reqs,
+                                              ciphers=TSSLSocket.CIPHERS)
+                self.handle.settimeout(self._timeout)
+                try:
+                    self.handle.connect(ip_port)
+                except socket.error, e:
+                    if res is not res0[-1]:
+                        continue
+                    else:
+                        raise e
+                break
         except socket.error, e:
-          if res is not res0[-1]:
-            continue
-          else:
-            raise e
-        break
-    except socket.error, e:
-      if self._unix_socket:
-        message = 'Could not connect to secure socket %s: %s' \
-                % (self._unix_socket, e)
-      else:
-        message = 'Could not connect to %s:%d: %s' % (self.host, self.port, e)
-      raise TTransportException(type=TTransportException.NOT_OPEN,
-                                message=message)
-    if self.validate:
-      self._validate_cert()
-
-  def _validate_cert(self):
-    """internal method to validate the peer's SSL certificate, and to check the
-    commonName of the certificate to ensure it matches the hostname we
-    used to make this connection.  Does not support subjectAltName records
-    in certificates.
-
-    raises TTransportException if the certificate fails validation.
-    """
-    cert = self.handle.getpeercert()
-    self.peercert = cert
-    if 'subject' not in cert:
-      raise TTransportException(
-        type=TTransportException.NOT_OPEN,
-        message='No SSL certificate found from %s:%s' % (self.host, self.port))
-    fields = cert['subject']
-    for field in fields:
-      # ensure structure we get back is what we expect
-      if not isinstance(field, tuple):
-        continue
-      cert_pair = field[0]
-      if len(cert_pair) < 2:
-        continue
-      cert_key, cert_value = cert_pair[0:2]
-      if cert_key != 'commonName':
-        continue
-      certhost = cert_value
-      # this check should be performed by some sort of Access Manager
-      if certhost == self.host:
-        # success, cert commonName matches desired hostname
-        self.is_valid = True
-        return
-      else:
+            if self._unix_socket:
+                message = 'Could not connect to secure socket %s: %s' \
+                          % (self._unix_socket, e)
+            else:
+                message = 'Could not connect to %s:%d: %s' % (self.host, self.port, e)
+            raise TTransportException(type=TTransportException.NOT_OPEN,
+                                      message=message)
+        if self.validate:
+            self._validate_cert()
+
+    def _validate_cert(self):
+        """internal method to validate the peer's SSL certificate, and to check the
+        commonName of the certificate to ensure it matches the hostname we
+        used to make this connection.  Does not support subjectAltName records
+        in certificates.
+
+        raises TTransportException if the certificate fails validation.
+        """
+        cert = self.handle.getpeercert()
+        self.peercert = cert
+        if 'subject' not in cert:
+            raise TTransportException(
+                type=TTransportException.NOT_OPEN,
+                message='No SSL certificate found from %s:%s' % (self.host, self.port))
+        fields = cert['subject']
+        for field in fields:
+            # ensure structure we get back is what we expect
+            if not isinstance(field, tuple):
+                continue
+            cert_pair = field[0]
+            if len(cert_pair) < 2:
+                continue
+            cert_key, cert_value = cert_pair[0:2]
+            if cert_key != 'commonName':
+                continue
+            certhost = cert_value
+            # this check should be performed by some sort of Access Manager
+            if certhost == self.host:
+                # success, cert commonName matches desired hostname
+                self.is_valid = True
+                return
+            else:
+                raise TTransportException(
+                    type=TTransportException.UNKNOWN,
+                    message='Hostname we connected to "%s" doesn\'t match certificate '
+                            'provided commonName "%s"' % (self.host, certhost))
         raise TTransportException(
-          type=TTransportException.UNKNOWN,
-          message='Hostname we connected to "%s" doesn\'t match certificate '
-                  'provided commonName "%s"' % (self.host, certhost))
-    raise TTransportException(
-      type=TTransportException.UNKNOWN,
-      message='Could not validate SSL certificate from '
-              'host "%s".  Cert=%s' % (self.host, cert))
+            type=TTransportException.UNKNOWN,
+            message='Could not validate SSL certificate from '
+                    'host "%s".  Cert=%s' % (self.host, cert))
 
 
 class TSSLServerSocket(TSocket.TServerSocket):
-  """SSL implementation of TServerSocket
-
-  This uses the ssl module's wrap_socket() method to provide SSL
-  negotiated encryption.
-  """
-  SSL_VERSION = ssl.PROTOCOL_TLSv1
-
-  def __init__(self,
-               host=None,
-               port=9090,
-               certfile='cert.pem',
-               unix_socket=None):
-    """Initialize a TSSLServerSocket
-
-    @param certfile: filename of the server certificate, defaults to cert.pem
-    @type certfile: str
-    @param host: The hostname or IP to bind the listen socket to,
-                 i.e. 'localhost' for only allowing local network connections.
-                 Pass None to bind to all interfaces.
-    @type host: str
-    @param port: The port to listen on for inbound connections.
-    @type port: int
-    """
-    self.setCertfile(certfile)
-    TSocket.TServerSocket.__init__(self, host, port)
-
-  def setCertfile(self, certfile):
-    """Set or change the server certificate file used to wrap new connections.
+    """SSL implementation of TServerSocket
 
-    @param certfile: The filename of the server certificate,
-                     i.e. '/etc/certs/server.pem'
-    @type certfile: str
-
-    Raises an IOError exception if the certfile is not present or unreadable.
+    This uses the ssl module's wrap_socket() method to provide SSL
+    negotiated encryption.
     """
-    if not os.access(certfile, os.R_OK):
-      raise IOError('No such certfile found: %s' % (certfile))
-    self.certfile = certfile
-
-  def accept(self):
-    plain_client, addr = self.handle.accept()
-    try:
-      client = ssl.wrap_socket(plain_client, certfile=self.certfile,
-                      server_side=True, ssl_version=self.SSL_VERSION)
-    except ssl.SSLError, ssl_exc:
-      # failed handshake/ssl wrap, close socket to client
-      plain_client.close()
-      # raise ssl_exc
-      # We can't raise the exception, because it kills most TServer derived
-      # serve() methods.
-      # Instead, return None, and let the TServer instance deal with it in
-      # other exception handling.  (but TSimpleServer dies anyway)
-      return None
-    result = TSocket.TSocket()
-    result.setHandle(client)
-    return result
+    SSL_VERSION = ssl.PROTOCOL_TLSv1
+
+    def __init__(self,
+                 host=None,
+                 port=9090,
+                 certfile='cert.pem',
+                 unix_socket=None):
+        """Initialize a TSSLServerSocket
+
+        @param certfile: filename of the server certificate, defaults to cert.pem
+        @type certfile: str
+        @param host: The hostname or IP to bind the listen socket to,
+                     i.e. 'localhost' for only allowing local network connections.
+                     Pass None to bind to all interfaces.
+        @type host: str
+        @param port: The port to listen on for inbound connections.
+        @type port: int
+        """
+        self.setCertfile(certfile)
+        TSocket.TServerSocket.__init__(self, host, port)
+
+    def setCertfile(self, certfile):
+        """Set or change the server certificate file used to wrap new connections.
+
+        @param certfile: The filename of the server certificate,
+                         i.e. '/etc/certs/server.pem'
+        @type certfile: str
+
+        Raises an IOError exception if the certfile is not present or unreadable.
+        """
+        if not os.access(certfile, os.R_OK):
+            raise IOError('No such certfile found: %s' % (certfile))
+        self.certfile = certfile
+
+    def accept(self):
+        plain_client, addr = self.handle.accept()
+        try:
+            client = ssl.wrap_socket(plain_client, certfile=self.certfile,
+                                     server_side=True, ssl_version=self.SSL_VERSION)
+        except ssl.SSLError, ssl_exc:
+            # failed handshake/ssl wrap, close socket to client
+            plain_client.close()
+            # raise ssl_exc
+            # We can't raise the exception, because it kills most TServer derived
+            # serve() methods.
+            # Instead, return None, and let the TServer instance deal with it in
+            # other exception handling.  (but TSimpleServer dies anyway)
+            return None
+        result = TSocket.TSocket()
+        result.setHandle(client)
+        return result

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/util/log.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/util/log.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/util/log.py
index 9bad214..6a0804e 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/util/log.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/util/log.py
@@ -27,7 +27,7 @@ class LogFactory(object):
     class __LogFactory:
         def __init__(self):
             self.logs = {}
-            logging_conf = os.path.abspath(os.path.dirname(__file__)).split("modules")[0] + "logging.ini"
+            logging_conf = os.path.abspath(os.path.dirname(__file__)) + "/../../logging.ini"
             logging.config.fileConfig(logging_conf)
 
         def get_log(self, name):

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/publisher.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/publisher.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/publisher.py
index d4365e8..00b5fba 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/publisher.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/publisher.py
@@ -104,7 +104,7 @@ def publish_instance_activated_event(health_stat_plugin):
             log.info("Instance activated event published")
             log.info("Starting health statistics notifier")
 
-            health_stat_publishing_enabled = Config.read_property(constants.CEP_PUBLISHER_ENABLED, False)
+            health_stat_publishing_enabled = Config.read_property(constants.CEP_PUBLISHER_ENABLED, True)
 
             if health_stat_publishing_enabled:
                 interval_default = 15  # seconds

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6fe098c..4f937bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -774,6 +774,7 @@
         <carbon.deployment.version>4.2.3</carbon.deployment.version>
         <carbon.automation.version>4.4.2</carbon.automation.version>
         <carbon.automationutils.version>4.4.2</carbon.automationutils.version>
+        <carbon.analytics.common.version>5.0.0</carbon.analytics.common.version>
         <carbon.ui.stratos.version>4.2.0-stratosv2</carbon.ui.stratos.version>
         <carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
         <carbon.platform.patch.version.4.2.1>4.2.1</carbon.platform.patch.version.4.2.1>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/distribution/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/distribution/src/main/assembly/bin.xml b/products/python-cartridge-agent/modules/distribution/src/main/assembly/bin.xml
index fa8874c..aa49e62 100644
--- a/products/python-cartridge-agent/modules/distribution/src/main/assembly/bin.xml
+++ b/products/python-cartridge-agent/modules/distribution/src/main/assembly/bin.xml
@@ -25,12 +25,15 @@
     <fileSets>
         <fileSet>
             <directory>
-                ${project.basedir}/../../../components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent
+                ${project.basedir}/../../../../components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent
             </directory>
             <outputDirectory>.</outputDirectory>
             <includes>
                 <include>**/*</include>
             </includes>
+            <excludes>
+                <exclude>**/*.pyc</exclude>
+            </excludes>
             <fileMode>0755</fileMode>
         </fileSet>
     </fileSets>

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/pom.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/pom.xml b/products/python-cartridge-agent/modules/integration/pom.xml
index aa9efb4..aa2c94d 100755
--- a/products/python-cartridge-agent/modules/integration/pom.xml
+++ b/products/python-cartridge-agent/modules/integration/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
   ~ Licensed to the Apache Software Foundation (ASF) under one
   ~ or more contributor license agreements.  See the NOTICE file
@@ -7,7 +8,7 @@
   ~ "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
+  ~     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
@@ -16,7 +17,6 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
@@ -27,193 +27,13 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>python-agent-integration</artifactId>
-    <packaging>jar</packaging>
-    <name>Python Cartridge Agent - Integration Tests</name>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>src/test/resources/test-conf</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>default</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <excludes>
-                                <exclude>**/*</exclude>
-                            </excludes>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
-            <id>live</id>
-            <build>
-                <resources>
-                    <resource>
-                        <directory>src/test/resources/test-conf</directory>
-                        <filtering>true</filtering>
-                    </resource>
-                </resources>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <excludes>
-                                <exclude>**/*</exclude>
-                            </excludes>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <id>default-test</id>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <inherited>false</inherited>
-                                <configuration>
-                                    <suiteXmlFiles>
-                                        <suiteXmlFile>src/test/resources/pca-testing1.xml</suiteXmlFile>
-                                    </suiteXmlFiles>
-                                    <workingDirectory>${basedir}/target</workingDirectory>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>adc-test</id>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <inherited>false</inherited>
-                                <configuration>
-                                    <suiteXmlFiles>
-                                        <suiteXmlFile>src/test/resources/pca-testing2.xml</suiteXmlFile>
-                                    </suiteXmlFiles>
-                                    <workingDirectory>${basedir}/target</workingDirectory>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>adc-mt-test</id>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <inherited>false</inherited>
-                                <configuration>
-                                    <suiteXmlFiles>
-                                        <suiteXmlFile>src/test/resources/pca-testing3.xml</suiteXmlFile>
-                                    </suiteXmlFiles>
-                                    <workingDirectory>${basedir}/target</workingDirectory>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>adc-mt-tenant-user-test</id>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <inherited>false</inherited>
-                                <configuration>
-                                    <suiteXmlFiles>
-                                        <suiteXmlFile>src/test/resources/pca-testing4.xml</suiteXmlFile>
-                                    </suiteXmlFiles>
-                                    <workingDirectory>${basedir}/target</workingDirectory>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-jar-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>test-jar</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-dependency-plugin</artifactId>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
+    <artifactId>python-cartridge-agent-integration</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Stratos - Python Cartridge Agent Integration Aggregator</name>
+    <description>Apache Stratos Python Cartridge Agent Integration Aggregator</description>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-exec</artifactId>
-            <version>1.0.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>6.1.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.axis2.wso2</groupId>
-            <artifactId>axis2-client</artifactId>
-            <version>${axis2.wso2.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents.wso2</groupId>
-            <artifactId>httpcore</artifactId>
-            <version>4.3.0.wso2v1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents.wso2</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.2.5.wso2v1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.mock.iaas.client</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.andes.wso2</groupId>
-            <artifactId>andes-client</artifactId>
-            <version>0.13.wso2v8</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-all</artifactId>
-            <version>5.10.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-mqtt</artifactId>
-            <version>5.10.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.messaging</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.thrift</groupId>
-            <artifactId>libthrift</artifactId>
-            <version>0.9.2</version>
-        </dependency>
-    </dependencies>
+    <modules>
+        <module>test-common</module>
+        <module>test-integration</module>
+    </modules>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/42c388bc/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java b/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java
deleted file mode 100644
index a604f55..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.apache.stratos.python.cartridge.agent.test;/*
- * 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.
- */
-
-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.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertTrue;
-
-public class ADCMTAppTenantUserTest extends PythonAgentTestManager {
-    private static final Log log = LogFactory.getLog(ADCMTAppTenantUserTest.class);
-    private static final int ADC_TIMEOUT = 180000;
-    private static final String RESOURCES_PATH = "/suite-4";
-    private static final String APPLICATION_PATH = "/tmp/pca-test-suite-4";
-    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;
-
-    @BeforeSuite
-    public void setupADCMTAppTest() {
-        // Set jndi.properties.dir system property for initializing event publishers and receivers
-        System.setProperty("jndi.properties.dir", getResourcesPath(RESOURCES_PATH));
-
-        // start Python agent with configurations provided in resource path
-        setup(RESOURCES_PATH);
-
-        // Simulate server socket
-        startServerSocket(8080);
-    }
-
-    /**
-     * TearDown method for test method testPythonCartridgeAgent
-     */
-    @AfterSuite
-    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/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java b/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java
deleted file mode 100644
index 2a4c8b5..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.apache.stratos.python.cartridge.agent.test;/*
- * 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.
- */
-
-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.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertTrue;
-
-public class ADCMTAppTest extends PythonAgentTestManager {
-    private static final Log log = LogFactory.getLog(ADCMTAppTest.class);
-    private static final int ADC_TIMEOUT = 180000;
-    private static final String RESOURCES_PATH = "/suite-3";
-    private static final String APPLICATION_PATH = "/tmp/pca-test-suite-3";
-    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;
-
-    @BeforeSuite
-    public void setupADCMTAppTest() {
-        // Set jndi.properties.dir system property for initializing event publishers and receivers
-        System.setProperty("jndi.properties.dir", getResourcesPath(RESOURCES_PATH));
-
-        // start Python agent with configurations provided in resource path
-        setup(RESOURCES_PATH);
-
-        // Simulate server socket
-        startServerSocket(8080);
-    }
-
-    /**
-     * TearDown method for test method testPythonCartridgeAgent
-     */
-    @AfterSuite
-    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/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java b/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java
deleted file mode 100755
index de5be67..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package org.apache.stratos.python.cartridge.agent.test;/*
- * 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.
- */
-
-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.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-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 ADCTest extends PythonAgentTestManager {
-    private static final Log log = LogFactory.getLog(ADCTest.class);
-    private static final int ADC_TIMEOUT = 180000;
-    private static final String RESOURCES_PATH = "/suite-2";
-    private static final String APPLICATION_PATH = "/tmp/pca-test-suite-2";
-    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;
-
-    @BeforeSuite
-    public void setupADCTest() {
-        // Set jndi.properties.dir system property for initializing event publishers and receivers
-        System.setProperty("jndi.properties.dir", getResourcesPath(RESOURCES_PATH));
-
-        // start Python agent with configurations provided in resource path
-        setup(RESOURCES_PATH);
-
-        // Simulate server socket
-        startServerSocket(8080);
-    }
-
-    /**
-     * TearDown method for test method testPythonCartridgeAgent
-     */
-    @AfterSuite
-    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/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java b/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java
deleted file mode 100755
index c08ab5c..0000000
--- a/products/python-cartridge-agent/modules/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.test;
-
-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.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-public class AgentStartupTest extends PythonAgentTestManager {
-    private static final Log log = LogFactory.getLog(AgentStartupTest.class);
-    private static final int STARTUP_TIMEOUT = 60000;
-    private static final String RESOURCES_PATH = "/suite-1";
-    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;
-
-    @BeforeSuite
-    public void setupAgentStartupTest() {
-        // Set jndi.properties.dir system property for initializing event publishers and receivers
-        System.setProperty("jndi.properties.dir", getResourcesPath(RESOURCES_PATH));
-
-        // start Python agent with configurations provided in resource path
-        setup(RESOURCES_PATH);
-
-        // Simulate server socket
-        startServerSocket(8080);
-    }
-
-
-    /**
-     * TearDown method for test method testPythonCartridgeAgent
-     */
-    @AfterSuite
-    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