UrlsExternalConfigSupplier extends AbstractExternalConfigSupplier { @Override public String toString() { return MoreObjects.toStringHelper(this).add("name", getName()).toString(); } UrlsExternalConfigSupplier(ManagementContext managementContext, String name, Map<String, String> config); @Override String toString(); @Override String get(String key);  }
@Test public void testFromUrls() throws Exception { File f1 = makeTempFile("my1"); File f2 = makeTempFile("my2"); BrooklynProperties props = BrooklynProperties.Factory.newEmpty(); props.put("brooklyn.external.foo", UrlsExternalConfigSupplier.class.getName()); props.put("brooklyn.external.foo.mykey1", f1.toURI().toString()); props.put("brooklyn.external.foo.mykey2", f2.getAbsolutePath()); mgmt = LocalManagementContextForTests.newInstance(props); assertEquals(mgmt.getExternalConfigProviderRegistry().getConfig("foo", "mykey1"), "my1"); assertEquals(mgmt.getExternalConfigProviderRegistry().getConfig("foo", "mykey2"), "my2"); try { String result = mgmt.getExternalConfigProviderRegistry().getConfig("foo", "wrongkey"); Asserts.shouldHaveFailedPreviously("result="+result); } catch (Exception e) { Asserts.expectedFailureContains(e, "Unknown key"); } }