Skip to content

Commit

Permalink
Adding builder method to imageconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Aug 28, 2017
1 parent 2bb001d commit 4b16f12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ public Builder externalConfig(Map<String, String> externalConfig) {
return this;
}

public Builder registry(String registry) {
config.registry = registry;
return this;
}

public ImageConfiguration build() {
return config;
}
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/io/fabric8/maven/docker/config/ConfigHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public void simple() throws Exception {
assertTrue(customizerCalled);
}

@Test
public void registry() throws Exception {
List<ImageConfiguration> configs = Arrays.asList(new ImageConfiguration.Builder().registry("docker.io").name("test").build());
List<ImageConfiguration> result = ConfigHelper.resolveImages(null, configs, createResolver(), null, createCustomizer());
assertEquals(1,result.size());
assertTrue(resolverCalled);
assertTrue(customizerCalled);
assertEquals("docker.io", configs.get(0).getRegistry());
}

@Test
public void filter() throws Exception {
List<ImageConfiguration> configs = Arrays.asList(new ImageConfiguration.Builder().name("test").build());
Expand Down

0 comments on commit 4b16f12

Please sign in to comment.