You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/12/01 04:39:34 UTC
[1/7] stratos git commit: Renaming cep-310 extension artifact id
Repository: stratos
Updated Branches:
refs/heads/stratos-4.1.x 81b72de83 -> 64f05a519
Renaming cep-310 extension artifact id
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/85036eb9
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/85036eb9
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/85036eb9
Branch: refs/heads/stratos-4.1.x
Commit: 85036eb9c42c1248bcc7dd48420f94cce86edccc
Parents: cd06c7b
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 13:30:30 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530
----------------------------------------------------------------------
extensions/cep/modules/distribution/pom.xml | 2 +-
extensions/cep/modules/distribution/src/assembly/bin.xml | 2 +-
extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml | 2 +-
pom.xml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/85036eb9/extensions/cep/modules/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/modules/distribution/pom.xml b/extensions/cep/modules/distribution/pom.xml
index 1b2fbc5..5c4364e 100644
--- a/extensions/cep/modules/distribution/pom.xml
+++ b/extensions/cep/modules/distribution/pom.xml
@@ -70,7 +70,7 @@
</dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.cep.310.extension</artifactId>
+ <artifactId>org.apache.stratos.cep310.extension</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/85036eb9/extensions/cep/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/modules/distribution/src/assembly/bin.xml b/extensions/cep/modules/distribution/src/assembly/bin.xml
index 8706de0..ee6c14b 100755
--- a/extensions/cep/modules/distribution/src/assembly/bin.xml
+++ b/extensions/cep/modules/distribution/src/assembly/bin.xml
@@ -61,7 +61,7 @@
<outputDirectory>${project.artifactId}-${project.version}/lib</outputDirectory>
<includes>
<include>org.apache.stratos:org.apache.stratos.cep300.extension:jar</include>
- <include>org.apache.stratos:org.apache.stratos.cep.310.extension:jar</include>
+ <include>org.apache.stratos:org.apache.stratos.cep310.extension:jar</include>
</includes>
</dependencySet>
</dependencySets>
http://git-wip-us.apache.org/repos/asf/stratos/blob/85036eb9/extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml b/extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml
index 3d47615..8208571 100644
--- a/extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml
+++ b/extensions/cep/modules/stratos-cep-extension/wso2cep-3.1.0/pom.xml
@@ -21,7 +21,7 @@
<relativePath>../../../pom.xml</relativePath>
</parent>
- <artifactId>org.apache.stratos.cep.310.extension</artifactId>
+ <artifactId>org.apache.stratos.cep310.extension</artifactId>
<name>Apache Stratos - CEP Extensions</name>
<description>Apache Stratos CEP Extensions</description>
http://git-wip-us.apache.org/repos/asf/stratos/blob/85036eb9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2c62945..50dd47a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1033,7 +1033,7 @@
</dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.cep.310.extension</artifactId>
+ <artifactId>org.apache.stratos.cep310.extension</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
[3/7] stratos git commit: Fixing the issue of data publishers are
created for nodes which has false value set to statsPublisherEnabled in
thrift-client-config.xml
Posted by ga...@apache.org.
Fixing the issue of data publishers are created for nodes which has false value set to statsPublisherEnabled in thrift-client-config.xml
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/f726ea8c
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/f726ea8c
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/f726ea8c
Branch: refs/heads/stratos-4.1.x
Commit: f726ea8c22207e7f0ae4c99cc7a622e71f16687d
Parents: 81b72de
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 01:42:30 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530
----------------------------------------------------------------------
.../statistics/publisher/ThriftStatisticsPublisher.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/f726ea8c/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
index 95c0478..f86293a 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
@@ -85,11 +85,13 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
ArrayList<ReceiverGroup> receiverGroups = new ArrayList<ReceiverGroup>();
for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
- ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
- DataPublisherHolder aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword());
- dataPublisherHolders.add(aNode);
- ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
- receiverGroups.add(group);
+ if (thriftClientInfo.isStatsPublisherEnabled()) {
+ ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
+ DataPublisherHolder aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword());
+ dataPublisherHolders.add(aNode);
+ ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
+ receiverGroups.add(group);
+ }
}
return receiverGroups;
[7/7] stratos git commit: Adding setUp() and having individual test
methods for cep and das in ThriftStatisticsPublisherTest
Posted by ga...@apache.org.
Adding setUp() and having individual test methods for cep and das in ThriftStatisticsPublisherTest
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/64f05a51
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/64f05a51
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/64f05a51
Branch: refs/heads/stratos-4.1.x
Commit: 64f05a5196d7e77880945f74a288480d3f1f20d4
Parents: 5435bff
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 17:06:50 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:55 2015 +0530
----------------------------------------------------------------------
.../test/ThriftStatisticsPublisherTest.java | 32 +++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/64f05a51/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
index 43cd4c1..c553b1c 100644
--- a/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
+++ b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
@@ -21,8 +21,10 @@ package org.apache.stratos.common.test;
import org.apache.stratos.common.statistics.publisher.ThriftClientConfig;
import org.apache.stratos.common.statistics.publisher.ThriftStatisticsPublisher;
+import org.junit.Before;
import org.junit.Test;
import org.wso2.carbon.databridge.commons.StreamDefinition;
+import org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException;
import java.net.URL;
@@ -32,29 +34,37 @@ import static org.junit.Assert.assertEquals;
* ThriftStatisticsPublisherTest
*/
public class ThriftStatisticsPublisherTest {
- /**
- * Checking whether LoadBalancingDataPublisher is created for cep and das according to thrift-client-config.xml
- *
- * @throws Exception
- */
- @Test
- public void createLoadBalancingDataPublisher() throws Exception {
+ private StreamDefinition streamDefinition;
+ private ThriftStatisticsPublisher thriftStatisticsPublisher;
+
+ @Before
+ public void setUp() throws MalformedStreamDefinitionException {
URL configFileUrl = ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, configFileUrl.getPath());
+ streamDefinition = new StreamDefinition("Test", "1.0.0");
+ }
- StreamDefinition streamDefinition = new StreamDefinition("Test", "1.0.0");
-
- ThriftStatisticsPublisher thriftStatisticsPublisher = new ThriftStatisticsPublisher(streamDefinition,
+ /**
+ * Checking whether LoadBalancingDataPublisher is created for cep according to thrift-client-config.xml
+ */
+ @Test
+ public void createCEPLoadBalancingDataPublisher() {
+ thriftStatisticsPublisher = new ThriftStatisticsPublisher(streamDefinition,
ThriftClientConfig.CEP_THRIFT_CLIENT_NAME);
assertEquals("CEP stats publisher is not enabled", true, thriftStatisticsPublisher.isEnabled());
assertEquals("No of CEP nodes enabled for stats publishing is not equal to two", 2,
thriftStatisticsPublisher.getDataPublisherHolders().size());
+ }
+ /**
+ * Checking whether LoadBalancingDataPublisher is created for das according to thrift-client-config.xml
+ */
+ @Test
+ public void createDASLoadBalancingDataPublisher() {
thriftStatisticsPublisher = new ThriftStatisticsPublisher(streamDefinition,
ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
assertEquals("DAS stats publisher is not enabled", true, thriftStatisticsPublisher.isEnabled());
assertEquals("More than one DAS node is enabled for stats publishing", 1,
thriftStatisticsPublisher.getDataPublisherHolders().size());
-
}
}
[2/7] stratos git commit: Updating scaling_decision nickname and
description
Posted by ga...@apache.org.
Updating scaling_decision nickname and description
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/994255e7
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/994255e7
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/994255e7
Branch: refs/heads/stratos-4.1.x
Commit: 994255e7e2dd438685387dd506ed1f56d08b2471
Parents: f726ea8
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 13:25:13 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530
----------------------------------------------------------------------
.../EventstreamScalingDecision/scaling_decision_1.0.0.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/994255e7/extensions/das/modules/artifacts/monitoring-dashboard/capps/stratos-monitoring-service/EventstreamScalingDecision/scaling_decision_1.0.0.json
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/monitoring-dashboard/capps/stratos-monitoring-service/EventstreamScalingDecision/scaling_decision_1.0.0.json b/extensions/das/modules/artifacts/monitoring-dashboard/capps/stratos-monitoring-service/EventstreamScalingDecision/scaling_decision_1.0.0.json
index fbda1ef..457fa06 100644
--- a/extensions/das/modules/artifacts/monitoring-dashboard/capps/stratos-monitoring-service/EventstreamScalingDecision/scaling_decision_1.0.0.json
+++ b/extensions/das/modules/artifacts/monitoring-dashboard/capps/stratos-monitoring-service/EventstreamScalingDecision/scaling_decision_1.0.0.json
@@ -1,8 +1,8 @@
{
"name": "scaling_decision",
"version": "1.0.0",
- "nickName": "Member Information",
- "description": "Member Information",
+ "nickName": "Scaling Decision",
+ "description": "Scaling Decision",
"payloadData": [
{
"name": "timestamp",
[4/7] stratos git commit: Formatting ThriftStatisticsPublisher class
Posted by ga...@apache.org.
Formatting ThriftStatisticsPublisher class
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cd06c7b0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cd06c7b0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cd06c7b0
Branch: refs/heads/stratos-4.1.x
Commit: cd06c7b0c4fb8051b78590fe3e7a6fa085b386b7
Parents: e129b80
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 13:28:54 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530
----------------------------------------------------------------------
.../publisher/ThriftStatisticsPublisher.java | 21 ++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/cd06c7b0/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
index f86293a..c26c6d3 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
@@ -83,27 +83,28 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
private ArrayList<ReceiverGroup> getReceiverGroups() {
ArrayList<ReceiverGroup> receiverGroups = new ArrayList<ReceiverGroup>();
+ ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
+ DataPublisherHolder aNode;
for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
if (thriftClientInfo.isStatsPublisherEnabled()) {
- ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
- DataPublisherHolder aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword());
+ aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(),
+ thriftClientInfo.getPassword());
dataPublisherHolders.add(aNode);
- ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
- receiverGroups.add(group);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Thrift client [id] %s [ip] %s [port] %s is added to data publisher holder",
+ thriftClientInfo.getId(), thriftClientInfo.getIp(), thriftClientInfo.getPort()));
+ }
}
}
+ ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
+ receiverGroups.add(group);
return receiverGroups;
}
private String buildUrl(ThriftClientInfo thriftClientInfo) {
- String url = new StringBuilder()
- .append("tcp://")
- .append(thriftClientInfo.getIp())
- .append(":")
- .append(thriftClientInfo.getPort()).toString();
- return url;
+ return String.format("tcp://%s:%s", thriftClientInfo.getIp(), thriftClientInfo.getPort());
}
@Override
[5/7] stratos git commit: Adding cep extension jars to distribution
Posted by ga...@apache.org.
Adding cep extension jars to distribution
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e129b807
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e129b807
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e129b807
Branch: refs/heads/stratos-4.1.x
Commit: e129b807df26cf73db74a5adffeb5b2908993aba
Parents: 994255e
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 01:46:11 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530
----------------------------------------------------------------------
extensions/cep/modules/distribution/pom.xml | 10 ++++++++++
extensions/cep/modules/distribution/src/assembly/bin.xml | 9 +++++++++
extensions/cep/pom.xml | 2 +-
pom.xml | 10 ++++++++++
4 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/e129b807/extensions/cep/modules/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/modules/distribution/pom.xml b/extensions/cep/modules/distribution/pom.xml
index cb9e874..1b2fbc5 100644
--- a/extensions/cep/modules/distribution/pom.xml
+++ b/extensions/cep/modules/distribution/pom.xml
@@ -63,4 +63,14 @@
</build>
</profile>
</profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.cep300.extension</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.cep.310.extension</artifactId>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/e129b807/extensions/cep/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/modules/distribution/src/assembly/bin.xml b/extensions/cep/modules/distribution/src/assembly/bin.xml
index 509a6e2..8706de0 100755
--- a/extensions/cep/modules/distribution/src/assembly/bin.xml
+++ b/extensions/cep/modules/distribution/src/assembly/bin.xml
@@ -56,4 +56,13 @@
<fileMode>644</fileMode>
</file>
</files>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>${project.artifactId}-${project.version}/lib</outputDirectory>
+ <includes>
+ <include>org.apache.stratos:org.apache.stratos.cep300.extension:jar</include>
+ <include>org.apache.stratos:org.apache.stratos.cep.310.extension:jar</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
</assembly>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/e129b807/extensions/cep/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/pom.xml b/extensions/cep/pom.xml
index ce59670..b746075 100644
--- a/extensions/cep/pom.xml
+++ b/extensions/cep/pom.xml
@@ -32,8 +32,8 @@
<description>Apache Stratos CEP Extensions</description>
<modules>
- <module>modules/distribution</module>
<module>modules/stratos-cep-extension/wso2cep-3.0.0</module>
<module>modules/stratos-cep-extension/wso2cep-3.1.0</module>
+ <module>modules/distribution</module>
</modules>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/e129b807/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8125401..2c62945 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1028,6 +1028,16 @@
</dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.cep300.extension</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.cep.310.extension</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
<artifactId>org.apache.stratos.das.extension</artifactId>
<version>${project.version}</version>
</dependency>
[6/7] stratos git commit: Adding ThriftStatisticsPublisherTest and
updating ThriftStatisticsPublisher and ThiriftClientConfigParserTest
Posted by ga...@apache.org.
Adding ThriftStatisticsPublisherTest and updating ThriftStatisticsPublisher and ThiriftClientConfigParserTest
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5435bffd
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5435bffd
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5435bffd
Branch: refs/heads/stratos-4.1.x
Commit: 5435bffd21f21aa26a61f6cf3df345af453e20f6
Parents: 85036eb
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 16:12:45 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:55 2015 +0530
----------------------------------------------------------------------
.../publisher/ThriftStatisticsPublisher.java | 20 +++---
.../test/ThriftClientConfigParserTest.java | 73 +++++++++++---------
.../test/ThriftStatisticsPublisherTest.java | 60 ++++++++++++++++
.../src/test/resources/thrift-client-config.xml | 53 ++++++++------
4 files changed, 142 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/5435bffd/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
index c26c6d3..bf0db61 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
@@ -43,6 +43,8 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
private LoadBalancingDataPublisher loadBalancingDataPublisher;
private List<ThriftClientInfo> thriftClientInfoList;
private boolean enabled = false;
+ private ArrayList<ReceiverGroup> receiverGroups;
+ private ArrayList<DataPublisherHolder> dataPublisherHolders;
/**
* Credential information stored inside thrift-client-config.xml file
@@ -58,6 +60,8 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
if (isPublisherEnabled()) {
this.enabled = true;
+ receiverGroups = new ArrayList<ReceiverGroup>();
+ dataPublisherHolders = new ArrayList<DataPublisherHolder>();
init();
}
}
@@ -82,23 +86,17 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
private ArrayList<ReceiverGroup> getReceiverGroups() {
- ArrayList<ReceiverGroup> receiverGroups = new ArrayList<ReceiverGroup>();
- ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
- DataPublisherHolder aNode;
-
for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
if (thriftClientInfo.isStatsPublisherEnabled()) {
- aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(),
- thriftClientInfo.getPassword());
- dataPublisherHolders.add(aNode);
+ dataPublisherHolders.add(new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(),
+ thriftClientInfo.getPassword()));
if (log.isDebugEnabled()) {
log.debug(String.format("Thrift client [id] %s [ip] %s [port] %s is added to data publisher holder",
thriftClientInfo.getId(), thriftClientInfo.getIp(), thriftClientInfo.getPort()));
}
}
}
- ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
- receiverGroups.add(group);
+ receiverGroups.add(new ReceiverGroup(dataPublisherHolders));
return receiverGroups;
}
@@ -107,6 +105,10 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
return String.format("tcp://%s:%s", thriftClientInfo.getIp(), thriftClientInfo.getPort());
}
+ public ArrayList<DataPublisherHolder> getDataPublisherHolders() {
+ return dataPublisherHolders;
+ }
+
@Override
public void setEnabled(boolean enabled) {
this.enabled = enabled;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5435bffd/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
index ae7e059..26cba9f 100644
--- a/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
+++ b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
@@ -20,7 +20,6 @@
package org.apache.stratos.common.test;
import junit.framework.TestCase;
-
import org.apache.stratos.common.statistics.publisher.ThriftClientConfig;
import org.apache.stratos.common.statistics.publisher.ThriftClientInfo;
import org.junit.Test;
@@ -44,48 +43,58 @@ public class ThriftClientConfigParserTest extends TestCase {
URL configFileUrl = ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, configFileUrl.getPath());
ThriftClientConfig thriftClientConfig = ThriftClientConfig.getInstance();
- List <ThriftClientInfo> cepList = thriftClientConfig.getThriftClientInfo(
+ List<ThriftClientInfo> cepList = thriftClientConfig.getThriftClientInfo(
ThriftClientConfig.CEP_THRIFT_CLIENT_NAME);
- List <ThriftClientInfo> dasList = thriftClientConfig.getThriftClientInfo(
+ List<ThriftClientInfo> dasList = thriftClientConfig.getThriftClientInfo(
ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
ThriftClientInfo cepNode1 = null;
ThriftClientInfo cepNode2 = null;
ThriftClientInfo dasNode1 = null;
-
+ ThriftClientInfo dasNode2 = null;
+
for (ThriftClientInfo cepNodeInfo : cepList) {
- if(cepNodeInfo.getId().equals("node-01")) {
- cepNode1 = cepNodeInfo;
- }else if(cepNodeInfo.getId().equals("node-02")) {
- cepNode2 = cepNodeInfo;
- }
- }
-
+ if (cepNodeInfo.getId().equals("node-01")) {
+ cepNode1 = cepNodeInfo;
+ } else if (cepNodeInfo.getId().equals("node-02")) {
+ cepNode2 = cepNodeInfo;
+ }
+ }
+
for (ThriftClientInfo dasNodeInfo : dasList) {
- if(dasNodeInfo.getId().equals("node-01")) {
- dasNode1 = dasNodeInfo;
- }
- }
+ if (dasNodeInfo.getId().equals("node-01")) {
+ dasNode1 = dasNodeInfo;
+ } else if (dasNodeInfo.getId().equals("node-02")) {
+ dasNode2 = dasNodeInfo;
+ }
+ }
// CEP-node1
- assertEquals("CEP Stats Publisher not enabled",true,cepNode1.isStatsPublisherEnabled());
- assertEquals("Incorrect Username", "admincep1", cepNode1.getUsername());
- assertEquals("Incorrect Password", "1234cep1", cepNode1.getPassword());
- assertEquals("Incorrect IP", "192.168.10.10", cepNode1.getIp());
- assertEquals("Incorrect Port", "9300", cepNode1.getPort());
-
+ assertEquals("CEP stats publisher is not enabled", true, cepNode1.isStatsPublisherEnabled());
+ assertEquals("Incorrect username", "admincep1", cepNode1.getUsername());
+ assertEquals("Incorrect password", "1234cep1", cepNode1.getPassword());
+ assertEquals("Incorrect ip", "192.168.10.10", cepNode1.getIp());
+ assertEquals("Incorrect port", "9300", cepNode1.getPort());
+
// CEP-node2
- assertEquals("CEP Stats Publisher not enabled",true,cepNode2.isStatsPublisherEnabled());
- assertEquals("Incorrect Username", "admincep2", cepNode2.getUsername());
- assertEquals("Incorrect Password", "1234cep2", cepNode2.getPassword());
- assertEquals("Incorrect IP", "192.168.10.20", cepNode2.getIp());
- assertEquals("Incorrect Port", "9300", cepNode2.getPort());
+ assertEquals("CEP stats publisher is not enabled", true, cepNode2.isStatsPublisherEnabled());
+ assertEquals("Incorrect username", "admincep2", cepNode2.getUsername());
+ assertEquals("Incorrect password", "1234cep2", cepNode2.getPassword());
+ assertEquals("Incorrect ip", "192.168.10.20", cepNode2.getIp());
+ assertEquals("Incorrect port", "9300", cepNode2.getPort());
// DAS node 1
- assertEquals("DAS Stats Publisher not enabled",true, dasNode1.isStatsPublisherEnabled());
- assertEquals("Incorrect Username", "admindas1", dasNode1.getUsername());
- assertEquals("Incorrect Password", "1234das1", dasNode1.getPassword());
- assertEquals("Incorrect IP", "192.168.10.11", dasNode1.getIp());
- assertEquals("Incorrect Port", "9301", dasNode1.getPort());
-
+ assertEquals("DAS stats publisher is not enabled", true, dasNode1.isStatsPublisherEnabled());
+ assertEquals("Incorrect username", "admindas1", dasNode1.getUsername());
+ assertEquals("Incorrect password", "1234das1", dasNode1.getPassword());
+ assertEquals("Incorrect ip", "192.168.10.11", dasNode1.getIp());
+ assertEquals("Incorrect port", "9301", dasNode1.getPort());
+
+ // DAS node 2
+ assertEquals("DAS stats publisher is enabled", false, dasNode2.isStatsPublisherEnabled());
+ assertEquals("Incorrect username", "admindas2", dasNode2.getUsername());
+ assertEquals("Incorrect password", "1234das2", dasNode2.getPassword());
+ assertEquals("Incorrect ip", "192.168.10.21", dasNode2.getIp());
+ assertEquals("Incorrect port", "9301", dasNode2.getPort());
+
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5435bffd/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
new file mode 100644
index 0000000..43cd4c1
--- /dev/null
+++ b/components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftStatisticsPublisherTest.java
@@ -0,0 +1,60 @@
+/*
+* 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.common.test;
+
+import org.apache.stratos.common.statistics.publisher.ThriftClientConfig;
+import org.apache.stratos.common.statistics.publisher.ThriftStatisticsPublisher;
+import org.junit.Test;
+import org.wso2.carbon.databridge.commons.StreamDefinition;
+
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * ThriftStatisticsPublisherTest
+ */
+public class ThriftStatisticsPublisherTest {
+ /**
+ * Checking whether LoadBalancingDataPublisher is created for cep and das according to thrift-client-config.xml
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createLoadBalancingDataPublisher() throws Exception {
+ URL configFileUrl = ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
+ System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, configFileUrl.getPath());
+
+ StreamDefinition streamDefinition = new StreamDefinition("Test", "1.0.0");
+
+ ThriftStatisticsPublisher thriftStatisticsPublisher = new ThriftStatisticsPublisher(streamDefinition,
+ ThriftClientConfig.CEP_THRIFT_CLIENT_NAME);
+ assertEquals("CEP stats publisher is not enabled", true, thriftStatisticsPublisher.isEnabled());
+ assertEquals("No of CEP nodes enabled for stats publishing is not equal to two", 2,
+ thriftStatisticsPublisher.getDataPublisherHolders().size());
+
+ thriftStatisticsPublisher = new ThriftStatisticsPublisher(streamDefinition,
+ ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
+ assertEquals("DAS stats publisher is not enabled", true, thriftStatisticsPublisher.isEnabled());
+ assertEquals("More than one DAS node is enabled for stats publishing", 1,
+ thriftStatisticsPublisher.getDataPublisherHolders().size());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5435bffd/components/org.apache.stratos.common/src/test/resources/thrift-client-config.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/test/resources/thrift-client-config.xml b/components/org.apache.stratos.common/src/test/resources/thrift-client-config.xml
index f828e0d..0d46ae6 100644
--- a/components/org.apache.stratos.common/src/test/resources/thrift-client-config.xml
+++ b/components/org.apache.stratos.common/src/test/resources/thrift-client-config.xml
@@ -20,31 +20,38 @@
<!-- Apache thrift client configuration for publishing statistics to WSO2 CEP and WSO2 DAS -->
<thriftClientConfiguration>
- <config>
+ <config>
<cep>
- <node id="node-01">
- <statsPublisherEnabled>true</statsPublisherEnabled>
- <username>admincep1</username>
- <password>1234cep1</password>
- <ip>192.168.10.10</ip>
- <port>9300</port>
- </node>
- <node id="node-02">
- <statsPublisherEnabled>true</statsPublisherEnabled>
- <username>admincep2</username>
- <password>1234cep2</password>
- <ip>192.168.10.20</ip>
- <port>9300</port>
- </node>
+ <node id="node-01">
+ <statsPublisherEnabled>true</statsPublisherEnabled>
+ <username>admincep1</username>
+ <password>1234cep1</password>
+ <ip>192.168.10.10</ip>
+ <port>9300</port>
+ </node>
+ <node id="node-02">
+ <statsPublisherEnabled>true</statsPublisherEnabled>
+ <username>admincep2</username>
+ <password>1234cep2</password>
+ <ip>192.168.10.20</ip>
+ <port>9300</port>
+ </node>
</cep>
<das>
- <node id="node-01">
- <statsPublisherEnabled>true</statsPublisherEnabled>
- <username>admindas1</username>
- <password>1234das1</password>
- <ip>192.168.10.11</ip>
- <port>9301</port>
- </node>
+ <node id="node-01">
+ <statsPublisherEnabled>true</statsPublisherEnabled>
+ <username>admindas1</username>
+ <password>1234das1</password>
+ <ip>192.168.10.11</ip>
+ <port>9301</port>
+ </node>
+ <node id="node-02">
+ <statsPublisherEnabled>false</statsPublisherEnabled>
+ <username>admindas2</username>
+ <password>1234das2</password>
+ <ip>192.168.10.21</ip>
+ <port>9301</port>
+ </node>
</das>
- </config>
+ </config>
</thriftClientConfiguration>
\ No newline at end of file