clusters.mapHostsToCluster(hostNames, "c1");
Cluster cluster = clusters.getCluster("c1");
cluster.setDesiredStackVersion(new StackId("HDP-0.1"));
ConfigFactory cf = injector.getInstance(ConfigFactory.class);
Config config1 = cf.createNew(cluster, "global",
new HashMap<String, String>(){{ put("key1", "value1"); }});
config1.setVersionTag("version1");
Config config2 = cf.createNew(cluster, "core-site",
new HashMap<String, String>(){{ put("key1", "value1"); }});
config2.setVersionTag("version1");
cluster.addConfig(config1);
cluster.addConfig(config2);