Skip to content

Commit f5da908

Browse files
committed
release 0.9.0
1 parent 92aae88 commit f5da908

6 files changed

Lines changed: 151 additions & 110 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ Add this dependency to your project's POM:
4545
<dependency>
4646
<groupId>io.github.kubesys</groupId>
4747
<artifactId>kubernetes-client</artifactId>
48-
<version>2.3.0</version>
48+
<version>0.9.0</version>
4949
</dependency>
5050

5151
<repositories>
5252
<repository>
5353
<id>pdos-repos</id>
5454
<name>PDOS Releases</name>
55-
<url>https://nexus3.iecas.cn/repository/maven-public/</url>
55+
<url>http://139.9.165.93:31016/repository/maven-public/</url>
5656
</repository>
5757
</repositories>
5858
```

pom.xml

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>io.github.kubesys</groupId>
7-
<artifactId>kubernetes-client</artifactId>
8-
<version>2.2.3</version>
7+
<artifactId>client-java</artifactId>
8+
<version>0.9.0</version>
99
<packaging>jar</packaging>
1010

11-
<name>kubernetes-client</name>
11+
<name>client-java</name>
1212
<url>http://maven.apache.org</url>
1313

1414
<properties>
15-
<jackson.version>2.14.2</jackson.version>
15+
<jackson.version>2.15.2</jackson.version>
1616
<httpclient.version>5.2.1</httpclient.version>
17-
<junit.version>4.13.2</junit.version>
17+
<junit.version>5.9.3</junit.version>
1818
</properties>
1919

2020
<licenses>
@@ -55,10 +55,10 @@
5555
<version>${httpclient.version}</version>
5656
</dependency>
5757

58-
<!-- https://mvnrepository.com/artifact/junit/junit -->
58+
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
5959
<dependency>
60-
<groupId>junit</groupId>
61-
<artifactId>junit</artifactId>
60+
<groupId>org.junit.jupiter</groupId>
61+
<artifactId>junit-jupiter-api</artifactId>
6262
<version>${junit.version}</version>
6363
<scope>test</scope>
6464
</dependency>
@@ -99,32 +99,6 @@
9999
</configuration>
100100
</plugin>
101101

102-
<plugin>
103-
<artifactId>maven-assembly-plugin</artifactId>
104-
<configuration>
105-
<archive>
106-
<manifest>
107-
<mainClass>com.github.kubesys.tests.WatchKindTest</mainClass>
108-
</manifest>
109-
<manifestEntries>
110-
<Class-Path>.</Class-Path>
111-
</manifestEntries>
112-
</archive>
113-
<descriptorRefs>
114-
<descriptorRef>jar-with-dependencies</descriptorRef>
115-
</descriptorRefs>
116-
</configuration>
117-
<executions>
118-
<execution>
119-
<id>make-assembly</id>
120-
<phase>package</phase>
121-
<goals>
122-
<goal>single</goal>
123-
</goals>
124-
</execution>
125-
</executions>
126-
</plugin>
127-
128102
<plugin>
129103
<artifactId>maven-resources-plugin</artifactId>
130104
<executions>
@@ -191,6 +165,67 @@
191165
</build>
192166

193167

168+
<profiles>
169+
<profile>
170+
<id>release</id>
171+
<build>
172+
<plugins>
173+
<!-- Source -->
174+
<plugin>
175+
<groupId>org.apache.maven.plugins</groupId>
176+
<artifactId>maven-source-plugin</artifactId>
177+
<version>2.2.1</version>
178+
<executions>
179+
<execution>
180+
<phase>package</phase>
181+
<goals>
182+
<goal>jar-no-fork</goal>
183+
</goals>
184+
</execution>
185+
</executions>
186+
</plugin>
187+
<!-- Javadoc -->
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-javadoc-plugin</artifactId>
191+
<version>2.9.1</version>
192+
<executions>
193+
<execution>
194+
<phase>package</phase>
195+
<goals>
196+
<goal>jar</goal>
197+
</goals>
198+
</execution>
199+
</executions>
200+
</plugin>
201+
<!-- GPG -->
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-gpg-plugin</artifactId>
205+
<version>1.5</version>
206+
<executions>
207+
<execution>
208+
<phase>verify</phase>
209+
<goals>
210+
<goal>sign</goal>
211+
</goals>
212+
</execution>
213+
</executions>
214+
</plugin>
215+
</plugins>
216+
</build>
217+
<distributionManagement>
218+
<snapshotRepository>
219+
<id>oss</id>
220+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
221+
</snapshotRepository>
222+
<repository>
223+
<id>oss</id>
224+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
225+
</repository>
226+
</distributionManagement>
227+
</profile>
228+
</profiles>
194229
<distributionManagement>
195230
<snapshotRepository>
196231
<id>ossrh</id>
@@ -202,21 +237,4 @@
202237
</repository>
203238
</distributionManagement>
204239

205-
<!-- <profiles>
206-
<profile>
207-
<id>sonar</id>
208-
<activation>
209-
<activeByDefault>true</activeByDefault>
210-
</activation>
211-
<properties>
212-
<sonar.jdbc.url>jdbc:postgresql://39.100.71.73:30306/sonar</sonar.jdbc.url>
213-
<sonar.jdbc.username>postgres</sonar.jdbc.username>
214-
<sonar.jdbc.password>onceas</sonar.jdbc.password>
215-
<sonar.host.url>http://39.100.71.73:31014</sonar.host.url>
216-
<sonar.login>admin</sonar.login>
217-
<sonar.password>adminadmin</sonar.password>
218-
<sonar.projectName>kubernetes-client-java</sonar.projectName>
219-
</properties>
220-
</profile>
221-
</profiles> -->
222240
</project>

src/main/java/io/github/kubesys/client/KubernetesWatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public void run() {
4646
BufferedReader br = null;
4747
try {
4848
CloseableHttpClient httpClient = client.copy().getHttpClient();
49+
@SuppressWarnings("deprecation")
4950
CloseableHttpResponse execute = httpClient.execute(request);
5051

5152
br = new BufferedReader(new InputStreamReader(

src/test/java/io/github/kubesys/client/core/ConvertorTest.java

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
*/
44
package io.github.kubesys.client.core;
55

6-
import static org.junit.Assert.assertEquals;
6+
import static org.junit.jupiter.api.Assertions.assertEquals;
7+
import static org.junit.jupiter.api.Assertions.assertThrows;
78

89
import java.util.Arrays;
910

10-
import org.junit.Test;
11+
import org.junit.jupiter.api.Test;
1112

1213
import com.fasterxml.jackson.databind.ObjectMapper;
1314
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -86,80 +87,99 @@ public static void main(String[] args) {
8687
System.out.println(convertor.createUrl(podJson));
8788
}
8889

89-
@Test(expected = NullPointerException.class)
90-
public void testNullCreateURL() {
91-
convertor.createUrl(null);
90+
@Test
91+
void testNullCreateURL() {
92+
assertThrows(NullPointerException.class, () -> {
93+
convertor.createUrl(null);
94+
});
95+
9296
}
9397

94-
@Test(expected = NullPointerException.class)
95-
public void testInvalidJsonCreateURL() {
96-
convertor.createUrl(new ObjectMapper().createObjectNode());
98+
@Test
99+
void testInvalidJsonCreateURL() {
100+
assertThrows(NullPointerException.class, () -> {
101+
convertor.createUrl(new ObjectMapper().createObjectNode());
102+
});
97103
}
98104

99-
@Test(expected = NullPointerException.class)
100-
public void testNullBindingURL() {
101-
convertor.bindingUrl(null);
105+
@Test
106+
void testNullBindingURL() {
107+
assertThrows(NullPointerException.class, () -> {
108+
convertor.bindingUrl(null);
109+
});
102110
}
103111

104-
@Test(expected = NullPointerException.class)
105-
public void testInvalidJsonBindingURL() {
106-
convertor.bindingUrl(new ObjectMapper().createObjectNode());
112+
@Test
113+
void testInvalidJsonBindingURL() {
114+
assertThrows(NullPointerException.class, () -> {
115+
convertor.bindingUrl(new ObjectMapper().createObjectNode());
116+
});
107117
}
108118

109-
@Test(expected = NullPointerException.class)
110-
public void testNullDeleteKindURL() {
111-
convertor.deleteUrl(null, "abc", "abc");
119+
@Test
120+
void testNullDeleteKindURL() {
121+
assertThrows(NullPointerException.class, () -> {
122+
convertor.deleteUrl(null, "abc", "abc");
123+
});
112124
}
113125

114-
@Test(expected = NullPointerException.class)
115-
public void testNullDeleteNameURL1() {
116-
convertor.deleteUrl("abc", "abc", null);
126+
@Test
127+
void testNullDeleteNameURL1() {
128+
assertThrows(NullPointerException.class, () -> {
129+
convertor.deleteUrl("abc", "abc", null);
130+
});
117131
}
118132

119-
@Test(expected = NullPointerException.class)
120-
public void testNullDeleteNameURL2() {
121-
convertor.deleteUrl("abc", "abc", "");
133+
@Test
134+
void testNullDeleteNameURL2() {
135+
assertThrows(NullPointerException.class, () -> {
136+
convertor.deleteUrl("abc", "abc", "");
137+
});
138+
122139
}
123140

124-
@Test(expected = NullPointerException.class)
125-
public void testNullListKindURL() {
126-
convertor.listUrl(null, "abc");
141+
@Test
142+
void testNullListKindURL() {
143+
assertThrows(NullPointerException.class, () -> {
144+
convertor.listUrl(null, "abc");
145+
});
146+
127147
}
128148

129149
@Test
130-
public void testValidCreateURL() {
150+
void testValidCreateURL() {
131151
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods", convertor.createUrl(podJson));
132152
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments", convertor.createUrl(deployJson));
133153
assertEquals("https://39.100.71.73:6443/api/v1/nodes", convertor.createUrl(nodeJson));
134154
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/ingressclasses", convertor.createUrl(igrsJson));
135155
}
136156

137157
@Test
138-
public void testValidDeleteURL() {
158+
void testValidDeleteURL() {
139159
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods/testPod", convertor.deleteUrl("Pod", "kube-system", "testPod"));
140160
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments/testDeploy", convertor.deleteUrl("apps.Deployment", "kube-system", "testDeploy"));
141161
assertEquals("https://39.100.71.73:6443/api/v1/nodes/testNode", convertor.deleteUrl("Node", "", "testNode"));
142162
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/ingressclasses/testIngress", convertor.deleteUrl("networking.k8s.io.IngressClass", "", "testIngress"));
143163
}
144164

145165
@Test
146-
public void testValidUpdateURL() {
166+
void testValidUpdateURL() {
147167
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods/testPod", convertor.updateUrl("Pod", "kube-system", "testPod"));
148168
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments/testDeploy", convertor.updateUrl("apps.Deployment", "kube-system", "testDeploy"));
149169
assertEquals("https://39.100.71.73:6443/api/v1/nodes/testNode", convertor.updateUrl("Node", "", "testNode"));
150170
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/ingressclasses/testIngress", convertor.updateUrl("networking.k8s.io.IngressClass", "", "testIngress"));
151171
}
152172

153173
@Test
154-
public void testValidGetURL() {
174+
void testValidGetURL() {
155175
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods/testPod", convertor.getUrl("Pod", "kube-system", "testPod"));
156176
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments/testDeploy", convertor.getUrl("apps.Deployment", "kube-system", "testDeploy"));
157177
assertEquals("https://39.100.71.73:6443/api/v1/nodes/testNode", convertor.getUrl("Node", "", "testNode"));
158178
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/ingressclasses/testIngress", convertor.getUrl("networking.k8s.io.IngressClass", "", "testIngress"));
159179
}
160180

161181
@Test
162-
public void testValidListURL() {
182+
void testValidListURL() {
163183
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods", convertor.listUrl("Pod", "kube-system"));
164184
assertEquals("https://39.100.71.73:6443/api/v1/pods", convertor.listUrl("Pod", ""));
165185
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments", convertor.listUrl("apps.Deployment", "kube-system"));
@@ -169,23 +189,23 @@ public void testValidListURL() {
169189
}
170190

171191
@Test
172-
public void testValidUpdateStatusUrlURL() {
192+
void testValidUpdateStatusUrlURL() {
173193
assertEquals("https://39.100.71.73:6443/api/v1/namespaces/kube-system/pods/testPod/status", convertor.updateStatusUrl("Pod", "kube-system", "testPod"));
174194
assertEquals("https://39.100.71.73:6443/apis/apps/v1/namespaces/kube-system/deployments/testDeploy/status", convertor.updateStatusUrl("apps.Deployment", "kube-system", "testDeploy"));
175195
assertEquals("https://39.100.71.73:6443/api/v1/nodes/testNode/status", convertor.updateStatusUrl("Node", "", "testNode"));
176196
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/ingressclasses/testIngress/status", convertor.updateStatusUrl("networking.k8s.io.IngressClass", "", "testIngress"));
177197
}
178198

179199
@Test
180-
public void testValidWatchOneUrlURL() {
200+
void testValidWatchOneUrlURL() {
181201
assertEquals("https://39.100.71.73:6443/api/v1/watch/namespaces/kube-system/pods/testPod?watch=true&timeoutSeconds=315360000", convertor.watchOneUrl("Pod", "kube-system", "testPod"));
182202
assertEquals("https://39.100.71.73:6443/apis/apps/v1/watch/namespaces/kube-system/deployments/testDeploy?watch=true&timeoutSeconds=315360000", convertor.watchOneUrl("apps.Deployment", "kube-system", "testDeploy"));
183203
assertEquals("https://39.100.71.73:6443/api/v1/watch/nodes/testNode?watch=true&timeoutSeconds=315360000", convertor.watchOneUrl("Node", "", "testNode"));
184204
assertEquals("https://39.100.71.73:6443/apis/networking.k8s.io/v1/watch/ingressclasses/testIngress?watch=true&timeoutSeconds=315360000", convertor.watchOneUrl("networking.k8s.io.IngressClass", "", "testIngress"));
185205
}
186206

187207
@Test
188-
public void testValidWatchAllUrlURL() {
208+
void testValidWatchAllUrlURL() {
189209
assertEquals("https://39.100.71.73:6443/api/v1/watch/namespaces/kube-system/pods?watch=true&timeoutSeconds=315360000", convertor.watchAllUrl("Pod", "kube-system"));
190210
assertEquals("https://39.100.71.73:6443/api/v1/watch/pods?watch=true&timeoutSeconds=315360000", convertor.watchAllUrl("Pod", ""));
191211
assertEquals("https://39.100.71.73:6443/apis/apps/v1/watch/namespaces/kube-system/deployments?watch=true&timeoutSeconds=315360000", convertor.watchAllUrl("apps.Deployment", "kube-system"));

0 commit comments

Comments
 (0)