From b35670742c728d7d85da2f9c856c51a5889449d6 Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Mon, 4 Sep 2017 14:52:07 +0300 Subject: [VID-55] Upgrade Tosca Parser (merge) Change-Id: I5389f1641ef22df3ed569a154b3c367117c04d04 Signed-off-by: Ofir Sonsino --- .../java/org/openecomp/aai/util/AAIProperties.java | 12 +++--- .../org/openecomp/aai/util/AAIRestInterface.java | 47 ++++++---------------- .../aai/util/CustomJacksonJaxBJsonProvider.java | 12 +++--- .../org/openecomp/aai/util/HttpsAuthClient.java | 12 +++--- .../JettyObfuscationConversionCommandLineUtil.java | 12 +++--- 5 files changed, 37 insertions(+), 58 deletions(-) (limited to 'vid-app-common/src/main/java/org/openecomp/aai') diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java index ca710f6fc..9716ba827 100755 --- a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java +++ b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java @@ -1,9 +1,9 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. * ============LICENSE_END========================================================= */ diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java index cd5095191..243410050 100755 --- a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java +++ b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java @@ -276,43 +276,22 @@ public class AAIRestInterface { if (xml) responseType = "application/xml"; - initRestClient(); - - String clientCert = SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT); - - boolean useClientCert = false; - if (clientCert != null && - SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) { - useClientCert = true; - } + initRestClient(); url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL_BASE) + path; - final Response cres; - if (useClientCert == true) { - cres = client.target(url) - .request() - .accept(responseType) - .header("X-TransactionId", transId) - .header("X-FromAppId", fromAppId) - .header("Content-Type", "application/json") - .post(Entity.entity(payload, MediaType.APPLICATION_JSON)); - } else { - - String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME); - String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X)); - String encodeThis = vidUsername + ":" + vidPassword; - - cres = client.target(url) - .request() - .accept(responseType) - .header("X-TransactionId", transId) - .header("X-FromAppId", fromAppId) - .header("Content-Type", "application/json") - .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8"))) - .post(Entity.entity(payload, MediaType.APPLICATION_JSON)); - } - + String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME); + String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X)); + String encodeThis = vidUsername + ":" + vidPassword; + + final Response cres = client.target(url) + .request() + .accept(responseType) + .header("X-TransactionId", transId) + .header("X-FromAppId", fromAppId) + .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8"))) + .post(Entity.entity(payload, MediaType.APPLICATION_JSON)); + if (cres.getStatus() == 200 && cres.getStatus() <= 299) { logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java b/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java index 2623d6b6f..1ed079219 100755 --- a/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java +++ b/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java @@ -1,9 +1,9 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. * ============LICENSE_END========================================================= */ diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java index 8335d15b2..6a3665edb 100755 --- a/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java +++ b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java @@ -1,9 +1,9 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. * ============LICENSE_END========================================================= */ diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java b/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java index e4c4bcef1..e31b0c1c7 100755 --- a/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java +++ b/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java @@ -1,9 +1,9 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. * ============LICENSE_END========================================================= */ -- cgit 1.2.3-korg