Codota Logo
AggregateConf.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.apache.slider.core.conf.AggregateConf
constructor

Best Java code snippets using org.apache.slider.core.conf.AggregateConf.<init> (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: org.apache.slider/slider-core

/**
 * Load the persistent cluster description
 * @param clustername name of the cluster
 * @return the description in the filesystem
 * @throws IOException any problems loading -including a missing file
 */
@VisibleForTesting
public AggregateConf loadPersistedClusterDescription(String clustername)
  throws IOException, SliderException, LockAcquireFailedException {
 Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
 ConfPersister persister = new ConfPersister(sliderFileSystem, clusterDirectory);
 AggregateConf instanceDescription = new AggregateConf();
 persister.load(instanceDescription);
 return instanceDescription;
}
origin: apache/incubator-slider

/**
 * Load the persistent cluster description
 * @param clustername name of the cluster
 * @return the description in the filesystem
 * @throws IOException any problems loading -including a missing file
 */
@VisibleForTesting
public AggregateConf loadPersistedClusterDescription(String clustername)
  throws IOException, SliderException, LockAcquireFailedException {
 Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
 ConfPersister persister = new ConfPersister(sliderFileSystem, clusterDirectory);
 AggregateConf instanceDescription = new AggregateConf();
 persister.load(instanceDescription);
 return instanceDescription;
}
origin: org.apache.slider/slider-core

 protected AggregateConf getAggregateConf() {
  try {
   JsonSerDeser<ConfTree> confTreeJsonSerDeser = new JsonSerDeser<>(ConfTree.class);
   AggregateConf aggregateConf = new AggregateConf(
     confTreeJsonSerDeser.fromResource(EXAMPLES + "resources.json"),
     confTreeJsonSerDeser.fromResource(EXAMPLES + "app_configuration.json"),
     confTreeJsonSerDeser.fromResource(EXAMPLES + "internal.json")
     );
   aggregateConf.setName("test");
   return aggregateConf;
  } catch (IOException e) {
   throw new AssertionError(e.getMessage(), e);
  }
 }
}
origin: apache/incubator-slider

 protected AggregateConf getAggregateConf() {
  try {
   JsonSerDeser<ConfTree> confTreeJsonSerDeser = new JsonSerDeser<>(ConfTree.class);
   AggregateConf aggregateConf = new AggregateConf(
     confTreeJsonSerDeser.fromResource(EXAMPLES + "resources.json"),
     confTreeJsonSerDeser.fromResource(EXAMPLES + "app_configuration.json"),
     confTreeJsonSerDeser.fromResource(EXAMPLES + "internal.json")
     );
   aggregateConf.setName("test");
   return aggregateConf;
  } catch (IOException e) {
   throw new AssertionError(e.getMessage(), e);
  }
 }
}
origin: org.apache.slider/slider-core

@Test
public void testParameterParsing() throws IOException {
 AgentProviderService aps = createAgentProviderService(new Configuration());
 AggregateConf aggConf = new AggregateConf();
 ConfTreeOperations treeOps = aggConf.getAppConfOperations();
 treeOps.getGlobalOptions().put(AgentKeys.SYSTEM_CONFIGS, "core-site,yarn-site, core-site ");
 List<String> configs = aps.getSystemConfigurationsRequested(treeOps);
 Assert.assertEquals(2, configs.size());
 Assert.assertTrue(configs.contains("core-site"));
 Assert.assertFalse(configs.contains("bore-site"));
}
origin: apache/incubator-slider

@Test
public void testParameterParsing() throws IOException {
 AgentProviderService aps = createAgentProviderService(new Configuration());
 AggregateConf aggConf = new AggregateConf();
 ConfTreeOperations treeOps = aggConf.getAppConfOperations();
 treeOps.getGlobalOptions().put(AgentKeys.SYSTEM_CONFIGS, "core-site,yarn-site, core-site ");
 List<String> configs = aps.getSystemConfigurationsRequested(treeOps);
 Assert.assertEquals(2, configs.size());
 Assert.assertTrue(configs.contains("core-site"));
 Assert.assertFalse(configs.contains("bore-site"));
}
origin: org.apache.slider/slider-core

 @Test
 public void testValidateInstanceDefinition() throws Exception {
  AgentClientProvider provider = new AgentClientProvider(null);
  AggregateConf instanceDefinition = new AggregateConf();

  try {
   provider.validateInstanceDefinition(instanceDefinition, null);
   Assert.assertFalse("Should fail with BadConfigException", true);
  } catch (BadConfigException e) {
   log.info(e.toString());
   Assert.assertTrue(e.getMessage().contains("Application definition must be provided"));
  }
 }
}
origin: org.apache.slider/slider-core

/**
 * Implementation of cluster flexing.
 * It should be the only way that anything -even the AM itself on startup-
 * asks for nodes. 
 * @param resources the resource tree
 * @throws SliderException slider problems, including invalid configs
 * @throws IOException IO problems
 */
public void flexCluster(ConfTree resources)
  throws IOException, SliderException {
 AggregateConf newConf =
   new AggregateConf(appState.getInstanceDefinitionSnapshot());
 newConf.setResources(resources);
 // verify the new definition is valid
 sliderAMProvider.validateInstanceDefinition(newConf);
 providerService.validateInstanceDefinition(newConf);
 appState.updateResourceDefinitions(resources);
 // reset the scheduled windows...the values
 // may have changed
 appState.resetFailureCounts();
 // ask for more containers if needed
 reviewRequestAndReleaseNodes("flexCluster");
}
origin: apache/incubator-slider

 @Test
 public void testValidateInstanceDefinition() throws Exception {
  AgentClientProvider provider = new AgentClientProvider(null);
  AggregateConf instanceDefinition = new AggregateConf();

  try {
   provider.validateInstanceDefinition(instanceDefinition, null);
   Assert.assertFalse("Should fail with BadConfigException", true);
  } catch (BadConfigException e) {
   log.info(e.toString());
   Assert.assertTrue(e.getMessage().contains("Application definition must be provided"));
  }
 }
}
origin: org.apache.slider/slider-core

@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");
}
origin: apache/incubator-slider

@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");
}
origin: org.apache.slider/slider-core

/**
 * Get the AM instance definition.
 * <p>
 *   See {@link SliderClusterProtocol#getInstanceDefinition(Messages.GetInstanceDefinitionRequestProto)}
 * @return current slider AM aggregate definition
 * @throws YarnException
 * @throws IOException
 */
public AggregateConf getInstanceDefinition()
 throws YarnException, IOException {
 Messages.GetInstanceDefinitionRequestProto.Builder builder =
  Messages.GetInstanceDefinitionRequestProto.newBuilder();
 Messages.GetInstanceDefinitionRequestProto request = builder.build();
 Messages.GetInstanceDefinitionResponseProto response =
  appMaster.getInstanceDefinition(request);
 ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
 ConfTree internal = confTreeSerDeser.fromJson(response.getInternal());
 ConfTree resources = confTreeSerDeser.fromJson(response.getResources());
 ConfTree app = confTreeSerDeser.fromJson(response.getApplication());
 AggregateConf instanceDefinition =
  new AggregateConf(resources, app, internal);
 return instanceDefinition;
}
/**
origin: apache/incubator-slider

@Test
public void testContainerStoresGenerationMisconfiguration() throws Exception {
 AggregateConf instanceDefinition = new AggregateConf();
 MapOperations compOps = new MapOperations();
 compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
 setupCredentials(instanceDefinition, "cant.be.found", null);
 try {
  StoresGenerator.generateSecurityStores("testhost", "container1",
                             "component1", instanceDefinition,
                             compOps);
  Assert.fail("SliderException should have been generated");
 } catch (SliderException e) {
  // ignore - should be thrown
 }
}
origin: org.apache.slider/slider-core

@Test
public void testContainerStoresGenerationMisconfiguration() throws Exception {
 AggregateConf instanceDefinition = new AggregateConf();
 MapOperations compOps = new MapOperations();
 compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
 setupCredentials(instanceDefinition, "cant.be.found", null);
 try {
  StoresGenerator.generateSecurityStores("testhost", "container1",
                             "component1", instanceDefinition,
                             compOps);
  Assert.fail("SliderException should have been generated");
 } catch (SliderException e) {
  // ignore - should be thrown
 }
}
origin: org.apache.slider/slider-core

@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");
}
origin: org.apache.slider/slider-core

@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");
}
origin: apache/incubator-slider

@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");
}
origin: apache/incubator-slider

@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");
}
origin: org.apache.slider/slider-core

private AggregateConf prepareConfForAgentStateTests() {
 ConfTree tree = new ConfTree();
 tree.global.put(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, ".");
 AggregateConf instanceDefinition = new AggregateConf();
 instanceDefinition.setInternal(tree);
 instanceDefinition.setAppConf(tree);
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.APP_DEF, ".");
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.AGENT_CONF, ".");
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.AGENT_VERSION, ".");
 instanceDefinition.getResourceOperations().getOrAddComponent(
   "HBASE_MASTER");
 instanceDefinition.getResourceOperations().getOrAddComponent(
   "HBASE_REGIONSERVER");
 return instanceDefinition;
}
origin: apache/incubator-slider

private AggregateConf prepareConfForAgentStateTests() {
 ConfTree tree = new ConfTree();
 tree.global.put(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, ".");
 AggregateConf instanceDefinition = new AggregateConf();
 instanceDefinition.setInternal(tree);
 instanceDefinition.setAppConf(tree);
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.APP_DEF, ".");
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.AGENT_CONF, ".");
 instanceDefinition.getAppConfOperations().getGlobalOptions()
   .put(AgentKeys.AGENT_VERSION, ".");
 instanceDefinition.getResourceOperations().getOrAddComponent(
   "HBASE_MASTER");
 instanceDefinition.getResourceOperations().getOrAddComponent(
   "HBASE_REGIONSERVER");
 return instanceDefinition;
}
org.apache.slider.core.confAggregateConf<init>

Javadoc

Take a snapshot of the configuration

Popular methods of AggregateConf

  • getAppConfOperations
  • getResourceOperations
  • getInternalOperations
  • getAppConf
  • resolve
  • setAppConf
  • setInternal
  • setName
  • getInternal
  • getName
  • getPassphrase
  • getResources
  • getPassphrase,
  • getResources,
  • isComplete,
  • isVersioned,
  • setResources,
  • toString,
  • validate

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • addToBackStack (FragmentTransaction)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now