summaryrefslogtreecommitdiffstats
path: root/bpmn/MSORESTClient/src
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-01-31 11:40:03 +0100
committerChrisC <cc697w@intl.att.com>2017-01-31 12:59:33 +0100
commit025301d08b061482c1f046d562bf017c8cbcfe8d (patch)
tree68a2a549736c9bf0f7cd4e71c76e40ef7e2606f2 /bpmn/MSORESTClient/src
parent2754ad52f833278a5c925bd788a16d1dce16a598 (diff)
Initial OpenECOMP MSO commit
Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'bpmn/MSORESTClient/src')
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java143
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java45
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java65
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java618
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java131
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java85
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java217
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java140
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java79
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java78
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java1068
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java366
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java77
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java110
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java78
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java78
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java83
17 files changed, 3461 insertions, 0 deletions
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
new file mode 100644
index 0000000000..dfb9f36e9a
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+import java.io.IOException;
+
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+
+/**
+ * An immutable class that encapsulates an API response.
+ *
+ * @version 1.0
+ * @since 1.0
+ */
+public class APIResponse {
+ private final int statusCode;
+ private final byte[] responseBody;
+ private final HttpHeader[] headers;
+
+ /**
+ * Internal method used to create http headers using the specified
+ * HttpResponse object.
+ *
+ * @param httpResponse used to create headers
+ * @return http headers
+ */
+ private HttpHeader[] buildHeaders(final HttpResponse httpResponse) {
+ final Header[] headers = httpResponse.getAllHeaders();
+
+ HttpHeader[] httpHeaders = new HttpHeader[headers.length];
+ for (int i = 0; i < headers.length; ++i) {
+ final Header header = headers[i];
+ final String name = header.getName();
+ final String value = header.getValue();
+ final HttpHeader httpHeader = new HttpHeader(name, value);
+ httpHeaders[i] = httpHeader;
+ }
+
+ return httpHeaders;
+ }
+
+ /**
+ * Create an APIResponse object using the specified HttpResponse object.
+ *
+ * @param httpResponse used to create the APIResponse
+ *
+ * @throws RESTException if unable to read from the HttpResponse object
+ */
+ public APIResponse(final HttpResponse httpResponse) throws RESTException {
+ try {
+ this.statusCode = httpResponse.getStatusLine().getStatusCode();
+
+ if (httpResponse.getEntity() == null)
+ {
+ this.responseBody = null;
+ }
+ else
+ {
+ this.responseBody = EntityUtils.toByteArray(httpResponse.getEntity());
+ }
+
+ this.headers = buildHeaders(httpResponse);
+ } catch (IOException ioe) {
+ throw new RESTException(ioe);
+ }
+ }
+
+ /**
+ * Gets the http status code returned by the api server.
+ * <p>
+ * For example, status code 200 represents 'OK.'
+ *
+ * @return status code
+ */
+ public int getStatusCode() {
+ return this.statusCode;
+ }
+
+ /**
+ * Gets the http response body as a byte array.
+ *
+ * @return http response body
+ */
+ public byte[] getResponseBodyAsByteArray() {
+ return this.responseBody;
+ }
+
+ /**
+ * Gets the http response body as a string.
+ *
+ * @return http response body
+ */
+ public String getResponseBodyAsString() {
+ if (this.responseBody != null) {
+ return new String(this.responseBody);
+ } else {
+ return "";
+ }
+ }
+
+ /**
+ * Gets a list of all the headers returned by the API response.
+ *
+ * @return an array of all the HttpHeaders
+ */
+ public HttpHeader[] getAllHeaders() {
+ // avoid exposing internals, create copy
+ HttpHeader[] copy = new HttpHeader[this.headers.length];
+ for (int i = 0; i < this.headers.length; ++i) {
+ copy[i] = headers[i];
+ }
+ return copy;
+ }
+
+ public String getFirstHeader(String name) {
+ for (HttpHeader header : headers) {
+ if (header.getName().equals(name)) {
+ return header.getValue();
+ }
+ }
+ return null;
+ }
+}
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java
new file mode 100644
index 0000000000..f597fdfaa7
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+import javax.net.ssl.SSLException;
+
+import org.apache.http.conn.ssl.AbstractVerifier;
+
+/**
+ * @version 1.0
+ * Place holder to validate host name, for now just invokes the super class method
+ *
+ */
+public class HostNameVerifier extends AbstractVerifier {
+
+ public final void verify(
+ final String host,
+ final String[] cns,
+ final String[] subjectAlts) throws SSLException {
+ try {
+ verify(host, cns, subjectAlts, true);
+ } catch (SSLException sex) {
+
+ }
+ }
+
+}
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java
new file mode 100644
index 0000000000..e0d6c3056d
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+/**
+ * An immutable class used to wrap an http header.
+ *
+ * @version 1.0
+ * @since 1.0
+ */
+public class HttpHeader {
+ private final String name;
+ private final String value;
+
+ /**
+ * Create an http header using the specified name and value
+ *
+ * @param name name of http header
+ * @param value value of http header
+ */
+ public HttpHeader(final String name, final String value) {
+ if (name == null) {
+ throw new IllegalArgumentException("Name may not be null.");
+ }
+
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Gets the header name.
+ *
+ * @return header name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Gets the header value.
+ *
+ * @return header value
+ */
+ public String getValue() {
+ return this.value;
+ }
+}
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
new file mode 100644
index 0000000000..5c200046ca
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
@@ -0,0 +1,618 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import javax.net.ssl.SSLSocketFactory;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPatch;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.message.AbstractHttpMessage;
+import org.apache.http.util.EntityUtils;
+
+/**
+ * Client used to send RESTFul requests.
+ * <p>
+ * Many of the methods return a reference to the 'this,' thereby allowing
+ * method chaining.
+ * <br>
+ * An example of usage can be found below:
+ * <pre>
+ * RESTClient client;
+ * try {
+ * client = new RESTClient("http://www.openecomp.org");
+ * APIResponse response = client
+ * .setHeader("Accept", "application/json")
+ * .setHeader("Clientid", "clientid")
+ * .setHeader("header", "value")
+ * .httpPost("postbody");
+ * if (response.getStatusCode() == 200) {
+ * System.out.println("Success!");
+ * }
+ * } catch (RESTException re) {
+ * // Handle Exception
+ * }
+ * </pre>
+ *
+ * @version 1.0
+ * @since 1.0
+ */
+public class RESTClient {
+ private final String proxyHost;
+ private final int proxyPort;
+
+ private final String URL;
+
+ private final LinkedHashMap<String, List<String>> headers;
+ private final LinkedHashMap<String, List<String>> parameters;
+
+ private HttpEntity httpEntity;
+ private HttpClient unitTestClient;
+
+ /**
+ * Internal method used to build an APIResponse using the specified
+ * HttpResponse object.
+ *
+ * @param response response wrapped inside an APIResponse object
+ * @return api response
+ */
+ private APIResponse buildResponse(HttpResponse response)
+ throws RESTException {
+
+ return new APIResponse(response);
+ }
+
+ /**
+ * Used to release any resources used by the connection.
+ * @param response HttpResponse object used for releasing the connection
+ * @throws RESTException if unable to release connection
+ *
+ */
+ private void releaseConnection(HttpResponse response) throws RESTException {
+ try {
+ EntityUtils.consume(response.getEntity());
+ } catch (IOException ioe) {
+ throw new RESTException(ioe);
+ }
+ }
+
+ /**
+ * Sets headers to the http message.
+ *
+ * @param httpMsg http message to set headers for
+ */
+ private void addInternalHeaders(AbstractHttpMessage httpMsg) {
+ if (headers.isEmpty()) {
+ return;
+ }
+
+ final Set<String> keySet = headers.keySet();
+ for (final String key : keySet) {
+ final List<String> values = headers.get(key);
+ for (final String value : values) {
+ httpMsg.addHeader(key, value);
+ }
+ }
+ }
+
+ /**
+ * Builds the query part of a URL.
+ *
+ * @return query
+ */
+ private String buildQuery() {
+ if (this.parameters.size() == 0) {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder();
+ String charSet = "UTF-8";
+ try {
+ Iterator<String> keyitr = this.parameters.keySet().iterator();
+ for (int i = 0; keyitr.hasNext(); ++i) {
+ if (i > 0) {
+ sb.append("&");
+ }
+
+ final String name = keyitr.next();
+ final List<String> values = this.parameters.get(name);
+ for(final String value : values) {
+ sb.append(URLEncoder.encode(name, charSet));
+ sb.append("=");
+ sb.append(URLEncoder.encode(value, charSet));
+ }
+ }
+ } catch (UnsupportedEncodingException e) {
+ // should not occur
+ e.printStackTrace();
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Creates an http client that can be used for sending http requests.
+ *
+ * @return created http client
+ *
+ * @throws RESTException if unable to create http client.
+ */
+ private CloseableHttpClient createClient() throws RESTException {
+ //TODO - we may want to trust self signed certificate at some point - add implementation here
+ HttpClientBuilder clientBuilder;
+
+ try {
+ SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(
+ (SSLSocketFactory) SSLSocketFactory.getDefault(),
+ new HostNameVerifier());
+ Registry<ConnectionSocketFactory> registry = RegistryBuilder
+ .<ConnectionSocketFactory> create()
+ .register("http",
+ PlainConnectionSocketFactory.getSocketFactory())
+ .register("https", sslSocketFactory).build();
+ PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(
+ registry);
+ clientBuilder = HttpClientBuilder.create().setConnectionManager(
+ manager);
+ } catch (Exception ex) {
+ throw new RESTException(ex.getMessage());
+ }
+ clientBuilder.disableRedirectHandling();
+
+ if ((this.proxyHost != null) && (this.proxyPort != -1)) {
+ HttpHost proxy = new HttpHost(this.proxyHost, this.proxyPort);
+ clientBuilder.setProxy(proxy);
+ }
+
+ return clientBuilder.build();
+ }
+
+ /**
+ * Creates a RESTClient with the specified URL, proxy host, and proxy port.
+ *
+ * @param URL URL to send request to
+ * @param proxyHost proxy host to use for sending request
+ * @param proxyPort proxy port to use for sendin request
+ *
+ * @throws RESTException if unable to create a RESTClient
+ */
+ public RESTClient(String URL, String proxyHost, int proxyPort)
+ throws RESTException {
+ this(new RESTConfig(URL, proxyHost, proxyPort));
+ }
+
+ /**
+ * Creates a RESTClient with the specified URL. No proxy host nor port will
+ * be used.
+ *
+ * @param URL URL to send request to
+ *
+ * @throws RESTException if unable to create a RESTClient
+ */
+ public RESTClient(String URL) throws RESTException {
+ this(new RESTConfig(URL));
+ }
+
+ /**
+ * Creates a RESTClient with the RESTConfig object.
+ *
+ * @param RESTConfig config to use for sending request
+ *
+ * @throws RESTException if unable to create a RESTClient
+ */
+ public RESTClient(RESTConfig cfg) throws RESTException {
+ this.headers = new LinkedHashMap<String, List<String>>();
+ this.parameters = new LinkedHashMap<String, List<String>>();
+ this.URL = cfg.getURL();
+ this.proxyHost = cfg.getProxyHost();
+ this.proxyPort = cfg.getProxyPort();
+ }
+
+ /**
+ * Adds parameter to be sent during http request.
+ * <p>
+ * Does not remove any parameters with the same name, thus allowing
+ * duplicates.
+ *
+ * @param name name of parameter
+ * @param value value of parametr
+ * @return a reference to 'this', which can be used for method chaining
+ */
+ public RESTClient addParameter(String name, String value) {
+ if (!parameters.containsKey(name)) {
+ parameters.put(name, new ArrayList<String>());
+ }
+
+ List<String> values = parameters.get(name);
+ values.add(value);
+
+ return this;
+ }
+
+ /**
+ * Sets parameter to be sent during http request.
+ * <p>
+ * Removes any parameters with the same name, thus disallowing duplicates.
+ *
+ * @param name name of parameter
+ * @param value value of parametr
+ * @return a reference to 'this', which can be used for method chaining
+ */
+ public RESTClient setParameter(String name, String value) {
+ if (parameters.containsKey(name)) {
+ parameters.get(name).clear();
+ }
+
+ addParameter(name, value);
+
+ return this;
+ }
+
+ /**
+ * Adds http header to be sent during http request.
+ * <p>
+ * Does not remove any headers with the same name, thus allowing
+ * duplicates.
+ *
+ * @param name name of header
+ * @param value value of header
+ * @return a reference to 'this', which can be used for method chaining
+ */
+ public RESTClient addHeader(String name, String value) {
+ if (!headers.containsKey(name)) {
+ headers.put(name, new ArrayList<String>());
+ }
+
+ List<String> values = headers.get(name);
+ values.add(value);
+
+ return this;
+ }
+
+ /**
+ * Sets http header to be sent during http request.
+ * <p>
+ * Does not remove any headers with the same name, thus allowing
+ * duplicates.
+ *
+ * @param name name of header
+ * @param value value of header
+ * @return a reference to 'this', which can be used for method chaining
+ */
+ public RESTClient setHeader(String name, String value) {
+ if (headers.containsKey(name)) {
+ headers.get(name).clear();
+ }
+
+ addHeader(name, value);
+
+ return this;
+ }
+
+ /**
+ * Convenience method for adding the authorization header using the
+ * specified OAuthToken object.
+ *
+ * @param token token to use for setting authorization
+ * @return a reference to 'this,' which can be used for method chaining
+ */
+ public RESTClient addAuthorizationHeader(String token) {
+ this.addHeader("Authorization", token);
+ return this;
+ }
+
+ /**
+ * Alias for httpGet().
+ *
+ * @see RESTClient#httpGet()
+ */
+ public APIResponse get() throws RESTException {
+ return httpGet();
+ }
+
+ /**
+ * Sends an http GET request using the parameters and headers previously
+ * set.
+ *
+ * @return api response
+ *
+ * @throws RESTException if request was unsuccessful
+ */
+ public APIResponse httpGet() throws RESTException {
+ HttpResponse response = null;
+
+ try (CloseableHttpClient httpClient = createClient()) {
+ String query = "";
+ if (!buildQuery().equals("")) {
+ query = "?" + buildQuery();
+ }
+ HttpGet httpGet = new HttpGet(this.getURL() + query);
+ addInternalHeaders(httpGet);
+
+ response = httpClient.execute(httpGet);
+
+ APIResponse apiResponse = buildResponse(response);
+ return apiResponse;
+ } catch (IOException ioe) {
+ throw new RESTException(ioe);
+ } finally {
+ if (response != null) {
+ this.releaseConnection(response);
+ }
+ }
+ }
+
+ /**
+ * Alias for httpPost()
+ *
+ * @see RESTClient#httpPost()
+ */
+ public APIResponse post() throws RESTException {
+ return httpPost();
+ }
+
+ /**
+ * Sends an http POST request.
+ * <p>
+ * POST body will be set to the values set using add/setParameter()
+ *
+ * @return api response
+ *
+ * @throws RESTException if POST was unsuccessful
+ */
+ public APIResponse httpPost() throws RESTException {
+ APIResponse response = httpPost(buildQuery());
+ return response;
+ }
+
+ /**
+ * Sends an http POST request using the specified body.
+ *
+ * @return api response
+ *
+ * @throws RESTException if POST was unsuccessful
+ */
+ public APIResponse httpPost(String body) throws RESTException {
+ HttpResponse response = null;
+ try (CloseableHttpClient httpClient = createClient()) {
+ HttpPost httpPost = new HttpPost(this.getURL());
+ addInternalHeaders(httpPost);
+ if (body != null && !body.equals("")) {
+ httpEntity = new StringEntity(body);
+ httpPost.setEntity(new StringEntity(body));
+ }
+
+ response = httpClient.execute(httpPost);
+
+ return buildResponse(response);
+ } catch (IOException e) {
+ throw new RESTException(e);
+ } finally {
+ if (response != null) {
+ this.releaseConnection(response);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param body Data to PUT
+ * @return API response
+ * @throws RESTException
+ */
+ public APIResponse httpPut(String body) throws RESTException {
+ HttpResponse response = null;
+ try (CloseableHttpClient httpClient = createClient()) {
+
+ String query = "";
+ if (!buildQuery().equals("")) {
+ query = "?" + buildQuery();
+ }
+ HttpPut httpPut = new HttpPut(this.getURL() + query);
+ addInternalHeaders(httpPut);
+ if (body != null && !body.equals("")) {
+ httpEntity = new StringEntity(body);
+ httpPut.setEntity(httpEntity);
+ }
+
+ response = httpClient.execute(httpPut);
+
+ return buildResponse(response);
+ } catch (IOException e) {
+ throw new RESTException(e);
+ } finally {
+ if (response != null) {
+ this.releaseConnection(response);
+ }
+ }
+ }
+
+ /**
+ * Alias for httpPatch().
+ *
+ * @see RESTClient#httpPatch()
+ */
+ public APIResponse patch(String body) throws RESTException {
+ return httpPatch(body);
+ }
+
+ /**
+ *
+ * @param body Data to PATCH
+ * @return API response
+ * @throws RESTException
+ */
+ public APIResponse httpPatch(String body) throws RESTException {
+ HttpResponse response = null;
+ try (CloseableHttpClient httpClient = createClient()) {
+ String query = "";
+ if (!buildQuery().equals("")) {
+ query = "?" + buildQuery();
+ }
+ HttpPatch httpPatch = new HttpPatch(this.getURL() + query);
+ addInternalHeaders(httpPatch);
+ if (body != null && !body.equals("")) {
+ httpEntity = new StringEntity(body);
+ httpPatch.setEntity(httpEntity);
+ }
+
+ response = httpClient.execute(httpPatch);
+
+ return buildResponse(response);
+ } catch (IOException e) {
+ throw new RESTException(e);
+ } finally {
+ if (response != null) {
+ this.releaseConnection(response);
+ }
+ }
+ }
+
+ /**
+ * Alias for httpDelete().
+ *
+ * @see RESTClient#httpDelete()
+ */
+ public APIResponse delete() throws RESTException {
+ return httpDelete();
+ }
+
+ /**
+ * Sends an http DELETE request using the parameters and headers previously
+ * set.
+ *
+ * @return api response
+ *
+ * @throws RESTException if request was unsuccessful
+ */
+ public APIResponse httpDelete() throws RESTException {
+ return httpDelete(null);
+ }
+
+ /**
+ * Sends an http DELETE request with a body, using the parameters and headers
+ * previously set.
+ *
+ * @return api response
+ *
+ * @throws RESTException if request was unsuccessful
+ */
+ public APIResponse httpDelete(String body) throws RESTException {
+ HttpResponse response = null;
+
+ try (CloseableHttpClient httpClient = createClient()){
+
+ String query = "";
+ if (!buildQuery().equals("")) {
+ query = "?" + buildQuery();
+ }
+ HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(this.getURL() + query);
+ addInternalHeaders(httpDelete);
+
+ if (body != null && !body.equals("")) {
+ httpEntity = new StringEntity(body);
+ httpDelete.setEntity(httpEntity);
+ }
+
+ response = httpClient.execute(httpDelete);
+
+ APIResponse apiResponse = buildResponse(response);
+ return apiResponse;
+ } catch (IOException ioe) {
+ throw new RESTException(ioe);
+ } finally {
+ if (response != null) {
+ this.releaseConnection(response);
+ }
+ }
+ }
+
+ public String getURL() {
+ return URL;
+ }
+ public LinkedHashMap<String,List<String>> getHeaders() {
+ return headers;
+ }
+ public LinkedHashMap<String,List<String>> getParameters() {
+ return parameters;
+ }
+ public HttpEntity getHttpEntity() {
+ return httpEntity;
+ }
+
+ public HttpClient getUnitTestClient() {
+ return unitTestClient;
+ }
+
+ public void setUnitTestClient(HttpClient unitTestClient) {
+ this.unitTestClient = unitTestClient;
+ }
+
+ /**
+ * Allows inclusion of a request body with DELETE.
+ */
+ private class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
+ public static final String METHOD_NAME = "DELETE";
+
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+
+ public HttpDeleteWithBody(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ public HttpDeleteWithBody(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ public HttpDeleteWithBody() {
+ super();
+ }
+ }
+}
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java
new file mode 100644
index 0000000000..a6685067f7
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+/**
+ * Configuration values to be used by the RESTClient.
+ *
+ * @version 1.0
+ *
+ */
+public class RESTConfig {
+ private final String URL;
+
+ private final boolean trustAllCerts;
+ private final String proxyHost;
+ private final int proxyPort;
+
+ /**
+ * Creates a RESTConfig with the specified URL.
+ * <p>
+ * By default, no proxy will be used, and only valid certificates will
+ * be used.
+ *
+ * @param URL url to set
+ */
+ public RESTConfig(final String URL) {
+ this(URL, null, -1, false);
+ }
+
+ /**
+ * Creates a RESTConfig with the specified URL and whether to trust all
+ * certificates.
+ * <p>
+ * Trusting all certificates is useful for testing self-signed
+ * certificates. By default, no proxy will be used.
+ *
+ * @param URL url to set
+ * @param trustAllCerts whether to trust all certificates
+ */
+ public RESTConfig(final String URL, final boolean trustAllCerts) {
+ this(URL, null, -1, trustAllCerts);
+ }
+
+ /**
+ * Creates a RESTConfig with the specified URL and proxy.
+ * <p>
+ * By default, only valid certificates will be allowed.
+ *
+ * @param URL url to set
+ * @param proxyHost proxy host to set
+ * @param proxyPort proxy port to set
+ */
+ public RESTConfig(final String URL, final String proxyHost,
+ final int proxyPort) {
+
+ this(URL, proxyHost, proxyPort, false);
+ }
+
+ /**
+ * Creates a RESTConfig object with the specified URL, proxy host, proxy
+ * port, and whether to trust all certificates. Allowing all certificates
+ * is useful for testing self-signed certificates.
+ *
+ * @param URL url to set
+ * @param proxyHost proxy host to set
+ * @param proxyPort porxy port to set
+ * @param trustAllCerts whether to trust all certificates
+ */
+ public RESTConfig(final String URL, final String proxyHost,
+ final int proxyPort, boolean trustAllCerts) {
+
+ this.URL = URL;
+ this.proxyHost = proxyHost;
+ this.proxyPort = proxyPort;
+ this.trustAllCerts = trustAllCerts;
+ }
+
+ /**
+ * Gets the URL to use.
+ *
+ * @return URL to use
+ */
+ public String getURL() {
+ return this.URL;
+ }
+
+ /**
+ * Gets whether to trust all certificates.
+ *
+ * @return true if to trust all certificates, false otherwise
+ */
+ public boolean trustAllCerts() {
+ return this.trustAllCerts;
+ }
+
+ /**
+ * Gets proxy host or null if proxy host has not been set.
+ *
+ * @return proxy host
+ */
+ public String getProxyHost() {
+ return this.proxyHost;
+ }
+
+ /**
+ * Gets proxy port or -1 if no proxy port has been set.
+ *
+ * @return proxy port
+ */
+ public int getProxyPort() {
+ return this.proxyPort;
+ }
+}
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java
new file mode 100644
index 0000000000..1c28aa1f09
--- /dev/null
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+/**
+ * A custom exception class.
+ *
+ * @version 1.0
+ *
+ */
+public class RESTException extends Exception {
+ private static final long serialVersionUID = -6874042744590915838L;
+ // http status code
+ private final int statusCode;
+
+ // error message
+ private final String errorMessage;
+
+ /**
+ * {@inheritDoc}
+ * @see Exception#RESTException(String)
+ */
+ public RESTException(final String errorMessage) {
+ this(-1, errorMessage);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see Exception#RESTException(Throwable)
+ */
+ public RESTException(final Throwable cause) {
+ super(cause);
+ this.statusCode = -1;
+ this.errorMessage = cause.getMessage();
+ }
+
+ /**
+ * Creates a RESTException with the specified status code and error
+ * message.
+ *
+ * @param statusCode http status code
+ * @param errorMessage http error message
+ */
+ public RESTException(final int statusCode, final String errorMessage) {
+ super(statusCode + ":" + errorMessage);
+ this.statusCode = statusCode;
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Gets the status code or -1 if none has been set.
+ *
+ * @return status code
+ */
+ public int getStatusCode() {
+ return this.statusCode;
+ }
+
+ /**
+ * Gets the error message.
+ *
+ * @return error message
+ */
+ public String getErrorMessage() {
+ return this.errorMessage;
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java
new file mode 100644
index 0000000000..87a3f47cfe
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java
@@ -0,0 +1,217 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 11:46:25 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.MockitoExtension.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import java.util.Locale;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.ReasonPhraseCatalog;
+import org.apache.http.StatusLine;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.EnglishReasonPhraseCatalog;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class APIResponseESTest extends APIResponseESTestscaffolding {
+
+ @Test(timeout = 4000)
+ public void test00() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "Uc");
+ basicHttpResponse0.addHeader("Uc", "org.apache.http.entity.ContentType");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ assertEquals(0, aPIResponse0.getStatusCode());
+ }
+
+ @Test(timeout = 4000)
+ public void test01() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 1471, "0fVXWr>");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ int int0 = aPIResponse0.getStatusCode();
+ assertEquals(1471, int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test02() throws Throwable {
+ ProtocolVersion protocolVersion0 = mock(ProtocolVersion.class, new ViolatedAssumptionAnswer());
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(protocolVersion0).when(statusLine0).getProtocolVersion();
+ doReturn("Gi|Heay:?O.-PvSJFp").when(statusLine0).getReasonPhrase();
+ doReturn((-1730834464), (-1730834464)).when(statusLine0).getStatusCode();
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse(statusLine0);
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ int int0 = aPIResponse0.getStatusCode();
+ assertEquals((-1730834464), int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test03() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 1471, "0fVXWr>");
+ byte[] byteArray0 = new byte[3];
+ ByteArrayEntity byteArrayEntity0 = new ByteArrayEntity(byteArray0);
+ basicHttpResponse0.setEntity(byteArrayEntity0);
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ byte[] byteArray1 = aPIResponse0.getResponseBodyAsByteArray();
+ assertFalse(byteArray1.equals((Object)byteArray0));
+ }
+
+ @Test(timeout = 4000)
+ public void test04() throws Throwable {
+ ProtocolVersion protocolVersion0 = new ProtocolVersion("", 548, 548);
+ BasicStatusLine basicStatusLine0 = new BasicStatusLine(protocolVersion0, 1196, " len: ");
+ EnglishReasonPhraseCatalog englishReasonPhraseCatalog0 = EnglishReasonPhraseCatalog.INSTANCE;
+ Locale locale0 = Locale.ITALY;
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((StatusLine) basicStatusLine0, (ReasonPhraseCatalog) englishReasonPhraseCatalog0, locale0);
+ StringEntity stringEntity0 = new StringEntity("");
+ basicHttpResponse0.setEntity(stringEntity0);
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ byte[] byteArray0 = aPIResponse0.getResponseBodyAsByteArray();
+ assertArrayEquals(new byte[] {}, byteArray0);
+ }
+
+ @Test(timeout = 4000)
+ public void test05() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "'");
+ basicHttpResponse0.addHeader("'", "'");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ String string0 = aPIResponse0.getFirstHeader("'");
+ assertEquals("'", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test06() throws Throwable {
+ APIResponse aPIResponse0 = null;
+ try {
+ aPIResponse0 = new APIResponse((HttpResponse) null);
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("org.openecomp.mso.rest.APIResponse", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test07() throws Throwable {
+ ProtocolVersion protocolVersion0 = new ProtocolVersion("=", 1, 2);
+ BasicStatusLine basicStatusLine0 = new BasicStatusLine(protocolVersion0, 1, "=");
+ EnglishReasonPhraseCatalog englishReasonPhraseCatalog0 = EnglishReasonPhraseCatalog.INSTANCE;
+ Locale locale0 = Locale.UK;
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((StatusLine) basicStatusLine0, (ReasonPhraseCatalog) englishReasonPhraseCatalog0, locale0);
+ basicHttpResponse0.setStatusLine(protocolVersion0, 1);
+ APIResponse aPIResponse0 = null;
+ try {
+ aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Unknown category for status code 1
+ //
+ verifyException("org.apache.http.util.Args", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test08() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "");
+ basicHttpResponse0.addHeader("", "");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ String string0 = aPIResponse0.getFirstHeader(",n6_`^Oyzn6YprnX");
+ assertNull(string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test09() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "");
+ basicHttpResponse0.addHeader("", "");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ String string0 = aPIResponse0.getFirstHeader("");
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test10() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "");
+ basicHttpResponse0.addHeader("", "");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ HttpHeader[] httpHeaderArray0 = aPIResponse0.getAllHeaders();
+ assertNotNull(httpHeaderArray0);
+ }
+
+ @Test(timeout = 4000)
+ public void test11() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 1471, "0fVXWr>");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ HttpHeader[] httpHeaderArray0 = aPIResponse0.getAllHeaders();
+ assertNotNull(httpHeaderArray0);
+ }
+
+ @Test(timeout = 4000)
+ public void test12() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "c");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ String string0 = aPIResponse0.getResponseBodyAsString();
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test13() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 1471, "0fVXWr>");
+ byte[] byteArray0 = new byte[3];
+ ByteArrayEntity byteArrayEntity0 = new ByteArrayEntity(byteArray0);
+ basicHttpResponse0.setEntity(byteArrayEntity0);
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ String string0 = aPIResponse0.getResponseBodyAsString();
+ assertEquals("\u0000\u0000\u0000", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test14() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 0, "c");
+ basicHttpResponse0.addHeader("c", "c");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ aPIResponse0.getResponseBodyAsString();
+ basicHttpResponse0.getStatusLine();
+ aPIResponse0.getStatusCode();
+ HttpHeader[] httpHeaderArray0 = new HttpHeader[2];
+ HttpHeader httpHeader0 = mock(HttpHeader.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(httpHeader0).getName();
+ httpHeaderArray0[0] = httpHeader0;
+ HttpHeader httpHeader1 = mock(HttpHeader.class, new ViolatedAssumptionAnswer());
+ httpHeaderArray0[1] = httpHeader1;
+ PrivateAccess.setVariable((Class<APIResponse>) APIResponse.class, aPIResponse0, "headers", (Object) httpHeaderArray0);
+ // Undeclared exception!
+ try {
+ aPIResponse0.getFirstHeader("");
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test15() throws Throwable {
+ BasicHttpResponse basicHttpResponse0 = new BasicHttpResponse((ProtocolVersion) null, 1471, "0fVXWr>");
+ APIResponse aPIResponse0 = new APIResponse((HttpResponse) basicHttpResponse0);
+ byte[] byteArray0 = aPIResponse0.getResponseBodyAsByteArray();
+ assertNull(byteArray0);
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java
new file mode 100644
index 0000000000..59f09a0bc9
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java
@@ -0,0 +1,140 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 11:46:25 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class APIResponseESTestscaffolding {
+
+ @org.junit.Rule
+ public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+ private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
+
+ private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+ @BeforeClass
+ public static void initEvoSuiteFramework() {
+ org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.APIResponse";
+ org.evosuite.runtime.GuiSupport.initialize();
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+ org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+ org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
+ org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
+ org.evosuite.runtime.classhandling.JDKClassResetter.init();
+ initializeClasses();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ }
+
+ @AfterClass
+ public static void clearEvoSuiteFramework(){
+ Sandbox.resetDefaultSecurityManager();
+ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
+ }
+
+ @Before
+ public void initTestCase(){
+ threadStopper.storeCurrentThreads();
+ threadStopper.startRecordingTime();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+ org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
+
+ org.evosuite.runtime.GuiSupport.setHeadless();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ org.evosuite.runtime.agent.InstrumentingAgent.activate();
+ }
+
+ @After
+ public void doneWithTestCase(){
+ threadStopper.killAndJoinClientThreads();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+ org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+ resetClasses();
+ org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
+ org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+ org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+ }
+
+
+ private static void initializeClasses() {
+ org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(APIResponseESTestscaffolding.class.getClassLoader() ,
+ "org.apache.http.HttpVersion",
+ "org.apache.http.message.BasicNameValuePair",
+ "org.apache.http.message.HeaderGroup",
+ "org.apache.http.message.HeaderValueParser",
+ "org.apache.http.message.BasicStatusLine",
+ "org.apache.http.message.BasicHeaderValueParser",
+ "org.apache.http.message.BasicLineFormatter",
+ "org.apache.http.entity.ByteArrayEntity",
+ "org.apache.http.Header",
+ "org.apache.http.StatusLine",
+ "org.apache.http.util.EntityUtils",
+ "org.apache.http.message.BasicHttpResponse",
+ "org.apache.http.FormattedHeader",
+ "org.apache.http.RequestLine",
+ "org.apache.http.HttpMessage",
+ "org.apache.http.message.AbstractHttpMessage",
+ "org.apache.http.Consts",
+ "org.apache.http.protocol.HTTP",
+ "org.apache.http.util.ByteArrayBuffer",
+ "org.apache.http.ParseException",
+ "org.apache.http.HeaderIterator",
+ "org.apache.http.entity.AbstractHttpEntity",
+ "org.openecomp.mso.rest.RESTException",
+ "org.apache.http.util.Args",
+ "org.apache.http.ReasonPhraseCatalog",
+ "org.apache.http.HttpEntity",
+ "org.apache.http.entity.ContentType",
+ "org.apache.http.message.LineFormatter",
+ "org.apache.http.entity.StringEntity",
+ "org.openecomp.mso.rest.HttpHeader",
+ "org.apache.http.HeaderElement",
+ "org.apache.http.message.BufferedHeader",
+ "org.openecomp.mso.rest.APIResponse",
+ "org.apache.http.util.CharArrayBuffer",
+ "org.apache.http.ProtocolVersion",
+ "org.apache.http.util.TextUtils",
+ "org.apache.http.impl.EnglishReasonPhraseCatalog",
+ "org.apache.http.params.HttpParams",
+ "org.apache.http.message.BasicHeader",
+ "org.apache.http.HttpResponse",
+ "org.apache.http.NameValuePair",
+ "org.apache.http.message.ParserCursor"
+ );
+ }
+
+ private static void resetClasses() {
+ org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(APIResponseESTestscaffolding.class.getClassLoader());
+
+ org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+ "org.apache.http.message.HeaderGroup",
+ "org.apache.http.ProtocolVersion",
+ "org.apache.http.message.BasicStatusLine",
+ "org.apache.http.message.BasicLineFormatter",
+ "org.apache.http.util.CharArrayBuffer",
+ "org.apache.http.HttpVersion",
+ "org.apache.http.impl.EnglishReasonPhraseCatalog",
+ "org.apache.http.message.BasicHeader",
+ "org.apache.http.message.BasicHeaderValueParser",
+ "org.apache.http.Consts",
+ "org.apache.http.protocol.HTTP",
+ "org.apache.http.message.BasicNameValuePair",
+ "org.apache.http.message.BufferedHeader",
+ "org.apache.http.ParseException",
+ "org.apache.http.entity.AbstractHttpEntity",
+ "org.apache.http.util.ByteArrayBuffer",
+ "org.apache.http.entity.ContentType"
+ );
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java
new file mode 100644
index 0000000000..21043496db
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java
@@ -0,0 +1,79 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 11:47:07 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class HttpHeaderESTest extends HttpHeaderESTestscaffolding {
+
+ @Test(timeout = 4000)
+ public void test0() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("Fw", "WD#>QF/v6_|_A");
+ String string0 = httpHeader0.getValue();
+ assertEquals("WD#>QF/v6_|_A", string0);
+ assertEquals("Fw", httpHeader0.getName());
+ }
+
+ @Test(timeout = 4000)
+ public void test1() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("", "");
+ String string0 = httpHeader0.getValue();
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test2() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("Nae may no be null.", "Nae may no be null.");
+ PrivateAccess.setVariable((Class<HttpHeader>) HttpHeader.class, httpHeader0, "name", (Object) null);
+ String string0 = httpHeader0.getName();
+ assertNull(string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test3() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("", "EIqJp");
+ String string0 = httpHeader0.getName();
+ assertEquals("EIqJp", httpHeader0.getValue());
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test4() throws Throwable {
+ HttpHeader httpHeader0 = null;
+ try {
+ httpHeader0 = new HttpHeader((String) null, (String) null);
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Name may not be null.
+ //
+ verifyException("org.openecomp.mso.rest.HttpHeader", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test5() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("Nae may no be null.", "Nae may no be null.");
+ String string0 = httpHeader0.getName();
+ assertEquals("Nae may no be null.", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test6() throws Throwable {
+ HttpHeader httpHeader0 = new HttpHeader("|SJ`pSz:BCB1o8~", (String) null);
+ String string0 = httpHeader0.getValue();
+ assertNull(string0);
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java
new file mode 100644
index 0000000000..e59f7da9fb
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 11:47:07 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class HttpHeaderESTestscaffolding {
+
+ @org.junit.Rule
+ public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+ private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
+
+ private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+ @BeforeClass
+ public static void initEvoSuiteFramework() {
+ org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.HttpHeader";
+ org.evosuite.runtime.GuiSupport.initialize();
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+ org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+ org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
+ org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
+ org.evosuite.runtime.classhandling.JDKClassResetter.init();
+ initializeClasses();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ }
+
+ @AfterClass
+ public static void clearEvoSuiteFramework(){
+ Sandbox.resetDefaultSecurityManager();
+ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
+ }
+
+ @Before
+ public void initTestCase(){
+ threadStopper.storeCurrentThreads();
+ threadStopper.startRecordingTime();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+ org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
+
+ org.evosuite.runtime.GuiSupport.setHeadless();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ org.evosuite.runtime.agent.InstrumentingAgent.activate();
+ }
+
+ @After
+ public void doneWithTestCase(){
+ threadStopper.killAndJoinClientThreads();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+ org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+ resetClasses();
+ org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
+ org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+ org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+ }
+
+
+ private static void initializeClasses() {
+ org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HttpHeaderESTestscaffolding.class.getClassLoader() ,
+ "org.openecomp.mso.rest.HttpHeader"
+ );
+ }
+
+ private static void resetClasses() {
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java
new file mode 100644
index 0000000000..1a9e05abd0
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java
@@ -0,0 +1,1068 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 11:49:09 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.MockitoExtension.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import java.io.InputStream;
+import java.util.LinkedHashMap;
+import java.util.List;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.HttpClient;
+import org.apache.http.entity.InputStreamEntity;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class RESTClientESTest extends RESTClientESTestscaffolding {
+
+ @Test(timeout = 4000)
+ public void test00() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException");
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(httpClient0).toString();
+ doReturn((HttpResponse) null).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ // Undeclared exception!
+ try {
+ rESTClient0.patch("<;xR");
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("org.openecomp.mso.rest.APIResponse", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test01() throws Throwable {
+ RESTConfig rESTConfig0 = mock(RESTConfig.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(rESTConfig0).getProxyHost();
+ doReturn(0).when(rESTConfig0).getProxyPort();
+ doReturn((String) null).when(rESTConfig0).getURL();
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(httpClient0).toString();
+ rESTClient0.setUnitTestClient(httpClient0);
+ HttpClient httpClient1 = rESTClient0.getUnitTestClient();
+ assertSame(httpClient1, httpClient0);
+ }
+
+ @Test(timeout = 4000)
+ public void test02() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient((String) null, "Jhhlq!Y8o>CaA", (-3767));
+ String string0 = rESTClient0.getURL();
+ assertNull(string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test03() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "=&http.request_sent=http.request_sent", 783, true);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ String string0 = rESTClient0.getURL();
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test04() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("http");
+ RESTClient rESTClient1 = rESTClient0.setParameter("http", "http");
+ LinkedHashMap<String, List<String>> linkedHashMap0 = rESTClient1.getParameters();
+ assertEquals(1, linkedHashMap0.size());
+ }
+
+ @Test(timeout = 4000)
+ public void test05() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt");
+ RESTClient rESTClient1 = rESTClient0.setHeader(",%LX:SC+'3!nt", ",[o<:aGQK");
+ LinkedHashMap<String, List<String>> linkedHashMap0 = rESTClient1.getHeaders();
+ assertEquals(1, linkedHashMap0.size());
+ }
+
+ @Test(timeout = 4000)
+ public void test06() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer());
+ InputStreamEntity inputStreamEntity0 = new InputStreamEntity(inputStream0);
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(0).when(statusLine0).getStatusCode();
+ HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer());
+ doReturn(inputStreamEntity0, (HttpEntity) null, (HttpEntity) null).when(httpResponse0).getEntity();
+ doReturn(statusLine0).when(httpResponse0).getStatusLine();
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn("Q[z^W").when(httpClient0).toString();
+ doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ HttpClient httpClient1 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ // Undeclared exception!
+ try {
+ rESTClient0.post();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Entity may not be null
+ //
+ verifyException("org.apache.http.util.Args", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test07() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ RESTClient rESTClient1 = rESTClient0.setParameter((String) null, "7%d/ia+s(I~@<PK");
+ // Undeclared exception!
+ try {
+ rESTClient1.post();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test08() throws Throwable {
+ RESTConfig rESTConfig0 = mock(RESTConfig.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(rESTConfig0).getProxyHost();
+ doReturn(0).when(rESTConfig0).getProxyPort();
+ doReturn((String) null).when(rESTConfig0).getURL();
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ // Undeclared exception!
+ try {
+ rESTClient0.post();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test09() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("UTF-8");
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ RESTClient rESTClient1 = rESTClient0.addParameter((String) null, "");
+ // Undeclared exception!
+ try {
+ rESTClient1.patch("DELETE");
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test10() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("!{usNmLQ_Gt.C_98");
+ // Undeclared exception!
+ try {
+ rESTClient0.patch("https");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 1: !{usNmLQ_Gt.C_98
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test11() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ rESTClient0.addParameter("", (String) null);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPut("");
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test12() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/", (-697));
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPut("");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 11: szM4DVVoiAs`]T/
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test13() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient((String) null);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost(" I3^~h5yoFuif");
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test14() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("&", false);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ rESTClient0.setHeader((String) null, "/G$0vW$R4vUaL)*tz");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost("/G$0vW$R4vUaL)*tz");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Header name may not be null
+ //
+ verifyException("org.apache.http.util.Args", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test15() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("oO!CF58JhSCm6t");
+ rESTClient0.addParameter((String) null, "oO!CF58JhSCm6t");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test16() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient((String) null, "F(Oy=<SOmNE9", (-1932735280));
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test17() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("JAl/&Uq6mM8Kf8", false);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test18() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("&8jW\"", "&8jW\"", (-1));
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 0: &8jW\"
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test19() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(")7l9={q>0E4sV]T");
+ RESTClient rESTClient1 = rESTClient0.addParameter((String) null, ")7l9={q>0E4sV]T");
+ // Undeclared exception!
+ try {
+ rESTClient1.httpPatch((String) null);
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test20() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("[59t(J)");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPatch("[59t(J)");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 0: [59t(J)
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test21() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("A29%23fZqv%7F*%405=%7F%7Frdbt-X%22DB%2FhCrUn", "=", (-1));
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn((String) null).when(httpClient0).toString();
+ doReturn((HttpResponse) null).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpGet();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("org.openecomp.mso.rest.APIResponse", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test22() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("*;R");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpGet();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 0: *;R
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test23() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ RESTClient rESTClient1 = rESTClient0.addParameter("https", "https");
+ RESTClient rESTClient2 = rESTClient1.setHeader("compatibility", "https");
+ RESTClient rESTClient3 = rESTClient2.setParameter("4#'mD<\"jNh?>_vfI:]", "Char array buffer");
+ InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer());
+ InputStreamEntity inputStreamEntity0 = new InputStreamEntity(inputStream0);
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(0).when(statusLine0).getStatusCode();
+ rESTClient3.addHeader("2b?N", "https");
+ HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer());
+ doReturn(inputStreamEntity0, (HttpEntity) null, (HttpEntity) null).when(httpResponse0).getEntity();
+ doReturn(statusLine0).when(httpResponse0).getStatusLine();
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString();
+ doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient2.setUnitTestClient(httpClient0);
+ // Undeclared exception!
+ try {
+ rESTClient3.httpDelete("");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Entity may not be null
+ //
+ verifyException("org.apache.http.util.Args", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test24() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(")TZ;T]b%B[FkT4", "%y@{Wz}c3J-!m", 1772);
+ RESTClient rESTClient1 = rESTClient0.addParameter("$y*O^k0", (String) null);
+ // Undeclared exception!
+ try {
+ rESTClient1.httpDelete((String) null);
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test25() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("Length Required");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete("Length Required");
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 6: Length Required
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test26() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("yhPl=c#;<s`V", false);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ rESTClient0.addParameter("yhPl=c#;<s`V", (String) null);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test27() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("2cSq'/FF]W'K.S^k=<=", "2cSq'/FF]W'K.S^k=<=", 2605);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 8: 2cSq'/FF]W'K.S^k=<=
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test28() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(")7l9={q>0E4sV]T");
+ RESTClient rESTClient1 = rESTClient0.addParameter((String) null, ")7l9={q>0E4sV]T");
+ // Undeclared exception!
+ try {
+ rESTClient1.get();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test29() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("z8UR?=)5pTtS]*");
+ // Undeclared exception!
+ try {
+ rESTClient0.get();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test30() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("JB<TRwDR@k.-C$=w3", "|N", 0);
+ // Undeclared exception!
+ try {
+ rESTClient0.get();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in path at index 2: JB<TRwDR@k.-C$=w3
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test31() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("YoeLljo%3A%5C%3D=http", "http.protocol.element-charset", (-1908874351));
+ RESTClient rESTClient1 = rESTClient0.setParameter("I/O exception (", (String) null);
+ // Undeclared exception!
+ try {
+ rESTClient1.delete();
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("java.net.URLEncoder", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test32() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("\":VYxeR;PP]jO_[f'");
+ // Undeclared exception!
+ try {
+ rESTClient0.delete();
+ fail("Expecting exception: IllegalArgumentException");
+
+ } catch(IllegalArgumentException e) {
+ //
+ // Illegal character in scheme name at index 0: \":VYxeR;PP]jO_[f'
+ //
+ verifyException("java.net.URI", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test33() throws Throwable {
+ RESTClient rESTClient0 = null;
+ try {
+ rESTClient0 = new RESTClient((RESTConfig) null);
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("org.openecomp.mso.rest.RESTClient", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test34() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ rESTClient0.addParameter("", "");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPatch("lr");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test35() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("", "netscape", 1);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost("");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test36() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig((String) null);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpGet();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test37() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("K.7:dc=", "K.7:dc=", 0);
+ try {
+ rESTClient0.httpPost();
+ fail("Expecting exception: Exception");
+
+ } catch(Exception e) {
+ //
+ // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: K.7:dc=
+ //
+ verifyException("org.openecomp.mso.rest.RESTClient", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test38() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException=", "EWh2BZ[]:q+%4S#7K", (-1847));
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test39() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt");
+ String string0 = rESTClient0.getURL();
+ assertEquals(",%LX:SC+'3!nt", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test40() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer());
+ doReturn((-3113)).when(inputStream0).read(any(byte[].class));
+ HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(201).when(statusLine0).getStatusCode();
+ HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn(inputStream0).when(httpEntity1).getContent();
+ doReturn(0L, (long)(-2116360694)).when(httpEntity1).getContentLength();
+ HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn(false).when(httpEntity2).isStreaming();
+ HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer());
+ doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity();
+ doReturn(statusLine0).when(httpResponse0).getStatusLine();
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString();
+ doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete("");
+ fail("Expecting exception: IndexOutOfBoundsException");
+
+ } catch(IndexOutOfBoundsException e) {
+ //
+ // off: 0 len: -3113 b.length: 4096
+ //
+ verifyException("org.apache.http.util.ByteArrayBuffer", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test41() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(201).when(statusLine0).getStatusCode();
+ Header[] headerArray0 = new Header[0];
+ HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn((InputStream) null).when(httpEntity1).getContent();
+ HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn(false).when(httpEntity2).isStreaming();
+ HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer());
+ doReturn(headerArray0).when(httpResponse0).getAllHeaders();
+ doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity();
+ doReturn(statusLine0).when(httpResponse0).getStatusLine();
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString();
+ doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ APIResponse aPIResponse0 = rESTClient0.httpDelete("");
+ assertEquals(201, aPIResponse0.getStatusCode());
+ }
+
+ @Test(timeout = 4000)
+ public void test42() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("wlq:6r");
+ try {
+ rESTClient0.httpDelete("E");
+ fail("Expecting exception: Exception");
+
+ } catch(Exception e) {
+ //
+ // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: wlq:6r
+ //
+ verifyException("org.openecomp.mso.rest.RESTClient", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test43() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPatch("");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test44() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("DELETE");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPatch((String) null);
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test45() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException");
+ RESTClient rESTClient1 = rESTClient0.addParameter("DELETE", "");
+ // Undeclared exception!
+ try {
+ rESTClient1.patch("<;xR");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test46() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer());
+ doReturn(201).when(statusLine0).getStatusCode();
+ Header[] headerArray0 = new Header[0];
+ HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn((InputStream) null).when(httpEntity1).getContent();
+ HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer());
+ doReturn(false).when(httpEntity2).isStreaming();
+ HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer());
+ doReturn(headerArray0).when(httpResponse0).getAllHeaders();
+ doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity();
+ doReturn(statusLine0).when(httpResponse0).getStatusLine();
+ HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer());
+ doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString();
+ doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class));
+ rESTClient0.setUnitTestClient(httpClient0);
+ APIResponse aPIResponse0 = rESTClient0.httpPut("compatibility");
+ assertEquals(201, aPIResponse0.getStatusCode());
+ }
+
+ @Test(timeout = 4000)
+ public void test47() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPut("");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test48() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ rESTClient0.addParameter("https", "https");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPut("compatibility");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test49() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("", "(", 307);
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPut((String) null);
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test50() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("@0*Eu-=Fa");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost("@0*Eu-=Fa");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test51() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("x");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpPost((String) null);
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test52() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("2cSq'/FF]W'K.S^k=<=", "2cSq'/FF]W'K.S^k=<=", 2605);
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ RESTClient rESTClient1 = rESTClient0.setHeader("WkI<", "http");
+ RESTClient rESTClient2 = rESTClient1.setHeader("WkI<", "");
+ assertEquals("2cSq'/FF]W'K.S^k=<=", rESTClient2.getURL());
+ }
+
+ @Test(timeout = 4000)
+ public void test53() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/", (-697));
+ RESTClient rESTClient1 = rESTClient0.setHeader("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/");
+ RESTClient rESTClient2 = rESTClient1.addHeader("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/");
+ assertSame(rESTClient0, rESTClient2);
+ }
+
+ @Test(timeout = 4000)
+ public void test54() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("E U(~h|zVLWi", "http", 0);
+ rESTClient0.setParameter("E U(~h|zVLWi", "http");
+ RESTClient rESTClient1 = rESTClient0.setParameter("E U(~h|zVLWi", "k@(}4U05'$}yl)W");
+ assertSame(rESTClient1, rESTClient0);
+ }
+
+ @Test(timeout = 4000)
+ public void test55() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ RESTClient rESTClient1 = rESTClient0.addParameter("", "");
+ RESTClient rESTClient2 = rESTClient0.addParameter("", (String) null);
+ assertSame(rESTClient2, rESTClient1);
+ }
+
+ @Test(timeout = 4000)
+ public void test56() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("compatibility");
+ rESTClient0.addParameter("https", "https");
+ RESTClient rESTClient1 = rESTClient0.setParameter("4#'mD<\"jNh?>_vfI:]", "Char array buffer");
+ // Undeclared exception!
+ try {
+ rESTClient1.httpDelete("");
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test57() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("K.7:dc=");
+ try {
+ rESTClient0.get();
+ fail("Expecting exception: Exception");
+
+ } catch(Exception e) {
+ //
+ // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: K.7:dc=
+ //
+ verifyException("org.openecomp.mso.rest.RESTClient", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test58() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("http.virtual-host");
+ RESTClient rESTClient1 = rESTClient0.addAuthorizationHeader("EWh2BZ[]:q+%4S#7K");
+ assertSame(rESTClient0, rESTClient1);
+ }
+
+ @Test(timeout = 4000)
+ public void test59() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("YoeLljo%3A%5C%3D=http", "http.protocol.element-charset", (-1908874351));
+ // Undeclared exception!
+ try {
+ rESTClient0.delete();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test60() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("UTF-8");
+ RESTClient rESTClient0 = new RESTClient(rESTConfig0);
+ HttpEntity httpEntity0 = rESTClient0.getHttpEntity();
+ assertNull(httpEntity0);
+ }
+
+ @Test(timeout = 4000)
+ public void test61() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt");
+ LinkedHashMap<String, List<String>> linkedHashMap0 = rESTClient0.getHeaders();
+ assertEquals(0, linkedHashMap0.size());
+ }
+
+ @Test(timeout = 4000)
+ public void test62() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("DELETE");
+ HttpClient httpClient0 = rESTClient0.getUnitTestClient();
+ assertNull(httpClient0);
+ }
+
+ @Test(timeout = 4000)
+ public void test63() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("A29%23fZqv%7F*%405=%7F%7Frdbt-X%22DB%2FhCrUn", "=", (-1));
+ RESTClient rESTClient1 = rESTClient0.addParameter("o", "o");
+ // Undeclared exception!
+ try {
+ rESTClient1.httpGet();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test64() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("DELETE");
+ LinkedHashMap<String, List<String>> linkedHashMap0 = rESTClient0.getParameters();
+ assertTrue(linkedHashMap0.isEmpty());
+ }
+
+ @Test(timeout = 4000)
+ public void test65() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("");
+ // Undeclared exception!
+ try {
+ rESTClient0.post();
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test66() throws Throwable {
+ RESTClient rESTClient0 = new RESTClient("DELETE");
+ // Undeclared exception!
+ try {
+ rESTClient0.httpDelete((String) null);
+ fail("Expecting exception: IllegalStateException");
+
+ } catch(IllegalStateException e) {
+ //
+ // Target host is null
+ //
+ verifyException("org.apache.http.util.Asserts", e);
+ }
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java
new file mode 100644
index 0000000000..2761b252fd
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java
@@ -0,0 +1,366 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 11:49:09 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class RESTClientESTestscaffolding {
+
+ @org.junit.Rule
+ public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+ private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
+
+ private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+ @BeforeClass
+ public static void initEvoSuiteFramework() {
+ org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.RESTClient";
+ org.evosuite.runtime.GuiSupport.initialize();
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+ org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+ org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
+ org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
+ org.evosuite.runtime.classhandling.JDKClassResetter.init();
+ initializeClasses();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ }
+
+ @AfterClass
+ public static void clearEvoSuiteFramework(){
+ Sandbox.resetDefaultSecurityManager();
+ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
+ }
+
+ @Before
+ public void initTestCase(){
+ threadStopper.storeCurrentThreads();
+ threadStopper.startRecordingTime();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+ org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
+
+ org.evosuite.runtime.GuiSupport.setHeadless();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ org.evosuite.runtime.agent.InstrumentingAgent.activate();
+ }
+
+ @After
+ public void doneWithTestCase(){
+ threadStopper.killAndJoinClientThreads();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+ org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+ resetClasses();
+ org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
+ org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+ org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+ }
+
+
+ private static void initializeClasses() {
+ org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RESTClientESTestscaffolding.class.getClassLoader() ,
+ "org.apache.http.client.methods.HttpPatch",
+ "org.apache.http.io.HttpMessageParserFactory",
+ "org.apache.http.impl.conn.DefaultHttpResponseParserFactory",
+ "org.apache.http.impl.execchain.RequestAbortedException",
+ "org.apache.http.impl.execchain.ProtocolExec",
+ "org.apache.http.config.Registry",
+ "org.apache.http.cookie.MalformedCookieException",
+ "org.apache.http.impl.conn.SystemDefaultDnsResolver",
+ "org.apache.http.client.protocol.RequestClientConnControl",
+ "org.apache.http.conn.ConnectionRequest",
+ "org.apache.http.impl.client.DefaultUserTokenHandler",
+ "org.apache.http.impl.conn.DefaultManagedHttpClientConnection",
+ "org.apache.http.conn.HttpClientConnectionManager",
+ "org.apache.http.client.protocol.RequestAcceptEncoding",
+ "org.apache.http.HttpException",
+ "org.apache.http.cookie.CookieSpec",
+ "org.apache.http.impl.cookie.RFC2965SpecFactory",
+ "org.apache.http.pool.AbstractConnPool$1",
+ "org.apache.http.conn.ssl.AllowAllHostnameVerifier",
+ "org.apache.http.client.CredentialsProvider",
+ "org.apache.http.client.ClientProtocolException",
+ "org.apache.http.pool.RouteSpecificPool",
+ "org.apache.http.client.methods.Configurable",
+ "org.apache.http.config.RegistryBuilder",
+ "org.apache.http.params.AbstractHttpParams",
+ "org.apache.http.io.HttpTransportMetrics",
+ "org.apache.http.conn.ssl.AbstractVerifier",
+ "org.openecomp.mso.rest.RESTConfig",
+ "org.apache.http.auth.Credentials",
+ "org.apache.http.io.HttpMessageParser",
+ "org.apache.http.client.methods.AbstractExecutionAwareRequest",
+ "org.apache.http.impl.BHttpConnectionBase",
+ "org.apache.http.HttpConnectionMetrics",
+ "org.apache.http.io.HttpMessageWriter",
+ "org.apache.http.HttpClientConnection",
+ "org.apache.http.conn.ConnectionPoolTimeoutException",
+ "org.apache.http.conn.routing.HttpRouteDirector",
+ "org.apache.http.pool.ConnPool",
+ "org.apache.http.protocol.HttpProcessor",
+ "org.apache.http.auth.AuthProtocolState",
+ "org.apache.http.client.RedirectStrategy",
+ "org.apache.http.impl.client.BasicCookieStore",
+ "org.apache.http.conn.routing.BasicRouteDirector",
+ "org.apache.http.protocol.HttpContext",
+ "org.apache.http.params.HttpParams",
+ "org.apache.http.client.NonRepeatableRequestException",
+ "org.apache.http.HttpResponse",
+ "org.apache.http.impl.client.AuthenticationStrategyImpl",
+ "org.apache.http.impl.client.HttpClientBuilder",
+ "org.apache.http.message.HeaderGroup",
+ "org.apache.http.impl.io.DefaultHttpRequestWriterFactory",
+ "org.apache.http.client.protocol.RequestAuthCache",
+ "org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory",
+ "org.apache.http.impl.conn.DefaultSchemePortResolver",
+ "org.apache.http.config.MessageConstraints",
+ "org.apache.http.Header",
+ "org.apache.http.conn.HttpHostConnectException",
+ "org.apache.http.util.EntityUtils",
+ "org.apache.http.impl.NoConnectionReuseStrategy",
+ "org.apache.http.impl.client.BasicCredentialsProvider",
+ "org.apache.http.conn.ConnectionKeepAliveStrategy",
+ "org.apache.http.cookie.CookieSpecFactory",
+ "org.apache.http.conn.ssl.X509HostnameVerifier",
+ "org.apache.http.protocol.ChainBuilder",
+ "org.apache.http.impl.client.DefaultHttpRequestRetryHandler",
+ "org.apache.http.impl.conn.PoolingHttpClientConnectionManager",
+ "org.apache.http.impl.conn.DefaultProxyRoutePlanner",
+ "org.apache.http.impl.auth.KerberosSchemeFactory",
+ "org.apache.http.util.ByteArrayBuffer",
+ "org.apache.http.cookie.CookieOrigin",
+ "org.apache.http.client.methods.HttpRequestBase",
+ "org.apache.http.HttpEntity",
+ "org.apache.http.pool.PoolEntryCallback",
+ "org.apache.http.entity.StringEntity",
+ "org.apache.http.impl.DefaultConnectionReuseStrategy",
+ "org.apache.http.pool.ConnFactory",
+ "org.apache.http.client.methods.HttpGet",
+ "org.apache.http.protocol.BasicHttpContext",
+ "org.apache.commons.logging.impl.Jdk14Logger",
+ "org.apache.http.impl.execchain.ClientExecChain",
+ "org.apache.http.HttpVersion",
+ "org.apache.http.conn.SchemePortResolver",
+ "org.apache.http.message.BasicStatusLine",
+ "org.apache.http.conn.DnsResolver",
+ "org.apache.http.impl.client.TargetAuthenticationStrategy",
+ "org.apache.http.params.CoreProtocolPNames",
+ "org.apache.http.auth.AuthScheme",
+ "org.apache.http.message.AbstractHttpMessage",
+ "org.apache.http.auth.MalformedChallengeException",
+ "org.apache.http.HttpEntityEnclosingRequest",
+ "org.apache.http.entity.AbstractHttpEntity",
+ "org.apache.http.ReasonPhraseCatalog",
+ "org.apache.http.impl.cookie.BrowserCompatSpecFactory$SecurityLevel",
+ "org.apache.http.client.UserTokenHandler",
+ "org.apache.http.impl.auth.DigestSchemeFactory",
+ "org.apache.http.impl.conn.HttpClientConnectionOperator",
+ "org.apache.http.HttpResponseFactory",
+ "org.apache.http.client.methods.HttpPut",
+ "org.openecomp.mso.rest.RESTClient",
+ "org.apache.http.ConnectionReuseStrategy",
+ "org.apache.http.client.protocol.RequestDefaultHeaders",
+ "org.apache.http.message.BasicHeader",
+ "org.apache.http.impl.conn.ConnectionShutdownException",
+ "org.apache.http.conn.ManagedHttpClientConnection",
+ "org.apache.http.client.protocol.ResponseContentEncoding",
+ "org.apache.http.message.BasicLineParser",
+ "org.apache.http.client.methods.HttpPost",
+ "org.apache.http.auth.AuthSchemeProvider",
+ "org.apache.http.config.SocketConfig",
+ "org.apache.http.util.Asserts",
+ "org.apache.http.client.config.RequestConfig",
+ "org.apache.http.StatusLine",
+ "org.apache.http.impl.DefaultBHttpClientConnection",
+ "org.apache.http.impl.DefaultHttpResponseFactory",
+ "org.apache.http.io.SessionOutputBuffer",
+ "org.apache.http.RequestLine",
+ "org.apache.http.conn.HttpConnectionFactory",
+ "org.apache.http.protocol.RequestContent",
+ "org.apache.http.cookie.CookieIdentityComparator",
+ "org.apache.http.config.Lookup",
+ "org.apache.http.HttpMessage",
+ "org.apache.http.impl.cookie.NetscapeDraftSpecFactory",
+ "org.apache.http.HttpRequestInterceptor",
+ "org.apache.http.HeaderElementIterator",
+ "org.apache.http.client.AuthCache",
+ "org.apache.http.pool.AbstractConnPool",
+ "org.apache.http.HeaderIterator",
+ "org.apache.http.conn.ClientConnectionManager",
+ "org.apache.http.HttpInetConnection",
+ "org.apache.http.entity.ContentType",
+ "org.apache.http.message.LineFormatter",
+ "org.apache.http.cookie.CookieSpecProvider",
+ "org.apache.http.HttpRequest",
+ "org.apache.http.pool.ConnPoolControl",
+ "org.openecomp.mso.rest.APIResponse",
+ "org.apache.http.client.BackoffManager",
+ "org.openecomp.mso.rest.HostNameVerifier",
+ "org.apache.http.client.AuthenticationStrategy",
+ "org.apache.http.conn.socket.ConnectionSocketFactory",
+ "org.apache.http.protocol.RequestTargetHost",
+ "org.apache.http.pool.PoolEntry",
+ "org.apache.http.message.BasicLineFormatter",
+ "org.apache.http.client.methods.HttpUriRequest",
+ "org.apache.http.protocol.HttpRequestExecutor",
+ "org.apache.http.client.methods.HttpRequestWrapper",
+ "org.apache.http.io.SessionInputBuffer",
+ "org.apache.http.impl.cookie.IgnoreSpecFactory",
+ "org.apache.http.impl.auth.HttpAuthenticator",
+ "org.apache.http.impl.conn.ManagedHttpClientConnectionFactory",
+ "org.apache.http.conn.ConnectTimeoutException",
+ "org.apache.http.client.methods.AbortableHttpRequest",
+ "org.apache.http.client.HttpClient",
+ "org.apache.http.auth.AuthSchemeFactory",
+ "org.apache.http.cookie.Cookie",
+ "org.apache.http.protocol.ImmutableHttpProcessor",
+ "org.apache.http.impl.auth.SPNegoSchemeFactory",
+ "org.apache.http.protocol.HTTP",
+ "org.apache.http.impl.conn.PoolingHttpClientConnectionManager$ConfigData",
+ "org.openecomp.mso.rest.RESTClient$HttpDeleteWithBody",
+ "org.apache.http.TokenIterator",
+ "org.openecomp.mso.rest.HttpHeader",
+ "org.apache.http.client.methods.HttpRequestWrapper$HttpEntityEnclosingRequestWrapper",
+ "org.apache.http.protocol.HttpCoreContext",
+ "org.apache.http.impl.conn.CPool",
+ "org.apache.http.impl.auth.NTLMSchemeFactory",
+ "org.apache.http.client.utils.URIUtils",
+ "org.apache.http.ProtocolVersion",
+ "org.apache.http.client.protocol.RequestExpectContinue",
+ "org.apache.http.util.VersionInfo",
+ "org.apache.http.impl.cookie.RFC2109SpecFactory",
+ "org.apache.http.entity.InputStreamEntity",
+ "org.apache.http.HttpHost",
+ "org.apache.http.conn.UnsupportedSchemeException",
+ "org.apache.http.ProtocolException",
+ "org.apache.http.impl.cookie.BrowserCompatSpecFactory",
+ "org.apache.http.client.methods.HttpEntityEnclosingRequestBase",
+ "org.apache.http.params.BasicHttpParams",
+ "org.apache.http.client.protocol.HttpClientContext",
+ "org.apache.http.impl.client.ProxyAuthenticationStrategy",
+ "org.apache.http.conn.ssl.StrictHostnameVerifier",
+ "org.apache.http.io.HttpMessageWriterFactory",
+ "org.apache.http.concurrent.Cancellable",
+ "org.apache.http.impl.execchain.MainClientExec",
+ "org.apache.http.protocol.HttpProcessorBuilder",
+ "org.apache.http.entity.ContentLengthStrategy",
+ "org.apache.http.impl.execchain.TunnelRefusedException",
+ "org.apache.http.conn.routing.HttpRoutePlanner",
+ "org.apache.http.Consts",
+ "org.apache.http.conn.ssl.SSLConnectionSocketFactory",
+ "org.apache.http.message.LineParser",
+ "org.apache.http.impl.cookie.BestMatchSpecFactory",
+ "org.apache.http.params.HttpParamsNames",
+ "org.apache.http.conn.ssl.SSLInitializationException",
+ "org.openecomp.mso.rest.RESTException",
+ "org.apache.http.util.Args",
+ "org.apache.http.params.HttpProtocolParams",
+ "org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy",
+ "org.apache.http.protocol.RequestUserAgent",
+ "org.apache.http.config.ConnectionConfig",
+ "org.apache.http.conn.socket.LayeredConnectionSocketFactory",
+ "org.apache.http.conn.ssl.BrowserCompatHostnameVerifier",
+ "org.apache.http.util.TextUtils",
+ "org.apache.http.HttpResponseInterceptor",
+ "org.apache.http.impl.EnglishReasonPhraseCatalog",
+ "org.apache.http.client.config.RequestConfig$Builder",
+ "org.apache.http.auth.AuthenticationException",
+ "org.apache.http.auth.AuthState",
+ "org.apache.http.client.protocol.RequestAddCookies",
+ "org.apache.http.impl.conn.DefaultRoutePlanner",
+ "org.apache.http.conn.routing.HttpRoute",
+ "org.apache.http.impl.conn.CPoolEntry",
+ "org.apache.http.client.CookieStore",
+ "org.apache.http.impl.auth.BasicSchemeFactory",
+ "org.apache.http.conn.socket.PlainConnectionSocketFactory",
+ "org.apache.http.client.HttpRequestRetryHandler",
+ "org.apache.http.ParseException",
+ "org.apache.http.impl.client.CloseableHttpClient",
+ "org.apache.http.client.protocol.ResponseProcessCookies",
+ "org.apache.http.message.BasicRequestLine",
+ "org.apache.http.client.ServiceUnavailableRetryStrategy",
+ "org.apache.http.client.methods.HttpExecutionAware",
+ "org.apache.http.impl.client.InternalHttpClient",
+ "org.apache.http.HeaderElement",
+ "org.apache.http.client.ConnectionBackoffStrategy",
+ "org.apache.http.util.CharArrayBuffer",
+ "org.apache.http.impl.execchain.RetryExec",
+ "org.apache.http.conn.routing.RouteInfo",
+ "org.apache.http.client.ResponseHandler",
+ "org.apache.http.HttpConnection",
+ "org.apache.http.message.ParserCursor"
+ );
+ }
+
+ private static void resetClasses() {
+ org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RESTClientESTestscaffolding.class.getClassLoader());
+
+ org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+ "org.openecomp.mso.rest.RESTClient$HttpDeleteWithBody",
+ "org.apache.http.conn.socket.PlainConnectionSocketFactory",
+ "org.apache.http.conn.ssl.AbstractVerifier",
+ "org.apache.commons.logging.impl.Jdk14Logger",
+ "org.apache.http.conn.ssl.SSLConnectionSocketFactory",
+ "org.apache.http.impl.conn.CPool",
+ "org.apache.http.message.BasicLineFormatter",
+ "org.apache.http.impl.io.DefaultHttpRequestWriterFactory",
+ "org.apache.http.ProtocolVersion",
+ "org.apache.http.HttpVersion",
+ "org.apache.http.message.BasicLineParser",
+ "org.apache.http.impl.EnglishReasonPhraseCatalog",
+ "org.apache.http.impl.DefaultHttpResponseFactory",
+ "org.apache.http.impl.conn.DefaultHttpResponseParserFactory",
+ "org.apache.http.impl.conn.ManagedHttpClientConnectionFactory",
+ "org.apache.http.impl.conn.HttpClientConnectionOperator",
+ "org.apache.http.impl.conn.DefaultSchemePortResolver",
+ "org.apache.http.impl.conn.SystemDefaultDnsResolver",
+ "org.apache.http.util.VersionInfo",
+ "org.apache.http.impl.client.HttpClientBuilder",
+ "org.apache.http.protocol.HttpRequestExecutor",
+ "org.apache.http.impl.DefaultConnectionReuseStrategy",
+ "org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy",
+ "org.apache.http.impl.client.AuthenticationStrategyImpl",
+ "org.apache.http.impl.client.TargetAuthenticationStrategy",
+ "org.apache.http.impl.client.ProxyAuthenticationStrategy",
+ "org.apache.http.impl.client.DefaultUserTokenHandler",
+ "org.apache.http.client.protocol.RequestClientConnControl",
+ "org.apache.http.client.protocol.ResponseContentEncoding",
+ "org.apache.http.impl.client.DefaultHttpRequestRetryHandler",
+ "org.apache.http.impl.cookie.BrowserCompatSpecFactory$SecurityLevel",
+ "org.apache.http.impl.client.BasicCookieStore",
+ "org.apache.http.cookie.CookieIdentityComparator",
+ "org.apache.http.client.config.RequestConfig",
+ "org.apache.http.client.methods.HttpPut",
+ "org.apache.http.message.HeaderGroup",
+ "org.apache.http.message.BasicHeader",
+ "org.apache.http.entity.AbstractHttpEntity",
+ "org.apache.http.Consts",
+ "org.apache.http.entity.ContentType",
+ "org.apache.http.util.CharArrayBuffer",
+ "org.apache.http.params.BasicHttpParams",
+ "org.apache.http.message.BasicRequestLine",
+ "org.apache.http.protocol.HttpCoreContext",
+ "org.apache.http.client.protocol.HttpClientContext",
+ "org.apache.http.auth.AuthProtocolState",
+ "org.apache.http.client.methods.HttpPost",
+ "org.apache.http.HttpHost",
+ "org.apache.http.client.methods.HttpGet",
+ "org.apache.http.client.methods.HttpPatch",
+ "org.openecomp.mso.rest.RESTException",
+ "org.apache.http.client.ClientProtocolException",
+ "org.apache.http.protocol.HTTP",
+ "org.apache.http.message.BasicStatusLine",
+ "org.apache.http.util.ByteArrayBuffer"
+ );
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java
new file mode 100644
index 0000000000..a1c83ba70e
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+ *
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.rest;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpVersion;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient;
+import org.openecomp.mso.rest.RESTException;
+
+/**
+ * @version 1.0
+ *
+ */
+public class RESTClientTest {
+
+ @Test
+ public void testSimpleHTTP() throws RESTException, ClientProtocolException, IOException {
+ HttpClient mockHttpClient = mock(HttpClient.class);
+ HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+ response.setEntity(new StringEntity("test","UTF-8"));
+ when(mockHttpClient.execute(Mockito.<HttpUriRequest>any())).thenReturn(response);
+
+ RESTClient restClient = new RESTClient("http://localhost");
+ restClient.setUnitTestClient(mockHttpClient);
+ APIResponse apiResponse = restClient.get();
+ Assert.assertEquals(200, apiResponse.getStatusCode());
+ Assert.assertEquals("test", apiResponse.getResponseBodyAsString());
+ }
+
+ @Test
+ public void testSimpleHTTPS() throws RESTException, ClientProtocolException, IOException {
+ HttpClient mockHttpClient = mock(HttpClient.class);
+ HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+ response.setEntity(new StringEntity("test","UTF-8"));
+ when(mockHttpClient.execute(Mockito.<HttpUriRequest>any())).thenReturn(response);
+
+ RESTClient restClient = new RESTClient("https://localhost");
+ restClient.setUnitTestClient(mockHttpClient);
+ APIResponse apiResponse = restClient.get();
+ Assert.assertEquals(200, apiResponse.getStatusCode());
+ Assert.assertEquals("test", apiResponse.getResponseBodyAsString());
+ }
+
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java
new file mode 100644
index 0000000000..0a46cebf29
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java
@@ -0,0 +1,110 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 11:47:42 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class RESTConfigESTest extends RESTConfigESTestscaffolding {
+
+ @Test(timeout = 4000)
+ public void test00() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig((String) null, "", (-3449));
+ String string0 = rESTConfig0.getURL();
+ assertEquals(-3449, rESTConfig0.getProxyPort());
+ assertNull(string0);
+ assertFalse(rESTConfig0.trustAllCerts());
+ }
+
+ @Test(timeout = 4000)
+ public void test01() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig(";A,GC~!-_.>+R=>rIO", "", (-3449), false);
+ String string0 = rESTConfig0.getURL();
+ assertEquals("", rESTConfig0.getProxyHost());
+ assertEquals(-3449, rESTConfig0.getProxyPort());
+ assertFalse(rESTConfig0.trustAllCerts());
+ assertEquals(";A,GC~!-_.>+R=>rIO", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test02() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "", 0);
+ int int0 = rESTConfig0.getProxyPort();
+ assertFalse(rESTConfig0.trustAllCerts());
+ assertEquals(0, int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test03() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig((String) null);
+ int int0 = rESTConfig0.getProxyPort();
+ assertEquals((-1), int0);
+ assertFalse(rESTConfig0.trustAllCerts());
+ }
+
+ @Test(timeout = 4000)
+ public void test04() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig((String) null, "zZu8", (-1933), true);
+ String string0 = rESTConfig0.getProxyHost();
+ assertEquals(-1933, rESTConfig0.getProxyPort());
+ assertTrue(rESTConfig0.trustAllCerts());
+ assertNotNull(string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test05() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "", 2708, true);
+ boolean boolean0 = rESTConfig0.trustAllCerts();
+ assertTrue(boolean0);
+ assertEquals(2708, rESTConfig0.getProxyPort());
+ }
+
+ @Test(timeout = 4000)
+ public void test06() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "", 2708, true);
+ rESTConfig0.getURL();
+ assertTrue(rESTConfig0.trustAllCerts());
+ assertEquals(2708, rESTConfig0.getProxyPort());
+ }
+
+ @Test(timeout = 4000)
+ public void test07() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", true);
+ String string0 = rESTConfig0.getProxyHost();
+ assertTrue(rESTConfig0.trustAllCerts());
+ assertNull(string0);
+ assertEquals(-1, rESTConfig0.getProxyPort());
+ }
+
+ @Test(timeout = 4000)
+ public void test08() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "", 2708, true);
+ int int0 = rESTConfig0.getProxyPort();
+ assertEquals(2708, int0);
+ assertTrue(rESTConfig0.trustAllCerts());
+ }
+
+ @Test(timeout = 4000)
+ public void test09() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("", "", 2708, true);
+ rESTConfig0.getProxyHost();
+ assertEquals(2708, rESTConfig0.getProxyPort());
+ assertTrue(rESTConfig0.trustAllCerts());
+ }
+
+ @Test(timeout = 4000)
+ public void test10() throws Throwable {
+ RESTConfig rESTConfig0 = new RESTConfig("");
+ boolean boolean0 = rESTConfig0.trustAllCerts();
+ assertEquals(-1, rESTConfig0.getProxyPort());
+ assertFalse(boolean0);
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java
new file mode 100644
index 0000000000..1eb33ddd80
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 11:47:42 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class RESTConfigESTestscaffolding {
+
+ @org.junit.Rule
+ public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+ private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
+
+ private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+ @BeforeClass
+ public static void initEvoSuiteFramework() {
+ org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.RESTConfig";
+ org.evosuite.runtime.GuiSupport.initialize();
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+ org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+ org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
+ org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
+ org.evosuite.runtime.classhandling.JDKClassResetter.init();
+ initializeClasses();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ }
+
+ @AfterClass
+ public static void clearEvoSuiteFramework(){
+ Sandbox.resetDefaultSecurityManager();
+ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
+ }
+
+ @Before
+ public void initTestCase(){
+ threadStopper.storeCurrentThreads();
+ threadStopper.startRecordingTime();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+ org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
+
+ org.evosuite.runtime.GuiSupport.setHeadless();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ org.evosuite.runtime.agent.InstrumentingAgent.activate();
+ }
+
+ @After
+ public void doneWithTestCase(){
+ threadStopper.killAndJoinClientThreads();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+ org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+ resetClasses();
+ org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
+ org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+ org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+ }
+
+
+ private static void initializeClasses() {
+ org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RESTConfigESTestscaffolding.class.getClassLoader() ,
+ "org.openecomp.mso.rest.RESTConfig"
+ );
+ }
+
+ private static void resetClasses() {
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java
new file mode 100644
index 0000000000..aff908ee98
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java
@@ -0,0 +1,78 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 11:47:59 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.mock.java.lang.MockThrowable;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class RESTExceptionESTest extends RESTExceptionESTestscaffolding {
+
+ @Test(timeout = 4000)
+ public void test0() throws Throwable {
+ RESTException rESTException0 = new RESTException(0, (String) null);
+ int int0 = rESTException0.getStatusCode();
+ assertEquals(0, int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test1() throws Throwable {
+ RESTException rESTException0 = new RESTException(1619, "");
+ int int0 = rESTException0.getStatusCode();
+ assertEquals(1619, int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test2() throws Throwable {
+ RESTException rESTException0 = new RESTException("");
+ String string0 = rESTException0.getErrorMessage();
+ assertEquals("", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test3() throws Throwable {
+ RESTException rESTException0 = null;
+ try {
+ rESTException0 = new RESTException((Throwable) null);
+ fail("Expecting exception: NullPointerException");
+
+ } catch(NullPointerException e) {
+ //
+ // no message in exception (getMessage() returned null)
+ //
+ verifyException("org.openecomp.mso.rest.RESTException", e);
+ }
+ }
+
+ @Test(timeout = 4000)
+ public void test4() throws Throwable {
+ RESTException rESTException0 = new RESTException((-489), "org.evosuite.runtime.mock.java.lang.MockThrowable: org.evosuite.runtime.mock.java.lang.MockThrowable");
+ String string0 = rESTException0.getErrorMessage();
+ assertEquals("org.evosuite.runtime.mock.java.lang.MockThrowable: org.evosuite.runtime.mock.java.lang.MockThrowable", string0);
+ }
+
+ @Test(timeout = 4000)
+ public void test5() throws Throwable {
+ MockThrowable mockThrowable0 = new MockThrowable();
+ RESTException rESTException0 = new RESTException((Throwable) mockThrowable0);
+ int int0 = rESTException0.getStatusCode();
+ assertEquals((-1), int0);
+ }
+
+ @Test(timeout = 4000)
+ public void test6() throws Throwable {
+ MockThrowable mockThrowable0 = new MockThrowable();
+ RESTException rESTException0 = new RESTException((Throwable) mockThrowable0);
+ String string0 = rESTException0.getErrorMessage();
+ assertNull(string0);
+ }
+}
diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java
new file mode 100644
index 0000000000..13d4dcc026
--- /dev/null
+++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java
@@ -0,0 +1,83 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 11:47:59 GMT 2016
+ */
+
+package org.openecomp.mso.rest;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class RESTExceptionESTestscaffolding {
+
+ @org.junit.Rule
+ public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+ private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
+
+ private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+ @BeforeClass
+ public static void initEvoSuiteFramework() {
+ org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.RESTException";
+ org.evosuite.runtime.GuiSupport.initialize();
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+ org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+ org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+ org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
+ org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
+ org.evosuite.runtime.classhandling.JDKClassResetter.init();
+ initializeClasses();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ }
+
+ @AfterClass
+ public static void clearEvoSuiteFramework(){
+ Sandbox.resetDefaultSecurityManager();
+ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
+ }
+
+ @Before
+ public void initTestCase(){
+ threadStopper.storeCurrentThreads();
+ threadStopper.startRecordingTime();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+ org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
+
+ org.evosuite.runtime.GuiSupport.setHeadless();
+ org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+ org.evosuite.runtime.agent.InstrumentingAgent.activate();
+ }
+
+ @After
+ public void doneWithTestCase(){
+ threadStopper.killAndJoinClientThreads();
+ org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+ org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+ resetClasses();
+ org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
+ org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+ org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+ }
+
+
+ private static void initializeClasses() {
+ org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RESTExceptionESTestscaffolding.class.getClassLoader() ,
+ "org.openecomp.mso.rest.RESTException"
+ );
+ }
+
+ private static void resetClasses() {
+ org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RESTExceptionESTestscaffolding.class.getClassLoader());
+
+ org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+ "org.openecomp.mso.rest.RESTException"
+ );
+ }
+}