Package org.apache.stratos.lb.common.conf.LoadBalancerConfiguration

Examples of org.apache.stratos.lb.common.conf.LoadBalancerConfiguration.ServiceConfiguration


    public final void testCreateServicesConfig() {

        /* Tests relavant to loadbalancer.conf file */
       
        ServiceConfiguration asServiceConfig =
                                               lbConfig.getServiceConfig("wso2.as1.domain",
                                                                         "worker");

        assertEquals(1, asServiceConfig.getInstancesPerScaleUp());
        assertEquals(5, asServiceConfig.getMaxAppInstances());
        assertEquals(0, asServiceConfig.getMinAppInstances());
        assertEquals(60000, asServiceConfig.getMessageExpiryTime());
        assertEquals(400, asServiceConfig.getMaxRequestsPerSecond());
        assertEquals(0.65, asServiceConfig.getAlarmingUpperRate());
        assertEquals(10, asServiceConfig.getRoundsToAverage());
        assertEquals("worker", asServiceConfig.getSubDomain());

        asServiceConfig = lbConfig.getServiceConfig("wso2.as2.domain", "worker1");
        assertEquals("worker1", asServiceConfig.getSubDomain());

        asServiceConfig = lbConfig.getServiceConfig("wso2.esb.domain", "mgt");
        assertEquals("mgt", asServiceConfig.getSubDomain());

        assertEquals(2, lbConfig.getHostNamesTracker().keySet().size());
        assertEquals(3, lbConfig.getHostNamesTracker().get("appserver").size());
        assertEquals(2, lbConfig.getHostNamesTracker().get("esb").size());

View Full Code Here


        for (Iterator iterator = lbConfig.getServiceConfigurations().values().iterator(); iterator.hasNext();) {
            Map<String, ServiceConfiguration> valuesMap = (Map<String, ServiceConfiguration>) iterator.next();
           
            for (Iterator iterator2 = valuesMap.values().iterator(); iterator2.hasNext();) {
                ServiceConfiguration oldServiceConfig = (ServiceConfiguration) iterator2.next();
               
                if(!currentServiceConfigs.contains(oldServiceConfig)){
                    // if the ServiceConfiguration is not there any more in the latest topology
                    lbConfig.removeServiceConfiguration(oldServiceConfig.getDomain(), oldServiceConfig.getSubDomain());
                    GroupMgtAgentBuilder.resetGroupMgtAgent(oldServiceConfig.getDomain(), oldServiceConfig.getSubDomain());
                }
            }
        }
    }
View Full Code Here

      int roundsToAverage = cluster.getRoundsToAverage();
      double alarmingUpperRate = cluster.getAlarmingUpperRate();
      double alarmingLowerRate = cluster.getAlarmingLowerRate();
      double scaleDownFactor = cluster.getScaleDownFactor();
       
        ServiceConfiguration serviceConfig ;
       
        if((serviceConfig = lbConfig.getServiceConfig(domain, subDomain)) == null){
            serviceConfig = lbConfig.new ServiceConfiguration();
        }
       
        // we simply override the attributes with new values
        serviceConfig.setDomain(domain);
        serviceConfig.setSub_domain(subDomain);
        serviceConfig.setTenant_range(tenantRange);
        serviceConfig.setHosts(hostName);
        serviceConfig.setMin_app_instances(minInstances);
        serviceConfig.setMax_app_instances(maxInstances);
        serviceConfig.setMax_requests_per_second(maxRequestsPerSecond);
        serviceConfig.setRounds_to_average(roundsToAverage);
        serviceConfig.setAlarming_upper_rate(alarmingUpperRate);
        serviceConfig.setAlarming_lower_rate(alarmingLowerRate);
        serviceConfig.setScale_down_factor(scaleDownFactor);
       
        // add to host name tracker
        lbConfig.addToHostNameTrackerMap(service, serviceConfig.getHosts());
       
        // add to host contexts
        lbConfig.addToHostContextMap(hostName, ctxt);
       
        // finally add this service config
View Full Code Here

        Assert.assertEquals(true, map.get("wso2.as1.domain").get("worker") != null);
    }

    @Test
    public void testAddition(){
        ServiceConfiguration config1 = lbConfig.new ServiceConfiguration();
        config1.setDomain("wso2.as3.domain");
        config1.setSub_domain("mgt");
        lbConfig.addServiceConfiguration(config1);
        clusteringAgent.addGroupManagementAgent(new SubDomainAwareGroupManagementAgent(
                "mgt"),
                "wso2.as3.domain", "mgt", -1);
        map = AutoscaleUtil.getAppDomainContexts(configCtx, lbConfig);
View Full Code Here

        for (Iterator<?> iterator = lbConfig.getServiceConfigurations().values().iterator(); iterator.hasNext();) {
            @SuppressWarnings("unchecked")
            Map<String, ServiceConfiguration> valuesMap = (Map<String, ServiceConfiguration>) iterator.next();

            for (Iterator<ServiceConfiguration> iterator2 = valuesMap.values().iterator(); iterator2.hasNext();) {
                ServiceConfiguration oldServiceConfig = (ServiceConfiguration) iterator2.next();

                if (!currentServiceConfigs.contains(oldServiceConfig)) {
                    // if the ServiceConfiguration is not there any more in the latest topology
                    lbConfig.removeServiceConfiguration(oldServiceConfig.getDomain(), oldServiceConfig.getSubDomain());
                    GroupMgtAgentBuilder.resetGroupMgtAgent(oldServiceConfig.getDomain(), oldServiceConfig.getSubDomain());
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.lb.common.conf.LoadBalancerConfiguration.ServiceConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.