/**
- * ============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;
import com.sun.jersey.core.util.MultivaluedMapImpl; // NOSONAR
-// import edu.emory.mathcs.backport.java.util.Collections;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
* @return operation result
*/
public OperationResult putResource(String url, String payload, String transId, MediaType mediaType) {
- logger.info(ModelLoaderMsgs.AAI_REST_REQUEST_PAYLOAD, payload);
+ logger.info(ModelLoaderMsgs.AAI_REST_REQUEST_PAYLOAD, payload);
return setupClient().put(url, payload, buildHeaders(transId), mediaType, mediaType);
}
* @return ClientResponse
*/
public OperationResult postResource(String url, String payload, String transId, MediaType mediaType) {
- logger.info(ModelLoaderMsgs.AAI_REST_REQUEST_PAYLOAD, payload);
+ logger.info(ModelLoaderMsgs.AAI_REST_REQUEST_PAYLOAD, payload);
return setupClient().post(url, payload, buildHeaders(transId), mediaType, mediaType);
}
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.validateServerHostname(false)
.validateServerCertChain(false)
.clientCertFile(config.getAaiKeyStorePath())
- .clientCertPassword(config.getAaiKeyStorePassword());
+ .clientCertPassword(config.getAaiKeyStorePassword())
+ .connectTimeoutMs(120000)
+ .readTimeoutMs(120000);
// @formatter:on
if (useBasicAuth()) {
* @param transId
* @return map of headers
*/
- @SuppressWarnings("unchecked")
private Map<String, List<String>> buildHeaders(String transId) {
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.put(HEADER_TRANS_ID, Collections.singletonList(transId));