/** * Load the instance definition. * @param name cluster name * @param resolved flag to indicate the cluster should be resolved * @return the loaded configuration * @throws IOException IO problems * @throws SliderException slider explicit issues * @throws UnknownApplicationInstanceException if the file is not found */ public AggregateConf loadInstanceDefinition(String name, boolean resolved) throws IOException, SliderException { Path clusterDirectory = sliderFileSystem.buildClusterDirPath(name); AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved( name, clusterDirectory); if (resolved) { instanceDefinition.resolve(); } return instanceDefinition; }
/** * Load the instance definition. * @param name cluster name * @param resolved flag to indicate the cluster should be resolved * @return the loaded configuration * @throws IOException IO problems * @throws SliderException slider explicit issues * @throws UnknownApplicationInstanceException if the file is not found */ public AggregateConf loadInstanceDefinition(String name, boolean resolved) throws IOException, SliderException { Path clusterDirectory = sliderFileSystem.buildClusterDirPath(name); AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved( name, clusterDirectory); if (resolved) { instanceDefinition.resolve(); } return instanceDefinition; }
componentAppConf.getOrAddComponent(rcomp); componentConf.resolve();
componentAppConf.getOrAddComponent(rcomp); componentConf.resolve();
instanceDefinition.resolve();
instanceDefinition.resolve();
@Test public void testContainerKeystoreGenerationViaStoresGeneratorOverrideGlobalSetting() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = setupComponentOptions(true, null, "app1.component1.password.property", null, null); instanceDefinition.getAppConf().components.put("component1", compOps); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "false"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorOverrideGlobalSetting() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = setupComponentOptions(true, null, "app1.component1.password.property", null, null); instanceDefinition.getAppConf().components.put("component1", compOps); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "false"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
resolvedInstance.resolve();
resolvedInstance.resolve();
@Test public void testContainerKeystoreGenerationViaStoresGeneratorUsingGlobalProps() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); compOps.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
instanceDefinition.resolve(); launchedInstanceDefinition = instanceDefinition;
@Test public void testContainerKeystoreGenerationViaStoresGenerator() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
instanceDefinition.resolve(); launchedInstanceDefinition = instanceDefinition;
@Test public void testContainerKeystoreGenerationViaStoresGenerator() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorUsingGlobalProps() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); compOps.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
aggregateConf.resolve();
aggregateConf.resolve();