@Test
public void testMetainfoParsing() throws Exception {
InputStream metainfo_1 = new ByteArrayInputStream(metainfo_1_str.getBytes());
Metainfo metainfo = new MetainfoParser().parse(metainfo_1);
Assert.assertNotNull(metainfo.getApplication());
Application application = metainfo.getApplication();
log.info("Service: " + application.toString());
Assert.assertEquals(application.getName(), "HBASE");
Assert.assertEquals(application.getComponents().size(), 2);
List<Component> components = application.getComponents();
int found = 0;
for (Component component : components) {
if (component.getName().equals("HBASE_MASTER")) {
Assert.assertEquals(component.getMinInstanceCount(), "1");
Assert.assertEquals(component.getMaxInstanceCount(), "2");
Assert.assertEquals(component.getCommandScript().getScript(), "scripts/hbase_master.py");
Assert.assertEquals(component.getCategory(), "MASTER");
found++;
}
if (component.getName().equals("HBASE_REGIONSERVER")) {
Assert.assertEquals(component.getMinInstanceCount(), "1");
Assert.assertNull(component.getMaxInstanceCount());
Assert.assertEquals(component.getCommandScript().getScript(), "scripts/hbase_regionserver.py");
Assert.assertEquals(component.getCategory(), "SLAVE");
found++;
}
}
Assert.assertEquals(found, 2);
assert application.getExportGroups().size() == 1;
List<ExportGroup> egs = application.getExportGroups();
ExportGroup eg = egs.get(0);
assert eg.getName().equals("QuickLinks");
assert eg.getExports().size() == 2;
found = 0;
for (Export export : eg.getExports()) {
if (export.getName().equals("JMX_Endpoint")) {
found++;
Assert.assertEquals(export.getValue(),
"http://${HBASE_MASTER_HOST}:${site.hbase-site.hbase.master.info.port}/jmx");
}
if (export.getName().equals("Master_Status")) {
found++;
Assert.assertEquals(export.getValue(),
"http://${HBASE_MASTER_HOST}:${site.hbase-site.hbase.master.info.port}/master-status");
}
}
Assert.assertEquals(found, 2);
List<CommandOrder> cmdOrders = application.getCommandOrder();
Assert.assertEquals(cmdOrders.size(), 2);
found = 0;
for (CommandOrder co : application.getCommandOrder()) {
if (co.getCommand().equals("HBASE_REGIONSERVER-START")) {
Assert.assertTrue(co.getRequires().equals("HBASE_MASTER-STARTED"));
found++;
}
if (co.getCommand().equals("A-START")) {