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/07 11:20:02 UTC
[33/50] [abbrv] stratos git commit: Adding setUp() and having
individual test methods for cep and das in ThriftStatisticsPublisherTest
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/a6393442
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/a6393442
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/a6393442
Branch: refs/heads/release-4.1.5
Commit: a6393442745f22ede36a44cf2306117eda1f7659
Parents: 649b5b8
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 17:06:50 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Mon Dec 7 10:16:28 2015 +0000
----------------------------------------------------------------------
.../test/ThriftStatisticsPublisherTest.java | 32 +++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/a6393442/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());
-
}
}