vhostsFile.deleteOnExit();
writeConfigFile(mainFile, false, false, vhostsFile, null);
writeVirtualHostsFile(vhostsFile, "test");
// Load config
ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
ApplicationRegistry.initialise(reg, 1);
// Test config
VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
String defaultVirtualHost = reg.getConfiguration().getDefaultVirtualHost();
VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
Exchange exchange = virtualHost.getExchangeRegistry().getExchange(new AMQShortString("test.topic"));
assertEquals("Incorrect default host", "test", defaultVirtualHost);
assertEquals("Incorrect virtualhost count", 1, virtualHostRegistry.getVirtualHosts().size());