Merge conflicts
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/2ee9873a Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2ee9873a Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2ee9873a Branch: refs/heads/master Commit: 2ee9873a97ac67ac4f2d8abec468c91064760633 Parents: e19bfe7 Author: Akila Perera <[email protected]> Authored: Tue Sep 1 01:41:28 2015 +0530 Committer: gayangunarathne <[email protected]> Committed: Tue Sep 1 19:54:17 2015 +0530 ---------------------------------------------------------------------- .../python-cartridge-agent/integration/pom.xml | 24 +- .../python.cartridge.agent/test/ADCTest.java | 218 +++++++++++++++++++ .../test/DataPublisherTestUtil.java | 46 ++++ .../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/log4j.properties | 41 ---- .../test-conf/integration-test.properties | 3 +- 12 files changed, 672 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/2ee9873a/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 index e92bbb4..ae6f5e1 100755 --- a/products/python-cartridge-agent/integration/pom.xml +++ b/products/python-cartridge-agent/integration/pom.xml @@ -106,42 +106,42 @@ <artifactId>commons-exec</artifactId> <version>1.0.1</version> </dependency> - <dependency> + <!--dependency> <groupId>org.apache.stratos</groupId> <artifactId>org.apache.stratos.common</artifactId> <version>${project.version}</version> - </dependency> + </dependency--> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.1.1</version> </dependency> - <dependency> + <!--dependency> <groupId>org.apache.axis2.wso2</groupId> <artifactId>axis2-client</artifactId> <version>${axis2.wso2.version}</version> - </dependency> - <dependency> + </dependency--> + <!--dependency> <groupId>org.apache.httpcomponents.wso2</groupId> <artifactId>httpcore</artifactId> <version>4.3.0.wso2v1</version> - </dependency> - <dependency> + </dependency--> + <!--dependency> <groupId>org.apache.httpcomponents.wso2</groupId> <artifactId>httpclient</artifactId> <version>4.2.5.wso2v1</version> - </dependency> - <dependency> + </dependency--> + <!--dependency> <groupId>org.apache.stratos</groupId> <artifactId>org.apache.stratos.mock.iaas.client</artifactId> <version>${project.version}</version> <scope>test</scope> - </dependency> - <dependency> + </dependency--> + <!--dependency> <groupId>org.wso2.andes.wso2</groupId> <artifactId>andes-client</artifactId> <version>0.13.wso2v8</version> - </dependency> + </dependency--> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-all</artifactId> http://git-wip-us.apache.org/repos/asf/stratos/blob/2ee9873a/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 index 86fc7c3..0b9d406 100755 --- 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 @@ -17,5 +17,223 @@ package org.apache.stratos.python.cartridge.agent.test;/* * under the License. */ + public class ADCTest { + +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/2ee9873a/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 new file mode 100644 index 0000000..7f1d985 --- /dev/null +++ b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/DataPublisherTestUtil.java @@ -0,0 +1,46 @@ +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 http://git-wip-us.apache.org/repos/asf/stratos/blob/2ee9873a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ThriftTestServer.java ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ThriftTestServer.java b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ThriftTestServer.java new file mode 100644 index 0000000..aaa9ba0 --- /dev/null +++ b/products/python-cartridge-agent/integration/src/test/java/org/apache/stratos/python.cartridge.agent/test/ThriftTestServer.java @@ -0,0 +1,213 @@ +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.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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/client-truststore.jks ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/client-truststore.jks b/products/python-cartridge-agent/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/integration/src/test/resources/common/client-truststore.jks differ http://git-wip-us.apache.org/repos/asf/stratos/blob/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/data-bridge-config.xml ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/data-bridge-config.xml b/products/python-cartridge-agent/integration/src/test/resources/common/data-bridge-config.xml new file mode 100644 index 0000000..13ca54c --- /dev/null +++ b/products/python-cartridge-agent/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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/log4j.properties ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/log4j.properties b/products/python-cartridge-agent/integration/src/test/resources/common/log4j.properties new file mode 100755 index 0000000..c0c6e78 --- /dev/null +++ b/products/python-cartridge-agent/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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/stratos-health-stream-def.json ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/stratos-health-stream-def.json b/products/python-cartridge-agent/integration/src/test/resources/common/stratos-health-stream-def.json new file mode 100644 index 0000000..4d36c19 --- /dev/null +++ b/products/python-cartridge-agent/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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/thrift-agent-config.xml ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/thrift-agent-config.xml b/products/python-cartridge-agent/integration/src/test/resources/common/thrift-agent-config.xml new file mode 100644 index 0000000..dbb2ba3 --- /dev/null +++ b/products/python-cartridge-agent/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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/common/wso2carbon.jks ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/common/wso2carbon.jks b/products/python-cartridge-agent/integration/src/test/resources/common/wso2carbon.jks new file mode 100644 index 0000000..7942c53 Binary files /dev/null and b/products/python-cartridge-agent/integration/src/test/resources/common/wso2carbon.jks differ http://git-wip-us.apache.org/repos/asf/stratos/blob/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/log4j.properties b/products/python-cartridge-agent/integration/src/test/resources/log4j.properties deleted file mode 100755 index c0c6e78..0000000 --- a/products/python-cartridge-agent/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/2ee9873a/products/python-cartridge-agent/integration/src/test/resources/test-conf/integration-test.properties ---------------------------------------------------------------------- diff --git a/products/python-cartridge-agent/integration/src/test/resources/test-conf/integration-test.properties b/products/python-cartridge-agent/integration/src/test/resources/test-conf/integration-test.properties index 1242841..332441a 100755 --- a/products/python-cartridge-agent/integration/src/test/resources/test-conf/integration-test.properties +++ b/products/python-cartridge-agent/integration/src/test/resources/test-conf/integration-test.properties @@ -20,7 +20,8 @@ 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 +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
