From 8aac2df744820304ee29354333661699e9695939 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Tue, 2 May 2017 15:11:04 -0700 Subject: Remove commented methods/fields in APPC Taking a stab at removing numerous commented out methods and fields. Almost all of what is removed is commented code with no explanation. Change-Id: I61cb1d7100ae6c75f6d42f500ade0504c97b760c Signed-off-by: Marcus G K Williams --- .../appc/adapter/chef/chefapi/ApiMethod.java | 24 ------------------ .../adapter/chef/chefclient/ChefApiClient.java | 21 ---------------- .../appc/adapter/chef/impl/ChefAdapterImpl.java | 29 ---------------------- 3 files changed, 74 deletions(-) (limited to 'appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle') diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefapi/ApiMethod.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefapi/ApiMethod.java index d2a0eb26f..c3ba7c1f3 100644 --- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefapi/ApiMethod.java +++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefapi/ApiMethod.java @@ -55,27 +55,8 @@ public class ApiMethod { private String methodName = "GET"; public String test = ""; private int returnCode; -// final String KEY_STORE_PATH = "/tmp/chef/trusted_certs/mykeystore.jks"; -// final String KEY_STORE_PASSWORD = "changeit"; public ApiMethod(String methodName) { -/* try { - SSLContext sslcontext = SSLContexts.custom() - .loadTrustMaterial(new File(KEY_STORE_PATH), KEY_STORE_PASSWORD.toCharArray(), - new TrustSelfSignedStrategy()) - .build(); - SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( - sslcontext, - new String[] { "TLSv1" }, - null, - SSLConnectionSocketFactory.getDefaultHostnameVerifier()); - client = HttpClients.custom() - .setSSLSocketFactory(sslsf) - .build(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }*/ client=HttpClients.createDefault(); this.methodName = methodName; } @@ -112,11 +93,6 @@ public class ApiMethod { for (int i = 0; i < auth_headers.length; i++) { method.addHeader("X-Ops-Authorization-" + (i + 1), auth_headers[i]); } - /* - * test=test+this.method.getMethod()+"\n"; Header[] - * RHS=this.method.getHeaders(); for (int i = 0; i < RHS.length; i++) { - * test=test+RHS[i]+"\n"; } test=test+this.reqBody+"\n"; - */ try{ response = client.execute(method); resCode = response.getStatusLine().getStatusCode(); diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/ChefApiClient.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/ChefApiClient.java index f3cc44bb2..743fe8456 100644 --- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/ChefApiClient.java +++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/ChefApiClient.java @@ -67,25 +67,4 @@ public class ChefApiClient { put.setChefPath(path); return put; } -/* public Post post(String path){ - Post post = new Post(new PostMethod(endpoint+path)); - post.setPemPath(pemPath); - post.setUserId(userId); - return post; - } - - public Delete delete(String path){ - Delete del = new Delete(new DeleteMethod(endpoint+path)); - del.setPemPath(pemPath); - del.setUserId(userId); - return del; - } - - -*/ -/* public Header[] buildHeaders(){ - - return null; - } -*/ } diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java index 39447bb70..5985bcfd1 100644 --- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java +++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java @@ -214,11 +214,6 @@ public class ChefAdapterImpl implements ChefAdapter { */ private Configuration configuration; - /** - * A cache of providers that are predefined. - */ - // private Map providerCache; - /** * This default constructor is used as a work around because the activator * wasnt getting called @@ -293,7 +288,6 @@ public class ChefAdapterImpl implements ChefAdapter { public void chefGet(Map params, SvcLogicContext ctx) { logger.info("chef get method"); String chefAction= params.get("org.openecomp.appc.instance.chefAction"); - // logger.info(vm_url); RequestContext rc = new RequestContext(ctx); rc.isAlive(); //should load pem from somewhere else @@ -306,13 +300,6 @@ public class ChefAdapterImpl implements ChefAdapter { String message = am.getResponseBodyAsString(); logger.info(code + " " + message); chefServerResult(rc,Integer.toString(code),message); -/* if (code == 200) { - doSuccess(rc); - } else { - String errorcode=code+" "; - doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, errorcode); - }*/ - } /** @@ -323,19 +310,13 @@ public class ChefAdapterImpl implements ChefAdapter { @Override public void chefPut(Map params, SvcLogicContext ctx) { - //String tVmIp = params.get("org.openecomp.appc.instance.ip"); - //logger.info(tVmIp); logger.info("chef PUT method"); logger.info(clientName+" "+clientPrivatekey+" "+chefserver+" "+organizations); - //String CHEF_NODE_STR= params.get("org.openecomp.appc.instance.chefRequestBody"); String chefAction= params.get("org.openecomp.appc.instance.chefAction"); String runList= params.get("org.openecomp.appc.instance.runList"); String attributes= params.get("org.openecomp.appc.instance.attributes"); logger.info(attributes); - //attributes="\"reconfig-test\":{\"secret\":\"newpass2\"}"; String CHEF_NODE_STR = "{\"json_class\":\"Chef::Node\",\"default\":{},\"chef_type\":\"node\",\"run_list\":[\""+runList+"\"],\"override\":{},\"automatic\":{},\"normal\":{"+attributes+"},\"name\":\"testnode\",\"chef_environment\":\"_default\"}"; - //String CHEF_NODE_STR = "{\"json_class\":\"Chef::Node\"}"; - // logger.info(vm_url); RequestContext rc = new RequestContext(ctx); rc.isAlive(); //should load pem from somewhere else @@ -349,15 +330,6 @@ public class ChefAdapterImpl implements ChefAdapter { String message = am.getResponseBodyAsString(); logger.info(code + " " + message); chefServerResult(rc,Integer.toString(code),message); -/* if (code == 200) { - logger.info("chef PUT method success"); - doSuccess(rc); - } else { - String errorcode=code+" "; - logger.info("chef PUT method failure"); - doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, errorcode); - }*/ - } @@ -371,7 +343,6 @@ public class ChefAdapterImpl implements ChefAdapter { public void trigger(Map params, SvcLogicContext ctx) { logger.info("Run trigger method"); String tVmIp = params.get("org.openecomp.appc.instance.ip"); - //String tUrl = "http://" + tVmIp; RequestContext rc = new RequestContext(ctx); rc.isAlive(); -- cgit 1.2.3-korg