DockerBuildService implements BuildService { @Override public void build(ImageConfiguration imageConfig) throws Fabric8ServiceException { io.fabric8.maven.docker.service.BuildService dockerBuildService = dockerServiceHub.getBuildService(); io.fabric8.maven.docker.service.BuildService.BuildContext dockerBuildContext = config.getDockerBuildContext(); ImagePullManager imagePullManager = config.getImagePullManager(); try { dockerBuildService.buildImage(imageConfig, imagePullManager, dockerBuildContext); dockerBuildService.tagImage(imageConfig.getName(), imageConfig); } catch (Exception ex) { throw new Fabric8ServiceException("Error while trying to build the image", ex); } } DockerBuildService(ServiceHub dockerServiceHub, BuildServiceConfig config); @Override void build(ImageConfiguration imageConfig); @Override void postProcess(BuildServiceConfig config);  }
@Test public void testSuccessfulBuild() throws Exception { final BuildService.BuildContext context = new BuildService.BuildContext.Builder() .build(); final io.fabric8.maven.core.service.BuildService.BuildServiceConfig config = new io.fabric8.maven.core.service.BuildService.BuildServiceConfig.Builder() .dockerBuildContext(context) .imagePullManager(new ImagePullManager(new TestCacheStore(), ImagePullPolicy.Always.name(), AutoPullMode.ALWAYS.name())) .build(); final String imageName = "image-name"; final ImageConfiguration image = new ImageConfiguration.Builder() .name(imageName) .buildConfig(new BuildImageConfiguration.Builder() .from("from") .build() ).build(); DockerBuildService service = new DockerBuildService(hub, config); service.build(image); new VerificationsInOrder() {{ buildService.buildImage(image, config.getImagePullManager(), context); buildService.tagImage(imageName, image); }}; }