Fix port mismatch and return value judgement issue 42/88442/1
authorliboNet <libo.zhu@intel.com>
Fri, 24 May 2019 21:32:49 +0000 (05:32 +0800)
committerliboNet <libo.zhu@intel.com>
Fri, 24 May 2019 21:32:49 +0000 (05:32 +0800)
. the port of k8s plugin has changed from 8081 to 9015
. the value from 200 to 300 is acceptable from k8s plugin

Change-Id: I85c61d2275c7913f8c8dbeee0751349552bec29d
Issue-ID: MULTICLOUD-650
Signed-off-by: liboNet <libo.zhu@intel.com>
artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java

index d920907..9bfe264 100644 (file)
@@ -64,7 +64,7 @@ import org.onap.sdc.api.notification.IArtifactInfo;
 public class K8sArtifactForwarder implements ArtifactForwarder {
 
     private static final Logger LOGGER = FlexLogger.getLogger(K8sArtifactForwarder.class);
-    private static final String BASE_PATH = "http://localhost:8081/v1/rb/definition";
+    private static final String BASE_PATH = "http://localhost:9015/v1/rb/definition";
     private static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT";
     private Map<String, IArtifactInfo> artifactMap;
 
@@ -184,10 +184,12 @@ public class K8sArtifactForwarder implements ArtifactForwarder {
                 String result = EntityUtils.toString(closeableHttpResponse.getEntity());
                 System.out.println("result = {}" + result);
                 System.out.println("status  = {}" + closeableHttpResponse.getStatusLine().getStatusCode());
-                if ( closeableHttpResponse.getStatusLine().getStatusCode() != 200 ) {
-                    System.out.println("exception: ret= " + closeableHttpResponse.getStatusLine().getStatusCode());
-                } else {
+                int status = closeableHttpResponse.getStatusLine().getStatusCode();
+                // [200, 300] means pass
+                if ( (status >=200) && (status <= 300) ) {
                     ret = true;
+                } else {
+                    System.out.println("exception: ret= " + status);
                 }
 
                 closeableHttpResponse.close();