Search in sources :

Example 16 with Config

use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.

the class VolumeServiceTest method testCreateVolumeConfig.

@Test
public void testCreateVolumeConfig() throws Exception {
    final VolumeConfiguration config = new VolumeConfiguration.Builder().name("testVolume").driver("test").opts(withMap("opts")).labels(withMap("labels")).build();
    new Expectations() {

        {
            // Use a 'delegate' to verify the argument given directly. No need
            // for an 'intermediate' return method in the service just to check this.
            docker.createVolume(with(new Delegate<VolumeCreateConfig>() {

                void check(VolumeCreateConfig vcc) {
                    assertThat(vcc.getName(), is("testVolume"));
                    JSONObject vccJson = (JSONObject) JSONParser.parseJSON(vcc.toJson());
                    assertEquals(vccJson.get("Driver"), "test");
                }
            }));
            result = "testVolume";
        }
    };
    String volume = new VolumeService(docker).createVolume(config);
    assertEquals(volume, "testVolume");
}
Also used : Expectations(mockit.Expectations) VolumeCreateConfig(io.fabric8.maven.docker.access.VolumeCreateConfig) JSONObject(org.json.JSONObject) Delegate(mockit.Delegate) VolumeConfiguration(io.fabric8.maven.docker.config.VolumeConfiguration) Test(org.junit.Test)

Example 17 with Config

use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.

the class AuthConfigFactoryTest method checkDockerAuthLogin.

private void checkDockerAuthLogin(File homeDir, String configRegistry, String lookupRegistry) throws IOException, MojoExecutionException {
    writeDockerConfigJson(createDockerConfig(homeDir), "roland", "secret", "roland@jolokia.org", configRegistry);
    AuthConfig config = factory.createAuthConfig(isPush, false, null, settings, "roland", lookupRegistry);
    verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
}
Also used : AuthConfig(io.fabric8.maven.docker.access.AuthConfig)

Example 18 with Config

use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.

the class AuthConfigFactoryTest method testSystemProperty.

@Test
public void testSystemProperty() throws Exception {
    System.setProperty("docker.push.username", "roland");
    System.setProperty("docker.push.password", "secret");
    System.setProperty("docker.push.email", "roland@jolokia.org");
    try {
        AuthConfig config = factory.createAuthConfig(true, false, null, settings, null, null);
        verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
    } finally {
        System.clearProperty("docker.push.username");
        System.clearProperty("docker.push.password");
        System.clearProperty("docker.push.email");
    }
}
Also used : AuthConfig(io.fabric8.maven.docker.access.AuthConfig) Test(org.junit.Test)

Example 19 with Config

use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.

the class AuthConfigFactoryTest method testFromPluginConfiguration.

@Test
public void testFromPluginConfiguration() throws MojoExecutionException {
    Map pluginConfig = new HashMap();
    pluginConfig.put("username", "roland");
    pluginConfig.put("password", "secret");
    pluginConfig.put("email", "roland@jolokia.org");
    AuthConfig config = factory.createAuthConfig(isPush, false, pluginConfig, settings, null, null);
    verifyAuthConfig(config, "roland", "secret", "roland@jolokia.org");
}
Also used : HashMap(java.util.HashMap) AuthConfig(io.fabric8.maven.docker.access.AuthConfig) HashMap(java.util.HashMap) Map(java.util.Map) Collections.singletonMap(java.util.Collections.singletonMap) Test(org.junit.Test)

Example 20 with Config

use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.

the class AuthConfigTest method simpleConstructor.

@Test
public void simpleConstructor() {
    Map<String, String> map = new HashMap<String, String>();
    map.put("username", "roland");
    map.put("password", "secret");
    map.put("email", "roland@jolokia.org");
    AuthConfig config = new AuthConfig(map);
    check(config);
}
Also used : HashMap(java.util.HashMap) AuthConfig(io.fabric8.maven.docker.access.AuthConfig) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)107 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)37 HashMap (java.util.HashMap)36 IOException (java.io.IOException)34 File (java.io.File)30 ResourceConfig (io.fabric8.maven.core.config.ResourceConfig)28 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)27 Map (java.util.Map)27 ProcessorConfig (io.fabric8.maven.core.config.ProcessorConfig)23 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)21 Expectations (mockit.Expectations)20 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)19 ArrayList (java.util.ArrayList)19 ConfigMapBuilder (io.fabric8.kubernetes.api.model.ConfigMapBuilder)17 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)15 AbstractConfigHandlerTest (io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)15 AuthConfig (io.fabric8.maven.docker.access.AuthConfig)13 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)12 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)12 Before (org.junit.Before)12