ClusterControllerClusterConfigurer { public FleetControllerOptions getOptions() { return options; } ClusterControllerClusterConfigurer(ClusterController controller,
                                              StorDistributionConfig distributionConfig,
                                              FleetcontrollerConfig fleetcontrollerConfig,
                                              SlobroksConfig slobroksConfig,
                                              ZookeepersConfig zookeepersConfig,
                                              Metric metricImpl); FleetControllerOptions getOptions();  }
@Test public void testSimple() throws Exception { ClusterController controller = new ClusterController(); StorDistributionConfig.Builder distributionConfig = new StorDistributionConfig.Builder(); StorDistributionConfig.Group.Builder group = new StorDistributionConfig.Group.Builder(); group.index("0").name("foo"); StorDistributionConfig.Group.Nodes.Builder node = new StorDistributionConfig.Group.Nodes.Builder(); node.index(0); group.nodes.add(node); distributionConfig.group.add(group); FleetcontrollerConfig.Builder fleetcontrollerConfig = new FleetcontrollerConfig.Builder(); fleetcontrollerConfig .cluster_name("storage") .index(0) .zookeeper_server("zoo") .min_node_ratio_per_group(0.123); SlobroksConfig.Builder slobroksConfig = new SlobroksConfig.Builder(); SlobroksConfig.Slobrok.Builder slobrok = new SlobroksConfig.Slobrok.Builder(); slobrok.connectionspec("foo"); slobroksConfig.slobrok.add(slobrok); ZookeepersConfig.Builder zookeepersConfig = new ZookeepersConfig.Builder(); zookeepersConfig.zookeeperserverlist("foo"); Metric metric = new Metric() { @Override public void set(String s, Number number, Context context) {} @Override public void add(String s, Number number, Context context) {} @Override public Context createContext(Map<String, ?> stringMap) { return null; } }; ClusterControllerClusterConfigurer configurer = new ClusterControllerClusterConfigurer( null, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric ); assertTrue(configurer.getOptions() != null); assertEquals(0.123, configurer.getOptions().minNodeRatioPerGroup, 0.01); zookeepersConfig.zookeeperserverlist(""); new ClusterControllerClusterConfigurer( controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric ); try{ fleetcontrollerConfig.fleet_controller_count(5); new ClusterControllerClusterConfigurer( controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric ); fail("Should not get here"); } catch (Exception e) { assertEquals("Must set zookeeper server with multiple fleetcontrollers", e.getMessage()); } }