@Test public void amqpUrlParserTest() { String amqpUrl1 = "amqp: String amqUrl2 = "asdfasdfasd: MetricsListener ml = new MetricsListener(amqpUrl1, "", "providerId", null); assertEquals("guest", ml.user); assertEquals("guest", ml.password); assertEquals("iaas-vm-dev:5673", ml.host); ml = new MetricsListener(amqUrl2, "", "providerId", null); assertEquals("guasdfasdst", ml.user); assertEquals("gu131312est", ml.password); assertEquals("iaaasdfasdfasdfas-vm-dev:5673", ml.host); ml = new MetricsListener(null, "", "providerId", null); assertEquals(null, ml.user); assertEquals(null, ml.password); assertEquals(null, ml.host); }
protected void amqpUrlParser(String amqpUrl) { String[] parts = amqpUrl.split("@"); host = parts[1]; parts = parts[0].split(":"); password = parts[2]; user = parts[1].substring(2); }
MetricsListener implements MessageListener { protected void amqpUrlParser(String amqpUrl) { String[] parts = amqpUrl.split("@"); host = parts[1]; parts = parts[0].split(":"); password = parts[2]; user = parts[1].substring(2); } }
MetricsListener implements MessageListener { protected void amqpUrlParser(String amqpUrl) { String[] parts = amqpUrl.split("@"); host = parts[1]; parts = parts[0].split(":"); password = parts[2]; user = parts[1].substring(2); } MetricsListener(String amqpUrl, String topic, String providerId, VMDAO vmDAO); }
MetricsListener implements MessageListener { protected void amqpUrlParser(String amqpUrl) { String[] parts = amqpUrl.split("@"); host = parts[1]; parts = parts[0].split(":"); password = parts[2]; user = parts[1].substring(2); } MetricsListener(String amqpUrl, String topic, String providerId, VMDAO vmDAO); @Override void onMessage(Message message); void close(); }
MetricsListener implements MessageListener { protected void amqpUrlParser(String amqpUrl) { String[] parts = amqpUrl.split("@"); host = parts[1]; parts = parts[0].split(":"); password = parts[2]; user = parts[1].substring(2); } MetricsListener(String amqpUrl, String topic, String providerId, VMDAO vmDAO); @Override void onMessage(Message message); void close();  }