Skip to content

Commit

Permalink
SpringBoot-Update & open-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-eggers committed Feb 12, 2017
1 parent d3db91e commit d362b68
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 58 deletions.
20 changes: 12 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<name>cawandu</name>
<description></description>
<url>https://github.com/julian-eggers/cawandu</url>
<version>0.2.25-RELEASE</version>
<version>0.3.0-RELEASE</version>

<properties>
<!-- System -->
Expand All @@ -17,7 +17,7 @@
<!-- Testing -->
<cobertura.version>2.7</cobertura.version>
<coveralls.version>4.1.0</coveralls.version>
<powermock.version>1.6.4</powermock.version>
<powermock.version>1.6.6</powermock.version>
<easymock.version>3.4</easymock.version>
<!-- UI -->
<zk.version>8.0.2.2</zk.version>
Expand All @@ -27,7 +27,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.4.RELEASE</version>
<version>1.5.1.RELEASE</version>
</parent>

<repositories>
Expand Down Expand Up @@ -153,7 +153,7 @@
<dependency>
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<version>6.1.1</version>
<version>7.0.2</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand All @@ -170,8 +170,8 @@
<scope>provided</scope>
</dependency>
</dependencies>
<scm>

<scm>
<url>https://github.com/julian-eggers/cawandu</url>
<connection>scm:git:https://github.com/julian-eggers/cawandu.git</connection>
<developerConnection>scm:git:https://github.com/julian-eggers/cawandu.git</developerConnection>
Expand Down Expand Up @@ -213,6 +213,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
<!-- TEST AND COVERAGE -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -244,10 +248,10 @@
<forceTags>true</forceTags>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>0.2</imageTag>
<imageTag>0.3</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<baseImage>jeanblanchard/java:serverjre-8</baseImage>
<baseImage>openjdk:8-jre-alpine</baseImage>
<volumes>
<volume>/var/log/apps</volume>
</volumes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.spotify.docker.client.DockerClient;
import com.spotify.docker.client.exceptions.DockerCertificateException;
import com.spotify.docker.client.exceptions.DockerException;
import com.spotify.docker.client.messages.AuthConfig;
import com.spotify.docker.client.messages.RegistryAuth;

@Configuration
public class DockerConfiguration
Expand Down Expand Up @@ -46,7 +46,7 @@ public void postConstruct()
public DockerClient dockerClient() throws DockerCertificateException
{
DefaultDockerClient.Builder dockerClientBuilder = getDockerClientBuilder();
dockerClientBuilder.authConfig(getAuthConfig());
dockerClientBuilder.registryAuth(getAuthConfig());
DockerClient dockerClient = dockerClientBuilder.build();
return dockerClient;
}
Expand All @@ -70,11 +70,11 @@ else if (Files.exists(Paths.get("/var/run/docker.sock")))
}
}

private AuthConfig getAuthConfig()
private RegistryAuth getAuthConfig()
{
if (isNotBlank(dockerRegistryUsername) && isNotBlank(dockerRegistryEmail) && isNotBlank(dockerRegistryPassword))
{
AuthConfig.Builder authConfigBuilder = AuthConfig.builder();
RegistryAuth.Builder authConfigBuilder = RegistryAuth.builder();
authConfigBuilder.username(dockerRegistryUsername);
authConfigBuilder.email(dockerRegistryEmail);
authConfigBuilder.password(dockerRegistryPassword);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.itelg.docker.cawandu.repository.http.parser;

import org.json.JSONException;
import org.springframework.core.convert.converter.Converter;

public abstract class AbstractJsonConverter<T> implements Converter<String, T>
{
@Override
public T convert(String json)
{
try
{
return convertJson(json);
}
catch (JSONException e)
{
throw new RuntimeException(e);
}
}

protected abstract T convertJson(String json) throws JSONException;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.itelg.docker.cawandu.repository.http.parser;

import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class RegistryAuthTokenParser implements Converter<String, String>
public class RegistryAuthTokenParser extends AbstractJsonConverter<String>
{
@Override
public String convert(String json)
public String convertJson(String json) throws JSONException
{
return new JSONObject(json).getString("token");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class RegistryImageTagListParser implements Converter<String, List<String>>
public class RegistryImageTagListParser extends AbstractJsonConverter<List<String>>
{
@Override
public List<String> convert(String json)
public List<String> convertJson(String json) throws JSONException
{
JSONObject jsonObject = new JSONObject(json);
JSONArray jsonArray = jsonObject.getJSONArray("tags");
Expand Down

This file was deleted.

0 comments on commit d362b68

Please sign in to comment.