QuarkusGenerator extends BaseGenerator { @Override public List<ImageConfiguration> customize(List<ImageConfiguration> existingConfigs, boolean prePackagePhase) throws MojoExecutionException { ImageConfiguration.Builder imageBuilder = new ImageConfiguration.Builder() .name(getImageName()) .registry(getRegistry()) .alias(getAlias()) .buildConfig(createBuildConfig(prePackagePhase)); existingConfigs.add(imageBuilder.build()); return existingConfigs; } QuarkusGenerator(GeneratorContext context); @Override boolean isApplicable(List<ImageConfiguration> configs); @Override List<ImageConfiguration> customize(List<ImageConfiguration> existingConfigs, boolean prePackagePhase);  }
@Test public void testCustomizeReturnsConfiguredFromWhenNative () throws MojoExecutionException, IOException { setNativeConfig(); new Expectations() {{ config.getConfig("quarkus", "from"); result = BASE_NATIVE_IMAGE; }}; QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, BASE_NATIVE_IMAGE); }
@Test public void testCustomizeReturnsPropertiesFrom () throws MojoExecutionException { projectProps.put("fabric8.generator.quarkus.from", BASE_JAVA_IMAGE); QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, BASE_JAVA_IMAGE); }
@Test public void testCustomizeReturnsPropertiesFromWhenNative () throws MojoExecutionException, IOException { setNativeConfig(); projectProps.put("fabric8.generator.quarkus.from", BASE_NATIVE_IMAGE); QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, BASE_NATIVE_IMAGE); }
@Test public void testCustomizeReturnsDefaultFrom () throws MojoExecutionException { QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, "openjdk:11"); }
@Test public void testCustomizeReturnsDefaultFromWhenNative () throws MojoExecutionException, IOException { setNativeConfig(); QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, "registry.fedoraproject.org/fedora-minimal"); }
@Test public void testCustomizeReturnsConfiguredFrom () throws MojoExecutionException { new Expectations() {{ config.getConfig("quarkus", "from"); result = BASE_JAVA_IMAGE; }}; QuarkusGenerator generator = new QuarkusGenerator(ctx); List<ImageConfiguration> resultImages = null; List<ImageConfiguration> existingImages = new ArrayList<>(); resultImages = generator.customize(existingImages, true); assertBuildFrom(resultImages, BASE_JAVA_IMAGE); }