View Javadoc

1   package org.apache.helix.integration;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Date;
23  
24  import org.apache.log4j.Logger;
25  import org.testng.annotations.Test;
26  
27  public class TestHelixUsingDifferentParams extends ZkIntegrationTestBase
28  {
29    private static Logger LOG = Logger.getLogger(TestHelixUsingDifferentParams.class);
30  
31    @Test()
32    public void testCMUsingDifferentParams() throws Exception
33    {
34      System.out.println("START " + getShortClassName() + " at "
35          + new Date(System.currentTimeMillis()));
36  
37      int numResourceArray[] = new int[] { 1 }; // , 2}; // , 3, 6};
38      int numPartitionsPerResourceArray[] = new int[] { 10 }; // , 20, 50, 100}; // ,
39                                                          // 1000};
40      int numInstances[] = new int[] { 5 }; // , 10}; // , 50, 100, 1000};
41      int replicas[] = new int[] { 2 }; // , 3}; //, 4, 5};
42  
43      for (int numResources : numResourceArray)
44      {
45        for (int numPartitionsPerResource : numPartitionsPerResourceArray)
46        {
47          for (int numInstance : numInstances)
48          {
49            for (int replica : replicas)
50            {
51              String uniqClusterName = "TestDiffParam_" + "rg" + numResources + "_p"
52                  + numPartitionsPerResource + "_n" + numInstance + "_r" + replica;
53              System.out.println("START " + uniqClusterName + " at "
54                  + new Date(System.currentTimeMillis()));
55  
56              TestDriver.setupCluster(uniqClusterName, ZK_ADDR, numResources,
57                  numPartitionsPerResource, numInstance, replica);
58  
59              for (int i = 0; i < numInstance; i++)
60              {
61                TestDriver.startDummyParticipant(uniqClusterName, i);
62              }
63  
64              TestDriver.startController(uniqClusterName);
65              TestDriver.verifyCluster(uniqClusterName, 1000, 50 * 1000);
66              TestDriver.stopCluster(uniqClusterName);
67  
68              System.out.println("END " + uniqClusterName + " at "
69                  + new Date(System.currentTimeMillis()));
70            }
71          }
72        }
73      }
74  
75      System.out
76          .println("END " + getShortClassName() + " at " + new Date(System.currentTimeMillis()));
77    }
78  }