@Test
public void testConvertConfig() throws Exception {

    Configuration config = loadTestConfigFile("/test-convert.yaml");
    AgentCoreEngineConfiguration agentConfig = new ConfigConverter(config).convert();
    Assert.assertTrue(agentConfig.getGlobalConfiguration().isSubsystemEnabled());
    Assert.assertEquals(111, agentConfig.getGlobalConfiguration().getAutoDiscoveryScanPeriodSeconds());
    Assert.assertEquals(true, agentConfig.getMetricsExporterConfiguration().isEnabled());
    Assert.assertEquals("thehost", agentConfig.getMetricsExporterConfiguration().getHost());
    Assert.assertEquals(12345, agentConfig.getMetricsExporterConfiguration().getPort());
    Assert.assertEquals("exporter", agentConfig.getMetricsExporterConfiguration().getConfigDir());
    Assert.assertEquals("config.yaml", agentConfig.getMetricsExporterConfiguration().getConfigFile());
    Assert.assertEquals(Mode.slave, agentConfig.getMetricsExporterConfiguration().getProxyMode());
    Assert.assertEquals("proxy/data/dir", agentConfig.getMetricsExporterConfiguration().getProxyDataDir());
    Assert.assertEquals("http://hawkular:8181", agentConfig.getStorageAdapter().getUrl());
    Assert.assertEquals("the user", agentConfig.getStorageAdapter().getUsername());
    Assert.assertEquals("the pass", agentConfig.getStorageAdapter().getPassword());
    Assert.assertEquals("h-server", agentConfig.getStorageAdapter().getSecurityRealm());
    Assert.assertNull(agentConfig.getStorageAdapter().getKeystorePath());
    Assert.assertNull(agentConfig.getStorageAdapter().getKeystorePassword());
    Assert.assertEquals("the feed", agentConfig.getStorageAdapter().getFeedId());
    Assert.assertEquals(5, agentConfig.getDiagnostics().getInterval());
    EndpointConfiguration localDmr = agentConfig.getDmrConfiguration().getEndpoints().get("Test Local DMR");
    Assert.assertEquals(true, localDmr.isEnabled());
    Assert.assertEquals(2, localDmr.getWaitForResources().size());
    Assert.assertEquals("/subsystem=undertow", localDmr.getWaitForResources().get(0).getResource());
    Assert.assertEquals("/", localDmr.getWaitForResources().get(1).getResource());
    EndpointConfiguration localJmx = agentConfig.getJmxConfiguration().getEndpoints().get("Test Local JMX");
    Assert.assertEquals(true, localJmx.isEnabled());
    Assert.assertEquals(2, localJmx.getWaitForResources().size());
    Assert.assertEquals("java.lang:type=Runtime", localJmx.getWaitForResources().get(0).getResource());
    Assert.assertEquals("java.lang:type=Memory", localJmx.getWaitForResources().get(1).getResource());
    EndpointConfiguration remoteDmr = agentConfig.getDmrConfiguration().getEndpoints().get("Test Remote DMR");
    Assert.assertEquals(true, remoteDmr.isEnabled());
    Assert.assertEquals(1, remoteDmr.getWaitForResources().size());
    Assert.assertEquals("/subsystem=undertow", remoteDmr.getWaitForResources().get(0).getResource());
    EndpointConfiguration remoteJmx = agentConfig.getJmxConfiguration().getEndpoints().get("Test Remote JMX");
    Assert.assertEquals(true, remoteJmx.isEnabled());
    Assert.assertEquals(1, remoteJmx.getWaitForResources().size());
    Assert.assertEquals("java.lang:type=Runtime", remoteJmx.getWaitForResources().get(0).getResource());
    EndpointConfiguration remoteDmr2 = agentConfig.getDmrConfiguration().getEndpoints().get("Test Remote DMR 2");
    Assert.assertEquals(true, remoteDmr2.isEnabled());
    Assert.assertEquals(0, remoteDmr2.getWaitForResources().size());
    EndpointConfiguration remoteJmx2 = agentConfig.getJmxConfiguration().getEndpoints().get("Test Remote JMX 2");
    Assert.assertEquals(true, remoteJmx2.isEnabled());
    Assert.assertEquals(0, remoteJmx2.getWaitForResources().size());
}