Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit e0bec9a

Browse files
committed
go plugin api updates
1 parent ac4a07d commit e0bec9a

File tree

6 files changed

+32
-28
lines changed

6 files changed

+32
-28
lines changed

pom.xml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.oneandone</groupId>
77
<artifactId>go-maven-poller</artifactId>
8-
<version>1.1.0-SNAPSHOT</version>
8+
<version>1.2.0-SNAPSHOT</version>
99

1010
<url>https://github.com/1and1/go-maven-poller</url>
1111

@@ -30,21 +30,21 @@
3030

3131
<properties>
3232
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
33-
<go.version>14.4.0</go.version>
33+
<go.version>16.3.0</go.version>
3434
</properties>
3535

3636
<dependencies>
3737
<dependency>
3838
<groupId>org.projectlombok</groupId>
3939
<artifactId>lombok</artifactId>
40-
<version>1.16.2</version>
40+
<version>1.16.8</version>
4141
<scope>provided</scope>
4242
</dependency>
4343

4444
<dependency>
4545
<groupId>com.google.code.gson</groupId>
4646
<artifactId>gson</artifactId>
47-
<version>2.3.1</version>
47+
<version>2.5</version>
4848
</dependency>
4949

5050
<dependency>
@@ -53,18 +53,6 @@
5353
<version>18.0</version>
5454
</dependency>
5555

56-
<dependency>
57-
<groupId>org.apache.commons</groupId>
58-
<artifactId>commons-lang3</artifactId>
59-
<version>3.1</version>
60-
</dependency>
61-
62-
<dependency>
63-
<groupId>commons-logging</groupId>
64-
<artifactId>commons-logging</artifactId>
65-
<version>1.1.3</version>
66-
</dependency>
67-
6856
<dependency>
6957
<groupId>commons-io</groupId>
7058
<artifactId>commons-io</artifactId>
@@ -74,26 +62,26 @@
7462
<dependency>
7563
<groupId>org.apache.httpcomponents</groupId>
7664
<artifactId>httpclient</artifactId>
77-
<version>4.4.1</version>
65+
<version>4.5.1</version>
7866
</dependency>
7967

8068
<dependency>
8169
<groupId>org.apache.httpcomponents</groupId>
8270
<artifactId>httpcore</artifactId>
83-
<version>4.4.1</version>
71+
<version>4.4.4</version>
8472
</dependency>
8573

8674
<dependency>
8775
<groupId>cd.go.plugin</groupId>
8876
<artifactId>go-plugin-api</artifactId>
89-
<version>14.4.0</version>
77+
<version>${go.version}</version>
9078
<scope>provided</scope>
9179
</dependency>
9280

9381
<dependency>
9482
<groupId>junit</groupId>
9583
<artifactId>junit</artifactId>
96-
<version>4.11</version>
84+
<version>4.12</version>
9785
<scope>test</scope>
9886
</dependency>
9987

src/main/java/com/oneandone/go/plugin/maven/MavenRepositoryMaterial.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse;
1111
import com.thoughtworks.go.plugin.api.response.GoPluginApiResponse;
1212

13-
import java.util.Collections;
14-
import java.util.LinkedHashMap;
15-
import java.util.Map;
13+
import java.util.*;
1614

1715
import static com.oneandone.go.plugin.maven.util.JsonUtil.fromJsonString;
1816
import static com.oneandone.go.plugin.maven.util.JsonUtil.toJsonString;
@@ -33,6 +31,9 @@ public class MavenRepositoryMaterial extends AbstractGoPlugin {
3331
/** The plugin extension type. */
3432
public static final String EXTENSION = "package-repository";
3533

34+
/** Request to retrieve plugin configuration. */
35+
public static final String REQUEST_PLUGIN_GET_CONFIGURATION = "go.plugin-settings.get-configuration";
36+
3637
/** Request to retrieve the repository configuration definition.*/
3738
public static final String REQUEST_REPOSITORY_CONFIGURATION = "repository-configuration";
3839

@@ -71,6 +72,7 @@ public MavenRepositoryMaterial() {
7172
configurationProvider = new ConfigurationProvider();
7273
packageRepositoryPoller = new MavenRepositoryPoller();
7374

75+
handlerMap.put(REQUEST_PLUGIN_GET_CONFIGURATION, getConfigurationMessageHandler());
7476
handlerMap.put(REQUEST_REPOSITORY_CONFIGURATION, repositoryConfigurationsMessageHandler());
7577
handlerMap.put(REQUEST_PACKAGE_CONFIGURATION, packageConfigurationMessageHandler());
7678
handlerMap.put(REQUEST_VALIDATE_REPOSITORY_CONFIGURATION, validateRepositoryConfigurationMessageHandler());
@@ -99,6 +101,15 @@ public GoPluginIdentifier pluginIdentifier() {
99101
return new GoPluginIdentifier(EXTENSION, Collections.singletonList("1.0"));
100102
}
101103

104+
private MessageHandler getConfigurationMessageHandler() {
105+
return new MessageHandler() {
106+
@Override
107+
public GoPluginApiResponse handle(final GoPluginApiRequest request) {
108+
return success(toJsonString(new Object()));
109+
}
110+
};
111+
}
112+
102113
/**
103114
* Returns a message handler for request of type [@link REQUEST_PACKAGE_CONFIGURATION}.
104115
*

src/main/java/com/oneandone/go/plugin/maven/MavenRepositoryPoller.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.oneandone.go.plugin.maven;
22

3-
import com.google.common.base.Joiner;
43
import com.oneandone.go.plugin.maven.client.RepositoryClient;
54
import com.oneandone.go.plugin.maven.client.RepositoryConnector;
65
import com.oneandone.go.plugin.maven.config.ConfigurationProperties;

src/main/java/com/oneandone/go/plugin/maven/client/RepositoryConnector.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import com.oneandone.go.plugin.maven.util.MavenVersion;
66
import com.thoughtworks.go.plugin.api.logging.Logger;
77
import java.net.MalformedURLException;
8-
import java.net.URI;
98
import java.net.URL;
10-
import java.util.logging.Level;
119
import org.apache.http.HttpEntity;
1210
import org.apache.http.HttpHost;
1311
import org.apache.http.HttpResponse;

src/main/resources/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<about>
44
<name>Maven repository plugin</name>
55
<version>${project.version}</version>
6-
<target-go-version>14.4</target-go-version>
6+
<target-go-version>16.3</target-go-version>
77
<description>Polls a Maven repository by maven-metadata.xml</description>
88
<vendor>
99
<name>1und1 Internet AG</name>

src/test/java/com/oneandone/go/plugin/maven/MavenRepositoryMaterialTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import java.io.File;
1818
import java.lang.reflect.Field;
19+
import java.util.Collections;
1920
import java.util.HashMap;
2021
import java.util.Map;
2122
import java.util.concurrent.Executors;
@@ -67,8 +68,15 @@ public void testHandle() throws Exception {
6768

6869
final MavenRepositoryMaterial repositoryMaterial = new MavenRepositoryMaterial();
6970

71+
// request get conf
72+
GoPluginApiResponse response = repositoryMaterial.handle(request("go.plugin-settings.get-configuration", null));
73+
assertNotNull(response);
74+
assertEquals(200, response.responseCode());
75+
assertEquals(Collections.emptyMap(), response.responseHeaders());
76+
assertEquals("{}", response.responseBody());
77+
7078
// request repo conf
71-
GoPluginApiResponse response = repositoryMaterial.handle(request("repository-configuration", null));
79+
response = repositoryMaterial.handle(request("repository-configuration", null));
7280
PackageMaterialProperties properties = JsonUtil.fromJsonString(response.responseBody(), PackageMaterialProperties.class);
7381
assertNotNull(properties);
7482

0 commit comments

Comments
 (0)