io.vertx.config.ConfigRetrieverOptions Java Examples
The following examples show how to use
io.vertx.config.ConfigRetrieverOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Service.java From xyz-hub with Apache License 2.0 | 7 votes |
/** * The service entry point. */ public static void main(String[] arguments) { Configurator.initialize("default", CONSOLE_LOG_CONFIG); final ConfigStoreOptions fileStore = new ConfigStoreOptions().setType("file").setConfig(new JsonObject().put("path", "config.json")); final ConfigStoreOptions envConfig = new ConfigStoreOptions().setType("env"); final ConfigStoreOptions sysConfig = new ConfigStoreOptions().setType("sys"); final ConfigRetrieverOptions options = new ConfigRetrieverOptions().addStore(fileStore).addStore(envConfig).addStore(sysConfig); boolean debug = Arrays.asList(arguments).contains("--debug"); final VertxOptions vertxOptions = new VertxOptions() .setWorkerPoolSize(NumberUtils.toInt(System.getenv(VERTX_WORKER_POOL_SIZE), 128)) .setPreferNativeTransport(true); if (debug) { vertxOptions .setBlockedThreadCheckInterval(TimeUnit.MINUTES.toMillis(1)) .setMaxEventLoopExecuteTime(TimeUnit.MINUTES.toMillis(1)) .setMaxWorkerExecuteTime(TimeUnit.MINUTES.toMillis(1)) .setWarningExceptionTime(TimeUnit.MINUTES.toMillis(1)); } vertx = Vertx.vertx(vertxOptions); webClient = WebClient.create(Service.vertx, new WebClientOptions().setUserAgent(XYZ_HUB_USER_AGENT)); ConfigRetriever retriever = ConfigRetriever.create(vertx, options); retriever.getConfig(Service::onConfigLoaded); }
Example #2
Source File: VaultConfigStoreTestBase.java From vertx-config with Apache License 2.0 | 7 votes |
/** * Tests the access to secret data encoded as properties with KV-v1 engine. */ @Test public void testAccessToNestedContentAsPropertiesFromSecretV1(TestContext tc) { JsonObject additionalConfig = getRetrieverConfiguration(); JsonObject config = additionalConfig.copy().put("path", "secret/app/foo").put("key", "props"); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("vault") .setFormat("properties") .setConfig(config))); Async async = tc.async(); retriever.getConfig(json -> { tc.assertTrue(json.succeeded()); JsonObject content = json.result(); tc.assertEquals(content.getString("key"), "val"); tc.assertEquals(content.getInteger("key2"), 5); async.complete(); }); }
Example #3
Source File: YamlProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithMissingFile(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("yaml") .setConfig(new JsonObject().put("path", "src/test/resources/some-missing-file.yaml")))); retriever.getConfig(ar -> { assertThat(ar.failed()).isTrue(); assertThat(ar.cause()).isNotNull().isInstanceOf(FileSystemException.class); async.complete(); }); }
Example #4
Source File: DirectoryConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWhenNoFileMatch(TestContext context) { Async async = context.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions() .setType("directory") .setConfig(new JsonObject().put("path", "src/test/resources") .put("filesets", new JsonArray().add(new JsonObject() .put("format", "properties") .put("pattern", "**/reg*.stuff")))))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); JsonObject json = ar.result(); assertThat(json.isEmpty()); async.complete(); }); }
Example #5
Source File: YamlProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testBasicYamlFile(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("yaml") .setConfig(new JsonObject().put("path", "src/test/resources/basic.yaml")))); retriever.getConfig(ar -> { expectSuccess(ar); JsonObject json = ar.result(); assertThat(json.getInteger("invoice")).isEqualTo(34843); assertThat(json.getString("date")).isEqualTo("2001-01-23"); JsonObject bill = json.getJsonObject("bill-to"); assertThat(bill).contains(entry("given", "Chris"), entry("family", "Dumars")); assertThat(bill.getJsonObject("address")).isNotNull().isNotEmpty(); JsonArray products = json.getJsonArray("product"); assertThat(products).hasSize(2); assertThat(products.getJsonObject(0).getFloat("price")).isEqualTo(450.0f); assertThat(products.getJsonObject(1).getDouble("price")).isEqualTo(2392.0); assertThat(json.getString("comments")).contains("Late afternoon is best. Backup contact is Nancy Billsmer @"); async.complete(); }); }
Example #6
Source File: HoconProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithMissingFile(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("hocon") .setConfig(new JsonObject().put("path", "src/test/resources/some-missing-file.conf")))); retriever.getConfig(ar -> { assertThat(ar.failed()).isTrue(); assertThat(ar.cause()).isNotNull().isInstanceOf(FileSystemException.class); async.complete(); }); }
Example #7
Source File: DirectoryConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithAFileSetMatching2FilesWithConflict(TestContext context) { Async async = context.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions() .setType("directory") .setConfig(new JsonObject().put("path", "src/test/resources") .put("filesets", new JsonArray() .add(new JsonObject().put("pattern", "dir/?.json")) )))); retriever.getConfig(ar -> { assertThat(ar.result().getString("b.name")).isEqualTo("B"); assertThat(ar.result().getString("a.name")).isEqualTo("A"); // Alphabetical order, so B is last. assertThat(ar.result().getString("conflict")).isEqualTo("B"); async.complete(); }); }
Example #8
Source File: VaultConfigStoreTestBase.java From vertx-config with Apache License 2.0 | 6 votes |
/** * Tests accessing a specific key from a missing secret. */ @Test public void testRetrievingAKeyFromAMissingSecret(TestContext tc) { JsonObject additionalConfig = getRetrieverConfiguration(); JsonObject config = additionalConfig.copy() .put("path", "secret/app/missing").put("key", "missing"); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("vault") .setConfig(config))); Async async = tc.async(); retriever.getConfig(json -> { tc.assertTrue(json.succeeded()); tc.assertTrue(json.result().isEmpty()); async.complete(); }); }
Example #9
Source File: HoconProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testSimplePropertiesConfiguration(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("hocon") .setConfig(new JsonObject().put("path", "src/test/resources/regular.properties")))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); JsonObject json = ar.result(); assertThat(json.getString("key")).isEqualTo("value"); assertThat(json.getBoolean("true")).isTrue(); assertThat(json.getBoolean("false")).isFalse(); assertThat(json.getString("missing")).isNull(); assertThat(json.getInteger("int")).isEqualTo(5); assertThat(json.getDouble("float")).isEqualTo(25.3); async.complete(); }); }
Example #10
Source File: VaultConfigStoreTestBase.java From vertx-config with Apache License 2.0 | 6 votes |
/** * Tests accessing a missing key from an existing secret. */ @Test public void testRetrievingAMissingKey(TestContext tc) { JsonObject additionalConfig = getRetrieverConfiguration(); JsonObject config = additionalConfig.copy() .put("path", "secret/app/foo").put("key", "missing"); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("vault") .setConfig(config))); Async async = tc.async(); retriever.getConfig(json -> { tc.assertTrue(json.succeeded()); tc.assertTrue(json.result().isEmpty()); async.complete(); }); }
Example #11
Source File: ConfigExamples.java From vertx-config with Apache License 2.0 | 6 votes |
public void stream(ConfigStoreOptions store1, ConfigStoreOptions store2) { ConfigRetrieverOptions options = new ConfigRetrieverOptions() .setScanPeriod(2000) .addStore(store1) .addStore(store2); ConfigRetriever retriever = ConfigRetriever.create(Vertx.vertx(), options); retriever.configStream() .endHandler(v -> { // retriever closed }) .exceptionHandler(t -> { // an error has been caught while retrieving the configuration }) .handler(conf -> { // the configuration }); }
Example #12
Source File: EnvVariablesConfigStoreWithMockEnvTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testLoadingFromEnvUsingRawData() { retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("env").setConfig(new JsonObject().put("raw-data", true))) ); AtomicBoolean done = new AtomicBoolean(); env.set("name", "12345678901234567890"); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); assertThat(ar.result().getString("PATH")).isNotNull(); assertThat(ar.result().getString("name")).isEqualTo("12345678901234567890"); done.set(true); }); await().untilAtomic(done, is(true)); }
Example #13
Source File: VerticleDeployment.java From vertx-config with Apache License 2.0 | 6 votes |
public void configureVertx() { // Create a first instance of Vert.x Vertx vertx = Vertx.vertx(); // Create the config retriever ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("file").setConfig(new JsonObject().put("path", "vertx.json")))); // Retrieve the configuration retriever.getConfig(json -> { JsonObject result = json.result(); // Close the vert.x instance, we don't need it anymore. vertx.close(); // Create a new Vert.x instance using the retrieve configuration VertxOptions options = new VertxOptions(result); Vertx newVertx = Vertx.vertx(options); // Deploy your verticle newVertx.deployVerticle(GreetingVerticle.class.getName(), new DeploymentOptions().setConfig(result.getJsonObject("a"))); }); }
Example #14
Source File: VaultConfigStoreTestBase.java From vertx-config with Apache License 2.0 | 6 votes |
/** * Tests the access to a specific key of a secret in KV-v1 engine. */ @Test public void testAccessToNestedContentFromSecretV1(TestContext tc) { JsonObject additionalConfig = getRetrieverConfiguration(); JsonObject config = additionalConfig.copy() .put("path", "secret/app/foo").put("key", "nested"); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("vault") .setConfig(config))); Async async = tc.async(); retriever.getConfig(json -> { if (json.failed()) { json.cause().printStackTrace(); } tc.assertTrue(json.succeeded()); JsonObject content = json.result(); tc.assertEquals(content.getString("foo"), "bar"); async.complete(); }); }
Example #15
Source File: SystemPropertiesConfigStoreWithRawDataTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testLoadingFromSysUsingRawData() { retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("sys").setConfig(new JsonObject().put("raw-data", true))) ); AtomicBoolean done = new AtomicBoolean(); System.setProperty("name", "12345678901234567890"); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); assertThat(ar.result().getString("name")).isEqualTo("12345678901234567890"); done.set(true); }); await().untilAtomic(done, is(true)); }
Example #16
Source File: SystemPropertiesConfigStoreWithRawDataTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testLoadingFromSysWithoutRawData() { retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("sys")) ); AtomicBoolean done = new AtomicBoolean(); System.setProperty("name", "12345678901234567891"); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); // Converted value, totally wrong ;-) assertThat(ar.result().getInteger("name")).isEqualTo(2147483647); done.set(true); }); await().untilAtomic(done, is(true)); }
Example #17
Source File: ConfigExamples.java From vertx-config with Apache License 2.0 | 6 votes |
public void propsWitHierarchicalStructure() { ConfigStoreOptions propertyWitHierarchical = new ConfigStoreOptions() .setFormat("properties") .setType("file") .setConfig(new JsonObject().put("path", "hierarchical.properties").put("hierarchical", true) ); ConfigRetrieverOptions options = new ConfigRetrieverOptions() .addStore(propertyWitHierarchical); ConfigRetriever configRetriever = ConfigRetriever.create(Vertx.vertx(), options); configRetriever.configStream().handler(config -> { String host = config.getJsonObject("server").getString("host"); Integer port = config.getJsonObject("server").getInteger("port"); JsonArray multiple = config.getJsonObject("multiple").getJsonArray("values"); for (int i = 0; i < multiple.size(); i++) { Integer value = multiple.getInteger(i); } }); }
Example #18
Source File: RawProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithBrokenJson(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore( new ConfigStoreOptions() .setType("file") .setFormat("raw") .setConfig( new JsonObject() .put("path", "src/test/resources/raw/username") .put("raw.type", "json-object") .put("raw.key", "some-json"))) ); retriever.getConfig(ar -> { assertThat(ar.failed()); assertThat(ar.cause()) .isInstanceOf(DecodeException.class) .hasRootCauseInstanceOf(JsonParseException.class); async.complete(); }); }
Example #19
Source File: YamlProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithTextFile(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("yaml") .setConfig(new JsonObject().put("path", "src/test/resources/some-text.txt")))); retriever.getConfig(ar -> { assertThat(ar.failed()).isTrue(); assertThat(ar.cause()).isNotNull().isInstanceOf(DecodeException.class); async.complete(); }); }
Example #20
Source File: DirectoryConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testLoadingASinglePropertiesFile(TestContext context) { Async async = context.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions() .setType("directory") .setConfig(new JsonObject().put("path", "src/test/resources") .put("filesets", new JsonArray().add(new JsonObject() .put("format", "properties") .put("pattern", "**/reg*.properties")))))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); JsonObject json = ar.result(); assertThat(json.getString("key")).isEqualTo("value"); assertThat(json.getBoolean("true")).isTrue(); assertThat(json.getBoolean("false")).isFalse(); assertThat(json.getString("missing")).isNull(); assertThat(json.getInteger("int")).isEqualTo(5); assertThat(json.getDouble("float")).isEqualTo(25.3); async.complete(); }); }
Example #21
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithAFileSetMatching2FilesOneNotBeingAJsonFile(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/a-bad.json"), "dir"); add(git, root, new File("src/test/resources/files/a.json"), "dir"); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("filesets", new JsonArray() .add(new JsonObject().put("pattern", "dir/a?*.*son")) )))); retriever.getConfig(ar -> { assertThat(ar.failed()); assertThat(ar.cause()).isInstanceOf(DecodeException.class); async.complete(); }); }
Example #22
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithAFileSetMatching2FilesWithConflict(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/b.json"), "dir"); add(git, root, new File("src/test/resources/files/a.json"), "dir"); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("filesets", new JsonArray() .add(new JsonObject().put("pattern", "dir/?.*son")) )))); retriever.getConfig(ar -> { assertThat(ar.result().getString("b.name")).isEqualTo("B"); assertThat(ar.result().getString("a.name")).isEqualTo("A"); // Alphabetical order, so B is last. assertThat(ar.result().getString("conflict")).isEqualTo("B"); async.complete(); }); }
Example #23
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithDeepConfigMerge(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/b.json"), "dir"); add(git, root, new File("src/test/resources/files/a.json"), "dir"); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("filesets", new JsonArray() .add(new JsonObject().put("pattern", "dir/b.json")) .add(new JsonObject().put("pattern", "dir/a.*son")) )))); retriever.getConfig(ar -> { // Both level-3 objects must exist. assertThat(ar.result().getJsonObject("parent").getJsonObject("level_2").getString("key1")).isEqualTo("A"); assertThat(ar.result().getJsonObject("parent").getJsonObject("level_2").getString("key2")).isEqualTo("B"); async.complete(); }); }
Example #24
Source File: RawProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithJsonArray(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore( new ConfigStoreOptions() .setType("file") .setFormat("raw") .setConfig( new JsonObject() .put("path", "src/test/resources/raw/some-json-array.json") .put("raw.type", "json-array") .put("raw.key", "some-json"))) ); retriever.getConfig(ar -> { assertThat(ar.result()).isNotNull().isNotEmpty(); assertThat(ar.result().getJsonArray("some-json").encode()).contains("1", "2", "3"); async.complete(); }); }
Example #25
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWith2FileSetsAndNoIntersection(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/regular.json"), "file"); add(git, root, new File("src/test/resources/files/a.json"), "dir"); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("filesets", new JsonArray() .add(new JsonObject().put("pattern", "file/reg*.json")) .add(new JsonObject().put("pattern", "dir/a.*son")) )))); retriever.getConfig(ar -> { assertThat(ar.result().getString("key")).isEqualTo("value"); assertThat(ar.result().getString("a.name")).isEqualTo("A"); async.complete(); }); }
Example #26
Source File: RawProcessorTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithMissingKey(TestContext tc) { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore( new ConfigStoreOptions() .setType("file") .setFormat("raw") .setConfig( new JsonObject() .put("path", "src/test/resources/raw/logo-white-big.png") .put("raw.type", "binary"))) ); retriever.getConfig(ar -> { assertThat(ar.failed()); assertThat(ar.cause().getMessage()).contains("raw.key"); async.complete(); }); }
Example #27
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithACustomBranch(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/a.json"), null); branch = "dev"; add(git, root, new File("src/test/resources/files/regular.json"), null); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("branch", branch) .put("filesets", new JsonArray().add(new JsonObject().put("pattern", "*.json")))))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); assertThat(ar.result()).isNotEmpty(); JsonObject json = ar.result(); assertThat(json).isNotNull(); assertThat(json.getString("key")).isEqualTo("value"); async.complete(); }); }
Example #28
Source File: GitConfigStoreTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testWithEmptyRepository(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); add(git, root, new File("src/test/resources/files/some-text.txt"), null); push(git); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", bareRoot.getAbsolutePath()) .put("path", "target/junk/work") .put("filesets", new JsonArray().add(new JsonObject().put("pattern", "**/*.json")))))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); assertThat(ar.result()).isEmpty(); async.complete(); }); }
Example #29
Source File: VaultConfigStoreTestBase.java From vertx-config with Apache License 2.0 | 6 votes |
/** * Tests the access to a secret with KV-v2 engine. */ @Test public void testAccessToSecretV2(TestContext tc) { JsonObject additionalConfig = getRetrieverConfiguration(); JsonObject config = additionalConfig.copy().put("path", "secret-v2/data/app/foo"); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("vault").setConfig(config))); Async async = tc.async(); retriever.getConfig(json -> { tc.assertTrue(json.succeeded()); JsonObject content = json.result(); tc.assertEquals("hello", content.getString("message")); tc.assertEquals(10, content.getInteger("counter")); async.complete(); }); }
Example #30
Source File: GitConfigStoreWithGithubTest.java From vertx-config with Apache License 2.0 | 6 votes |
@Test public void testOnMasterWithASingleFile(TestContext tc) throws GitAPIException, IOException { Async async = tc.async(); retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(new ConfigStoreOptions().setType("git").setConfig(new JsonObject() .put("url", REPO) .put("path", "target/junk/work") .put("filesets", new JsonArray().add(new JsonObject().put("pattern", "a.json")))))); retriever.getConfig(ar -> { assertThat(ar.succeeded()).isTrue(); assertThat(ar.result()).isNotEmpty(); JsonObject json = ar.result(); assertThat(json).isNotNull(); assertThat(json.getString("branch")).isEqualToIgnoringCase("master"); assertThat(json.getString("name")).isEqualToIgnoringCase("A"); async.complete(); }); }