From 9a40df1346876764fecf1cc170f482cc3722cd7a Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Fri, 14 Dec 2018 21:59:37 +0530 Subject: [PATCH] Update okhttp version to 3.12.0 --- CHANGELOG.md | 2 ++ .../dsl/internal/WatchConnectionManager.java | 5 ++++- .../fabric8/kubernetes/client/utils/Utils.java | 17 +++++++++++++++++ .../kubernetes/client/mock/CronJobTest.java | 15 +++------------ .../kubernetes/client/mock/DeploymentTest.java | 15 +++------------ .../kubernetes/client/mock/IngressTest.java | 15 +++------------ .../fabric8/kubernetes/client/mock/JobTest.java | 15 +++------------ .../client/mock/PodDisruptionBudgetTest.java | 16 +++------------- .../fabric8/kubernetes/client/mock/PodTest.java | 15 +++------------ .../client/mock/PriorityClassTest.java | 15 +++------------ .../client/server/mock/BuildConfigTest.java | 4 ++-- .../features/src/main/resources/feature.xml | 6 ++++-- pom.xml | 17 ++++++++++------- 13 files changed, 60 insertions(+), 97 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1c462fa4b..d39d0cc8e6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ * Updated jackson to 2.9.8 + * Upgrade okhttp to 3.12.0 + New Feature * Fix #1286: Pod Preset Support diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java index 4e8e0c125fc..766648583bc 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java @@ -81,7 +81,10 @@ public WatchConnectionManager(final OkHttpClient client, final BaseOperation properties, String property public static String getProperty(Map properties, String propertyName) { return getProperty(properties, propertyName, null); } + + /** + * Converts string to URL encoded string. + * + * @param str + * @return + */ + public static final String toUrlEncoded(String str) { + try { + return URLEncoder.encode(str, "UTF-8"); + } catch (UnsupportedEncodingException exception) { + // Ignore + } + return null; + } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CronJobTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CronJobTest.java index 4627fc042af..bd9de7f4747 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CronJobTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CronJobTest.java @@ -21,6 +21,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -63,8 +64,8 @@ public void testList() { @Test public void testListWithLables() { - server.expect().withPath("/apis/batch/v1beta1/namespaces/test/cronjobs?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new CronJobListBuilder().build()).always(); - server.expect().withPath("/apis/batch/v1beta1/namespaces/test/cronjobs?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new CronJobListBuilder() + server.expect().withPath("/apis/batch/v1beta1/namespaces/test/cronjobs?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new CronJobListBuilder().build()).always(); + server.expect().withPath("/apis/batch/v1beta1/namespaces/test/cronjobs?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new CronJobListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -252,14 +253,4 @@ public void testHandlersLoadFromFile() { assertTrue("Handler did not return expected single resource", 1==hasMetadata.size()); assertEquals("hasMetadata found did not match the expected name of the test input", "pi", hasMetadata.get(0).getMetadata().getName()); } - - /** - * Converts string to URL encoded string. - * It's not a full blown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentTest.java index b130f05b3c1..a8a49cea879 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentTest.java @@ -26,6 +26,7 @@ import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Rule; import org.junit.Test; @@ -69,8 +70,8 @@ public void testList() { @Test public void testListWithLabels() { - server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new DeploymentListBuilder().build()).always(); - server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new DeploymentListBuilder() + server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new DeploymentListBuilder().build()).always(); + server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new DeploymentListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -271,14 +272,4 @@ public void testCreateWithNameMismatch() { client.apps().deployments().inNamespace("test1").withName("mydeployment1").create(deployment1); } - - /** - * Converts string to URL encoded string. - * It's not a fullblown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/IngressTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/IngressTest.java index bc4ac260d34..4dc971506c0 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/IngressTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/IngressTest.java @@ -23,6 +23,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Rule; import org.junit.Test; @@ -66,8 +67,8 @@ public void testList() { @Test public void testListWithLables() { - server.expect().withPath("/apis/extensions/v1beta1/namespaces/test/ingresses?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new IngressListBuilder().build()).always(); - server.expect().withPath("/apis/extensions/v1beta1/namespaces/test/ingresses?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new IngressListBuilder() + server.expect().withPath("/apis/extensions/v1beta1/namespaces/test/ingresses?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new IngressListBuilder().build()).always(); + server.expect().withPath("/apis/extensions/v1beta1/namespaces/test/ingresses?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new IngressListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -167,14 +168,4 @@ public void testCreateWithNameMismatch() { client.extensions().ingress().inNamespace("test1").withName("myingress1").create(ingress1); } - /** - * Converts string to URL encoded string. - * It's not a fullblown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } - } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/JobTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/JobTest.java index 4444fe40af5..6dbcd47b272 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/JobTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/JobTest.java @@ -23,6 +23,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Rule; import org.junit.Test; @@ -66,8 +67,8 @@ public void testList() { @Test public void testListWithLables() { - server.expect().withPath("/apis/batch/v1/namespaces/test/jobs?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new JobListBuilder().build()).always(); - server.expect().withPath("/apis/batch/v1/namespaces/test/jobs?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new JobListBuilder() + server.expect().withPath("/apis/batch/v1/namespaces/test/jobs?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new JobListBuilder().build()).always(); + server.expect().withPath("/apis/batch/v1/namespaces/test/jobs?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new JobListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -232,14 +233,4 @@ public void testCreateWithNameMismatch() { client.batch().jobs().inNamespace("test1").withName("myjob1").create(job1); } - - /** - * Converts string to URL encoded string. - * It's not a fullblown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodDisruptionBudgetTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodDisruptionBudgetTest.java index 792e3b7dbac..aa54fba3424 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodDisruptionBudgetTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodDisruptionBudgetTest.java @@ -23,6 +23,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Rule; import org.junit.Test; @@ -66,8 +67,8 @@ public void list() { @Test public void testListWithLabels() { - server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PodDisruptionBudgetListBuilder().build()).always(); - server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PodDisruptionBudgetListBuilder() + server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PodDisruptionBudgetListBuilder().build()).always(); + server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PodDisruptionBudgetListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -151,15 +152,4 @@ public void testLoadFromFile() { KubernetesClient client = server.getClient(); assertNotNull(client.policy().podDisruptionBudget().load(getClass().getResourceAsStream("/test-pdb.yml")).get()); } - - /** - * Converts string to URL encoded string. - * It's not a full blown converter, it serves just the purpose of this test. - * - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java index 7a630eb2672..88c7e347884 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java @@ -16,6 +16,7 @@ package io.fabric8.kubernetes.client.mock; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -92,8 +93,8 @@ public void testList() { @Test public void testListWithLables() { - server.expect().withPath("/api/v1/namespaces/test/pods?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PodListBuilder().build()).always(); - server.expect().withPath("/api/v1/namespaces/test/pods?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PodListBuilder() + server.expect().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PodListBuilder().build()).always(); + server.expect().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PodListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -428,16 +429,6 @@ public void testPortForwardWithChannel() throws InterruptedException, IOExceptio assertEquals("Hello World!", got); } - /** - * Converts string to URL encoded string. - * It's not a fullblown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } - private static String portForwardEncode(boolean dataChannel, String str) { try { byte[] data = str.getBytes("UTF-8"); diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PriorityClassTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PriorityClassTest.java index d9c97137e7d..5f33f9856de 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PriorityClassTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PriorityClassTest.java @@ -23,6 +23,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; +import io.fabric8.kubernetes.client.utils.Utils; import org.junit.Rule; import org.junit.Test; @@ -51,8 +52,8 @@ public void testList() { @Test public void testListWithLables() { - server.expect().withPath("/apis/scheduling.k8s.io/v1beta1/priorityclasses?labelSelector=" + toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PriorityClassListBuilder().build()).always(); - server.expect().withPath("/apis/scheduling.k8s.io/v1beta1/priorityclasses?labelSelector=" + toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PriorityClassListBuilder() + server.expect().withPath("/apis/scheduling.k8s.io/v1beta1/priorityclasses?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PriorityClassListBuilder().build()).always(); + server.expect().withPath("/apis/scheduling.k8s.io/v1beta1/priorityclasses?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PriorityClassListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() @@ -146,14 +147,4 @@ public void testLoadFromFile() { KubernetesClient client = server.getClient(); assertNotNull(client.scheduling().priorityClass().load(getClass().getResourceAsStream("/test-priorityclass.yml")).get()); } - - /** - * Converts string to URL encoded string. - * It's not a full blown converter, it serves just the purpose of this test. - * @param str - * @return - */ - private static final String toUrlEncoded(String str) { - return str.replaceAll("=", "%3D"); - } } diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigTest.java index dd4febac974..d833a9beff9 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigTest.java @@ -167,9 +167,9 @@ public void testBinaryBuildWithTimeout() { @Test public void testDelete() { server.expect().withPath("/oapi/v1/namespaces/test/buildconfigs/bc1").andReturn(200, new BuildConfigBuilder().withNewMetadata().withName("bc1").and().build()).once(); - server.expect().withPath("/oapi/v1/namespaces/test/builds?labelSelector=openshift.io/build-config.name%3Dbc1").andReturn( 200, new BuildListBuilder().build()).once(); + server.expect().withPath("/oapi/v1/namespaces/test/builds?labelSelector=openshift.io%2Fbuild-config.name%3Dbc1").andReturn( 200, new BuildListBuilder().build()).once(); server.expect().withPath("/oapi/v1/namespaces/ns1/buildconfigs/bc2").andReturn( 200, new BuildConfigBuilder().withNewMetadata().withName("bc2").and().build()).once(); - server.expect().withPath("/oapi/v1/namespaces/ns1/builds?labelSelector=openshift.io/build-config.name%3Dbc2").andReturn( 200, new BuildListBuilder().build()).once(); + server.expect().withPath("/oapi/v1/namespaces/ns1/builds?labelSelector=openshift.io%2Fbuild-config.name%3Dbc2").andReturn( 200, new BuildListBuilder().build()).once(); OpenShiftClient client = server.getOpenshiftClient(); diff --git a/platforms/karaf/features/src/main/resources/feature.xml b/platforms/karaf/features/src/main/resources/feature.xml index 1f415958909..43888621595 100644 --- a/platforms/karaf/features/src/main/resources/feature.xml +++ b/platforms/karaf/features/src/main/resources/feature.xml @@ -19,15 +19,17 @@ mvn:javax.validation/validation-api/${validation.api.version} - mvn:com.fasterxml.jackson.core/jackson-core/${jackson.bundle.version} + mvn:com.google.code.findbugs/jsr305/${jsr305.version} + mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.bundle.version} mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.bundle.version} mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${jackson.bundle.version} mvn:org.yaml/snakeyaml/${snakeyaml.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.generex/${generex.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.automaton/${automaton.bundle.version} - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/${okio.bundle.version} + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.conscrypt-openjdk/${conscrypt-openjdk-uber.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okhttp/${okhttp.bundle.version} + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/${okio.bundle.version} mvn:io.fabric8/zjsonpatch/${zjsonpatch.version} mvn:io.fabric8/kubernetes-model/${project.version} mvn:io.fabric8/kubernetes-client/${project.version}/jar/bundle diff --git a/pom.xml b/pom.xml index d94dc288a6c..900359f4f75 100644 --- a/pom.xml +++ b/pom.xml @@ -78,11 +78,15 @@ UTF-8 - 0.1.0 - 3.9.1 - 3.9.1_2 - 1.13.0 - 1.13.0_1 + 0.1.1 + 3.12.0 + 3.12.0_1 + 1.15.0 + 1.15.0_1 + 3.0.2 + 2.5.0_1 + 1.4.2 + 1.4.2_1 1.0.1 1.0.1_1 1.11-8 @@ -102,8 +106,7 @@ 1.9.12 0.14.6 - 1.1.0.Final - + 2.0.1.Final 2.5.4 1.10 3.0.1