Search in sources :

Example 16 with ProcessorConfig

use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.

the class DefaultServiceEnricherTest method setupExpectations.

private void setupExpectations(final boolean withPorts, String... configParams) {
    // Setup mock behaviour
    final TreeMap<String, Object> config = new TreeMap<>();
    for (int i = 0; i < configParams.length; i += 2) {
        config.put(configParams[i], configParams[i + 1]);
    }
    new Expectations() {

        {
            Configuration configuration = Configuration.builder().image(imageConfiguration).processorConfig(new ProcessorConfig(null, null, Collections.singletonMap("jkube-service", config))).build();
            context.getConfiguration();
            result = configuration;
            imageConfiguration.getBuildConfiguration();
            result = initBuildConfig(withPorts);
        }
    };
}
Also used : Expectations(mockit.Expectations) BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) Configuration(org.eclipse.jkube.kit.enricher.api.model.Configuration) TreeMap(java.util.TreeMap) ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig)

Example 17 with ProcessorConfig

use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.

the class WatcherManagerTest method setUp.

@Before
public void setUp() throws Exception {
    // @formatter:off
    new Expectations() {

        {
            jKubeServiceHub.getClusterAccess().isOpenShift();
            result = false;
        }
    };
    // @formatter:on
    final ProcessorConfig processorConfig = new ProcessorConfig();
    processorConfig.setIncludes(Collections.singletonList("fake-watcher"));
    watcherContext = WatcherContext.builder().config(processorConfig).jKubeServiceHub(jKubeServiceHub).logger(logger).build();
}
Also used : Expectations(mockit.Expectations) ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig) Before(org.junit.Before)

Example 18 with ProcessorConfig

use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.

the class ProfileUtilTest method blendProfiles.

@Test
public void blendProfiles() throws Exception {
    ProcessorConfig origConfig = new ProcessorConfig(Arrays.asList("i1", "i2"), Collections.singleton("spring.swarm"), null);
    ProcessorConfig mergeConfig = ProfileUtil.blendProfileWithConfiguration(ProfileUtil.ENRICHER_CONFIG, "simple", getProfileDir(), origConfig);
    assertTrue(mergeConfig.use("base"));
    assertTrue(mergeConfig.use("i1"));
    assertEquals("http://jolokia.org", mergeConfig.getConfig().get("base").get("url"));
    mergeConfig = ProfileUtil.blendProfileWithConfiguration(ProfileUtil.GENERATOR_CONFIG, "simple", getProfileDir(), origConfig);
    assertTrue(mergeConfig.use("i2"));
    assertFalse(mergeConfig.use("spring.swarm"));
}
Also used : ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig) Test(org.junit.Test)

Example 19 with ProcessorConfig

use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.

the class ProfileUtilTest method simple.

@Test
public void simple() throws IOException {
    InputStream is = getClass().getResourceAsStream("/jkube/config/profiles-lookup-dir/profiles.yaml");
    assertNotNull(is);
    List<Profile> profiles = ProfileUtil.fromYaml(is);
    assertNotNull(profiles);
    assertEquals(3, profiles.size());
    Profile profile = profiles.get(0);
    assertEquals("simple", profile.getName());
    ProcessorConfig config = profile.getEnricherConfig();
    assertTrue(config.use("base"));
    assertFalse(config.use("blub"));
    config = profile.getGeneratorConfig();
    assertFalse(config.use("java.app"));
    assertTrue(config.use("spring.swarm"));
}
Also used : InputStream(java.io.InputStream) ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig) Test(org.junit.Test)

Example 20 with ProcessorConfig

use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.

the class DefaultEnricherManagerTest method setUp.

@Before
public void setUp() throws Exception {
    final ProcessorConfig processorConfig = new ProcessorConfig();
    processorConfig.setIncludes(Collections.singletonList("fake-enricher"));
    final EnricherContext enricherContext = JKubeEnricherContext.builder().project(JavaProject.builder().build()).log(logger).processorConfig(processorConfig).build();
    enricherManager = new DefaultEnricherManager(enricherContext);
}
Also used : ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig) Before(org.junit.Before)

Aggregations

ProcessorConfig (org.eclipse.jkube.kit.config.resource.ProcessorConfig)33 Expectations (mockit.Expectations)22 Before (org.junit.Before)14 Test (org.junit.Test)13 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)12 Properties (java.util.Properties)12 TreeMap (java.util.TreeMap)6 Configuration (org.eclipse.jkube.kit.enricher.api.model.Configuration)6 ServiceBuilder (io.fabric8.kubernetes.api.model.ServiceBuilder)4 DeploymentBuilder (io.fabric8.kubernetes.api.model.apps.DeploymentBuilder)4 ArrayList (java.util.ArrayList)4 ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)4 File (java.io.File)3 URLClassLoader (java.net.URLClassLoader)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ProjectClassLoaders (org.eclipse.jkube.kit.common.util.ProjectClassLoaders)3 BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)3 TypeToken (com.google.common.reflect.TypeToken)2 Gson (com.google.gson.Gson)2