Repository: stratos Updated Branches: refs/heads/master 208c671a8 -> 7cb8dc7eb
Remove LB integration tests Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7cb8dc7e Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7cb8dc7e Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7cb8dc7e Branch: refs/heads/master Commit: 7cb8dc7ebf218ba29a5f17351fdb2ce444096d7a Parents: 208c671 Author: Lahiru Sandaruwan <[email protected]> Authored: Fri May 22 14:55:37 2015 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Fri May 22 14:55:37 2015 +0530 ---------------------------------------------------------------------- .../load-balancer/modules/integration/pom.xml | 161 ------------------- .../tests/AlgorithmContextCacheTest.java | 55 ------- .../tests/LoadBalancerTestServerManager.java | 69 -------- .../tests/RoundRobinAlgorithmTest.java | 70 -------- .../src/test/resources/instrumentation.txt | 1 - .../src/test/resources/loadbalancer.conf | 142 ---------------- .../integration/src/test/resources/testng.xml | 31 ---- 7 files changed, 529 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/pom.xml ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/pom.xml b/products/load-balancer/modules/integration/pom.xml deleted file mode 100644 index b79e40c..0000000 --- a/products/load-balancer/modules/integration/pom.xml +++ /dev/null @@ -1,161 +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. - --> - -<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/xsd/maven-4.0.0.xsd"> - - <parent> - <groupId>org.apache.stratos.load.balancer</groupId> - <artifactId>load-balancer-parent</artifactId> - <version>4.1.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>integration</artifactId> - <name>Apache Stratos - Load Balancer - Integration Tests</name> - <packaging>jar</packaging> - - <build> - <plugins> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <version>2.4.1</version> - <executions> - <execution> - <id>auto-clean</id> - <phase>initialize</phase> - <goals> - <goal>clean</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <inherited>false</inherited> - <configuration> - <includes> - <include>**/*TestServerManager.java</include> - <include>**/*TestCase.java</include> - </includes> - <systemProperties> - <maven.test.haltafterfailure>false</maven.test.haltafterfailure> - <carbon.zip> - ${basedir}/../distribution/target/apache-stratos-load-balancer-${project.version}.zip - </carbon.zip> - <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir> - <samples.dir>${basedir}/../samples/product</samples.dir> - <extracted.dir>apache-stratos-load-balancer-${project.version}</extracted.dir> - <emma.home>${basedir}/target/emma</emma.home> - </systemProperties> - <workingDirectory>${basedir}/target</workingDirectory> - </configuration> - </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> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-emma-dependencies</id> - <phase>compile</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/emma</outputDirectory> - <includeTypes>jar</includeTypes> - <includeArtifactIds>emma,org.wso2.carbon.integration.framework</includeArtifactIds> - </configuration> - </execution> - <execution> - <id>copy-secVerifier</id> - <phase>compile</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/target/security-verifier</outputDirectory> - <includeTypes>aar</includeTypes> - <includeArtifactIds>SecVerifier</includeArtifactIds> - <stripVersion>true</stripVersion> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <!--<dependency> - <groupId>org.wso2.lb</groupId> - <artifactId>wso2lb</artifactId> - <version>${project.version}</version> - </dependency>--> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.integration.framework</artifactId> - <version>4.2.0</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.1.1</version> - </dependency> - <dependency> - <groupId>emma</groupId> - <artifactId>emma</artifactId> - <version>${emma.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>SecVerifier</artifactId> - <version>${carbon.version}</version> - <type>aar</type> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.messaging</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.load.balancer</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/AlgorithmContextCacheTest.java ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/AlgorithmContextCacheTest.java b/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/AlgorithmContextCacheTest.java deleted file mode 100755 index 1375b45..0000000 --- a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/AlgorithmContextCacheTest.java +++ /dev/null @@ -1,55 +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.load.balancer.integration.tests; - -import org.apache.stratos.load.balancer.algorithm.AlgorithmContext; -import org.apache.stratos.load.balancer.algorithm.RoundRobin; -import org.apache.stratos.load.balancer.cache.AlgorithmContextCache; -import org.apache.stratos.messaging.domain.topology.Member; -import org.apache.stratos.messaging.domain.topology.MemberStatus; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.util.ArrayList; -import java.util.List; - -/** -* Algorithm context cache test. -*/ -@RunWith(JUnit4.class) -public class AlgorithmContextCacheTest { - - @Test - public final void testAlgorithmContextCache() { - testCurrentMemberIndex("Service1", "Cluster1", 0); - testCurrentMemberIndex("Service1", "Cluster1", 1); - testCurrentMemberIndex("Service1", "Cluster1", 2); - testCurrentMemberIndex("Service1", "Cluster1", 3); - testCurrentMemberIndex("Service1", "Cluster1", 2); - testCurrentMemberIndex("Service1", "Cluster1", 1); - testCurrentMemberIndex("Service1", "Cluster1", 0); - } - - private void testCurrentMemberIndex(String serviceName, String clusterId, int index) { - AlgorithmContextCache.putCurrentMemberIndex(serviceName, clusterId, index); - Assert.assertEquals("Expected algorithm context member index not found", true, (AlgorithmContextCache.getCurrentMemberIndex(serviceName, clusterId) == index)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/LoadBalancerTestServerManager.java ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/LoadBalancerTestServerManager.java b/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/LoadBalancerTestServerManager.java deleted file mode 100644 index e9a3ad5..0000000 --- a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/LoadBalancerTestServerManager.java +++ /dev/null @@ -1,69 +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.load.balancer.integration.tests; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeSuite; -import org.wso2.carbon.integration.framework.TestServerManager; - -import java.io.File; -import java.io.IOException; - -/** - * Prepares the WSO2 LB for test runs, starts the server, and stops the server after - * test runs - */ -public class LoadBalancerTestServerManager extends TestServerManager { - private static final Log log = LogFactory.getLog(LoadBalancerTestServerManager.class); - - public LoadBalancerTestServerManager() { - super(1); - } - - @Override - @BeforeSuite(timeOut = 300000) - public String startServer() throws IOException { - String carbonHome = super.startServer(); - System.setProperty("carbon.home", carbonHome); - return carbonHome; - } - - @Override - @AfterSuite(timeOut = 60000) - public void stopServer() throws Exception { - super.stopServer(); - } - - protected void copyArtifacts(String carbonHome) throws IOException { - String resourceLocation = System.getProperty("framework.resource.location", - System.getProperty("basedir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator ); - String confDir = carbonHome + File.separator + "repository"+ File.separator + "conf"; - - log.info("Copying loadbalancer.conf file..."); - FileUtils.copyFile(new File(resourceLocation,"loadbalancer.conf"),new File(confDir,"loadbalancer.conf")); - - // Could not provide the script name via Test Server Manager - FileUtils.copyFile(new File(carbonHome + File.separator + "bin", "stratos.sh"), new File(carbonHome + File.separator + "bin", "wso2server.sh")); - FileUtils.copyFile(new File(carbonHome + File.separator + "bin","stratos.bat"),new File(carbonHome + File.separator + "bin","wso2server.bat")); - } -} - http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/RoundRobinAlgorithmTest.java ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/RoundRobinAlgorithmTest.java b/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/RoundRobinAlgorithmTest.java deleted file mode 100755 index 44db544..0000000 --- a/products/load-balancer/modules/integration/src/test/java/org/apache/stratos/load/balancer/integration/tests/RoundRobinAlgorithmTest.java +++ /dev/null @@ -1,70 +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.load.balancer.integration.tests; - -import org.apache.stratos.load.balancer.algorithm.AlgorithmContext; -import org.apache.stratos.load.balancer.algorithm.RoundRobin; -import org.apache.stratos.messaging.domain.topology.Member; -import org.apache.stratos.messaging.domain.topology.MemberStatus; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.util.ArrayList; -import java.util.List; - -/** - * Round robin algorithm test. - */ -@RunWith(JUnit4.class) -public class RoundRobinAlgorithmTest { - - @Test - public final void testRoundRobinAlgorithm() { - List<Member> members = new ArrayList<Member>(); - Member member = new Member("service1", "cluster1", "np1", "p1", "m1"); - member.setStatus(MemberStatus.Activated); - members.add(member); - - member = new Member("service1", "cluster1", "np1", "p1", "m2"); - member.setStatus(MemberStatus.Activated); - members.add(member); - - member = new Member("service1", "cluster1", "np1", "p1", "m3"); - member.setStatus(MemberStatus.Activated); - members.add(member); - - RoundRobin algorithm = new RoundRobin(); - algorithm.setMembers(members); - - AlgorithmContext algorithmContext = new AlgorithmContext("service1", "cluster1"); - Member nextMember = algorithm.getNextMember(algorithmContext); - Assert.assertEquals("Expected member not found", true, "m1".equals(nextMember.getMemberId())); - - nextMember = algorithm.getNextMember(algorithmContext); - Assert.assertEquals("Expected member not found", true, "m2".equals(nextMember.getMemberId())); - - nextMember = algorithm.getNextMember(algorithmContext); - Assert.assertEquals("Expected member not found", true, "m3".equals(nextMember.getMemberId())); - - nextMember = algorithm.getNextMember(algorithmContext); - Assert.assertEquals("Expected member not found", true, "m1".equals(nextMember.getMemberId())); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/resources/instrumentation.txt ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/resources/instrumentation.txt b/products/load-balancer/modules/integration/src/test/resources/instrumentation.txt deleted file mode 100644 index 6d61796..0000000 --- a/products/load-balancer/modules/integration/src/test/resources/instrumentation.txt +++ /dev/null @@ -1 +0,0 @@ -org.apache.stratos.load.balancer.* \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/resources/loadbalancer.conf ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/resources/loadbalancer.conf b/products/load-balancer/modules/integration/src/test/resources/loadbalancer.conf deleted file mode 100644 index 31bbdd5..0000000 --- a/products/load-balancer/modules/integration/src/test/resources/loadbalancer.conf +++ /dev/null @@ -1,142 +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. - -loadbalancer { - - # Default load balancing algorithm - # Refer algorithm name from algorithms section. - algorithm: round-robin; - - # Enable/disable failover handling - # If failover handling is enabled load balancer will retry requests on all members in a - # given cluster if the selected member fails to respond. - failover: true; - - # Enable/disable session affinity - # If session affinity is enabled load balancer will track all outgoing sessions and delegate - # incoming requests to members with same sessions. - session-affinity: true; - - # Session timeout in milli-seconds - session-timeout: 90000; - - # Enable/disable topology event listener - # If this property is set to true, load balancer will listen to topology events and build - # the topology configuration accordingly. If not static configuration given in the services - # section will be used. - topology-event-listener: false; - - # Message broker endpoint - # Provide message broker ip address and port if topology-event-listener or multi-tenancy is set to true. - mb-ip: localhost; - mb-port: 5677; - - # Topology member ip address type - # Provide this configuration if topology-event-listener is set to true. If this property is set to 'private' - # load balancer will delegate requests to member's private IP address. If it is set to 'public' requests will - # be delegated to member's public IP address. - topology-member-ip-type: private; - - # Topology service filter - # Provide service names in a comma separated list to filter incoming topology events if - # topology_event_listener_enabled is set to true. This functionality could be used for hosting - # dedicated load balancers for services. - # topology-service-filter: service-name=service-name1,service-name2; - - # Topology cluster filter - # Provide cluster ids in a comma separated list to filter incoming topology events if - # topology_event_listener_enabled is set to true. This functionality could be used for hosting - # dedicated load balancers for subscriptions. - # topology-cluster-filter: cluster-id=cluster-id1,cluster-id2; - - # Topology member filter - # Provide load balancer cluster ids in a comma separated list to filter incoming topology events if - # topology_event_listener_enabled is set to true. This functionality could be used for allowing members - # to join a given load balancer cluster. - # topology-member-filter: lb-cluster-id=lb-cluster-id1; - - # Enable/disable cep statistics publisher - cep-stats-publisher: false; - - # Complex event processor endpoint - # Provide CEP ip address and port if cep-stats-publisher is set to true. - cep-ip: localhost; - cep-port: 7615; - - # Network partition id - # Provide the network partition id if cep-stats-publisher is set to true. - network-partition-id: network-partition-1; - - # Multi-tenancy - # If this property is set to true, all incoming request URLs will be scanned using the given tenant-identifier-regex - # and matching tenant identifier value will be used to delegate the requests to the relevant cluster. - multi-tenancy: false; - tenant-identifier: tenant-domain; # Tenant identifier could either be tenant-id or tenant-domain. - tenant-identifier-regex: t/([^/]*)/; # Regular expression for extracting the tenant identifier value from the URL. - - # Load balancing algorithm class names - algorithms { - round-robin { # algorithm name - class-name: org.apache.stratos.load.balancer.algorithm.RoundRobin; - } - } - - # Static topology configuration - # Define a static topology configuration if topology-event-listener is set to false. - # A sample configuration has been given below: - - services { - app-server { # service name, a unique identifier to identify a service - multi-tenant: true; # Set to true if the service is multi-tenant - clusters { - app-server-cluster1 { # cluster id, a unique identifier to identify a cluster - hosts: cluster1.appserver.foo.org, cluster1.org; # comma separated hostname list - tenant-range: 1-100; # Tenant range of the cluster - algorithm: round-robin; # algorithm name - members { - m1 { # member id, a unique identifier to identify a member - ip: 10.0.0.10; # member ip address - ports { - http { - value: 8080; # application port - proxy: 80; # proxy port exposed by load balancer transport, set this value in axis2.xml - } - https { - value: 8090; - proxy: 443; - } - } - } - m2 { - ip: 10.0.0.11; - ports { - http { - value: 8080; - proxy: 80; - } - https { - value: 8090; - proxy: 443; - } - } - } - } - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/7cb8dc7e/products/load-balancer/modules/integration/src/test/resources/testng.xml ---------------------------------------------------------------------- diff --git a/products/load-balancer/modules/integration/src/test/resources/testng.xml b/products/load-balancer/modules/integration/src/test/resources/testng.xml deleted file mode 100644 index da56e47..0000000 --- a/products/load-balancer/modules/integration/src/test/resources/testng.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version='1.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. - --> - -<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > -<suite name="Apache Stratos Load Balancer Integration Test Suite" parallel="false"> - - <test name="loadbalancer-test" preserve-order="true" parallel="false"> - <classes> - <class name="org.apache.stratos.load.balancer.integration.tests.LoadBalancerTestServerManager"/> - <class name="org.apache.stratos.load.balancer.integration.tests.AlgorithmContextCacheTest" /> - <class name="org.apache.stratos.load.balancer.integration.tests.RoundRobinAlgorithmTest" /> - </classes> - </test> -</suite>
