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/08/31 22:41:16 UTC
[4/4] stratos git commit: Restructuring PCA product pom structure:
move submodules inside modules dir
Restructuring PCA product pom structure: move submodules inside modules dir
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d5f11fc2
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d5f11fc2
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d5f11fc2
Branch: refs/heads/master
Commit: d5f11fc22f850540a3e3bcde3c2b667b197c6745
Parents: 7f634c5
Author: Akila Perera <ra...@gmail.com>
Authored: Tue Sep 1 02:10:54 2015 +0530
Committer: Akila Perera <ra...@gmail.com>
Committed: Tue Sep 1 02:10:54 2015 +0530
----------------------------------------------------------------------
.../extensions/py/ExtensionExecutor.py | 2 +-
.../cartridge.agent/modules/util/log.py | 2 +-
.../python-cartridge-agent/distribution/pom.xml | 58 ---
.../distribution/src/main/assembly/bin.xml | 57 ---
.../distribution/src/main/license/LICENSE | 202 --------
.../distribution/src/main/notice/NOTICE | 5 -
.../distribution/src/main/readme/README | 32 --
.../integration/.gitignore | 1 -
.../python-cartridge-agent/integration/pom.xml | 250 ----------
.../test/ADCMTAppTenantUserTest.java | 213 --------
.../test/ADCMTAppTest.java | 213 --------
.../python.cartridge.agent/test/ADCTest.java | 235 ---------
.../test/AgentStartupTest.java | 154 ------
.../test/DataPublisherTestUtil.java | 46 --
.../test/PythonAgentTestManager.java | 497 -------------------
.../test/ThriftTestServer.java | 213 --------
.../test/resources/common/client-truststore.jks | Bin 37935 -> 0 bytes
.../resources/common/data-bridge-config.xml | 75 ---
.../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 33260 -> 0 bytes
.../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 | 27 -
.../modules/distribution/pom.xml | 59 +++
.../distribution/src/main/assembly/bin.xml | 57 +++
.../distribution/src/main/license/LICENSE | 202 ++++++++
.../modules/distribution/src/main/notice/NOTICE | 5 +
.../modules/distribution/src/main/readme/README | 32 ++
.../modules/integration/.gitignore | 1 +
.../modules/integration/pom.xml | 251 ++++++++++
.../test/ADCMTAppTenantUserTest.java | 213 ++++++++
.../test/ADCMTAppTest.java | 213 ++++++++
.../python.cartridge.agent/test/ADCTest.java | 235 +++++++++
.../test/AgentStartupTest.java | 154 ++++++
.../test/DataPublisherTestUtil.java | 46 ++
.../test/PythonAgentTestManager.java | 497 +++++++++++++++++++
.../test/ThriftTestServer.java | 213 ++++++++
.../test/resources/common/client-truststore.jks | Bin 0 -> 37935 bytes
.../resources/common/data-bridge-config.xml | 75 +++
.../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
.../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 | 27 +
products/python-cartridge-agent/pom.xml | 6 +-
85 files changed, 2987 insertions(+), 2985 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/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/d5f11fc2/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/d5f11fc2/products/python-cartridge-agent/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/distribution/pom.xml b/products/python-cartridge-agent/distribution/pom.xml
deleted file mode 100644
index 74d1003..0000000
--- a/products/python-cartridge-agent/distribution/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?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
- ~ 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-parent</artifactId>
- <version>4.2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>python-cartridge-agent-distribution</artifactId>
- <packaging>pom</packaging>
- <name>Apache Stratos - Python Cartridge Agent</name>
- <description>Apache Stratos Python Cartridge Agent Distribution</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>1-pre_dist</id>
- <phase>test</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <finalName>${python.cartridge.agent.distribution.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- </descriptors>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/distribution/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/distribution/src/main/assembly/bin.xml b/products/python-cartridge-agent/distribution/src/main/assembly/bin.xml
deleted file mode 100644
index fa8874c..0000000
--- a/products/python-cartridge-agent/distribution/src/main/assembly/bin.xml
+++ /dev/null
@@ -1,57 +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.
- -->
-<assembly>
- <id>bin</id>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>
- ${project.basedir}/../../../components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent
- </directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>**/*</include>
- </includes>
- <fileMode>0755</fileMode>
- </fileSet>
- </fileSets>
- <files>
- <file>
- <source>${project.basedir}/src/main/notice/NOTICE</source>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- <fileMode>644</fileMode>
- </file>
- <file>
- <source>${project.basedir}/src/main/license/LICENSE</source>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- <fileMode>644</fileMode>
- </file>
- <file>
- <source>${project.basedir}/src/main/readme/README</source>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- <fileMode>644</fileMode>
- </file>
- </files>
-</assembly>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/distribution/src/main/license/LICENSE
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/distribution/src/main/license/LICENSE b/products/python-cartridge-agent/distribution/src/main/license/LICENSE
deleted file mode 100644
index 7a4a3ea..0000000
--- a/products/python-cartridge-agent/distribution/src/main/license/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/distribution/src/main/notice/NOTICE
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/distribution/src/main/notice/NOTICE b/products/python-cartridge-agent/distribution/src/main/notice/NOTICE
deleted file mode 100644
index c59ffa6..0000000
--- a/products/python-cartridge-agent/distribution/src/main/notice/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Stratos Python Cartridge Agent
-Copyright 2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/distribution/src/main/readme/README
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/distribution/src/main/readme/README b/products/python-cartridge-agent/distribution/src/main/readme/README
deleted file mode 100644
index 92066bf..0000000
--- a/products/python-cartridge-agent/distribution/src/main/readme/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Python Cartridge Agent (PCA)
-============================
-
-Cartridge agent manages cartridge instance lifecycle and publishes its health statistics
-to Complex Event Processor (CEP). It provides a set of extension points for implementing
-logic required for configuring the server.
-
-How to run Live Tests
----------------------
-1. Install following packages
-
- apt-get install -y git python python-pip python-dev gcc zip
-
-2. Install dependent python modules:
- ```
- pip install paho-mqtt
- pip install psutil
- pip install pexpect
- pip install pycrypto
- pip install gitpython
- pip install yapsy
- ```
-
-3. Start ActiveMQ:
- ```
- <activemq-home>/bin/activemq start
- ```
-
-4. Run python cartridge agent live tests:
- ```
- mvn clean install -Plive
- ```
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/integration/.gitignore
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/.gitignore b/products/python-cartridge-agent/integration/.gitignore
deleted file mode 100644
index 4d01b31..0000000
--- a/products/python-cartridge-agent/integration/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-cartridge-agent.log
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/integration/pom.xml
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/pom.xml b/products/python-cartridge-agent/integration/pom.xml
deleted file mode 100755
index 946bf01..0000000
--- a/products/python-cartridge-agent/integration/pom.xml
+++ /dev/null
@@ -1,250 +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.
- -->
-
-<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-parent</artifactId>
- <version>4.2.0-SNAPSHOT</version>
- </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>
- <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>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>
-
- <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>
- <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.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/d5f11fc2/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTenantUserTest.java
deleted file mode 100644
index 07dd6b2..0000000
--- a/products/python-cartridge-agent/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 SUITE_NAME = "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(SUITE_NAME));
-
- // start Python agent with configurations provided in resource path
- setup(SUITE_NAME);
-
- // 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/d5f11fc2/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCMTAppTest.java
deleted file mode 100644
index dbab83e..0000000
--- a/products/python-cartridge-agent/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 SUITE_NAME = "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(SUITE_NAME));
-
- // start Python agent with configurations provided in resource path
- setup(SUITE_NAME);
-
- // 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/d5f11fc2/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ADCTest.java
deleted file mode 100755
index d1355e1..0000000
--- a/products/python-cartridge-agent/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 SUITE_NAME = "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(SUITE_NAME));
-
- // start Python agent with configurations provided in resource path
- setup(SUITE_NAME);
-
- // 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/d5f11fc2/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/AgentStartupTest.java
deleted file mode 100755
index 615cd8e..0000000
--- a/products/python-cartridge-agent/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 = 120000;
- private static final String SUITE_NAME = "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(SUITE_NAME));
-
- // start Python agent with configurations provided in resource path
- setup(SUITE_NAME);
-
- // 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
http://git-wip-us.apache.org/repos/asf/stratos/blob/d5f11fc2/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/DataPublisherTestUtil.java
----------------------------------------------------------------------
diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/DataPublisherTestUtil.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/DataPublisherTestUtil.java
deleted file mode 100644
index 7f1d985..0000000
--- a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/DataPublisherTestUtil.java
+++ /dev/null
@@ -1,46 +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 java.io.File;
-
-public class DataPublisherTestUtil {
- public static final String LOCAL_HOST = "localhost";
-
- public static void setTrustStoreParams() {
- String trustStore = PythonAgentTestManager.getResourcesPath("common");
- 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 = PythonAgentTestManager.getResourcesPath("common");
- System.setProperty("Security.KeyStore.Location", keyStore + File.separator + "wso2carbon.jks");
- System.setProperty("Security.KeyStore.Password", "wso2carbon");
- }
-
- public static String getDataAgentConfigPath() {
- String filePath = PythonAgentTestManager.getResourcesPath("common");
- return filePath + File.separator + "data-agent-config.xml";
- }
-
- public static String getDataBridgeConfigPath() {
- String filePath = PythonAgentTestManager.getResourcesPath("common");
- return filePath + File.separator + "data-bridge-config.xml";
- }
-}
\ No newline at end of file