public AggregateConf(ConfTree resources, ConfTree appConf, ConfTree internal) { setResources(resources); setAppConf(appConf); setInternal(internal); }
public AggregateConf(ConfTree resources, ConfTree appConf, ConfTree internal) { setResources(resources); setAppConf(appConf); setInternal(internal); }
private void loadConf(AggregateConf conf) throws IOException { conf.setInternal(confTreeSerDeser.load(fileSystem, internal)); conf.setResources(confTreeSerDeser.load(fileSystem, resources)); conf.setAppConf(confTreeSerDeser.load(fileSystem, app_conf)); }
private void loadConf(AggregateConf conf) throws IOException { conf.setInternal(confTreeSerDeser.load(fileSystem, internal)); conf.setResources(confTreeSerDeser.load(fileSystem, resources)); conf.setAppConf(confTreeSerDeser.load(fileSystem, app_conf)); }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
@Test public void testPrepareAMAndConfigForLaunch() throws Exception { AgentClientProvider provider = new AgentClientProvider(null); SliderFileSystem sfs = PowerMock.createMock(SliderFileSystem.class); FileSystem fs = PowerMock.createMock(FileSystem.class); Configuration serviceConf = PowerMock.createMock(Configuration.class); PowerMock.mockStatic(ProviderUtils.class); expect(sfs.getFileSystem()).andReturn(fs); expect(fs.mkdirs(anyObject(Path.class))).andReturn(true); expect(ProviderUtils.addAgentTar( anyObject(), anyObject(String.class), anyObject(SliderFileSystem.class), anyObject(Path.class))). andReturn(true); AggregateConf instanceDefinition = new AggregateConf(); ConfTree tree = new ConfTree(); tree.global.put(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, "."); instanceDefinition.setInternal(tree); PowerMock.replay(sfs, fs, serviceConf, ProviderUtils.class); provider.prepareAMAndConfigForLaunch( sfs, serviceConf, null, instanceDefinition, null, null, null, null, null, false); Assert.assertTrue(tree.global.containsKey(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH)); tree.global.remove(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); // Verify that slider-agent.tar.gz got added Path tempPath = new Path(".", "temp"); provider.prepareAMAndConfigForLaunch( sfs, serviceConf, null, instanceDefinition, null, null, null, null, tempPath, false); PowerMock.verify(sfs, fs, ProviderUtils.class); Assert.assertTrue(tree.global.containsKey(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH)); }
@Test public void testPrepareAMAndConfigForLaunch() throws Exception { AgentClientProvider provider = new AgentClientProvider(null); SliderFileSystem sfs = PowerMock.createMock(SliderFileSystem.class); FileSystem fs = PowerMock.createMock(FileSystem.class); Configuration serviceConf = PowerMock.createMock(Configuration.class); PowerMock.mockStatic(ProviderUtils.class); expect(sfs.getFileSystem()).andReturn(fs); expect(fs.mkdirs(anyObject(Path.class))).andReturn(true); expect(ProviderUtils.addAgentTar( anyObject(), anyObject(String.class), anyObject(SliderFileSystem.class), anyObject(Path.class))). andReturn(true); AggregateConf instanceDefinition = new AggregateConf(); ConfTree tree = new ConfTree(); tree.global.put(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, "."); instanceDefinition.setInternal(tree); PowerMock.replay(sfs, fs, serviceConf, ProviderUtils.class); provider.prepareAMAndConfigForLaunch( sfs, serviceConf, null, instanceDefinition, null, null, null, null, null, false); Assert.assertTrue(tree.global.containsKey(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH)); tree.global.remove(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); // Verify that slider-agent.tar.gz got added Path tempPath = new Path(".", "temp"); provider.prepareAMAndConfigForLaunch( sfs, serviceConf, null, instanceDefinition, null, null, null, null, tempPath, false); PowerMock.verify(sfs, fs, ProviderUtils.class); Assert.assertTrue(tree.global.containsKey(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH)); }
AggregateConf instanceDefinition = new AggregateConf(); instanceDefinition.setInternal(tree); instanceDefinition.setAppConf(tree); instanceDefinition.getAppConfOperations().getGlobalOptions().put(AgentKeys.APP_DEF, ".");
AggregateConf instanceDefinition = new AggregateConf(); instanceDefinition.setInternal(tree); instanceDefinition.setAppConf(tree); instanceDefinition.getAppConfOperations().getGlobalOptions().put(AgentKeys.APP_DEF, ".");
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; }
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; }