/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 European Software Marketing Ltd.
+ * ================================================================================
* 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.restclient;
public OperationResult getAndDeleteResource(String url, String transId) {
// First, GET the model
OperationResult getResponse = getResource(url, transId, MediaType.APPLICATION_XML_TYPE);
- if ((getResponse == null) || (getResponse.getResultCode() != Response.Status.OK.getStatusCode())) {
+ if (getResponse == null || getResponse.getResultCode() != Response.Status.OK.getStatusCode()) {
return getResponse;
}
public boolean useBasicAuth() {
- return (config.getAaiAuthenticationUser() != null) && (config.getAaiAuthenticationPassword() != null);
+ return config.getAaiAuthenticationUser() != null && config.getAaiAuthenticationPassword() != null;
}
private RestClient setupClient() {
RestClient restClient = new RestClient();
- // @formatter:off
- restClient.validateServerHostname(false)
- .validateServerCertChain(false)
- .clientCertFile(config.getAaiKeyStorePath())
- .clientCertPassword(config.getAaiKeyStorePassword());
- // @formatter:on
+ //Use certs only if SSL is enabled
+ if (config.useHttpsWithAAI())
+ {// @formatter:off
+ restClient.validateServerHostname(false)
+ .validateServerCertChain(false)
+ .clientCertFile(config.getAaiKeyStorePath())
+ .clientCertPassword(config.getAaiKeyStorePassword())
+ .connectTimeoutMs(120000)
+ .readTimeoutMs(120000);
+ // @formatter:on
+ }
+ else {
+ restClient.validateServerHostname(false)
+ .validateServerCertChain(false)
+ .connectTimeoutMs(120000)
+ .readTimeoutMs(120000);
+ }
if (useBasicAuth()) {
restClient.authenticationMode(RestAuthenticationMode.SSL_BASIC);