diff options
Diffstat (limited to 'mso-api-handlers')
63 files changed, 3508 insertions, 3686 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java index 511b874e15..a5c1b6fa96 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java @@ -92,4 +92,9 @@ public class BPELRestClient extends RequestClient { String requestDetails) { return null; } + + @Override + public HttpResponse get() { + return null; + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index d893a12b24..0a307f3ce0 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -129,6 +129,11 @@ public class CamundaClient extends RequestClient{ return response; } + + @Override + public HttpResponse get() { + return null; + } private String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){ String jsonReq = null; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java new file mode 100644 index 0000000000..5fbb6f0242 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java @@ -0,0 +1,114 @@ +/*-
+ * ============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.apihandler.common;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+
+import javax.xml.bind.DatatypeConverter;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+public class CamundaTaskClient extends RequestClient{
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ public CamundaTaskClient() {
+ super(CommonConstants.CAMUNDATASK);
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq)
+ throws ClientProtocolException, IOException{
+ HttpPost post = new HttpPost(url);
+ msoLogger.debug("Camunda Task url is: "+ url);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+ String encryptedCredentials = null;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ HttpResponse response = client.execute(post);
+
+ return response;
+ }
+
+ @Override
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
+ throws ClientProtocolException, IOException{
+ msoLogger.debug("Method not supported");
+ return null;
+ }
+
+ @Override
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails)
+ throws ClientProtocolException, IOException{
+ msoLogger.debug("Method not supported");
+ return null;
+ }
+
+ @Override
+ public HttpResponse get()
+ throws ClientProtocolException, IOException{
+ HttpGet get = new HttpGet(url);
+ msoLogger.debug("Camunda Task url is: "+ url);
+ String encryptedCredentials = null;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ get.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+
+ HttpResponse getResponse = client.execute(get);
+
+ return getResponse;
+}
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java index 187e0ed0a6..44a058dc4f 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java @@ -40,10 +40,12 @@ public final class CommonConstants { public static final String CAMUNDA_URL = "camundaURL"; public static final String CAMUNDA_AUTH = "camundaAuth"; public static final String BPEL_SEARCH_STR = "active-bpel"; + public static final String TASK_SEARCH_STR = "task"; public static final String BPEL_URL = "bpelURL"; public static final String BPEL_AUTH = "bpelAuth"; public static final int BPEL = 0; public static final int CAMUNDA = 1; + public static final int CAMUNDATASK = 2; public static final String CAMUNDA_HOST = "host"; public static final String SDNC_UUID_HEADER = "mso-sdnc-request-id"; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java index 0b796d5ac2..eef61fa589 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java @@ -78,6 +78,9 @@ public abstract class RequestClient { String requestDetails) throws ClientProtocolException, IOException; + public abstract HttpResponse get() + throws ClientProtocolException, IOException; + protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) { try { String result = CryptoUtils.decrypt(prop, encryptionKey); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java index 9dc43c7e7a..c7f94c0452 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java @@ -29,7 +29,7 @@ import org.openecomp.mso.properties.MsoJavaProperties; public class RequestClientFactory { - //based on URI, returns BPEL or Camunda client + //based on URI, returns BPEL, CamundaTask or Camunda client public static RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{ RequestClient retClient; if(props ==null){ @@ -40,7 +40,11 @@ public class RequestClientFactory { url = props.getProperty(CommonConstants.BPEL_URL,null) + orchestrationURI; retClient= new BPELRestClient(); - }else{ + }else if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){ + url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI; + retClient = new CamundaTaskClient(); + } + else{ url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI; retClient = new CamundaClient(); } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java index 2edf686e07..2e23a1ed84 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java @@ -51,12 +51,14 @@ public class ResponseHandler { private void parseResponse() { int statusCode = httpResponse.getStatusLine().getStatusCode(); - msoLogger.debug("Returned status is: " + statusCode); + msoLogger.debug("Returned status is: " + statusCode); status = setStatus(statusCode); msoLogger.debug("Parsed status is: " + status); if(type==CommonConstants.CAMUNDA){ parseCamunda(); - }else{ + }else if(type==CommonConstants.CAMUNDATASK){ + parseCamundaTask(); + }else { parseBpel(); } @@ -109,14 +111,30 @@ public class ResponseHandler { } } + private void parseCamundaTask(){ + HttpEntity camundataskEntity = httpResponse.getEntity(); + try { + if (camundataskEntity!=null) { + responseBody = EntityUtils.toString(camundataskEntity); + msoLogger.debug("response body is: " + responseBody); + + } + if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){ + msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), responseBody, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task"); + } + } + catch (IOException e) { + msoLogger.debug("IOException getting Camunda Task response body", e); + } + } private int setStatus(int statusCode){ int status = 0; switch(statusCode) { case HttpStatus.SC_ACCEPTED: - case HttpStatus.SC_OK: + case HttpStatus.SC_OK: status = HttpStatus.SC_ACCEPTED; break; case HttpStatus.SC_BAD_REQUEST: @@ -135,6 +153,9 @@ public class ResponseHandler { case HttpStatus.SC_SERVICE_UNAVAILABLE: status = HttpStatus.SC_SERVICE_UNAVAILABLE; break; + case HttpStatus.SC_NO_CONTENT: + status = HttpStatus.SC_NO_CONTENT; + break; default: status = HttpStatus.SC_INTERNAL_SERVER_ERROR; break; @@ -167,7 +188,4 @@ public class ResponseHandler { return status; } - - - } diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml index 88d5024f0d..f7fc214469 100644 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml +++ b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml @@ -5,12 +5,17 @@ <module name="org.apache.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
+ <module name="org.jboss.resteasy.resteasy-jackson-provider" />
+ <module name="org.jboss.resteasy.resteasy-jettison-provider" />
</exclusions>
<dependencies>
<module name="org.jboss.jandex" slot="main" />
<module name="org.javassist" slot="main" />
<module name="org.antlr" slot="main" />
<module name="org.dom4j" slot="main" />
+ <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
+ <!-- This module contain the ProviderBase class: -->
+ <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml index fa80b9ee4e..cd4a560ad1 100644 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml +++ b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml @@ -2,20 +2,23 @@ <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>MSO API Handler Infra</display-name>
-
-
- <context-param>
- <param-name>resteasy.jndi.resources</param-name>
- <param-value>java:module/MsoPropertiesFactory</param-value>
+
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <context-param>
+ <param-name>resteasy.jndi.resources</param-name>
+ <param-value>java:module/MsoPropertiesFactory</param-value>
</context-param>
-
+
<!-- enable the Asynchronous Job Service -->
<context-param>
<param-name>resteasy.async.job.service.enabled</param-name>
<param-value>true</param-value>
</context-param>
- <!-- The next context parameters are all optional.
+ <!-- The next context parameters are all optional.
Their default values are shown as example param-values -->
<!-- How many jobs results can be held in memory at once? -->
@@ -23,12 +26,17 @@ <param-name>resteasy.async.job.service.max.job.results</param-name>
<param-value>100</param-value>
</context-param>
-
- <!-- Maximum wait time on a job when a client is querying for it -->
+
+ <!-- Maximum wait time on a job when a client is querying for it -->
<context-param>
<param-name>resteasy.async.job.service.max.wait</param-name>
<param-value>300000</param-value>
</context-param>
+
+ <context-param>
+ <param-name>resteasy.scan</param-name>
+ <param-value>true</param-value>
+ </context-param>
<!-- Thread pool size of background threads that run the job -->
<context-param>
@@ -41,55 +49,52 @@ <param-name>resteasy.async.job.service.base.path</param-name>
<param-value>/asynch/jobs</param-value>
</context-param>
- <context-param>
- <param-name>resteasy.scan</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <!--
- <context-param>
- <param-name>resteasy.servlet.mapping.prefix</param-name>
- <param-value>/v1</param-value>
- </context-param>
- -->
- <context-param>
- <param-name>log.configuration</param-name>
- <param-value>logback.apihandler-infra.xml</param-value>
- </context-param>
-
- <context-param>
- <param-name>mso.configuration</param-name>
- <param-value>MSO_PROP_APIHANDLER_INFRA=mso.apihandler-infra.properties,MSO_PROP_TOPOLOGY=topology.properties</param-value>
- </context-param>
-
- <context-param>
- <param-name>resteasy.resources</param-name>
- <param-value>org.openecomp.mso.logger.MsoLoggingServlet</param-value>
- </context-param>
-
- <listener>
- <listener-class>
- org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
- </listener-class>
- </listener>
- <servlet>
- <servlet-name>msoapihandler-infra-servlet</servlet-name>
- <servlet-class>
- org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>msoapihandler-infra-servlet</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
+
+ <context-param>
+ <param-name>log.configuration</param-name>
+ <param-value>logback.apihandler-infra.xml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>mso.configuration</param-name>
+ <param-value>MSO_PROP_APIHANDLER_INFRA=mso.apihandler-infra.properties,MSO_PROP_TOPOLOGY=topology.properties</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>resteasy.resources</param-name>
+ <param-value>org.openecomp.mso.logger.MsoLoggingServlet</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>resteasy-servlet</servlet-name>
+ <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>resteasy-servlet</servlet-name>
+ <url-pattern>/serviceInstances/*</url-pattern>
+ <url-pattern>/orchestrationRequests/*</url-pattern>
+ <url-pattern>/nodehealthcheck</url-pattern>
+ <url-pattern>/v1/*</url-pattern>
+ <url-pattern>/v2/*</url-pattern>
+ <url-pattern>/v3/*</url-pattern>
+ <url-pattern>/logging/*</url-pattern>
+ <url-pattern>/globalhealthcheck/*</url-pattern>
+ <url-pattern>/healthcheck/*</url-pattern>
+ <url-pattern>/setStatus/*</url-pattern>
+ <url-pattern>/properties/*</url-pattern>
+ <url-pattern>/api-docs/*</url-pattern>
+ <url-pattern>/tasks/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- To be replaced by AAF in the future, when Camunda scripts replacing the BPEL scripts completely -->
<security-constraint>
<web-resource-collection>
<web-resource-name>HealthcheckNoAuth</web-resource-name>
<description>No Authentication for Healthcheck</description>
- <url-pattern>/healthcheck</url-pattern>
- <url-pattern>/nodehealthcheck</url-pattern>
+ <url-pattern>/healthcheck</url-pattern>
<url-pattern>/globalhealthcheck</url-pattern>
+ <url-pattern>/nodehealthcheck</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
@@ -105,9 +110,9 @@ <role-name>SiteControl-Client</role-name>
</auth-constraint>
</security-constraint>
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>MSO internal Requests</web-resource-name>
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>MSO internal Requests</web-resource-name>
<description>Internal Requests</description>
<url-pattern>/logging/*</url-pattern>
<url-pattern>/properties/*</url-pattern>
@@ -130,7 +135,7 @@ <role-name>InfraPortal-Client</role-name>
</auth-constraint>
</security-constraint>
-
+
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>ApplicationRealm</realm-name>
@@ -140,11 +145,11 @@ </security-role>
<security-role>
<role-name>SiteControl-Client</role-name>
- </security-role>
- <security-role>
+ </security-role>
+ <security-role>
<role-name>MSO-Client</role-name>
</security-role>
-
+
<filter>
<filter-name>LogFilter</filter-name>
<filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
@@ -152,6 +157,6 @@ <filter-mapping>
<filter-name>LogFilter</filter-name>
<url-pattern>/*</url-pattern>
- </filter-mapping>
-
+ </filter-mapping>
+
</web-app>
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 2eb5f1e185..4490d78648 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -16,10 +16,33 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <spring-version>3.2.9.RELEASE</spring-version> + <swagger-version>1.3.0</swagger-version> + <jax-rs-version>1.1.1</jax-rs-version> + <json4s-jackson-version>3.2.4</json4s-jackson-version> + <json4s-core-version>3.0.0</json4s-core-version> + <fasterxml-json-version>2.2.2</fasterxml-json-version> + <scala-lang-version>2.9.1-1</scala-lang-version> + <reflections-version>0.9.9-RC1</reflections-version> + <javassist-version>3.16.1-GA</javassist-version> + <paranamer-version>2.5.2</paranamer-version> + <scannotation-version>1.0.3</scannotation-version> + <resteasy-version>3.0.18.Final</resteasy-version> </properties> <dependencies> <dependency> + <groupId>com.github.tomakehurst</groupId> + <artifactId>wiremock</artifactId> + <version>2.6.0</version> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine</artifactId> + <version>7.8.0-alpha1</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>3.0.19.Final</version> @@ -66,8 +89,137 @@ <version>1.1.1</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-jackson-provider</artifactId> + <version>${resteasy-version}</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + <version>${jax-rs-version}</version> + </dependency> <dependency> + <groupId>org.json4s</groupId> + <artifactId>json4s-jackson_2.9.1-1</artifactId> + <version>${json4s-jackson-version}</version> + </dependency> + <dependency> + <groupId>org.json4s</groupId> + <artifactId>json4s-core_2.9.2</artifactId> + <version>${json4s-core-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${fasterxml-json-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${fasterxml-json-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${fasterxml-json-version}</version> + </dependency> + <dependency> + <groupId>com.thoughtworks.paranamer</groupId> + <artifactId>paranamer</artifactId> + <version>${paranamer-version}</version> + </dependency> + <dependency> + <groupId>org.scala-lang</groupId> + <artifactId>scala-library</artifactId> + <version>${scala-lang-version}</version> + </dependency> + <dependency> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + <version>${reflections-version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.javassist</groupId> + <artifactId>javassist</artifactId> + <version>${javassist-version}</version> + </dependency> + <dependency> + <groupId>org.scannotation</groupId> + <artifactId>scannotation</artifactId> + <version>${scannotation-version}</version> + </dependency> + <!-- swagger --> + <dependency> + <groupId>com.wordnik</groupId> + <artifactId>swagger-jersey-jaxrs_2.9.1</artifactId> + <version>${swagger-version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.wordnik</groupId> + <artifactId>swagger-annotations_2.9.1</artifactId> + <version>${swagger-version}</version> + </dependency> + <dependency> + <groupId>com.wordnik</groupId> + <artifactId>swagger-core_2.9.1</artifactId> + <version>${swagger-version}</version> + </dependency> + <dependency> + <groupId>com.wordnik</groupId> + <artifactId>swagger-jaxrs_2.9.1</artifactId> + <version>${swagger-version}</version> + </dependency> + <!-- Spring 3 dependencies --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-tx</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context-support</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring-version}</version> + </dependency> + <dependency> <groupId>org.openecomp.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> @@ -87,7 +239,17 @@ <artifactId>status-control</artifactId> <version>${project.version}</version> </dependency> - + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20160212</version> + </dependency> </dependencies> <build> <finalName>${project.artifactId}-${project.version}</finalName> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java index 8df4c87898..6ff8f252b2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java @@ -27,5 +27,8 @@ public enum Action { createInstance, updateInstance, deleteInstance, - configureInstance + configureInstance, + replaceInstance, + activateInstance, + deactivateInstance } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java new file mode 100644 index 0000000000..6123ee906c --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java @@ -0,0 +1,48 @@ +package org.openecomp.mso.apihandlerinfra;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.mso.HealthCheckUtils;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/globalhealthcheck")
+@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check")
+public class GlobalHealthcheckHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @HEAD
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing global health check",response=Response.class)
+ public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("GlobalHealthcheck");
+ // Generate a Request Id
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) {
+ msoLogger.debug("globalHealthcheck - Successful");
+ return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
+ } else {
+ msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available");
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java index 0ae1695516..bc8c2e03cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java @@ -25,14 +25,17 @@ import javax.ws.rs.HEAD; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.DefaultValue; import javax.ws.rs.core.Response; -import org.openecomp.mso.HealthCheckUtils; +import org.openecomp.mso.HealthCheckUtils; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.utils.UUIDChecker; -@Path("/") +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +@Path("/healthcheck") +@Api(value="/healthcheck",description="API Handler Infra Health Check") public class HealthcheckHandler { public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @@ -41,8 +44,8 @@ public class HealthcheckHandler { @HEAD @GET - @Path("/healthcheck") @Produces("text/html") + @ApiOperation(value="Perform Health Check",response=Response.class) public Response healthcheck (@QueryParam("requestId") String requestId) { long startTime = System.currentTimeMillis (); MsoLogger.setServiceName ("Healthcheck"); @@ -62,51 +65,4 @@ public class HealthcheckHandler { msoLogger.debug("healthcheck - Successful"); return HealthCheckUtils.HEALTH_CHECK_RESPONSE; } - - @HEAD - @GET - @Path("/nodehealthcheck") - @Produces("text/html") - public Response nodeHealthcheck () { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("NodeHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger, startTime)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, requestId)) { - msoLogger.debug("nodeHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available."); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } - - @HEAD - @GET - @Path("/globalhealthcheck") - @Produces("text/html") - public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("GlobalHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger, startTime)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) { - msoLogger.debug("globalHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available"); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } - } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java new file mode 100644 index 0000000000..d1e60a1cca --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java @@ -0,0 +1,226 @@ +/*-
+ * ============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.apihandlerinfra;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.ApiOperation;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.apihandlerinfra.tasksbeans.*;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+
+
+@Path("/tasks")
+public class ManualTasks {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ @POST
+ @Path("/{version:[vV]1}/{taskId}/complete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Complete specified task",response=Response.class)
+ public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId) {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ TasksRequest tr = null;
+
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ tr= mapper.readValue(request, TasksRequest.class);
+
+ if (tr.getRequestDetails() == null) {
+ throw new ValidationException("requestDetails");
+ }
+ if (tr.getRequestDetails().getRequestInfo() == null) {
+ throw new ValidationException("requestInfo");
+ }
+ if (empty(tr.getRequestDetails().getRequestInfo().getSource())) {
+ throw new ValidationException("source");
+ }
+ if (empty(tr.getRequestDetails().getRequestInfo().getRequestorId())) {
+ throw new ValidationException("requestorId");
+ }
+
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, request, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ // Transform the request to Camunda-style Complete request
+ Variables variablesForComplete = new Variables();
+ Value sourceValue = new Value();
+ sourceValue.setValue(tr.getRequestDetails().getRequestInfo().getSource());
+ Value responseValue = new Value();
+ responseValue.setValue(tr.getRequestDetails().getRequestInfo().getResponseValue().name());
+ Value requestorIdValue = new Value();
+ requestorIdValue.setValue(tr.getRequestDetails().getRequestInfo().getRequestorId());
+ variablesForComplete.setSource(sourceValue);
+ variablesForComplete.setResponseValue(responseValue);
+ variablesForComplete.setRequestorId(requestorIdValue);
+
+ String camundaJsonReq = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
+ msoLogger.debug("Camunda Json Request: " + camundaJsonReq);
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of JSON object to Camunda request failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Mapping of JSON object to Camunda Request failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, request, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ String requestUrl = "/mso/task/" + taskId + "/complete";
+ try {
+ requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ());
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to Camunda engine for url: " + requestClient.getUrl ());
+
+ System.out.println("URL : " + requestClient.getUrl ());
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed");
+
+ response = requestClient.post(camundaJsonReq);
+
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ if (response == null) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+
+ // BPEL accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
+ msoLogger.debug ("Received good response from Camunda");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
+ TaskRequestReference trr = new TaskRequestReference();
+ trr.setTaskId(taskId);
+ String completeResp = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ completeResp = mapper.writeValueAsString(trr);
+ }
+ catch (Exception e) {
+ msoLogger.debug("Unable to format response");
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to bad response format" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Bad response format");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Bad response format");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ msoLogger.debug("Response to the caller: " + completeResp);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp);
+ return Response.status (HttpStatus.SC_ACCEPTED).entity (completeResp).build ();
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ }
+
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java index 5b84a59b6b..0407903d40 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java @@ -64,13 +64,14 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceException; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo; import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; @@ -109,7 +110,7 @@ public class MsoRequest { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; - protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); MsoRequest (String requestId) { this.requestId = requestId; @@ -287,10 +288,31 @@ public class MsoRequest { this.requestScope = modelInfo.getModelType().name(); + // modelCustomizationId is required when usePreLoad is false for v4 and higher for VF Module Create + if(requestParameters != null && reqVersion > 3 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.createInstance && !requestParameters.isUsePreload()) { + if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) { + throw new ValidationException("modelCustomizationId"); + } + } + + // modelCustomizationId is required when usePreLoad is false for v5 and higher for VF Module Replace + if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) { + if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) { + throw new ValidationException("modelCustomizationId"); + } + } + + // modelCustomizationId or modelCustomizationName are required when usePreLoad is false for v5 and higher for VNF Replace + if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) { + if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId()) && modelInfo.getModelCustomizationName() == null) { + throw new ValidationException("modelCustomizationId or modelCustomizationName"); + } + } + //is required for serviceInstance delete macro when aLaCarte=false (v3) - //create and updates except for network + //create and updates except for network (except v4) if (empty (modelInfo.getModelInvariantId ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || - !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { + !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { throw new ValidationException ("modelInvariantId"); } @@ -307,11 +329,17 @@ public class MsoRequest { throw new ValidationException ("modelName"); } - if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || - !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { + if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion == 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || + !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { throw new ValidationException ("modelVersion"); } + // modelVersionId doesn't exist in v2, not required field in v3, is required for serviceInstance delete macro when aLaCarte=false in v4 + if (this.reqVersion > 3 && empty (modelInfo.getModelVersionId()) && ((!this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || + (action == Action.createInstance || action == Action.updateInstance))) { + throw new ValidationException ("modelVersionId"); + } + if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) { if(this.reqVersion<=2){ throw new ValidationException ("modelCustomizationName"); @@ -328,12 +356,9 @@ public class MsoRequest { if(!empty(modelInfo.getModelNameVersionId())){ modelInfo.setModelVersionId(modelInfo.getModelNameVersionId()); } - if(!empty(modelInfo.getModelVersionId())){ - modelInfo.setModelNameVersionId(modelInfo.getModelVersionId()); - } this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration (); - if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ())) || + if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ()) && this.reqVersion < 5) || (!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance)) && cloudConfiguration == null) { throw new ValidationException ("cloudConfiguration"); @@ -349,7 +374,6 @@ public class MsoRequest { } - if (requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) { if (requestParameters == null) { throw new ValidationException ("requestParameters"); @@ -358,6 +382,16 @@ public class MsoRequest { throw new ValidationException ("subscriptionServiceType"); } } + + if (this.reqVersion > 4 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) { + SubscriberInfo subscriberInfo = sir.getRequestDetails ().getSubscriberInfo(); + if (subscriberInfo == null) { + throw new ValidationException ("subscriberInfo"); + } + if (empty (subscriberInfo.getGlobalSubscriberId ())) { + throw new ValidationException ("globalSubscriberId"); + } + } if(requestScope.equalsIgnoreCase(ModelType.service.name())){ this.serviceInstanceType = modelInfo.getModelName(); @@ -378,10 +412,20 @@ public class MsoRequest { } } - if (empty (requestInfo.getProductFamilyId ()) && ((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) || - (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)))) { + if (empty (requestInfo.getProductFamilyId ())) { + // Mandatory for vnf Create(aLaCarte=true), Network Create(aLaCarte=true) and network update + //Mandatory for macro request create service instance + if((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) || + (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)) || + (this.reqVersion > 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) { throw new ValidationException ("productFamilyId"); } + } + + //required for all operations in V4 + if(empty(requestInfo.getRequestorId()) && this.reqVersion > 3) { + throw new ValidationException ("requestorId"); + } if (empty (requestInfo.getSource ())) { throw new ValidationException ("source"); @@ -401,11 +445,12 @@ public class MsoRequest { for(RelatedInstanceList relatedInstanceList : instanceList){ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - if (relatedInstance.getModelInfo () == null) { + ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo (); + if (relatedInstanceModelInfo == null) { throw new ValidationException ("modelInfo in relatedInstance"); } - if (relatedInstance.getModelInfo ().getModelType () == null) { + if (relatedInstanceModelInfo.getModelType () == null) { throw new ValidationException ("modelType in relatedInstance"); } @@ -426,50 +471,47 @@ public class MsoRequest { if (action != Action.deleteInstance) { + if(!relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) { - // ModelInvariantId is not required in volumeGroup relatedInstance - if(!(relatedInstance.getModelInfo ().getModelType ().equals(ModelType.volumeGroup)) && - empty (relatedInstance.getModelInfo ().getModelInvariantId ())) { + if(empty (relatedInstanceModelInfo.getModelInvariantId ())) { throw new ValidationException ("modelInvariantId in relatedInstance"); + } else if(this.reqVersion > 3 && empty(relatedInstanceModelInfo.getModelVersionId ())) { + throw new ValidationException("modelVersionId in relatedInstance"); + } else if(empty(relatedInstanceModelInfo.getModelName ())) { + throw new ValidationException ("modelName in relatedInstance"); + } else if (empty (relatedInstanceModelInfo.getModelVersion ())) { + throw new ValidationException ("modelVersion in relatedInstance"); + } } - if (!empty (relatedInstance.getModelInfo ().getModelInvariantId ()) && - !UUIDChecker.isValidUUID (relatedInstance.getModelInfo ().getModelInvariantId ())) { + if (!empty (relatedInstanceModelInfo.getModelInvariantId ()) && + !UUIDChecker.isValidUUID (relatedInstanceModelInfo.getModelInvariantId ())) { throw new ValidationException ("modelInvariantId format in relatedInstance"); } - - if (empty(relatedInstance.getModelInfo ().getModelName ()) && - !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { - throw new ValidationException ("modelName in relatedInstance"); } - if (empty (relatedInstance.getModelInfo ().getModelVersion ()) && - !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { - throw new ValidationException ("modelVersion in relatedInstance"); - } + if (empty (relatedInstanceModelInfo.getModelCustomizationName ()) && relatedInstanceModelInfo.getModelType ().equals (ModelType.vnf) ) { + if(this.reqVersion >=3 && empty (relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) { + throw new ValidationException ("modelCustomizationName or modelCustomizationId in relatedInstance of vnf"); + } else if(this.reqVersion < 3) { + throw new ValidationException ("modelCustomizationName in relatedInstance"); } - - if (empty (relatedInstance.getModelInfo ().getModelCustomizationName ()) && - relatedInstance.getModelInfo ().getModelType ().equals (ModelType.vnf)) { - throw new ValidationException ("modelCustomizationName in relatedInstance"); } - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { + if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) { isRelatedServiceInstancePresent = true; if (!relatedInstance.getInstanceId ().equals (this.sir.getServiceInstanceId ())) { throw new ValidationException ("serviceInstanceId matching the serviceInstanceId in request URI"); } - serviceModelName = relatedInstance.getModelInfo ().getModelName (); - asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion (); - } - else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + serviceModelName = relatedInstanceModelInfo.getModelName (); + asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion (); + } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) { isRelatedVnfInstancePresent = true; if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) { throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI"); } - vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName(); - } - else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { + vnfModelName = relatedInstanceModelInfo.getModelCustomizationName(); + } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) { volumeGroupId = relatedInstance.getInstanceId (); } } @@ -556,21 +598,22 @@ public class MsoRequest { try{ if(queryParam.equalsIgnoreCase("filter")){ - - StringTokenizer st = new StringTokenizer(entry.getValue().get(0), ":"); - - int counter=0; - String mapKey=null; - List<String> orchestrationList = new ArrayList<String>(); - while (st.hasMoreElements()) { - if(counter == 0){ - mapKey = st.nextElement() + ""; - } else{ - orchestrationList.add(st.nextElement() + ""); - } - counter++; - } - orchestrationFilterParams.put(mapKey, orchestrationList); + for(String value : entry.getValue()) { + StringTokenizer st = new StringTokenizer(value, ":"); + + int counter=0; + String mapKey=null; + List<String> orchestrationList = new ArrayList<String>(); + while (st.hasMoreElements()) { + if(counter == 0){ + mapKey = st.nextElement() + ""; + } else{ + orchestrationList.add(st.nextElement() + ""); + } + counter++; + } + orchestrationFilterParams.put(mapKey, orchestrationList); + } } }catch(Exception e){ @@ -590,7 +633,7 @@ public class MsoRequest { Session session = null; try { - session = hibernateUtils.getSessionFactory ().openSession (); + session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); session.beginTransaction (); if (null == sir) { @@ -727,7 +770,7 @@ public class MsoRequest { public void updateFinalStatus (Status status) { int result = 0; try { - result = RequestsDatabase.updateInfraFinalStatus (requestId, + result = (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId, status.toString (), this.errorMessage, this.progress, @@ -939,6 +982,20 @@ public class MsoRequest { //mapper.configure(Feature.WRAP_ROOT_VALUE, true); msoLogger.debug ("building sir from object " + sir); requestJSON = mapper.writeValueAsString(sir); + + // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields + + msoLogger.debug("REQUEST JSON before mapping: " + requestJSON); + // modelUuid = modelVersionId + requestJSON = requestJSON.replaceAll("\"modelVersionId\":","\"modelUuid\":"); + // modelCustomizationUuid = modelCustomizationId + requestJSON = requestJSON.replaceAll("\"modelCustomizationId\":","\"modelCustomizationUuid\":"); + // modelInstanceName = modelCustomizationName + requestJSON = requestJSON.replaceAll("\"modelCustomizationName\":","\"modelInstanceName\":"); + // modelInvariantUuid = modelInvariantId + requestJSON = requestJSON.replaceAll("\"modelInvariantId\":","\"modelInvariantUuid\":"); + msoLogger.debug("REQUEST JSON after mapping: " + requestJSON); + return requestJSON; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java index 59b93eadde..f61a50bb06 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java @@ -39,8 +39,6 @@ import javax.xml.bind.Unmarshaller; import javax.xml.transform.sax.SAXSource; import org.apache.http.HttpStatus; -import org.xml.sax.InputSource; - import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.apihandlerinfra.networkbeans.ActionType; import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkInputs; @@ -55,8 +53,13 @@ import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; +import org.xml.sax.InputSource; + +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; @Path("/{version: v1|v2|v3}/network-request") +@Api(value="/{version: v1|v2|v3}/network-request",description="API Requests for network requests") public class NetworkInfoHandler { protected ObjectFactory beansObjectFactory = new ObjectFactory (); @@ -64,6 +67,7 @@ public class NetworkInfoHandler { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); @GET + @ApiOperation(value="Finds Network Requests",response=Response.class) public Response queryFilters (@QueryParam("network-type") String networkType, @QueryParam("service-type") String serviceType, @QueryParam("aic-node-clli") String aicNodeClli, @@ -94,6 +98,7 @@ public class NetworkInfoHandler { @GET @Path(Constants.REQUEST_ID_PATH) + @ApiOperation(value="Add a Network Outputs from requestId and version",response=Response.class) public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) { // Check INFRA_ACTIVE_REQUESTS table to find info // on this request @@ -213,7 +218,7 @@ public class NetworkInfoHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK"); + InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, "NETWORK"); if (activeReq != null) { // build response for active responseString = infraRequestsResponse (activeReq, version); @@ -230,7 +235,7 @@ public class NetworkInfoHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute, queryValue, "NETWORK"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java index c25f5ce1ef..4f022c2b16 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java @@ -56,10 +56,10 @@ import org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; public class NetworkMsoInfraRequest { @@ -80,7 +80,7 @@ public class NetworkMsoInfraRequest { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; - protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); NetworkMsoInfraRequest (String requestId) { this.requestId = requestId; @@ -255,7 +255,7 @@ public class NetworkMsoInfraRequest { Session session = null; try { - session = hibernateUtils.getSessionFactory ().openSession (); + session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); @@ -348,7 +348,7 @@ public class NetworkMsoInfraRequest { public void updateFinalStatus (Status status) { try { - RequestsDatabase.updateInfraFinalStatus (requestId, + (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId, status.toString (), this.errorMessage, this.progress, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java index 8d44d213b1..1922cb421a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java @@ -94,6 +94,8 @@ public class NetworkRequestHandler { .entity (NOT_FOUND) .build (); + private RequestsDatabase requestDB = RequestsDatabase.getInstance(); + @GET public Response queryFilters (@QueryParam("network-type") String networkType, @QueryParam("service-type") String serviceType, @@ -244,7 +246,7 @@ public class NetworkRequestHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK"); + InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, "NETWORK"); if (activeReq != null) { // build response for active responseString = infraRequestsResponse (activeReq, version); @@ -261,7 +263,7 @@ public class NetworkRequestHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute, queryValue, "NETWORK"); @@ -433,7 +435,7 @@ public class NetworkRequestHandler { InfraActiveRequests dup = null; try { - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (), + dup = requestDB.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (), msoRequest.getRequestInfo ().getAction ().value (), "NETWORK"); @@ -471,7 +473,7 @@ public class NetworkRequestHandler { InfraActiveRequests dup = null; msoLogger.debug ("Checking for a duplicate with the same network-id"); try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (), + dup = requestDB.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (), msoRequest.getRequestInfo ().getAction ().value (), "NETWORK"); @@ -511,7 +513,7 @@ public class NetworkRequestHandler { String orchestrationURI = ""; // Query MSO Catalog DB - try (CatalogDatabase db = new CatalogDatabase()) { + try (CatalogDatabase db = CatalogDatabase.getInstance()) { Recipe recipe = null; @@ -618,7 +620,7 @@ public class NetworkRequestHandler { String bpelXMLResponseBody = respHandler.getResponseBody (); msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), + requestDB.updateInfraStatus (msoRequest.getRequestId (), Status.IN_PROGRESS.toString (), Constants.PROGRESS_REQUEST_IN_PROGRESS, Constants.MODIFIED_BY_APIHANDLER); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java index 3bdb745b15..bd47c8a4dd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java @@ -26,28 +26,34 @@ import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.apache.http.HttpStatus; - import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkType; import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkTypes; import org.openecomp.mso.apihandlerinfra.networkbeans.ObjectFactory; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.NetworkResource; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + @Path(Constants.NETWORK_TYPES_PATH) +@Api(value="/{version: v1|v2|v3}/network-types",description="API Requests to find Network Types") public class NetworkTypesHandler { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); @GET - public Response getNetworkTypes () { + @ApiOperation(value="Finds Network Types",response=Response.class) + public Response getNetworkTypes (@PathParam("version") String version) { long startTime = System.currentTimeMillis (); MsoLogger.setServiceName ("getNetworkTypes"); // Generate a Request Id @@ -55,7 +61,7 @@ public class NetworkTypesHandler { msoLogger.debug ("Incoming request received for getNetworkTypes"); List <NetworkResource> networkResources = null; - try (CatalogDatabase db = new CatalogDatabase()){ + try (CatalogDatabase db = CatalogDatabase.getInstance()){ networkResources = db.getAllNetworkResources (); } catch (Exception e) { msoLogger.debug ("No connection to catalog DB", e); @@ -75,9 +81,9 @@ public class NetworkTypesHandler { for (int i = 0; i < networkResources.size (); i++) { NetworkType networkType = beansObjectFactory.createNetworkType (); NetworkResource vr = networkResources.get (i); - networkType.setType (vr.getNetworkType ()); + networkType.setType (vr.getModelName()); networkType.setDescription (vr.getDescription ()); - networkType.setId (String.valueOf (vr.getId ())); + networkType.setId (String.valueOf (vr.getModelUUID())); networkTypes.getNetworkType ().add (networkType); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java new file mode 100644 index 0000000000..cb4b94ce3a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java @@ -0,0 +1,46 @@ +package org.openecomp.mso.apihandlerinfra;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.mso.HealthCheckUtils;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/nodehealthcheck")
+@Api(value="/nodehealthcheck",description="API Handler Infra Node Health Check")
+public class NodeHealthcheckHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @HEAD
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing node health check",response=Response.class)
+ public Response nodeHealthcheck () {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("NodeHealthcheck");
+ // Generate a Request Id
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, requestId)) {
+ msoLogger.debug("nodeHealthcheck - Successful");
+ return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
+ } else {
+ msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available.");
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index f42ba97e89..4f0bad9028 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -24,7 +24,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; @@ -33,16 +38,26 @@ import javax.ws.rs.core.UriInfo; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; - import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; -@Path("/") +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +@Path("/orchestrationRequests") +@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests") public class OrchestrationRequests { public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @@ -51,6 +66,8 @@ public class OrchestrationRequests { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + /** * */ @@ -59,9 +76,10 @@ public class OrchestrationRequests { } @GET - @Path("/orchestrationRequests/{version:[vV][2-3]}/{requestId}") + @Path("/{version:[vV][2-5]}/{requestId}") + @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId) { + public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) { GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); @@ -72,7 +90,7 @@ public class OrchestrationRequests { InfraActiveRequests requestDB = null; try { - requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); + requestDB = requestsDB.getRequestFromInfraActive(requestId); } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); @@ -112,9 +130,10 @@ public class OrchestrationRequests { } @GET - @Path("/orchestrationRequests/{version:[vV][2-3]}") + @Path("/{version:[vV][2-5]}") + @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@Context UriInfo ui) { + public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) { long startTime = System.currentTimeMillis (); @@ -131,7 +150,7 @@ public class OrchestrationRequests { Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); - activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap); + activeRequests = requestsDB.getOrchestrationFiltersFromInfraActive(orchestrationMap); orchestrationList = new GetOrchestrationListResponse(); @@ -166,10 +185,11 @@ public class OrchestrationRequests { @POST - @Path("/orchestrationRequests/v3/{requestId}/unlock") + @Path("/{version: [vV][3-5]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId) { + @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class) + public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { MsoRequest msoRequest = new MsoRequest (requestId); @@ -218,7 +238,7 @@ public class OrchestrationRequests { } try { - requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); + requestDB = requestsDB.getRequestFromInfraActive(requestId); if(requestDB == null) { Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, @@ -238,7 +258,7 @@ public class OrchestrationRequests { if(status == Status.IN_PROGRESS || status == Status.PENDING){ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); reqStatus.setRequestState(Status.UNLOCKED.toString ()); - RequestsDatabase.updateInfraStatus (requestId, + requestsDB.updateInfraStatus (requestId, Status.UNLOCKED.toString (), Constants.MODIFIED_BY_APIHANDLER); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java index 940fcc9c57..e6887a59e9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java @@ -43,6 +43,7 @@ public class RequestActionMap { actionMap.put("createInstance", "createInstance"); actionMap.put("deleteInstance", "deleteInstance"); actionMap.put("updateInstance", "updateInstance"); + actionMap.put("replaceInstance", "replaceInstance"); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index 988d72cc6f..91888f8a35 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -36,55 +36,91 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; - -import org.openecomp.mso.apihandler.common.*; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*; +import org.openecomp.mso.apihandler.common.ErrorNumbers; +import org.openecomp.mso.apihandler.common.RequestClient; +import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.ResponseHandler; +import org.openecomp.mso.apihandler.common.ValidationException; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestReferences; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesResponse; import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.*; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.Recipe; +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.openecomp.mso.db.catalog.beans.VnfRecipe; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; -@Path("/serviceInstances/{version:[vV][2-3]}") +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +@Path("/serviceInstances") +@Api(value="/serviceInstances",description="API Requests for Service Instances") public class ServiceInstances { - private HashMap<String, String> instanceIdMap = new HashMap<String,String>(); + private HashMap<String, String> instanceIdMap = new HashMap<String,String>(); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); + @POST + @Path("/{version:[vV][3-5]}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create a Service Instance on a version provided",response=Response.class) + public Response createServiceInstance(String request, @PathParam("version") String version) { - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + Response response = serviceInstances(request, Action.createInstance, null, version); - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + return response; + } + + @POST + @Path("/{version:[vV][5]}/{serviceInstanceId}/activate") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Activate provided Service Instance",response=Response.class) + public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties (); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + Response response = serviceInstances(request, Action.activateInstance, instanceIdMap, version); - /** - * - */ - public ServiceInstances() { - // TODO Auto-generated constructor stub + return response; } - + @POST - @Path("/") + @Path("/{version:[vV][5]}/{serviceInstanceId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response createServiceInstance(String request, @PathParam("version") String version) { + @ApiOperation(value="Deactivate provided Service Instance",response=Response.class) + public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - Response response = serviceInstances(request, Action.createInstance, null, version); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + Response response = serviceInstances(request, Action.deactivateInstance, instanceIdMap, version); return response; } + @DELETE - @Path("/{serviceInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Delete provided Service Instance",response=Response.class) public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); @@ -93,23 +129,56 @@ public class ServiceInstances { } @POST - @Path("/{serviceInstanceId}/vnfs") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create VNF on a specified version and serviceInstance",response=Response.class) public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - msoLogger.debug ("version is: " + version); + msoLogger.debug ("version is: " + version); instanceIdMap.put("serviceInstanceId", serviceInstanceId); Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); return response; } + + @POST + @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Replace provided VNF instance",response=Response.class) + public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId) { + msoLogger.debug ("version is: " + version); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + Response response = serviceInstances(request, Action.replaceInstance, instanceIdMap, version); + + return response; + } + + @PUT + @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Update VNF on a specified version, serviceInstance and vnfInstance",response=Response.class) + public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId) { + + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version); + + return response; + } + @DELETE - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Delete provided VNF instance",response=Response.class) public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); @@ -119,26 +188,46 @@ public class ServiceInstances { } @POST - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class) public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - msoLogger.debug ("version is: " + version); + @PathParam("vnfInstanceId") String vnfInstanceId) { + msoLogger.debug ("version is: " + version); instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); return response; } + + @POST + @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class) + public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { + + msoLogger.debug ("version is: " + version); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); + Response response = serviceInstances(request, Action.replaceInstance, instanceIdMap, version); + + return response; + } @PUT - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",response=Response.class) public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); @@ -149,12 +238,13 @@ public class ServiceInstances { } @DELETE - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Delete provided VfModule instance",response=Response.class) public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); @@ -167,11 +257,12 @@ public class ServiceInstances { @POST - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create VolumeGroup on a specified version, serviceInstance, vnfInstance",response=Response.class) public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); @@ -181,12 +272,13 @@ public class ServiceInstances { } @PUT - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",response=Response.class) public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); @@ -198,12 +290,13 @@ public class ServiceInstances { } @DELETE - @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Delete provided VolumeGroup instance",response=Response.class) public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); @@ -215,9 +308,10 @@ public class ServiceInstances { } @POST - @Path("/{serviceInstanceId}/networks") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Create NetworkInstance on a specified version and serviceInstance ",response=Response.class) public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); @@ -227,11 +321,12 @@ public class ServiceInstances { } @PUT - @Path("/{serviceInstanceId}/networks/{networkInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, networkInstance",response=Response.class) public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { + @PathParam("networkInstanceId") String networkInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("networkInstanceId", networkInstanceId); @@ -241,11 +336,12 @@ public class ServiceInstances { } @DELETE - @Path("/{serviceInstanceId}/networks/{networkInstanceId}") + @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Delete provided Network instance",response=Response.class) public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { + @PathParam("networkInstanceId") String networkInstanceId) { instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("networkInstanceId", networkInstanceId); @@ -258,573 +354,647 @@ public class ServiceInstances { private Response serviceInstances(String requestJSON, Action action, HashMap<String,String> instanceIdMap, String version) { - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - ServiceInstancesRequest sir = null; - - MsoRequest msoRequest = new MsoRequest (requestId); - - - try{ - ObjectMapper mapper = new ObjectMapper(); - sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - try{ - msoRequest.parse(sir, instanceIdMap, action, version); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - InfraActiveRequests dup = null; - String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); - String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); - try { - if(!(instanceName==null && requestScope.equals("service") && action == Action.createInstance)){ - dup = RequestsDatabase.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - String instance = null; - if(instanceName != null){ - instance = instanceName; - }else{ - instance = instanceIdMap.get(requestScope + "InstanceId"); - } - String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding."; - //List<String> variables = new ArrayList<String>(); - //variables.add(dup.getRequestStatus()); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, - dupMessage, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service"); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); - - RequestReferences referencesResponse = new RequestReferences(); - - referencesResponse.setRequestId(requestId); - - serviceResponse.setRequestReferences(referencesResponse); - - CatalogDatabase db = null; - try { - db = new CatalogDatabase (); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "No communication to catalog DB " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - - RecipeLookupResult recipeLookupResult = null; - try { - recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action); - } catch (ValidationException e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error validating request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe could not be retrieved from catalog DB " + e.getMessage (), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - if (recipeLookupResult == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - - Boolean isBaseVfModule = false; - - if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) { - String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion (); - - // Get VF Module-specific base module indicator - VfModule vfm = null; - - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - vfm = db.getVfModuleType (msoRequest.getVfModuleType (), asdcServiceModelVersion); - } - else { - vfm = db.getVfModuleType (msoRequest.getVfModuleType ()); - } - - if (vfm != null) { - if (vfm.getIsBase() == 1) { - isBaseVfModule = true; - } - } - else if (action == Action.createInstance || action == Action.updateInstance){ - // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB. - // This request cannot proceed - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - String serviceVersionText = ""; - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - serviceVersionText = " with version " + asdcServiceModelVersion; - } - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB", - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - } - - db.close(); - - String serviceInstanceId = ""; - String vnfId = ""; - String vfModuleId = ""; - String volumeGroupId = ""; - String networkId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getVnfInstanceId () != null){ - vnfId = siReq.getVnfInstanceId (); - } - - if(siReq.getVfModuleInstanceId () != null){ - vfModuleId = siReq.getVfModuleInstanceId (); - } - - if(siReq.getVolumeGroupInstanceId () != null){ - volumeGroupId = siReq.getVolumeGroupInstanceId (); - } - - if(siReq.getNetworkInstanceId () != null){ - networkId = siReq.getNetworkInstanceId (); - } - - - requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - msoRequest.createRequestRecord (Status.PENDING, action); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Exception while creating record in DB " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), props); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - - System.out.println("URL : " + requestClient.getUrl ()); - - response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (), - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, - msoRequest.getServiceInstanceType (), - msoRequest.getVnfType (), msoRequest.getVfModuleType (), - msoRequest.getNetworkType (), msoRequest.getRequestJSON()); - - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getResponseBody (); - msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody); - return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build (); - } else { - List<String> variables = new ArrayList<String>(); - variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getResponseBody (); - if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1" , - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - - //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build (); - // return serviceResponse; + String requestId = UUIDChecker.generateUUID(msoLogger); + long startTime = System.currentTimeMillis (); + msoLogger.debug ("requestId is: " + requestId); + ServiceInstancesRequest sir = null; + + MsoRequest msoRequest = new MsoRequest (requestId); + + + try{ + ObjectMapper mapper = new ObjectMapper(); + sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + + } catch(Exception e){ + msoLogger.debug ("Mapping of request to JSON object failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Mapping of request to JSON object failed. " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, null); + if (msoRequest.getRequestId () != null) { + msoLogger.debug ("Mapping of request to JSON object failed"); + msoRequest.createRequestRecord (Status.FAILED, action); + } + msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + + try{ + msoRequest.parse(sir, instanceIdMap, action, version); + } catch (Exception e) { + msoLogger.debug ("Validation failed: ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Error parsing request. " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, null); + if (msoRequest.getRequestId () != null) { + msoLogger.debug ("Logging failed message to the database"); + msoRequest.createRequestRecord (Status.FAILED, action); + } + msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + InfraActiveRequests dup = null; + String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); + String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); + try { + if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){ + dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); + } + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); + + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, + e.getMessage(), + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null) ; + + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + if (dup != null) { + // Found the duplicate record. Return the appropriate error. + String instance = null; + if(instanceName != null){ + instance = instanceName; + }else{ + instance = instanceIdMap.get(requestScope + "InstanceId"); + } + String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding."; + //List<String> variables = new ArrayList<String>(); + //variables.add(dup.getRequestStatus()); + + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, + dupMessage, + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null) ; + + + msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service"); + msoRequest.createRequestRecord (Status.FAILED, action); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + + ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); + + RequestReferences referencesResponse = new RequestReferences(); + + referencesResponse.setRequestId(requestId); + + serviceResponse.setRequestReferences(referencesResponse); + + CatalogDatabase db = null; + try { + db = CatalogDatabase.getInstance(); + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + "No communication to catalog DB " + e.getMessage (), + ErrorNumbers.SVC_NO_SERVER_RESOURCES, + null); + alarmLogger.sendAlarm ("MsoDatabaseAccessError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); + msoRequest.createRequestRecord (Status.FAILED,action); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + + + RecipeLookupResult recipeLookupResult = null; + try { + recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action); + } catch (ValidationException e) { + msoLogger.debug ("Validation failed: ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Error validating request. " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, null); + if (msoRequest.getRequestId () != null) { + msoLogger.debug ("Logging failed message to the database"); + msoRequest.createRequestRecord (Status.FAILED, action); + } + msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + "Recipe could not be retrieved from catalog DB " + e.getMessage (), + ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, + null); + alarmLogger.sendAlarm ("MsoDatabaseAccessError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB)); + msoRequest.createRequestRecord (Status.FAILED,action); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + db.close(); + return response; + } + + if (recipeLookupResult == null) { + msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB"); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + "Recipe does not exist in catalog DB", + ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, + null); + msoRequest.createRequestRecord (Status.FAILED, action); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + db.close(); + return response; + } + + + Boolean isBaseVfModule = false; + + if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) { + String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion (); + + // Get VF Module-specific base module indicator + VfModule vfm = null; + + String modelVersionId = msoRequest.getModelInfo().getModelVersionId(); + + if(modelVersionId != null) { + vfm = db.getVfModuleByModelUuid(modelVersionId); + } else { + vfm = db.getVfModuleByModelInvariantUuidAndModelVersion(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); + } + + if (vfm != null) { + if (vfm.getIsBase() == 1) { + isBaseVfModule = true; + } + } + else if (action == Action.createInstance || action == Action.updateInstance){ + // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB. + // This request cannot proceed + msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB"); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + String serviceVersionText = ""; + if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { + serviceVersionText = " with version " + asdcServiceModelVersion; + } + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB", + ErrorNumbers.SVC_BAD_PARAMETER, + null); + msoRequest.createRequestRecord (Status.FAILED, action); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + db.close(); + return response; + } + } + + db.close(); + + String serviceInstanceId = ""; + String vnfId = ""; + String vfModuleId = ""; + String volumeGroupId = ""; + String networkId = ""; + ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); + + if(siReq.getServiceInstanceId () != null){ + serviceInstanceId = siReq.getServiceInstanceId (); + } + + if(siReq.getVnfInstanceId () != null){ + vnfId = siReq.getVnfInstanceId (); + } + + if(siReq.getVfModuleInstanceId () != null){ + vfModuleId = siReq.getVfModuleInstanceId (); + } + + if(siReq.getVolumeGroupInstanceId () != null){ + volumeGroupId = siReq.getVolumeGroupInstanceId (); + } + + if(siReq.getNetworkInstanceId () != null){ + networkId = siReq.getNetworkInstanceId (); + } + + + requestId = msoRequest.getRequestId (); + msoLogger.debug ("requestId is: " + requestId); + msoLogger.debug ("About to insert a record"); + + try { + msoRequest.createRequestRecord (Status.PENDING, action); + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, + MsoException.ServiceException, + "Exception while creating record in DB " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, + null); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + RequestClient requestClient = null; + HttpResponse response = null; + long subStartTime = System.currentTimeMillis(); + try { + requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), MsoPropertiesUtils.loadMsoProperties ()); + // Capture audit event + msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); + + System.out.println("URL : " + requestClient.getUrl ()); + + response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (), + serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, + msoRequest.getServiceInstanceType (), + msoRequest.getVnfType (), msoRequest.getVfModuleType (), + msoRequest.getNetworkType (), msoRequest.getRequestJSON()); + + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); + } catch (Exception e) { + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, + MsoException.ServiceException, + "Failed calling bpmn " + e.getMessage (), + ErrorNumbers.SVC_NO_SERVER_RESOURCES, + null); + alarmLogger.sendAlarm ("MsoConfigurationError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); + msoRequest.updateFinalStatus (Status.FAILED); + msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + + if (response == null) { + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, + MsoException.ServiceException, + "bpelResponse is null", + ErrorNumbers.SVC_NO_SERVER_RESOURCES, + null); + msoRequest.updateFinalStatus (Status.FAILED); + msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + + ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); + int bpelStatus = respHandler.getStatus (); + + // BPEL accepted the request, the request is in progress + if (bpelStatus == HttpStatus.SC_ACCEPTED) { + String camundaJSONResponseBody = respHandler.getResponseBody (); + msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); + (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (), + Status.IN_PROGRESS.toString (), + Constants.PROGRESS_REQUEST_IN_PROGRESS, + Constants.MODIFIED_BY_APIHANDLER); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody); + return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build (); + } else { + List<String> variables = new ArrayList<String>(); + variables.add(bpelStatus + ""); + String camundaJSONResponseBody = respHandler.getResponseBody (); + if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, + MsoException.ServiceException, + "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + variables); + msoRequest.updateFinalStatus (Status.FAILED); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } else { + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, + MsoException.ServiceException, + "Request Failed due to BPEL error with HTTP Status= %1" , + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + variables); + msoRequest.updateFinalStatus (Status.FAILED); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + } + + //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build (); + // return serviceResponse; } - private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - RecipeLookupResult recipeLookupResult = null; - //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT†recipe for the requested action - - msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag()); - // Query MSO Catalog DB - - if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) { - recipeLookupResult = getServiceURI(db, msoRequest, action); - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) || - msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - - recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action); - - }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { - - recipeLookupResult = getNetworkUri(db, msoRequest, action); - } - - if (recipeLookupResult != null) { - msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); - } - else { - msoLogger.debug("No matching recipe record found"); - } - return recipeLookupResult; - } - - - private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - // SERVICE REQUEST - // Construct the default service name - // TODO need to make this a configurable property - String sourceDefaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - String defaultService = "*"; - - Service serviceRecord = null; - int serviceId; - ServiceRecipe recipe = null; - - //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific model version - if(!msoRequest.getALaCarteFlag()){ - serviceRecord = db.getServiceByVersionAndInvariantId(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); - if(serviceRecord !=null){ - serviceId = serviceRecord.getId(); - recipe = db.getServiceRecipe(serviceId, action.name()); - } - } - - if (recipe == null) { - //find source(initiator) default recipe - recipe = db.getServiceRecipeByServiceNameAndAction(sourceDefaultServiceName, action.name()); - } - if (recipe == null) { - //find default recipe - recipe = db.getServiceRecipeByServiceNameAndAction(defaultService, action.name()); - } - if(recipe==null){ - return null; - } - return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - - } - - - private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - String vnfComponentType = msoRequest.getModelInfo().getModelType().name(); - - RelatedInstanceList[] instanceList = null; - if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { - instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); - } - - String serviceModelName = null; - String vnfModelName = null; - String asdcServiceModelVersion = null; - String modelVersion = msoRequest.getModelInfo().getModelVersion(); - Recipe recipe = null; - String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - String modelCustomizationId = msoRequest.getModelInfo().getModelCustomizationId(); - String vfModuleModelName = msoRequest.getModelInfo().getModelName(); - if (instanceList != null) { - - for(RelatedInstanceList relatedInstanceList : instanceList){ - - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - ModelInfo modelInfo = relatedInstance.getModelInfo(); - if(modelInfo.getModelType().equals(ModelType.service)){ - serviceModelName = modelInfo.getModelName(); - asdcServiceModelVersion = modelInfo.getModelVersion(); - } - - if(modelInfo.getModelType().equals(ModelType.vnf)){ - vnfModelName = modelInfo.getModelCustomizationName(); - if (null == vnfModelName || vnfModelName.trim().isEmpty()) { - VnfResource vnfResource = db.getVnfResourceByModelCustomizationId(modelInfo.getModelCustomizationUuid(), modelInfo.getModelVersion()); - vnfModelName = vnfResource.getModelName(); - } - } - } - - if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - String modelCustomizationName = msoRequest.getModelInfo().getModelCustomizationName(); - - VnfResource vnfResource = null; - - // Validation for vnfResource - if(modelCustomizationName!=null) { - vnfResource = db.getVnfResource(serviceModelName + "/" + modelCustomizationName, asdcServiceModelVersion); - }else{ - vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId, asdcServiceModelVersion); - } - - if(vnfResource==null){ - throw new ValidationException("catalog entry"); - } - - VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name()); - - if (vnfRecipe == null) { - return null; - } - - return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); - }else{ - String vnfType = serviceModelName + "/" + vnfModelName; - String vfModuleType = vnfType + "::" + vfModuleModelName; - List<VfModule> vfModule = db.getVfModule(vfModuleType, modelCustomizationId, asdcServiceModelVersion, modelVersion, action.name()); - if(vfModule==null || vfModule.isEmpty()){ - throw new ValidationException("catalog entry"); - }else{ - if(!msoRequest.getALaCarteFlag() && action != Action.deleteInstance){ - recipe = db.getVnfComponentsRecipeByVfModule(vfModule, action.name()); - } - } - if (recipe == null) { - msoLogger.debug("recipe is null, getting default"); - recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); - - if (recipe == null) { - return null; - } - } - - } - } else { - msoLogger.debug("recipe is null, getting default"); - - if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - recipe = db.getVnfRecipe(defaultVnfType, action.name()); - if (recipe == null) { - return null; - } - } else { - recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); - - if (recipe == null) { - return null; - } - } - } - - return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - - private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - String sourceDefaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - String defaultNetworkType = "*"; - - String modelName = msoRequest.getModelInfo().getModelName(); - Recipe recipe = null; - //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific ModelCustomizationId - if(!msoRequest.getALaCarteFlag()){ - String networkType = null; - - if(msoRequest.getModelInfo().getModelCustomizationId()!=null){ - NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(msoRequest.getModelInfo().getModelCustomizationId()); - if(networkResource!=null){ - networkType = networkResource.getNetworkType(); - }else{ - throw new ValidationException("no catalog entry found"); - } - }else{ - //ok for version < 3 - networkType = modelName; - } - - //find latest version Recipe for the given networkType and action - recipe = db.getNetworkRecipe(networkType, action.name()); - } - - if(recipe == null){ - //find source(initiator) default recipe - recipe = db.getNetworkRecipe(sourceDefaultNetworkType, action.name()); - } - if(recipe == null){ - //find default recipe - recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); - } - if (recipe == null) { - return null; - } - return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } + private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + RecipeLookupResult recipeLookupResult = null; + //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT†recipe for the requested action + + msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag()); + // Query MSO Catalog DB + + if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) { + recipeLookupResult = getServiceURI(db, msoRequest, action); + } + else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) || + msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { + + recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action); + + }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { + + recipeLookupResult = getNetworkUri(db, msoRequest, action); + } + + if (recipeLookupResult != null) { + msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); + } + else { + msoLogger.debug("No matching recipe record found"); + } + return recipeLookupResult; + } + + + private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + // SERVICE REQUEST + // Construct the default service name + // TODO need to make this a configurable property + String defaultServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + + Service serviceRecord = null; + ModelInfo modelInfo = msoRequest.getModelInfo(); + if(msoRequest.getALaCarteFlag()){ + serviceRecord = db.getServiceByModelName(defaultServiceModelName); + }else{ + serviceRecord = db.getServiceByModelUUID(modelInfo.getModelVersionId()); // ModelVersionId is not required in v3 + if(serviceRecord == null) { + serviceRecord = db.getServiceByVersionAndInvariantId(modelInfo.getModelInvariantId(), modelInfo.getModelVersion()); + } + } + + ServiceRecipe recipe = null; + if(serviceRecord !=null){ + recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); + } + //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found + RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); + if(reqParam!=null && reqParam.isALaCarteSet() && recipe==null){ + return null; + }else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default + serviceRecord = db.getServiceByModelName(defaultServiceModelName); + recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); + } + + if(modelInfo.getModelVersionId() == null) { + modelInfo.setModelVersionId(serviceRecord.getModelUUID()); + } + if(recipe==null){ + return null; + } + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } + + + private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + + ModelInfo modelInfo = msoRequest.getModelInfo(); + String vnfComponentType = modelInfo.getModelType().name(); + + RelatedInstanceList[] instanceList = null; + if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { + instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); + } + + Recipe recipe = null; + String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String modelCustomizationId = modelInfo.getModelCustomizationId(); + String modelCustomizationName = modelInfo.getModelCustomizationName(); + String relatedInstanceModelVersionId = null; + String relatedInstanceModelInvariantId = null; + String relatedInstanceVersion = null; + String relatedInstanceModelCustomizationName = null; + + if (instanceList != null) { + + for(RelatedInstanceList relatedInstanceList : instanceList){ + + RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); + ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo(); + if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)){ + relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId(); + relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion(); + } + + if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)){ + relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId(); + relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId(); + relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion(); + relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName(); + } + } + + if(modelInfo.getModelType().equals(ModelType.vnf)) { + // a. For a vnf request (only create, no update currently): + // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in vnf_resource_customization.model_customization_uuid. + // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have + // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName + // to “join†service_to_resource_customizations with vnf_resource_customization to confirm a vnf_resource_customization.model_customization_uuid record exists. + // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId + // (MODEL_UUID) in SERVICE table. + // iii. Regardless of how the value was provided/obtained above, APIH must always populate vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated + // during 1707 data migration if VID did not provide it originally on request. + // iv. Note: continue to construct the “vnf-type†value and pass to BPMN (must still be populated in A&AI). + // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to look it up in our catalog to construct vnf-type value to pass to BPMN. + + VnfResource vnfResource = null; + VnfResourceCustomization vrc = null; + // Validation for vnfResource + + if(modelCustomizationId!=null) { + vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId); + } else { + Service service = db.getServiceByModelUUID(relatedInstanceModelVersionId); + if(service == null) { + service = db.getServiceByVersionAndInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion); + } + + if(service == null) { + throw new ValidationException("service in relatedInstance"); + } + + vrc = db.getVnfResourceCustomizationByModelCustomizationName(modelCustomizationName, service.getModelUUID()); + if(vrc != null) { + vnfResource = vrc.getVnfResource(); + modelInfo.setModelCustomizationId(vrc.getModelCustomizationUuid()); + modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUuid()); + } + } + + if(vnfResource==null){ + throw new ValidationException("catalog entry"); + } else { + if(modelInfo.getModelVersionId() == null) { + modelInfo.setModelVersionId(vnfResource.getModelUuid()); + } + } + + VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name()); + + if (vnfRecipe == null) { + return null; + } + + return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); + } else { + // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have + // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId** + modelInfo[vnf].modelCustomizationName + // to “join†vnf_to_resource_customizations with vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record exists. + // **If relatedInstance.modelInfo[vnf].modelVersionId was not provided, use relatedInstance.modelInfo[vnf].modelInvariantId + modelVersion instead + // to lookup modelVersionId (MODEL_UUID) in vnf_resource table. Once the vnf’s model_customization_uuid has been obtained, use it to find all vfModule customizations + // for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. For each vf_module_cust_model_customization_uuid value returned, + // use that UUID to query vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId** to confirm record matches request data + // (and to identify the modelCustomizationId associated with the vfModule in the request). **If modelInfo[vfModule|volumeGroup].modelVersionId was not + // provided (potentially in v2/v3), use modelInfo[vfModule|volumeGroup].modelInvariantId + modelVersion instead. This means taking each record found + // in vf_module_customization and looking up in vf_module (using vf_module_customization’s FK into vf_module) to find a match on MODEL_INVARIANT_UUID (modelInvariantId) + // and MODEL_VERSION (modelVersion). + + if(!msoRequest.getALaCarteFlag()) { + VfModuleCustomization vfmc = null; + VnfResourceCustomization vnfrc = null; + VfModule vfModule = null; + + if( modelInfo.getModelCustomizationId() != null) { + vfmc = db.getVfModuleCustomizationByModelCustomizationId(modelInfo.getModelCustomizationId()); + } else { + vnfrc =db.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(relatedInstanceModelCustomizationName, relatedInstanceModelVersionId); + if(vnfrc == null) { + vnfrc = db.getVnfResourceCustomizationByModelInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion, relatedInstanceModelCustomizationName); + } + + List<VfModuleCustomization> list = db.getVfModuleCustomizationByVnfModuleCustomizationUuid(vnfrc.getModelCustomizationUuid()); + + String vfModuleModelUUID = modelInfo.getModelVersionId(); + for(VfModuleCustomization vf : list) { + if(vfModuleModelUUID != null) { + vfModule = db.getVfModuleByModelCustomizationIdAndVersion(vf.getModelCustomizationUuid(), vfModuleModelUUID); + } else { + vfModule = db.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(vf.getModelCustomizationUuid(), modelInfo.getModelVersion(), modelInfo.getModelInvariantId()); + } + + if(vfModule != null) { + modelInfo.setModelCustomizationId(vf.getModelCustomizationUuid()); + modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUuid()); + break; + } + } + } + + if(vfmc == null && vfModule == null) { + throw new ValidationException("no catalog entry found"); + } else if (vfModule == null && vfmc != null) { + vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in VfModuleCustomization table + } + + if(modelInfo.getModelVersionId() == null) { + modelInfo.setModelVersionId(vfModule.getModelUUID()); + } + recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(vfModule.getModelUUID(), vnfComponentType, action.name()); + } + + if(recipe == null) { + recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultVnfType, vnfComponentType, action.name()); + if (recipe == null) { + recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("*", vnfComponentType, action.name()); + } + + if(recipe == null) { + return null; + } + } + } + } else { + msoLogger.debug("recipe is null, getting default"); + + if(modelInfo.getModelType().equals(ModelType.vnf)) { + recipe = db.getVnfRecipe(defaultVnfType, action.name()); + if (recipe == null) { + return null; + } + } else { + recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("VID_DEFAULT", vnfComponentType, action.name()); + + if (recipe == null) { + return null; + } + } + } + + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } + + private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + + String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + + ModelInfo modelInfo = msoRequest.getModelInfo(); + String modelName = modelInfo.getModelName(); + Recipe recipe = null; + if(msoRequest.getALaCarteFlag()){ + recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); + }else{ + if(modelInfo.getModelCustomizationId()!=null){ + NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(modelInfo.getModelCustomizationId()); + if(networkResource!=null){ + if(modelInfo.getModelVersionId() == null) { + modelInfo.setModelVersionId(networkResource.getModelUUID()); + } + recipe = db.getNetworkRecipe(networkResource.getModelName(), action.name()); + }else{ + throw new ValidationException("no catalog entry found"); + } + }else{ + //ok for version < 3 and action delete + recipe = db.getNetworkRecipe(modelName, action.name()); + } + if(recipe == null){ + recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); + } + } + if (recipe == null) { + return null; + } + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java new file mode 100644 index 0000000000..b191a3d767 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java @@ -0,0 +1,328 @@ +/*- + * #%L + * MSO + * %% + * Copyright (C) 2016 OPENECOMP - MSO + * %% + * 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. + * #L% + */ + +package org.openecomp.mso.apihandlerinfra; + +import org.openecomp.mso.apihandlerinfra.tasksbeans.*; + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; + +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.json.JSONArray; +import org.json.JSONObject; +import org.codehaus.jackson.map.ObjectMapper; + +import org.openecomp.mso.apihandler.common.ErrorNumbers; +import org.openecomp.mso.apihandler.common.RequestClient; +import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.ResponseHandler; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.utils.UUIDChecker; + +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +@Path("/tasks") +@Api(value="/tasks/{version: [vV]1}",description="Queries of Manual Tasks") +public class TasksHandler { + + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); + public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + public final static String requestUrl = "mso/task/"; + + @Path("/{version:[vV]1}") + @GET + @ApiOperation(value="Finds Manual Tasks",response=Response.class) + public Response queryFilters (@QueryParam("taskId") String taskId, + @QueryParam("originalRequestId") String originalRequestId, + @QueryParam("subscriptionServiceType") String subscriptionServiceType, + @QueryParam("nfRole") String nfRole, + @QueryParam("buildingBlockName") String buildingBlockName, + @QueryParam("originalRequestDate") String originalRequestDate, + @QueryParam("originalRequestorId") String originalRequestorId, + @PathParam("version") String version) { + Response responseBack = null; + long startTime = System.currentTimeMillis (); + String requestId = UUIDChecker.generateUUID(msoLogger); + MsoLogger.setServiceName ("ManualTasksQuery"); + // Generate a Request Id + UUIDChecker.generateUUID(msoLogger); + msoLogger.debug ("Incoming request received for queryFilter with taskId:" + taskId + + " originalRequestId:" + originalRequestId + + " subscriptionServiceType:" + subscriptionServiceType + + " nfRole:" + nfRole + + " buildingBlockName:" + buildingBlockName + + " originalRequestDate:" + originalRequestDate + + " originalRequestorId: " + originalRequestorId); + + // Prepare the query string to /task interface + TaskVariables tv = new TaskVariables(); + + List<TaskVariableValue> tvvList = new ArrayList<TaskVariableValue>(); + + if (originalRequestId != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("originalRequestId"); + tvv.setValue(originalRequestId); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + if (subscriptionServiceType != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("subscriptionServiceType"); + tvv.setValue(subscriptionServiceType); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + if (nfRole != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("nfRole"); + tvv.setValue(nfRole); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + if (buildingBlockName != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("buildingBlockName"); + tvv.setValue(buildingBlockName); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + if (originalRequestDate != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("originalRequestDate"); + tvv.setValue(originalRequestDate); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + if (originalRequestorId != null) { + TaskVariableValue tvv = new TaskVariableValue(); + tvv.setName("originalRequestorId"); + tvv.setValue(originalRequestorId); + tvv.setOperator("eq"); + tvvList.add(tvv); + } + + tv.setTaskVariables(tvvList); + + RequestClient requestClient = null; + MsoRequest msoRequest = new MsoRequest(requestId); + HttpResponse response = null; + long subStartTime = System.currentTimeMillis(); + + try { + requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ()); + // Capture audit event + msoLogger.debug ("MSO API Handler Post call to Camunda engine for url: " + requestClient.getUrl ()); + + System.out.println("URL : " + requestClient.getUrl ()); + ObjectMapper mapper = new ObjectMapper(); + String camundaJsonReq = mapper.writeValueAsString(tv); + msoLogger.debug("Camunda Json Request: " + camundaJsonReq); + response = requestClient.post(camundaJsonReq); + + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null); + } catch (Exception e) { + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, + MsoException.ServiceException, + "Failed calling bpmn " + e.getMessage (), + ErrorNumbers.SVC_NO_SERVER_RESOURCES, + null); + alarmLogger.sendAlarm ("MsoConfigurationError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); + msoRequest.updateFinalStatus (Status.FAILED); + msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + TasksGetResponse trr = new TasksGetResponse(); + List<TaskList> taskList = new ArrayList<TaskList>(); + + ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); + int bpelStatus = respHandler.getStatus (); + if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) { + msoLogger.debug ("Received good response from Camunda"); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); + String respBody = respHandler.getResponseBody(); + if (respBody != null) { + JSONArray data = new JSONArray(respBody); + + for (int i=0; i<data.length();i++) { + JSONObject taskEntry = data.getJSONObject(i); + String id = taskEntry.getString("id"); + msoLogger.debug("taskId is: " + id); + if (taskId != null && !taskId.equals(id)) { + continue; + } + // Get variables info for each task ID + TaskList taskListEntry = null; + try { + taskListEntry = getTaskInfo(id); + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null); + } catch (Exception e) { + msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, + MsoException.ServiceException, + "Failed calling bpmn " + e.getMessage (), + ErrorNumbers.SVC_NO_SERVER_RESOURCES, + null); + alarmLogger.sendAlarm ("MsoConfigurationError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); + + msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + taskList.add(taskListEntry); + + } + trr.setTaskList(taskList); + } + + } else { + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, + MsoException.ServiceException, + "Request Failed due to BPEL error with HTTP Status= %1" , + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + + + String jsonResponse = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonResponse = mapper.writeValueAsString(trr); + } + catch (Exception e) { + msoLogger.debug("Unable to format response"); + Response resp = msoRequest.buildServiceErrorResponse(500, + MsoException.ServiceException, + "Request Failed due to bad response format" , + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Bad response format"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Bad response format"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + responseBack = Response.status (HttpStatus.SC_ACCEPTED).entity (jsonResponse).build (); + // msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return responseBack; + + } + + protected MsoLogger getMsoLogger () { + return msoLogger; + } + + // Makes a GET call to Camunda to get variables for this task + private TaskList getTaskInfo(String taskId) throws Exception { + TaskList taskList = null; + String getRequestUrl = requestUrl + taskId + "/variables"; + HttpResponse getResponse = null; + long subStartTime = System.currentTimeMillis(); + + RequestClient requestClient = RequestClientFactory.getRequestClient (getRequestUrl, MsoPropertiesUtils.loadMsoProperties ()); + // Capture audit event + msoLogger.debug ("MSO API Handler Get call to Camunda engine for url: " + requestClient.getUrl ()); + getResponse = requestClient.get(); + + ResponseHandler respHandler = new ResponseHandler (getResponse, requestClient.getType ()); + int bpelStatus = respHandler.getStatus (); + if (bpelStatus == HttpStatus.SC_ACCEPTED) { + msoLogger.debug ("Received good response from Camunda"); + + msoLogger.recordAuditEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); + String respBody = respHandler.getResponseBody(); + if (respBody != null) { + taskList = buildTaskList(taskId, respBody); + } + else { + throw new Exception("Null task info from Camunda"); + } + + } + else { + throw new Exception ("Bad GET response from Camunda. Status is " + bpelStatus); + } + + return taskList; + + } + + private TaskList buildTaskList(String taskId, String respBody) { + TaskList taskList = new TaskList(); + JSONObject variables = new JSONObject(respBody); + + taskList.setTaskId(taskId); + taskList.setType(getOptVariableValue(variables, "type")); + taskList.setNfRole(getOptVariableValue(variables, "nfRole")); + taskList.setSubscriptionServiceType(getOptVariableValue(variables, "subscriptionServiceType")); + taskList.setOriginalRequestId(getOptVariableValue(variables, "originalRequestId")); + taskList.setOriginalRequestorId(getOptVariableValue(variables, "originalRequestorId")); + taskList.setErrorSource(getOptVariableValue(variables, "errorSource")); + taskList.setErrorCode(getOptVariableValue(variables, "errorCode")); + taskList.setErrorMessage(getOptVariableValue(variables, "errorMessage")); + taskList.setBuildingBlockName(getOptVariableValue(variables, "buildingBlockName")); + taskList.setBuildingBlockStep(getOptVariableValue(variables, "buildingBlockStep")); + taskList.setValidResponses(new JSONArray("[" + getOptVariableValue(variables, "validResponses").toLowerCase() + "]")); + + return taskList; + } + + private String getOptVariableValue(JSONObject variables, String name) { + String variableEntry = variables.optString(name); + String value = ""; + if (!variableEntry.isEmpty()) { + JSONObject variableEntryJson = new JSONObject(variableEntry); + value = variableEntryJson.optString("value"); + } + return value; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java index 07d70e9982..aee6c8f2c1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java @@ -26,21 +26,24 @@ import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.apache.http.HttpStatus; - import org.openecomp.mso.apihandlerinfra.vnfbeans.VfModuleModelName; import org.openecomp.mso.apihandlerinfra.vnfbeans.VfModuleModelNames; import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.VfModule; import org.openecomp.mso.logger.MsoLogger; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; @Path(Constants.VF_MODULE_MODEL_NAMES_PATH) +@Api(value="/{version: v2|v3}/vf-module-model-names",description="API Requests to find Vf Module model names") public class VfModuleModelNamesHandler { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); @@ -48,13 +51,14 @@ public class VfModuleModelNamesHandler { private static final String LOG_REPLY_NAME = "MSO-APIH:InfrastructurePortal."; @GET - public Response getVfModuleModelNames () { + @ApiOperation(value="Finds Vf Module Model Names",response=Response.class) + public Response getVfModuleModelNames (@PathParam("version") String version) { long startTime = System.currentTimeMillis (); String methodName = "getVfModuleModelNames"; MsoLogger.setServiceName (LOG_SERVICE_NAME + methodName); msoLogger.debug ("Incoming request received for vfModuleModelNames"); List <VfModule> vfModules = null; - try (CatalogDatabase db = new CatalogDatabase()){ + try (CatalogDatabase db = CatalogDatabase.getInstance()){ vfModules = db.getAllVfModules (); } catch (Exception e) { msoLogger.debug ("No connection to catalog DB", e); @@ -79,7 +83,7 @@ public class VfModuleModelNamesHandler { vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ()); vfModuleModelName.setIsBase(vm.isBase()); vfModuleModelName.setDescription (vm.getDescription ()); - vfModuleModelName.setId (String.valueOf (vm.getId ())); + vfModuleModelName.setId (String.valueOf (vm.getModelUUID())); vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ()); vfModuleModelNames.getVfModuleModelName ().add (vfModuleModelName); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java index 7494747879..c87d450cef 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java @@ -31,18 +31,13 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; - -import org.apache.http.HttpStatus; - import javax.xml.bind.Unmarshaller; import javax.xml.transform.sax.SAXSource; -import org.xml.sax.InputSource; - +import org.apache.http.HttpStatus; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType; import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory; @@ -53,12 +48,17 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfOutputs; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequests; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.InfraActiveRequests; +import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; +import org.xml.sax.InputSource; + +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; @Path("/{version: v1|v2|v3}/vnf-request") +@Api(value="/{version: v1|v2|v3}/vnf-request",description="API Requests of vnfRequest") public class VnfInfoHandler { protected ObjectFactory beansObjectFactory = new ObjectFactory (); @@ -67,6 +67,7 @@ public class VnfInfoHandler { @GET + @ApiOperation(value="Finds Volume Requests",response=Response.class) public Response queryFilters (@QueryParam("vnf-type") String vnfType, @QueryParam("service-type") String serviceType, @QueryParam("aic-node-clli") String aicNodeClli, @@ -99,6 +100,7 @@ public class VnfInfoHandler { @GET @Path(Constants.REQUEST_ID_PATH) + @ApiOperation(value="Add a Vnf Outputs from requestId and version",response=Response.class) public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) { // Check INFRA_ACTIVE_REQUESTS table to find info // on this request @@ -253,7 +255,7 @@ public class VnfInfoHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ()); + InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, getRequestType ()); if (activeReq != null) { // build response for active responseString = infraRequestsResponse (activeReq, version); @@ -270,7 +272,7 @@ public class VnfInfoHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute, queryValue, getRequestType ()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java index bfcbe0d4d5..87667952d4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java @@ -59,10 +59,10 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; public class VnfMsoInfraRequest { @@ -84,7 +84,7 @@ public class VnfMsoInfraRequest { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; - protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); VnfMsoInfraRequest (String requestId) { this.requestId = requestId; @@ -279,7 +279,7 @@ public class VnfMsoInfraRequest { Session session = null; try { - session = hibernateUtils.getSessionFactory ().openSession (); + session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); @@ -399,7 +399,7 @@ public class VnfMsoInfraRequest { public void updateFinalStatus (Status status) { int result = 0; try { - result = RequestsDatabase.updateInfraFinalStatus (requestId, + result = (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId, status.toString (), this.errorMessage, this.progress, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java index 617172be08..024a84ca9b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java @@ -97,7 +97,8 @@ public class VnfRequestHandler { private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE) .entity (NOT_FOUND) .build (); - + private RequestsDatabase requestDB = RequestsDatabase.getInstance(); + @GET public Response queryFilters (@QueryParam("vnf-type") String vnfType, @QueryParam("service-type") String serviceType, @@ -285,7 +286,7 @@ public class VnfRequestHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ()); + InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, getRequestType ()); if (activeReq != null) { // build response for active responseString = infraRequestsResponse (activeReq, version); @@ -302,7 +303,7 @@ public class VnfRequestHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute, queryValue, getRequestType ()); @@ -471,7 +472,7 @@ public class VnfRequestHandler { msoLogger.debug ("Checking for a duplicate with the same vnf-name"); InfraActiveRequests dup = null; try { - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (), + dup = requestDB.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (), msoRequest.getRequestInfo ().getAction ().value (), "VNF"); @@ -508,7 +509,7 @@ public class VnfRequestHandler { InfraActiveRequests dup = null; msoLogger.debug ("Checking for a duplicate with the same vnf-id"); try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (), + dup = requestDB.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (), msoRequest.getRequestInfo ().getAction ().value (), "VNF"); @@ -548,7 +549,7 @@ public class VnfRequestHandler { String orchestrationURI = ""; // Query MSO Catalog DB - try (CatalogDatabase db = new CatalogDatabase()){ + try (CatalogDatabase db = CatalogDatabase.getInstance()){ Recipe recipe = null; @@ -755,7 +756,7 @@ public class VnfRequestHandler { String bpelXMLResponseBody = respHandler.getResponseBody (); msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), + requestDB.updateInfraStatus (msoRequest.getRequestId (), Status.IN_PROGRESS.toString (), Constants.PROGRESS_REQUEST_IN_PROGRESS, Constants.MODIFIED_BY_APIHANDLER); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java index 0b595855df..868828ba60 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java @@ -27,27 +27,35 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfTypes; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.VnfResource; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; import org.apache.http.HttpStatus; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; + import java.io.StringWriter; import java.util.List; @Path(Constants.VNF_TYPES_PATH) +@Api(value="/{version: v1|v2|v3}/vnf-types",description="API Requests of vnfTypes") public class VnfTypesHandler { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); @GET - public Response getVnfTypes (@QueryParam("vnf-role") String vnfRole) { + @ApiOperation(value="Finds Vnf Types",response=Response.class) + public Response getVnfTypes (@QueryParam("vnf-role") String vnfRole, @PathParam("version") String version) { long startTime = System.currentTimeMillis (); MsoLogger.setServiceName ("GetVnfTypes"); @@ -56,7 +64,7 @@ public class VnfTypesHandler { msoLogger.debug ("Incoming request received for getVnfTypes with vnf-role:" + vnfRole); List <VnfResource> vnfResources = null; - try(CatalogDatabase db = new CatalogDatabase ()) { + try(CatalogDatabase db = CatalogDatabase.getInstance()) { if (vnfRole != null) { vnfResources = db.getVnfResourcesByRole (vnfRole); } else { @@ -80,9 +88,8 @@ public class VnfTypesHandler { for (int i = 0; i < vnfResources.size (); i++) { VnfType vnfType = beansObjectFactory.createVnfType (); VnfResource vr = vnfResources.get (i); - vnfType.setType (vr.getVnfType ()); vnfType.setDescription (vr.getDescription ()); - vnfType.setId (String.valueOf (vr.getId ())); + vnfType.setId (String.valueOf (vr.getModelUuid())); vnfTypes.getVnfType ().add (vnfType); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java index 3190fc507e..1891c00521 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java @@ -31,18 +31,13 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; - -import org.apache.http.HttpStatus; - import javax.xml.bind.Unmarshaller; import javax.xml.transform.sax.SAXSource; -import org.xml.sax.InputSource; - +import org.apache.http.HttpStatus; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType; import org.openecomp.mso.apihandlerinfra.volumebeans.ObjectFactory; @@ -53,12 +48,17 @@ import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeOutputs; import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest; import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequests; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.InfraActiveRequests; +import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; +import org.xml.sax.InputSource; + +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; @Path("/{version: v1|v2|v3}/volume-request") +@Api(value="/{version: v1|v2|v3}/volume-request",description="API Requests for volumeRequest") public class VolumeInfoHandler { protected ObjectFactory beansObjectFactory = new ObjectFactory (); @@ -66,6 +66,7 @@ public class VolumeInfoHandler { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); @GET + @ApiOperation(value="Finds Volume Requests",response=Response.class) public Response queryFilters (@QueryParam("vnf-type") String vnfType, @QueryParam("service-type") String serviceType, @QueryParam("aic-node-clli") String aicNodeClli, @@ -96,6 +97,7 @@ public class VolumeInfoHandler { @GET @Path(Constants.REQUEST_ID_PATH) + @ApiOperation(value="Find Volume Outputs by requestId and verison",response=Response.class) public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) { // Check INFRA_ACTIVE_REQUESTS table to find info @@ -233,7 +235,7 @@ public class VolumeInfoHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, + InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, "VOLUME"); if (activeReq != null) { // build response for active @@ -251,7 +253,7 @@ public class VolumeInfoHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute, queryValue, "VOLUME"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java index 911ac48d03..340d3dbecc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java @@ -54,11 +54,11 @@ import org.openecomp.mso.apihandlerinfra.volumebeans.ObjectFactory; import org.openecomp.mso.apihandlerinfra.volumebeans.RequestInfo; import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType; import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; @@ -78,7 +78,7 @@ public class VolumeMsoInfraRequest { private long startTime; private long progress = Constants.PROGRESS_REQUEST_RECEIVED; - protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; @@ -282,7 +282,7 @@ public class VolumeMsoInfraRequest { Session session = null; try { - session = hibernateUtils.getSessionFactory ().openSession (); + session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); @@ -376,7 +376,7 @@ public class VolumeMsoInfraRequest { public void updateFinalStatus (Status status) { int result = 0; try { - result = RequestsDatabase.updateInfraFinalStatus(requestId, status.toString (), + result = (RequestsDatabase.getInstance()).updateInfraFinalStatus(requestId, status.toString (), this.errorMessage, this.progress, this.responseBody, Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception in updateFinalStatus"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java index 7c1b74c684..1fa6161cc6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java @@ -97,6 +97,8 @@ public class VolumeRequestHandler { .entity (NOT_FOUND) .build (); + private RequestsDatabase requestDB = RequestsDatabase.getInstance(); + @GET public Response queryFilters (@QueryParam("vnf-type") String vnfType, @QueryParam("service-type") String serviceType, @@ -265,7 +267,7 @@ public class VolumeRequestHandler { String responseString = null; - InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, + InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, "VOLUME"); if (activeReq != null) { // build response for active @@ -283,7 +285,7 @@ public class VolumeRequestHandler { getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue); - List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute, + List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute, queryValue, "VOLUME"); @@ -468,7 +470,7 @@ public class VolumeRequestHandler { InfraActiveRequests dup = null; try { - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (), + dup = requestDB.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (), msoRequest.getRequestInfo ().getAction ().value (), "VOLUME"); @@ -506,7 +508,7 @@ public class VolumeRequestHandler { InfraActiveRequests dup = null; msoLogger.debug ("Checking for a duplicate with the same volume-group-id"); try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (), + dup = requestDB.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (), msoRequest.getRequestInfo ().getAction ().value (), "VOLUME"); @@ -545,7 +547,7 @@ public class VolumeRequestHandler { String orchestrationURI = ""; // Query MSO Catalog DB - try(CatalogDatabase db = new CatalogDatabase ()) { + try(CatalogDatabase db = CatalogDatabase.getInstance()) { Recipe recipe = null; if (version.equals(Constants.SCHEMA_VERSION_V1)) { @@ -597,7 +599,7 @@ public class VolumeRequestHandler { // If no recipe for the vnf type is found, look for generic recipe with "*" in vf module id if (recipe == null) { - recipe = db.getVnfComponentsRecipeByVfModuleId (Constants.VNF_TYPE_WILDCARD, + recipe = db.getVnfComponentsRecipeByVfModuleModelUUId (Constants.VNF_TYPE_WILDCARD, Constants.VOLUME_GROUP_COMPONENT_TYPE, msoRequest.getRequestInfo ().getAction ().value ()); } @@ -695,7 +697,7 @@ public class VolumeRequestHandler { String bpelXMLResponseBody = respHandler.getResponseBody (); msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), + requestDB.updateInfraStatus (msoRequest.getRequestId (), Status.IN_PROGRESS.toString (), Constants.PROGRESS_REQUEST_IN_PROGRESS, Constants.MODIFIED_BY_APIHANDLER); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java index dee0649184..d6b79bf1eb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java @@ -21,7 +21,6 @@ package org.openecomp.mso.apihandlerinfra.serviceinstancebeans; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,8 +28,6 @@ import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.openecomp.mso.apihandlerinfra.MsoRequest; - @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) public class RequestParameters { @@ -44,6 +41,10 @@ public class RequestParameters { private boolean autoBuildVfModules = false; @JsonSerialize(include=Inclusion.ALWAYS) private boolean cascadeDelete = false; + @JsonSerialize(include=Inclusion.ALWAYS) + private boolean usePreload=true; // usePreload would always be true for Update + @JsonSerialize(include=Inclusion.ALWAYS) + private boolean rebuildVolumeGroups = false; public String getSubscriptionServiceType() { @@ -107,12 +108,30 @@ public class RequestParameters { this.cascadeDelete = cascadeDelete; } + public boolean isUsePreload() { + return usePreload; + } + + public void setUsePreload(boolean usePreload) { + this.usePreload = usePreload; + } + + public boolean rebuildVolumeGroups() { + return rebuildVolumeGroups; + } + + public void setRebuildVolumeGroups(boolean rebuildVolumeGroups) { + this.rebuildVolumeGroups = rebuildVolumeGroups; + } + @Override public String toString() { return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules=" - + autoBuildVfModules + "]"; + + autoBuildVfModules + ", usePreload=" + + usePreload + ", rebuildVolumeGroups=" + + rebuildVolumeGroups +"]"; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java new file mode 100644 index 0000000000..3f9627e6e2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java @@ -0,0 +1,55 @@ +/*-
+ * ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonRootName(value = "requestDetails")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestDetails {
+
+ protected RequestInfo requestInfo;
+ /**
+ * Gets the value of the requestInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestInfo }
+ *
+ */
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ /**
+ * Sets the value of the requestInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestInfo }
+ *
+ */
+ public void setRequestInfo(RequestInfo value) {
+ this.requestInfo = value;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java new file mode 100644 index 0000000000..2a06d5f7e8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java @@ -0,0 +1,74 @@ +/*-
+ * ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestInfo {
+
+ protected String source;
+ protected ValidResponses responseValue;
+ protected String requestorId;
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(String value) {
+ this.source = value;
+ }
+
+ public ValidResponses getResponseValue() {
+ return responseValue;
+ }
+
+ public void setResponseValue(ValidResponses responseValue) {
+ this.responseValue = responseValue;
+ }
+
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java new file mode 100644 index 0000000000..5cb90bb8c6 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java @@ -0,0 +1,334 @@ +/*- + * ============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.apihandlerinfra.tasksbeans; + +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + +import org.json.JSONArray; + +@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) +public class TaskList { + protected String taskId; + protected String type; + protected String nfRole; + protected String subscriptionServiceType; + protected String originalRequestId; + protected String originalRequestorId; + protected String errorSource; + protected String errorCode; + protected String errorMessage; + protected String buildingBlockName; + protected String buildingBlockStep; + protected JSONArray validResponses; + + /** + * Gets the value of the taskId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTaskId() { + return taskId; + } + + /** + * Sets the value of the taskId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTaskId(String value) { + this.taskId = value; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the nfRole property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNfRole() { + return nfRole; + } + + /** + * Sets the value of the nfRole property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNfRole(String value) { + this.nfRole = value; + } + + /** + * Gets the value of the subscriptionServiceType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + /** + * Sets the value of the subscriptionServiceType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSubscriptionServiceType(String value) { + this.subscriptionServiceType = value; + } + + /** + * Gets the value of the originalRequestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOriginalRequestId() { + return originalRequestId; + } + + /** + * Sets the value of the originalRequestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOriginalRequestId(String value) { + this.originalRequestId = value; + } + + /** + * Gets the value of the originalRequestorId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOriginalRequestorId() { + return originalRequestorId; + } + + /** + * Sets the value of the originalRequestorId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOriginalRequestorId(String value) { + this.originalRequestorId = value; + } + + /** + * Gets the value of the errorSource property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorSource() { + return errorSource; + } + + /** + * Sets the value of the errorSource property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorSource(String value) { + this.errorSource = value; + } + + /** + * Gets the value of the errorCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Sets the value of the errorCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorCode(String value) { + this.errorCode = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + /** + * Gets the value of the buildingBlockName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBuildingBlockName() { + return buildingBlockName; + } + + /** + * Sets the value of the buildingBlockName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBuildingBlockName(String value) { + this.buildingBlockName = value; + } + + /** + * Gets the value of the buildingBlockStep property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBuildingBlockStep() { + return buildingBlockStep; + } + + /** + * Sets the value of the buildingBlockStep property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBuildingBlockStep(String value) { + this.buildingBlockStep = value; + } + + /** + * Gets the value of the validResponses property. + * + * @return + * possible object is + * {@link ValidResponses } + * + */ + public JSONArray getValidResponses() { + return validResponses; + } + + /** + * Sets the value of the validResponses property. + * + * @param value + * allowed object is + * {@link ValidResponses } + * + */ + public void setValidResponses(JSONArray value) { + this.validResponses = value; + } + + + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java new file mode 100644 index 0000000000..a3403ec35c --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java @@ -0,0 +1,57 @@ +/* ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+@JsonRootName(value = "taskRequestReference")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskRequestReference {
+
+ protected String taskId;
+
+ /**
+ * Gets the value of the taskId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTaskId() {
+ return taskId;
+ }
+
+ /**
+ * Sets the value of the taskId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTaskId(String value) {
+ this.taskId = value;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java new file mode 100644 index 0000000000..51521b9f00 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java @@ -0,0 +1,108 @@ +/*-
+ * ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskVariableValue {
+
+ protected String name;
+ protected String value;
+ protected String operator;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the operator property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOperator() {
+ return operator;
+ }
+
+ /**
+ * Sets the value of the operator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOperator(String value) {
+ this.operator = value;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java new file mode 100644 index 0000000000..9d0701ce25 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java @@ -0,0 +1,39 @@ +/*- + * ============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.apihandlerinfra.tasksbeans; + +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import java.util.List; + +@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) +public class TaskVariables { + + private List<TaskVariableValue> taskVariables; + + public List<TaskVariableValue> getTaskVariables() { + return taskVariables; + } + + public void setTaskVariables(List<TaskVariableValue> taskVariables) { + this.taskVariables = taskVariables; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java new file mode 100644 index 0000000000..6bcdd93639 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java @@ -0,0 +1,36 @@ +/*- + * ============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.apihandlerinfra.tasksbeans; + +import java.util.List; + +public class TasksGetResponse { + + private List<TaskList> taskList; + + public List<TaskList> getTaskList() { + return taskList; + } + + public void setTaskList(List<TaskList> taskList) { + this.taskList = taskList; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java new file mode 100644 index 0000000000..b4006743b7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java @@ -0,0 +1,34 @@ +/*- + * ============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.apihandlerinfra.tasksbeans; + +public class TasksRequest { + + private RequestDetails requestDetails; + + public RequestDetails getRequestDetails() { + return requestDetails; + } + + public void setRequestDetails(RequestDetails requestDetails) { + this.requestDetails = requestDetails; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java new file mode 100644 index 0000000000..3db6f99cd1 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java @@ -0,0 +1,52 @@ +/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2015.09.03 at 02:02:13 PM EDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+
+public enum ValidResponses {
+
+ rollback,
+ abort,
+ skip,
+ retry
+ ;
+
+ public String value() {
+ return name();
+ }
+
+ public static ValidResponses fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java new file mode 100644 index 0000000000..bf1c5e0f69 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java @@ -0,0 +1,56 @@ +/*-
+ * ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class Value {
+
+ protected String value;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java new file mode 100644 index 0000000000..6f5298bbaf --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java @@ -0,0 +1,76 @@ +/*-
+ * ============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.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+@JsonRootName(value = "variables")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class Variables {
+
+ protected Value source;
+ protected Value responseValue;
+ protected Value requestorId;
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public Value getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(Value value) {
+ this.source = value;
+ }
+
+ public Value getResponseValue() {
+ return responseValue;
+ }
+
+ public void setResponseValue(Value responseValue) {
+ this.responseValue = responseValue;
+ }
+
+
+ public Value getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(Value requestorId) {
+ this.requestorId = requestorId;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd new file mode 100644 index 0000000000..e8c67dddd7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd @@ -0,0 +1,48 @@ +<xs:schema targetNamespace="org.openecomp.mso/humantasks" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="org.openecomp.mso/humantasks">
+ <xs:element name="taskList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ <xs:element type="xs:string" name="type"/>
+ <xs:element type="xs:string" name="nfRole"/>
+ <xs:element type="xs:string" name="subscriptionServiceType"/>
+ <xs:element type="xs:string" name="originalRequestId"/>
+ <xs:element type="xs:string" name="originalRequestorId"/>
+ <xs:element type="xs:string" name="errorSource"/>
+ <xs:element type="xs:string" name="errorCode"/>
+ <xs:element type="xs:string" name="errorMessage"/>
+ <xs:element type="xs:string" name="buildingBlockName"/>
+ <xs:element type="xs:string" name="buildingBlockStep"/>
+ <xs:element name="validResponses">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="action" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="requestDetails">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="requestInfo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="source"/>
+ <xs:element type="xs:string" name="responseValue"/>
+ <xs:element type="xs:string" name="requestorId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name ="taskRequestReference">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd b/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd new file mode 100644 index 0000000000..e8c67dddd7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd @@ -0,0 +1,48 @@ +<xs:schema targetNamespace="org.openecomp.mso/humantasks" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="org.openecomp.mso/humantasks">
+ <xs:element name="taskList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ <xs:element type="xs:string" name="type"/>
+ <xs:element type="xs:string" name="nfRole"/>
+ <xs:element type="xs:string" name="subscriptionServiceType"/>
+ <xs:element type="xs:string" name="originalRequestId"/>
+ <xs:element type="xs:string" name="originalRequestorId"/>
+ <xs:element type="xs:string" name="errorSource"/>
+ <xs:element type="xs:string" name="errorCode"/>
+ <xs:element type="xs:string" name="errorMessage"/>
+ <xs:element type="xs:string" name="buildingBlockName"/>
+ <xs:element type="xs:string" name="buildingBlockStep"/>
+ <xs:element name="validResponses">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="action" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="requestDetails">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="requestInfo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="source"/>
+ <xs:element type="xs:string" name="responseValue"/>
+ <xs:element type="xs:string" name="requestorId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name ="taskRequestReference">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java index dde7ecf20b..c956e4d3f8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java @@ -19,18 +19,24 @@ */ package org.openecomp.mso.apihandlerinfra; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; import org.apache.commons.io.IOUtils; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.junit.Test; +import static org.junit.Assert.assertEquals; + + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.IOException; import java.util.HashMap; -import static org.junit.Assert.*; +import org.openecomp.mso.apihandler.common.ValidationException; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; public class MsoRequestTest { @@ -232,4 +238,64 @@ public class MsoRequestTest { } + @Test + public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModule.json")); + + } catch (IOException e) { + fail ("Exception caught"); + e.printStackTrace (); + return; + } + + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<String,String>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest ("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + + + + try { + requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleNoCustomizationId.json")); + + } catch (IOException e) { + fail ("Exception caught"); + e.printStackTrace (); + return; + } + + mapper = new ObjectMapper(); + instanceIdMap = new HashMap<String,String>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + msoRequest = new MsoRequest ("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + } + + @Test(expected = ValidationException.class) + public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleMissingModelCustomizationId.json")); + + } catch (IOException e) { + fail ("Exception caught"); + e.printStackTrace (); + return; + } + + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<String,String>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest ("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json new file mode 100644 index 0000000000..eb39ef12b9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json @@ -0,0 +1,62 @@ +{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelCustomizationId": "856f9806-b01a-11e6-80f5-76304dec7eb7",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": true,
+ "userParams": []
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json new file mode 100644 index 0000000000..2fd0e03ad3 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json @@ -0,0 +1,61 @@ +{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": false,
+ "userParams": []
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json new file mode 100644 index 0000000000..9c892a4fc0 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json @@ -0,0 +1,61 @@ +{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": true,
+ "userParams": []
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index a08f7cb535..1f1882aa3a 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -20,12 +20,15 @@ package org.openecomp.mso.requestsdb; +import java.util.Date; import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import org.hibernate.Criteria; import org.hibernate.Query; @@ -33,12 +36,13 @@ import org.hibernate.Session; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; import org.openecomp.mso.logger.MsoLogger; public class RequestsDatabase { - protected static HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected final AbstractSessionFactoryManager sessionFactoryRequestDB; protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); @@ -63,34 +67,16 @@ public class RequestsDatabase { protected static final String REQUEST_ID = "requestId"; protected static MockRequestsDatabase mockDB = null; - protected static enum Scope { - SERVICE("service", SERVICE_INSTANCE_NAME, SERVICE_INSTANCE_ID, "serviceInstanceId"), - VNF_INSTANCE("vnf", VNF_INSTANCE_NAME, VNF_INSTANCE_ID, "vnfInstanceId"), - VOLUME_GROUP("volumeGroup", VOLUME_GROUP_INSTANCE_NAME, VOLUME_GROUP_INSTANCE_ID, "volumeGroupInstanceId"), - VFMODULE("vfModule", VFMODULE_INSTANCE_NAME, VFMODULE_INSTANCE_ID, "vfModuleInstanceId"), - NETWORK("network", NETWORK_INSTANCE_NAME, NETWORK_INSTANCE_ID, "networkInstanceId"); - - public final String type; - public final String nameColumn; - public final String idColumn; - public final String idMapKey; - - private Scope(String type, String nameColumn, String idColumn, String idMapKey) { - this.type = type; - this.nameColumn = nameColumn; - this.idColumn = idColumn; - this.idMapKey = idMapKey; - } + public static RequestsDatabase getInstance() { + return new RequestsDatabase(new RequestsDbSessionFactoryManager ()); } - /** - * Avoids creating an instance of this utility class. - */ - protected RequestsDatabase () { + protected RequestsDatabase (AbstractSessionFactoryManager sessionFactoryRequest) { + sessionFactoryRequestDB = sessionFactoryRequest; } - public static boolean healthCheck () { - Session session = hibernateUtils.getSessionFactory ().openSession (); + public boolean healthCheck () { + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); try { Query query = session.createSQLQuery (" show tables "); @@ -105,10 +91,10 @@ public class RequestsDatabase { } - public static int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) { + public int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); int result = 0; try { @@ -130,10 +116,10 @@ public class RequestsDatabase { return result; } - public static int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) { + public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); int result = 0; try { @@ -156,10 +142,10 @@ public class RequestsDatabase { return result; } - public static int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) { + public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); int result = 0; try { @@ -185,14 +171,14 @@ public class RequestsDatabase { } - private static List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) { + private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Execute query on infra active request table"); List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>(); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); try { session.beginTransaction (); Criteria crit = session.createCriteria (InfraActiveRequests.class); @@ -213,11 +199,11 @@ public class RequestsDatabase { return results; } - public static InfraActiveRequests getRequestFromInfraActive (String requestId) { + public InfraActiveRequests getRequestFromInfraActive (String requestId) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB"); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); InfraActiveRequests ar = null; try { session.beginTransaction (); @@ -233,24 +219,48 @@ public class RequestsDatabase { return ar; } - public static InfraActiveRequests checkInstanceNameDuplicate (Map<String,String> instanceIdMap, String instanceName, String requestScope) { + public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) { List <Criterion> criteria = new LinkedList <> (); - if (instanceName != null && !instanceName.equals("")) { - - Arrays.stream(Scope.values()) // - .filter(scope -> scope.type.equals(requestScope)) // - .forEach(scope -> criteria.add(Restrictions.eq(scope.nameColumn, instanceName))); - - } else if (instanceIdMap != null) { - - Arrays.stream(Scope.values()) // - .filter(scope -> scope.type.equals(requestScope) && instanceIdMap.get(scope.idMapKey) != null) // - .forEach(scope -> criteria.add(Restrictions.eq(scope.idColumn, instanceIdMap.get(scope.idMapKey)))); - + if(instanceName != null && !instanceName.equals("")) { + + if(requestScope.equals("service")){ + criteria.add (Restrictions.eq (SERVICE_INSTANCE_NAME, instanceName)); + } else if(requestScope.equals("vnf")){ + criteria.add (Restrictions.eq (VNF_INSTANCE_NAME, instanceName)); + } else if(requestScope.equals("volumeGroup")){ + criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_NAME, instanceName)); + } else if(requestScope.equals("vfModule")){ + criteria.add (Restrictions.eq (VFMODULE_INSTANCE_NAME, instanceName)); + } else if(requestScope.equals("network")){ + criteria.add (Restrictions.eq (NETWORK_INSTANCE_NAME, instanceName)); + } + + } else { + if(instanceIdMap != null){ + if(requestScope.equals("service") && instanceIdMap.get("serviceInstanceId") != null){ + criteria.add (Restrictions.eq (SERVICE_INSTANCE_ID, instanceIdMap.get("serviceInstanceId"))); + } + + if(requestScope.equals("vnf") && instanceIdMap.get("vnfInstanceId") != null){ + criteria.add (Restrictions.eq (VNF_INSTANCE_ID, instanceIdMap.get("vnfInstanceId"))); + } + + if(requestScope.equals("vfModule") && instanceIdMap.get("vfModuleInstanceId") != null){ + criteria.add (Restrictions.eq (VFMODULE_INSTANCE_ID, instanceIdMap.get("vfModuleInstanceId"))); + } + + if(requestScope.equals("volumeGroup") && instanceIdMap.get("volumeGroupInstanceId") != null){ + criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_ID, instanceIdMap.get("volumeGroupInstanceId"))); + } + + if(requestScope.equals("network") && instanceIdMap.get("networkInstanceId") != null){ + criteria.add (Restrictions.eq (NETWORK_INSTANCE_ID, instanceIdMap.get("networkInstanceId"))); + } + } } - + criteria.add (Restrictions.in ("requestStatus", new String[] { "PENDING", "IN_PROGRESS", "TIMEOUT" })); Order order = Order.desc (START_TIME); @@ -266,15 +276,18 @@ public class RequestsDatabase { return infraActiveRequests; } - public static List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) { + public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) { List <Criterion> criteria = new LinkedList <> (); for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet()) { String mapKey = entry.getKey(); - - if(mapKey.equalsIgnoreCase("vnfInstanceId")){ + if(mapKey.equalsIgnoreCase("serviceInstanceId")) { + mapKey = "serviceInstanceId"; + } else if(mapKey.equalsIgnoreCase("serviceInstanceName")) { + mapKey = "serviceInstanceName"; + } else if(mapKey.equalsIgnoreCase("vnfInstanceId")){ mapKey = "vnfId"; } else if(mapKey.equalsIgnoreCase("vnfInstanceName")) { mapKey = "vnfName"; @@ -292,9 +305,41 @@ public class RequestsDatabase { mapKey = "networkName"; } else if(mapKey.equalsIgnoreCase("lcpCloudRegionId")) { mapKey = "aicCloudRegion"; - } + } else if(mapKey.equalsIgnoreCase("tenantId")) { + mapKey = "tenantId"; + } else if(mapKey.equalsIgnoreCase("modelType")) { + mapKey = "requestScope"; + } else if(mapKey.equalsIgnoreCase("requestorId")) { + mapKey = "requestorId"; + } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) { + mapKey = "startTime"; + } - criteria.add(Restrictions.eq(mapKey, entry.getValue().get(1))); + String propertyValue = entry.getValue().get(1); + if (mapKey.equals("startTime")) { + SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); + try { + Date thisDate = format.parse(propertyValue); + Timestamp minTime = new Timestamp(thisDate.getTime()); + Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); + + if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { + criteria.add(Restrictions.or(Restrictions.lt(mapKey, minTime), + Restrictions.ge(mapKey, maxTime))); + } else { + criteria.add(Restrictions.between(mapKey, minTime, maxTime)); + } + } + catch (Exception e){ + msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage()); + return null; + } + } + else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { + criteria.add(Restrictions.ne(mapKey, propertyValue)); + } else { + criteria.add(Restrictions.eq(mapKey, propertyValue)); + } } @@ -304,13 +349,12 @@ public class RequestsDatabase { } - public static List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, + public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, String queryValue, String requestType) { - long startTime = System.currentTimeMillis (); msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); try { session.beginTransaction (); Criteria crit = session.createCriteria (InfraActiveRequests.class) @@ -334,11 +378,11 @@ public class RequestsDatabase { } - public static InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) { + public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get infra request from DB with id " + requestId); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); InfraActiveRequests ar = null; try { session.beginTransaction (); @@ -356,13 +400,13 @@ public class RequestsDatabase { } - public static InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) { + public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType); InfraActiveRequests ar = null; - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); try { session.beginTransaction (); @@ -385,13 +429,13 @@ public class RequestsDatabase { return ar; } - public static InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) { + public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action); InfraActiveRequests ar = null; - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); try { session.beginTransaction (); @@ -414,7 +458,7 @@ public class RequestsDatabase { return ar; } - public static void setMockDB(MockRequestsDatabase mockDB) { + public void setMockDB(MockRequestsDatabase mockDB) { RequestsDatabase.mockDB = mockDB; } @@ -424,10 +468,9 @@ public class RequestsDatabase { * @param siteName The unique name of the site * @return SiteStatus object or null if none found */ - public static SiteStatus getSiteStatus (String siteName) { - Session session = hibernateUtils.getSessionFactory ().openSession (); + public SiteStatus getSiteStatus (String siteName) { + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); - long startTime = System.currentTimeMillis (); SiteStatus siteStatus = null; msoLogger.debug ("Request database - get Site Status with Site name:" + siteName); try { @@ -451,8 +494,8 @@ public class RequestsDatabase { * @param siteName The unique name of the site * @param status The updated status of the Site */ - public static void updateSiteStatus (String siteName, boolean status) { - Session session = hibernateUtils.getSessionFactory ().openSession (); + public void updateSiteStatus (String siteName, boolean status) { + Session session = sessionFactoryRequestDB.getSessionFactory ().openSession (); session.beginTransaction (); long startTime = System.currentTimeMillis (); @@ -492,13 +535,13 @@ public class RequestsDatabase { * @return current progress of the operation * @since ONAP Amsterdam Release */ - public static OperationStatus getOperationStatus(String serviceId, String operationId) { + public OperationStatus getOperationStatus(String serviceId, String operationId) { long startTime = System.currentTimeMillis(); msoLogger.debug("Execute query on infra active request table"); OperationStatus operStatus = null; - Session session = hibernateUtils.getSessionFactory().openSession(); + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); try { session.beginTransaction(); String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"; @@ -524,8 +567,8 @@ public class RequestsDatabase { * @param operstatus the operation object * @since ONAP Amsterdam Release */ - public static void updateOperationStatus(OperationStatus operstatus) { - Session session = hibernateUtils.getSessionFactory().openSession(); + public void updateOperationStatus(OperationStatus operstatus) { + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); session.beginTransaction(); long startTime = System.currentTimeMillis(); @@ -563,13 +606,13 @@ public class RequestsDatabase { * @return the progress status of a resource * @since ONAP Amsterdam Release */ - public static ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, + public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) { long startTime = System.currentTimeMillis(); msoLogger.debug("Execute query on infra active request table"); ResourceOperationStatus operStatus = null; - Session session = hibernateUtils.getSessionFactory().openSession(); + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); try { session.beginTransaction(); String hql = @@ -597,8 +640,8 @@ public class RequestsDatabase { * @param operstatus the resource operation object * @since ONAP Amsterdam Release */ - public static void updateResOperStatus(ResourceOperationStatus operStatus) { - Session session = hibernateUtils.getSessionFactory().openSession(); + public void updateResOperStatus(ResourceOperationStatus operStatus) { + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); session.beginTransaction(); long startTime = System.currentTimeMillis(); @@ -636,8 +679,8 @@ public class RequestsDatabase { * @param operStatus the resource operation status * @since ONAP Amsterdam Release */ - private static void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) { - Session session = hibernateUtils.getSessionFactory().openSession(); + private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) { + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); session.beginTransaction(); long startTime = System.currentTimeMillis(); diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java index 09548116c5..efe9e908a2 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java @@ -19,12 +19,12 @@ */ package org.openecomp.mso.requestsdb; -import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; import java.net.URL; -public class HibernateUtilsRequestsDb extends HibernateUtils { +public class RequestsDbSessionFactoryManager extends AbstractSessionFactoryManager { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTest.java deleted file mode 100644 index 96ed0bea83..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:13:40 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -import org.junit.Test; -import static org.junit.Assert.*; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.InfraActiveRequests; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class InfraActiveRequestsESTest extends InfraActiveRequestsESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - InfraActiveRequests infraActiveRequests0 = new InfraActiveRequests(); - assertNull(infraActiveRequests0.getVolumeGroupId()); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - InfraActiveRequests infraActiveRequests0 = new InfraActiveRequests("#)r", "#)r"); - assertNull(infraActiveRequests0.getNetworkName()); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTestscaffolding.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTestscaffolding.java deleted file mode 100644 index 012b17a4d0..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraActiveRequestsESTestscaffolding.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Wed Dec 14 15:13:40 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -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; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; - -@EvoSuiteClassExclude -public class InfraActiveRequestsESTestscaffolding { - - @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.requestsdb.InfraActiveRequests"; - 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(InfraActiveRequestsESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.requestsdb.InfraActiveRequests", - "org.openecomp.mso.requestsdb.InfraRequests" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(InfraActiveRequestsESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.requestsdb.InfraRequests", - "org.openecomp.mso.requestsdb.InfraActiveRequests" - ); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTest.java deleted file mode 100644 index e3f5710833..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTest.java +++ /dev/null @@ -1,2029 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:15:48 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.runtime.EvoAssertions.*; -import java.sql.Timestamp; -import java.time.Clock; -import java.time.DateTimeException; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.Month; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.temporal.ChronoUnit; -import java.time.temporal.TemporalUnit; -import java.time.temporal.UnsupportedTemporalTypeException; -import java.util.Date; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.System; -import org.evosuite.runtime.mock.java.net.MockURI; -import org.evosuite.runtime.mock.java.time.MockClock; -import org.evosuite.runtime.mock.java.time.MockInstant; -import org.evosuite.runtime.mock.java.time.MockLocalDateTime; -import org.evosuite.runtime.mock.java.util.MockDate; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.InfraRequests; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class InfraRequestsESTest extends InfraRequestsESTestscaffolding { - - @Test(timeout = 4000) - public void test000() throws Throwable { - System.setCurrentTimeMillis(0L); - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestStatus("org.openecomp.mso.requestsdb.InfraRequests"); - Instant instant0 = MockInstant.ofEpochSecond((-1L)); - Timestamp timestamp0 = Timestamp.from(instant0); - infraRequests0.setModifyTime(timestamp0); - infraRequests0.setTenantId("7z3rvWw}>"); - infraRequests0.setVnfParams("7z3rvWw}>"); - infraRequests0.setVfModuleModelName("H(+:J_^eh02J"); - InfraRequests infraRequests1 = new InfraRequests("", "zCyMQj^e"); - infraRequests1.setProvStatus("7z3rvWw}>"); - infraRequests1.getProgress(); - infraRequests0.setProgress((Long) null); - infraRequests0.setRequestId(""); - infraRequests0.getStartTime(); - Timestamp timestamp1 = infraRequests0.getModifyTime(); - infraRequests0.getEndTime(); - Timestamp timestamp2 = infraRequests0.getModifyTime(); - assertSame(timestamp2, timestamp1); - } - - @Test(timeout = 4000) - public void test001() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("&^pJug .NI><P", "&^pJug .NI><P"); - infraRequests0.setNetworkType("jxNkugb+TFTHEb"); - infraRequests0.setVfModuleName("&^pJug .NI><P"); - Timestamp timestamp0 = new Timestamp(0L); - timestamp0.toLocalDateTime(); - timestamp0.clone(); - infraRequests0.setStartTime(timestamp0); - infraRequests0.setVolumeGroupName("&^pJug .NI><P"); - infraRequests0.setRequestAction(" g)]V!'`TH5O"); - infraRequests0.setServiceInstanceId("DfLF%$Jbfi.Q31<"); - infraRequests0.getStartTime(); - infraRequests0.getStartTime(); - infraRequests0.setAicCloudRegion("sz.!~p3obl/"); - infraRequests0.setClientRequestId("sz.!~p3obl/"); - infraRequests0.setVnfParams((String) null); - infraRequests0.getEndTime(); - infraRequests0.getStartTime(); - infraRequests0.getStartTime(); - infraRequests0.getEndTime(); - infraRequests0.getModifyTime(); - infraRequests0.getModifyTime(); - Timestamp timestamp1 = infraRequests0.getEndTime(); - assertNull(timestamp1); - } - - @Test(timeout = 4000) - public void test002() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - Timestamp timestamp0 = new Timestamp(153L); - Instant instant0 = timestamp0.toInstant(); - Timestamp timestamp1 = Timestamp.from(instant0); - infraRequests0.setStartTime(timestamp1); - Timestamp timestamp2 = infraRequests0.getStartTime(); - assertNotSame(timestamp2, timestamp0); - } - - @Test(timeout = 4000) - public void test003() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - Timestamp timestamp0 = new Timestamp((-1852L)); - infraRequests0.setEndTime(timestamp0); - Timestamp timestamp1 = infraRequests0.getEndTime(); - assertEquals(148000000, timestamp1.getNanos()); - } - - @Test(timeout = 4000) - public void test004() throws Throwable { - System.setCurrentTimeMillis(0L); - InfraRequests infraRequests0 = new InfraRequests((String) null, (String) null); - infraRequests0.setAction(""); - infraRequests0.setLastModifiedBy("et'?MxG"); - infraRequests0.setSource((String) null); - infraRequests0.setRequestStatus("i>Ckz=#\"! &-"); - infraRequests0.setVnfName((String) null); - infraRequests0.setRequestBody(""); - infraRequests0.setProvStatus(""); - infraRequests0.setRequestBody((String) null); - infraRequests0.setAicCloudRegion("m&WTLl(Z@56C"); - infraRequests0.getNetworkId(); - infraRequests0.setNetworkId("zcYzTK3rhfL`Cw"); - infraRequests0.getStartTime(); - System.setCurrentTimeMillis(2579L); - infraRequests0.getModifyTime(); - infraRequests0.getStartTime(); - infraRequests0.setAicCloudRegion("=o7|rLO^"); - infraRequests0.getEndTime(); - infraRequests0.getEndTime(); - infraRequests0.getNetworkId(); - System.setCurrentTimeMillis(0L); - System.setCurrentTimeMillis(0L); - infraRequests0.getStartTime(); - infraRequests0.getSource(); - String string0 = infraRequests0.getNetworkId(); - assertEquals("zcYzTK3rhfL`Cw", string0); - } - - @Test(timeout = 4000) - public void test005() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - Long long0 = new Long(1283L); - infraRequests0.setProvStatus("'4~OJS*DL/lP"); - Long.sum((-978L), 1283L); - infraRequests0.setProgress(long0); - infraRequests0.setServiceInstanceName("'4~OJS*DL/lP"); - infraRequests0.getSource(); - infraRequests0.setRequestId(""); - infraRequests0.getSource(); - infraRequests0.setVnfParams((String) null); - infraRequests0.getNetworkId(); - infraRequests0.getEndTime(); - infraRequests0.getNetworkId(); - infraRequests0.getModifyTime(); - infraRequests0.getProgress(); - infraRequests0.getSource(); - infraRequests0.getModifyTime(); - infraRequests0.getNetworkId(); - infraRequests0.getSource(); - infraRequests0.getModifyTime(); - infraRequests0.getEndTime(); - infraRequests0.getEndTime(); - infraRequests0.getModifyTime(); - infraRequests0.getProgress(); - infraRequests0.getProgress(); - Timestamp timestamp0 = infraRequests0.getStartTime(); - assertNull(timestamp0); - } - - @Test(timeout = 4000) - public void test006() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getEndTime(); - infraRequests0.setVfModuleModelName(""); - infraRequests0.setVfModuleId(""); - infraRequests0.getStartTime(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getSource(); - infraRequests0.setVfModuleModelName(""); - infraRequests0.setAction(""); - infraRequests0.setVnfType("32ex<U{"); - infraRequests0.setVfModuleId("~!_Y!cPw*c_>H$"); - infraRequests0.getModifyTime(); - System.setCurrentTimeMillis(0L); - infraRequests0.getEndTime(); - infraRequests0.setRequestStatus(""); - infraRequests0.setServiceInstanceName(""); - infraRequests0.getStartTime(); - infraRequests0.getVfModuleModelName(); - infraRequests0.setVolumeGroupName(""); - infraRequests0.getProgress(); - infraRequests0.setProvStatus(""); - System.setCurrentTimeMillis(0L); - infraRequests0.getStartTime(); - System.setCurrentTimeMillis(0L); - infraRequests0.getVfModuleModelName(); - infraRequests0.getNetworkId(); - infraRequests0.getNetworkId(); - infraRequests0.getVfModuleModelName(); - System.setCurrentTimeMillis(0L); - infraRequests0.getProgress(); - Timestamp timestamp0 = infraRequests0.getStartTime(); - assertNull(timestamp0); - } - - @Test(timeout = 4000) - public void test007() throws Throwable { - System.setCurrentTimeMillis((-2047L)); - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVolumeGroupName("k*}2I)_;C'i,[i>aRNU"); - infraRequests0.setSource("%az="); - infraRequests0.getModifyTime(); - infraRequests0.setRequestAction(""); - infraRequests0.setClientRequestId(""); - infraRequests0.setAicNodeClli(""); - infraRequests0.setCallBackUrl(""); - infraRequests0.setAction(""); - infraRequests0.getNetworkId(); - infraRequests0.getNetworkId(); - infraRequests0.getProgress(); - infraRequests0.getProgress(); - infraRequests0.getNetworkId(); - infraRequests0.getProgress(); - infraRequests0.getModifyTime(); - infraRequests0.setRequestScope("URuw\"b-"); - infraRequests0.setNetworkName(""); - infraRequests0.getStartTime(); - infraRequests0.getAicNodeClli(); - infraRequests0.getProgress(); - infraRequests0.setCallBackUrl(""); - infraRequests0.getEndTime(); - infraRequests0.setVnfId(""); - infraRequests0.getProgress(); - infraRequests0.getNetworkId(); - Long long0 = infraRequests0.getProgress(); - assertNull(long0); - } - - @Test(timeout = 4000) - public void test008() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests((String) null, (String) null); - infraRequests0.setClientRequestId((String) null); - infraRequests0.setVfModuleModelName((String) null); - Long long0 = new Long((-43L)); - Long.compare((-1L), 0L); - Long.compare(819L, (-43L)); - infraRequests0.setProgress(long0); - infraRequests0.getModifyTime(); - infraRequests0.getStartTime(); - infraRequests0.setAction(""); - infraRequests0.getSource(); - infraRequests0.getSource(); - infraRequests0.getStartTime(); - infraRequests0.setNetworkId((String) null); - infraRequests0.getNetworkId(); - Long long1 = infraRequests0.getProgress(); - assertEquals((-43L), (long)long1); - } - - @Test(timeout = 4000) - public void test009() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getStartTime(); - infraRequests0.setRequestScope(""); - System.setCurrentTimeMillis(0L); - infraRequests0.setVnfType(""); - infraRequests0.setProvStatus(""); - infraRequests0.setRequestScope("LB1xoi:3Wz.5'5uxZ"); - infraRequests0.setVfModuleId("+x66Ol"); - infraRequests0.setVfModuleModelName("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setVnfOutputs("LB1xoi:3Wz.5'5uxZ"); - infraRequests0.setCorrelator("{%N>'KCKdC"); - infraRequests0.getEndTime(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getSource(); - infraRequests0.getStartTime(); - infraRequests0.getNetworkId(); - infraRequests0.setRequestBody("jBcy6j^"); - infraRequests0.setAaiServiceId("m,{Gy9PQsY5J/aU!uX"); - infraRequests0.setVolumeGroupId(""); - infraRequests0.getEndTime(); - infraRequests0.getEndTime(); - infraRequests0.getVfModuleId(); - infraRequests0.getModifyTime(); - infraRequests0.getEndTime(); - infraRequests0.getModifyTime(); - String string0 = infraRequests0.getSource(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test010() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getVfModuleId(); - infraRequests0.getEndTime(); - infraRequests0.setVfModuleId((String) null); - infraRequests0.setServiceType(""); - infraRequests0.getModifyTime(); - infraRequests0.getAicNodeClli(); - infraRequests0.setAaiServiceId((String) null); - infraRequests0.getVfModuleModelName(); - infraRequests0.getVfModuleId(); - infraRequests0.getEndTime(); - infraRequests0.setVfModuleModelName((String) null); - infraRequests0.getModifyTime(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getEndTime(); - infraRequests0.setVnfName((String) null); - infraRequests0.getVfModuleId(); - infraRequests0.getAicNodeClli(); - infraRequests0.getAicNodeClli(); - infraRequests0.getNetworkId(); - infraRequests0.getVfModuleId(); - infraRequests0.getSource(); - infraRequests0.getAicNodeClli(); - infraRequests0.getSource(); - infraRequests0.getServiceType(); - infraRequests0.getModifyTime(); - String string0 = infraRequests0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test011() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVnfName("s4 -bpK"); - infraRequests0.setLastModifiedBy(""); - infraRequests0.getProgress(); - infraRequests0.getServiceType(); - infraRequests0.setVfModuleName((String) null); - infraRequests0.setVnfName(""); - infraRequests0.setVnfType(""); - infraRequests0.getVfModuleId(); - infraRequests0.setResponseBody(""); - infraRequests0.getStartTime(); - infraRequests0.setStartTime((Timestamp) null); - infraRequests0.setCorrelator(""); - infraRequests0.getVnfType(); - infraRequests0.getNetworkId(); - infraRequests0.setServiceInstanceId(""); - infraRequests0.getProgress(); - infraRequests0.getAicNodeClli(); - infraRequests0.getNetworkId(); - infraRequests0.setCorrelator((String) null); - infraRequests0.getNetworkId(); - infraRequests0.getVnfType(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getAicNodeClli(); - infraRequests0.setVnfName(""); - System.setCurrentTimeMillis((-1L)); - infraRequests0.setProvStatus(""); - infraRequests0.getVfModuleId(); - infraRequests0.getSource(); - infraRequests0.getAicNodeClli(); - String string0 = infraRequests0.getServiceType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test012() throws Throwable { - System.setCurrentTimeMillis(1L); - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setEndTime((Timestamp) null); - infraRequests0.setTenantId(""); - infraRequests0.setRequestStatus(""); - infraRequests0.setClientRequestId(""); - infraRequests0.setAction(""); - infraRequests0.setCorrelator(""); - infraRequests0.setAicNodeClli(""); - infraRequests0.getVnfParams(); - System.setCurrentTimeMillis(1L); - infraRequests0.setVolumeGroupName(""); - infraRequests0.setVfModuleId((String) null); - infraRequests0.setVnfParams(""); - infraRequests0.getSource(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getSource(); - infraRequests0.getVnfParams(); - infraRequests0.getServiceType(); - infraRequests0.setAaiServiceId("i`q1kSghF"); - infraRequests0.setStatusMessage((String) null); - infraRequests0.getProgress(); - infraRequests0.getModifyTime(); - infraRequests0.getVnfType(); - infraRequests0.getProgress(); - infraRequests0.getServiceType(); - String string0 = infraRequests0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test013() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestScope(""); - infraRequests0.setAaiServiceId(")9?S*`\"0>k"); - infraRequests0.getEndTime(); - infraRequests0.setVolumeGroupName(""); - infraRequests0.setServiceInstanceId(""); - infraRequests0.getProgress(); - infraRequests0.getRequestScope(); - Long long0 = infraRequests0.getProgress(); - assertNull(long0); - } - - @Test(timeout = 4000) - public void test014() throws Throwable { - System.setCurrentTimeMillis(3986L); - InfraRequests infraRequests0 = new InfraRequests("", (String) null); - infraRequests0.setVnfName((String) null); - infraRequests0.getResponseBody(); - infraRequests0.setAction((String) null); - infraRequests0.setCallBackUrl("(tW~,tC"); - infraRequests0.setClientRequestId("$Y$nNqJ`e'KL#@v>:"); - infraRequests0.setVolumeGroupId("mSK_k$P)79N/:l"); - infraRequests0.setResponseBody(""); - infraRequests0.setSource("(tW~,tC"); - infraRequests0.setProvStatus((String) null); - infraRequests0.setVfModuleName("9"); - infraRequests0.getServiceType(); - infraRequests0.getVnfParams(); - infraRequests0.getVnfType(); - infraRequests0.getVnfParams(); - infraRequests0.getStartTime(); - infraRequests0.getVnfType(); - infraRequests0.getStartTime(); - infraRequests0.getSource(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getStartTime(); - infraRequests0.getAicNodeClli(); - System.setCurrentTimeMillis((-1622L)); - infraRequests0.getVfModuleModelName(); - String string0 = infraRequests0.getResponseBody(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test015() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("wkT`'", "kMn9?"); - infraRequests0.setVfModuleName(""); - infraRequests0.setNetworkType(""); - infraRequests0.getVfModuleModelName(); - infraRequests0.setProvStatus("kMn9?"); - infraRequests0.getRequestScope(); - infraRequests0.setVfModuleModelName((String) null); - infraRequests0.setAicCloudRegion("wkT`'"); - infraRequests0.setServiceInstanceName("7Stei0W{<@QDoE9~"); - infraRequests0.setRequestAction(""); - infraRequests0.getServiceType(); - infraRequests0.getVnfParams(); - infraRequests0.getAicNodeClli(); - infraRequests0.getRequestScope(); - infraRequests0.getNetworkType(); - infraRequests0.getStartTime(); - infraRequests0.getNetworkType(); - infraRequests0.getStartTime(); - infraRequests0.getRequestAction(); - infraRequests0.setCorrelator("!5"); - infraRequests0.getSource(); - infraRequests0.getServiceType(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getVnfParams(); - infraRequests0.getModifyTime(); - infraRequests0.getVnfParams(); - infraRequests0.getProvStatus(); - infraRequests0.getAicNodeClli(); - infraRequests0.getVfModuleModelName(); - assertEquals("wkT`'", infraRequests0.getRequestId()); - assertEquals("kMn9?", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test016() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", (String) null); - infraRequests0.setRequestId(""); - infraRequests0.setVfModuleId(""); - infraRequests0.setRequestScope(""); - infraRequests0.setVfModuleId(""); - infraRequests0.setSource((String) null); - infraRequests0.setClientRequestId(""); - infraRequests0.setVnfName("3?/m3##"); - infraRequests0.setVfModuleName(""); - infraRequests0.setSource("y [b8^A,yt|auh|y"); - infraRequests0.setRequestScope("y [b8^A,yt|auh|y"); - infraRequests0.setClientRequestId(""); - infraRequests0.getEndTime(); - infraRequests0.setVolumeGroupName("r7szQIK?~Q"); - infraRequests0.getRequestAction(); - infraRequests0.getVfModuleModelName(); - infraRequests0.setServiceInstanceId("y [b8^A,yt|auh|y"); - infraRequests0.getServiceType(); - infraRequests0.getNetworkType(); - System.setCurrentTimeMillis(3509L); - infraRequests0.getClientRequestId(); - infraRequests0.setTenantId((String) null); - infraRequests0.getVfModuleModelName(); - infraRequests0.getVnfType(); - infraRequests0.getVnfParams(); - infraRequests0.getServiceType(); - infraRequests0.getVnfParams(); - String string0 = infraRequests0.getVfModuleModelName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test017() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - LocalDateTime localDateTime0 = MockLocalDateTime.of(264, 1, 1, 0, 1, 0); - Timestamp timestamp0 = Timestamp.valueOf(localDateTime0); - infraRequests0.setEndTime(timestamp0); - infraRequests0.setServiceInstanceId("TmMT"); - infraRequests0.setServiceInstanceName(""); - infraRequests0.setAicNodeClli(";"); - infraRequests0.setAicCloudRegion(""); - infraRequests0.setAction(""); - infraRequests0.setServiceInstanceId(""); - infraRequests0.setAaiServiceId(""); - infraRequests0.getVnfType(); - infraRequests0.getSource(); - infraRequests0.getVnfParams(); - infraRequests0.getVfModuleId(); - infraRequests0.getStartTime(); - infraRequests0.getProvStatus(); - infraRequests0.getServiceType(); - infraRequests0.getProvStatus(); - infraRequests0.getServiceType(); - System.setCurrentTimeMillis(1); - infraRequests0.setVnfParams((String) null); - infraRequests0.getServiceInstanceName(); - infraRequests0.getEndTime(); - infraRequests0.setAicNodeClli((String) null); - infraRequests0.getNetworkType(); - infraRequests0.getEndTime(); - infraRequests0.getRequestScope(); - System.setCurrentTimeMillis(0); - } - - @Test(timeout = 4000) - public void test018() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setCorrelator("nBvp})-N}"); - infraRequests0.setSource("dOe#{Gx#~I(,F)0("); - infraRequests0.setVnfId(""); - infraRequests0.getVolumeGroupName(); - infraRequests0.getCorrelator(); - infraRequests0.getModifyTime(); - infraRequests0.getRequestScope(); - infraRequests0.getVfModuleModelName(); - String string0 = infraRequests0.getProvStatus(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test019() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("HY7\"yA%CG", ""); - infraRequests0.setVnfType(""); - infraRequests0.setAicNodeClli(""); - infraRequests0.setNetworkId("HY7\"yA%CG"); - infraRequests0.setAicNodeClli(""); - infraRequests0.getProgress(); - infraRequests0.setProgress((Long) null); - infraRequests0.setServiceType(""); - infraRequests0.setLastModifiedBy(""); - infraRequests0.getRequestScope(); - infraRequests0.getProvStatus(); - infraRequests0.setVolumeGroupName((String) null); - infraRequests0.getLastModifiedBy(); - infraRequests0.getProvStatus(); - infraRequests0.setAicCloudRegion(""); - infraRequests0.getRequestScope(); - infraRequests0.getProvStatus(); - assertEquals("HY7\"yA%CG", infraRequests0.getRequestId()); - assertEquals("", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test020() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestBody(""); - infraRequests0.setTenantId(""); - infraRequests0.setRequestType(""); - infraRequests0.setCallBackUrl(""); - infraRequests0.setRequestAction(">Q'MsuT`)ThP6"); - infraRequests0.setVfModuleId(""); - infraRequests0.setResponseBody(""); - infraRequests0.getVnfName(); - infraRequests0.getProgress(); - infraRequests0.setVnfName(""); - infraRequests0.getVfModuleModelName(); - infraRequests0.setClientRequestId((String) null); - infraRequests0.getServiceType(); - infraRequests0.getVfModuleId(); - infraRequests0.getVnfName(); - infraRequests0.getVfModuleModelName(); - infraRequests0.getNetworkId(); - infraRequests0.getRequestAction(); - infraRequests0.getNetworkType(); - infraRequests0.getCorrelator(); - infraRequests0.setLastModifiedBy((String) null); - infraRequests0.getCorrelator(); - infraRequests0.getNetworkId(); - infraRequests0.getTenantId(); - infraRequests0.getVolumeGroupName(); - String string0 = infraRequests0.getVolumeGroupName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test021() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getNetworkId(); - infraRequests0.setRequestAction((String) null); - Long long0 = new Long((-965L)); - infraRequests0.setProgress(long0); - infraRequests0.getSource(); - infraRequests0.setNetworkType("5K\u0002}.V3dm%yU_&r"); - infraRequests0.setVnfOutputs("5K\u0002}.V3dm%yU_&r"); - String string0 = infraRequests0.getVnfOutputs(); - assertEquals("5K\u0002}.V3dm%yU_&r", string0); - } - - @Test(timeout = 4000) - public void test022() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestBody(""); - infraRequests0.setNetworkName("K|it"); - infraRequests0.setAction("hcA}j,"); - infraRequests0.setLastModifiedBy(""); - infraRequests0.getCallBackUrl(); - infraRequests0.getVfModuleId(); - infraRequests0.getRequestScope(); - String string0 = infraRequests0.getRequestBody(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test023() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("0", "0"); - infraRequests0.setNetworkType("0"); - infraRequests0.getStatusMessage(); - infraRequests0.getProvStatus(); - infraRequests0.getVnfParams(); - infraRequests0.getStatusMessage(); - infraRequests0.setVfModuleName((String) null); - infraRequests0.getResponseBody(); - infraRequests0.setStatusMessage("[3aRfG;XuP"); - infraRequests0.setVolumeGroupId((String) null); - infraRequests0.setAction(""); - infraRequests0.getEndTime(); - infraRequests0.getStartTime(); - infraRequests0.getServiceType(); - infraRequests0.getResponseBody(); - infraRequests0.getVfModuleId(); - infraRequests0.getServiceInstanceName(); - infraRequests0.getEndTime(); - infraRequests0.getNetworkType(); - infraRequests0.getVnfOutputs(); - infraRequests0.getVnfType(); - infraRequests0.getRequestScope(); - infraRequests0.getStartTime(); - infraRequests0.getRequestAction(); - infraRequests0.getProgress(); - infraRequests0.getLastModifiedBy(); - infraRequests0.getStatusMessage(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getVnfName(); - System.setCurrentTimeMillis(1480L); - String string0 = infraRequests0.getVnfName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test024() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestType("2AfD]In8p;DK-]O`8}s"); - infraRequests0.getClientRequestId(); - infraRequests0.setClientRequestId((String) null); - infraRequests0.setResponseBody("2AfD]In8p;DK-]O`8}s"); - infraRequests0.setAaiServiceId("2AfD]In8p;DK-]O`8}s"); - infraRequests0.setRequestBody((String) null); - infraRequests0.setVfModuleId(""); - Timestamp timestamp0 = new Timestamp(0L); - infraRequests0.setEndTime(timestamp0); - infraRequests0.setVfModuleModelName((String) null); - infraRequests0.getAicNodeClli(); - infraRequests0.getAicNodeClli(); - infraRequests0.setVnfName("}}xiNsZQ:D73z4dha"); - Clock clock0 = MockClock.systemDefaultZone(); - Timestamp timestamp1 = infraRequests0.getEndTime(); - timestamp0.before(timestamp1); - Instant instant0 = MockInstant.now(clock0); - Instant instant1 = MockInstant.minusNanos(instant0, (-290L)); - ChronoUnit chronoUnit0 = ChronoUnit.DECADES; - // Undeclared exception! - try { - MockInstant.plus(instant1, 0L, (TemporalUnit) chronoUnit0); - fail("Expecting exception: UnsupportedTemporalTypeException"); - - } catch(UnsupportedTemporalTypeException e) { - // - // Unsupported unit: Decades - // - verifyException("java.time.Instant", e); - } - } - - @Test(timeout = 4000) - public void test025() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getTenantId(); - infraRequests0.setServiceType(""); - infraRequests0.getModifyTime(); - infraRequests0.setModifyTime((Timestamp) null); - infraRequests0.getClientRequestId(); - infraRequests0.setVolumeGroupId((String) null); - infraRequests0.getRequestId(); - infraRequests0.getVfModuleName(); - infraRequests0.getServiceInstanceName(); - infraRequests0.setNetworkId(""); - infraRequests0.setNetworkName((String) null); - infraRequests0.getResponseBody(); - infraRequests0.getNetworkId(); - Timestamp timestamp0 = infraRequests0.getModifyTime(); - assertNull(timestamp0); - } - - @Test(timeout = 4000) - public void test026() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getVolumeGroupName(); - infraRequests0.setResponseBody(")Y?y`MhJSG>i"); - infraRequests0.setVfModuleId((String) null); - infraRequests0.setRequestStatus((String) null); - infraRequests0.getResponseBody(); - infraRequests0.setVnfOutputs("q+6_~:+S5N.3.Lge\""); - infraRequests0.setVfModuleModelName("q+6_~:+S5N.3.Lge\""); - infraRequests0.setSource("q+6_~:+S5N.3.Lge\""); - infraRequests0.setServiceInstanceName(")Y?y`MhJSG>i"); - infraRequests0.getServiceType(); - infraRequests0.getModifyTime(); - infraRequests0.setNetworkName("YUNs`H&7xu@i2P/1_"); - InfraRequests infraRequests1 = new InfraRequests(); - infraRequests1.setVfModuleModelName(""); - infraRequests1.setRequestStatus("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setRequestId("6A'N2)N@dyHD|PV"); - infraRequests1.getNetworkType(); - infraRequests0.getNetworkName(); - infraRequests1.getLastModifiedBy(); - infraRequests0.getRequestBody(); - infraRequests1.setServiceInstanceId(""); - infraRequests0.setServiceInstanceName(":fK$0REpUY"); - assertEquals(")Y?y`MhJSG>i", infraRequests0.getResponseBody()); - } - - @Test(timeout = 4000) - public void test027() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setServiceType("i3b%q%2jvX"); - infraRequests0.getServiceType(); - infraRequests0.setClientRequestId("i3b%q%2jvX"); - infraRequests0.setVnfId(""); - infraRequests0.getSource(); - ChronoUnit chronoUnit0 = ChronoUnit.NANOS; - // Undeclared exception! - try { - MockInstant.plus((Instant) null, (-1L), (TemporalUnit) chronoUnit0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.evosuite.runtime.mock.java.time.MockInstant", e); - } - } - - @Test(timeout = 4000) - public void test028() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("org.openecomp.mso.requestsdb.InfraRequests", ""); - infraRequests0.setRequestType(""); - infraRequests0.setRequestBody("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setAction(""); - infraRequests0.getVnfParams(); - InfraRequests infraRequests1 = new InfraRequests(); - infraRequests0.setVfModuleName((String) null); - infraRequests0.getVfModuleName(); - infraRequests1.setVfModuleName("?ynVFwCW]h"); - infraRequests0.setVnfParams(""); - infraRequests1.setResponseBody((String) null); - infraRequests1.setLastModifiedBy((String) null); - infraRequests1.setClientRequestId("oCb )W1D3x;e}QaJ"); - infraRequests0.setServiceInstanceName(""); - infraRequests0.getVfModuleId(); - infraRequests1.getClientRequestId(); - infraRequests1.getModifyTime(); - infraRequests0.setSource("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests1.setVfModuleName("org.openecomp.mso.requestsdb.InfraRequests"); - String string0 = infraRequests1.getAaiServiceId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test029() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setServiceType(""); - infraRequests0.setVfModuleModelName("QE|"); - infraRequests0.setStatusMessage("/`_aGH,(,:O9e'"); - infraRequests0.setStatusMessage("/`_aGH,(,:O9e'"); - infraRequests0.setLastModifiedBy((String) null); - infraRequests0.setServiceInstanceName("QE|"); - infraRequests0.setCallBackUrl("QE|"); - infraRequests0.setCallBackUrl("QE|"); - Long long0 = new Long(0L); - Long.getLong("/`_aGH,(,:O9e'", 0L); - Long.getLong("QE|", (Long) null); - infraRequests0.setProgress(long0); - infraRequests0.setVfModuleName("QE|"); - infraRequests0.setSource(""); - infraRequests0.setVfModuleId("QE|"); - infraRequests0.setVolumeGroupId(""); - infraRequests0.getTenantId(); - infraRequests0.getClientRequestId(); - String string0 = infraRequests0.getServiceInstanceName(); - assertEquals("QE|", string0); - } - - @Test(timeout = 4000) - public void test030() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getResponseBody(); - infraRequests0.setServiceInstanceName((String) null); - InfraRequests infraRequests1 = new InfraRequests((String) null, ";*MXO3Cx^<r~)I#t"); - infraRequests1.setSource("H>f%;>>.T7]h8?L]*"); - infraRequests1.setRequestScope((String) null); - infraRequests1.setNetworkName(""); - infraRequests0.setRequestAction("FLknU%"); - infraRequests1.setCallBackUrl(""); - InfraRequests infraRequests2 = new InfraRequests(";*MXO3Cx^<r~)I#t", ";*MXO3Cx^<r~)I#t"); - infraRequests2.setCorrelator(""); - infraRequests1.getNetworkName(); - infraRequests0.setRequestBody((String) null); - assertNull(infraRequests0.getRequestScope()); - } - - @Test(timeout = 4000) - public void test031() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getNetworkId(); - infraRequests0.setVfModuleModelName((String) null); - infraRequests0.setNetworkType((String) null); - infraRequests0.setAction((String) null); - infraRequests0.setVfModuleModelName("d@?@e`uVahW|y"); - infraRequests0.setVolumeGroupName("$1"); - infraRequests0.getResponseBody(); - infraRequests0.getVnfParams(); - infraRequests0.getRequestAction(); - infraRequests0.setClientRequestId("N] J}ueWB9R)u"); - infraRequests0.getVfModuleId(); - infraRequests0.getNetworkType(); - infraRequests0.getModifyTime(); - infraRequests0.getNetworkId(); - infraRequests0.getModifyTime(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getAicNodeClli(); - infraRequests0.setVnfOutputs("d@?@e`uVahW|y"); - infraRequests0.getVfModuleModelName(); - infraRequests0.getRequestAction(); - infraRequests0.getRequestAction(); - infraRequests0.setVnfId("2dCOj."); - System.setCurrentTimeMillis(509L); - infraRequests0.getNetworkId(); - infraRequests0.getProgress(); - infraRequests0.getVfModuleId(); - infraRequests0.getVfModuleId(); - infraRequests0.getProgress(); - String string0 = infraRequests0.getAicNodeClli(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test032() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVfModuleName(""); - infraRequests0.setVfModuleModelName("1Hr"); - infraRequests0.setNetworkType(""); - infraRequests0.setCallBackUrl(""); - infraRequests0.setSource("[@Z"); - infraRequests0.setRequestBody(">!b;YwVyr(8"); - infraRequests0.setRequestBody("[@Z"); - infraRequests0.setServiceInstanceId("1Hr"); - infraRequests0.setClientRequestId((String) null); - infraRequests0.setRequestAction(">!b;YwVyr(8"); - infraRequests0.setVnfName(">!b;YwVyr(8"); - infraRequests0.setAicCloudRegion("[@Z"); - infraRequests0.setNetworkId("OU%$T'av6Ca'8.%"); - infraRequests0.setCallBackUrl("1Hr"); - infraRequests0.setServiceInstanceId(""); - infraRequests0.setNetworkName("OU%$T'av6Ca'8.%"); - infraRequests0.setNetworkName("gB~~7^R}E0VY*jjv"); - infraRequests0.getSource(); - infraRequests0.getLastModifiedBy(); - infraRequests0.getVfModuleName(); - String string0 = infraRequests0.getRequestStatus(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test033() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "c~]g[*"); - infraRequests0.setServiceType(""); - infraRequests0.setAaiServiceId("c~]g[*"); - infraRequests0.setVnfType("8u=!kEh2}E<wR-=T3Eu"); - infraRequests0.setAicNodeClli("c~]g[*"); - infraRequests0.getVnfType(); - infraRequests0.setVnfName("~x"); - infraRequests0.setVnfOutputs("8u=!kEh2}E<wR-=T3Eu"); - infraRequests0.setServiceType(""); - infraRequests0.setVnfOutputs("CxZIOx,v-"); - infraRequests0.getVfModuleModelName(); - infraRequests0.getAicNodeClli(); - assertEquals("c~]g[*", infraRequests0.getAction()); - - infraRequests0.setAction("Z+$8\"UD&O@G"); - assertEquals("", infraRequests0.getRequestId()); - } - - @Test(timeout = 4000) - public void test034() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - Timestamp timestamp0 = new Timestamp((-2655L)); - infraRequests0.setModifyTime(timestamp0); - Timestamp timestamp1 = infraRequests0.getModifyTime(); - timestamp1.after(timestamp0); - infraRequests0.setStartTime(timestamp1); - infraRequests0.getAaiServiceId(); - infraRequests0.getRequestStatus(); - infraRequests0.setRequestStatus("I1e1@rWiu`h-"); - infraRequests0.setVolumeGroupName("I1e1@rWiu`h-"); - infraRequests0.setAicNodeClli("H/;N:1&TC[5,}"); - String string0 = infraRequests0.getClientRequestId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test035() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setNetworkType("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.getVnfOutputs(); - infraRequests0.getProgress(); - infraRequests0.setClientRequestId((String) null); - infraRequests0.setRequestAction("YN8"); - infraRequests0.setProvStatus(""); - infraRequests0.getServiceInstanceId(); - infraRequests0.getProvStatus(); - infraRequests0.setRequestScope((String) null); - infraRequests0.getAicNodeClli(); - infraRequests0.getRequestScope(); - infraRequests0.getServiceInstanceName(); - infraRequests0.setVnfName((String) null); - infraRequests0.getVolumeGroupName(); - infraRequests0.getTenantId(); - infraRequests0.getNetworkId(); - infraRequests0.setStatusMessage((String) null); - infraRequests0.setTenantId("org.openecomp.mso.requestsdb.InfraRequests"); - // Undeclared exception! - try { - Timestamp.valueOf((String) null); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // null string - // - verifyException("java.sql.Timestamp", e); - } - } - - @Test(timeout = 4000) - public void test036() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getVolumeGroupId(); - infraRequests0.setVnfParams("xeM>h;aPCLLMO/"); - infraRequests0.setAaiServiceId("xeM>h;aPCLLMO/"); - infraRequests0.setProvStatus(""); - infraRequests0.setVfModuleId("xeM>h;aPCLLMO/"); - infraRequests0.setVnfOutputs(""); - infraRequests0.setAaiServiceId((String) null); - infraRequests0.setClientRequestId("S|%I {=}otjRfuQa8Ab"); - infraRequests0.setRequestBody("S|%I {=}otjRfuQa8Ab"); - infraRequests0.setModifyTime((Timestamp) null); - infraRequests0.getRequestBody(); - infraRequests0.setAaiServiceId(""); - infraRequests0.setRequestId("4_X\":Ety|S,O-RObu"); - infraRequests0.getCorrelator(); - infraRequests0.setVnfOutputs("%~+Mc"); - infraRequests0.getVolumeGroupId(); - infraRequests0.setVnfId(""); - assertNull(infraRequests0.getStatusMessage()); - } - - @Test(timeout = 4000) - public void test037() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("org.openecomp.mso.requestsdb.InfraRequests", "YpJ&"); - infraRequests0.setRequestType(""); - infraRequests0.setSource("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.getNetworkId(); - infraRequests0.getSource(); - infraRequests0.setVfModuleName("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setRequestType((String) null); - infraRequests0.getStatusMessage(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getVnfName(); - infraRequests0.getModifyTime(); - MockDate mockDate0 = new MockDate((-1949L)); - Instant instant0 = mockDate0.toInstant(); - Instant instant1 = MockInstant.plusSeconds(instant0, (-1949L)); - Date.from(instant1); - infraRequests0.getRequestBody(); - infraRequests0.getNetworkId(); - infraRequests0.setModifyTime((Timestamp) null); - infraRequests0.getEndTime(); - infraRequests0.getProvStatus(); - infraRequests0.getRequestAction(); - infraRequests0.getVfModuleName(); - infraRequests0.getRequestAction(); - assertEquals("YpJ&", infraRequests0.getAction()); - assertEquals("org.openecomp.mso.requestsdb.InfraRequests", infraRequests0.getRequestId()); - } - - @Test(timeout = 4000) - public void test038() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setAicCloudRegion((String) null); - infraRequests0.setRequestType("_P-9"); - infraRequests0.getRequestBody(); - infraRequests0.setRequestStatus(""); - infraRequests0.setCorrelator(".3!"); - infraRequests0.setRequestId((String) null); - String string0 = infraRequests0.getRequestType(); - assertEquals("_P-9", string0); - } - - @Test(timeout = 4000) - public void test039() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setAaiServiceId(""); - infraRequests0.setCallBackUrl(""); - infraRequests0.setVnfOutputs("]8N<"); - infraRequests0.setVfModuleId(""); - infraRequests0.setCorrelator("]8N<"); - infraRequests0.setResponseBody(""); - infraRequests0.setNetworkType("]8N<"); - infraRequests0.getProgress(); - infraRequests0.setCallBackUrl(""); - infraRequests0.getCallBackUrl(); - infraRequests0.setServiceType("]8N<"); - infraRequests0.getVnfId(); - infraRequests0.setRequestAction(""); - infraRequests0.setVnfName(""); - infraRequests0.setVnfName("x'+i.S`"); - infraRequests0.getTenantId(); - infraRequests0.getAicCloudRegion(); - infraRequests0.getTenantId(); - infraRequests0.setStartTime((Timestamp) null); - infraRequests0.setRequestId("c"); - infraRequests0.getRequestType(); - infraRequests0.getEndTime(); - infraRequests0.setModifyTime((Timestamp) null); - String string0 = infraRequests0.getVnfName(); - assertEquals("x'+i.S`", string0); - } - - @Test(timeout = 4000) - public void test040() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setNetworkId("8FcIWeVboHbH"); - infraRequests0.setVnfId(""); - infraRequests0.setStatusMessage(""); - infraRequests0.getClientRequestId(); - infraRequests0.setNetworkName((String) null); - infraRequests0.setVnfName((String) null); - infraRequests0.setCallBackUrl("sK9}!C'50J,"); - infraRequests0.setVolumeGroupId("oC"); - infraRequests0.getVnfOutputs(); - infraRequests0.setVnfName("sK9}!C'50J,"); - infraRequests0.setRequestScope("sK9}!C'50J,"); - infraRequests0.getRequestAction(); - infraRequests0.setVnfParams("oC"); - infraRequests0.getVolumeGroupName(); - infraRequests0.setResponseBody((String) null); - infraRequests0.setNetworkId((String) null); - infraRequests0.setProvStatus(""); - infraRequests0.setAicNodeClli(""); - infraRequests0.getAaiServiceId(); - infraRequests0.getCallBackUrl(); - infraRequests0.getResponseBody(); - infraRequests0.setAaiServiceId((String) null); - infraRequests0.getResponseBody(); - infraRequests0.getEndTime(); - infraRequests0.setModifyTime((Timestamp) null); - infraRequests0.getServiceType(); - infraRequests0.setResponseBody(""); - infraRequests0.getServiceInstanceId(); - infraRequests0.setRequestBody("J2E*wkiH'm}"); - assertEquals("sK9}!C'50J,", infraRequests0.getCallBackUrl()); - } - - @Test(timeout = 4000) - public void test041() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestStatus("gUu8 g"); - infraRequests0.setClientRequestId("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setVnfOutputs(""); - infraRequests0.setResponseBody(""); - infraRequests0.setVnfId(""); - infraRequests0.setAaiServiceId("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setAicNodeClli("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setVnfParams("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setResponseBody(""); - infraRequests0.getModifyTime(); - infraRequests0.getVnfOutputs(); - infraRequests0.getRequestStatus(); - infraRequests0.setVfModuleId("GrYS{|<Q&Zg22qy+qi"); - infraRequests0.setStartTime((Timestamp) null); - infraRequests0.getVnfOutputs(); - String string0 = infraRequests0.getRequestAction(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test042() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setServiceInstanceId((String) null); - infraRequests0.setAction("niZk9/S^^Ok_H^a{"); - infraRequests0.setVfModuleId("niZk9/S^^Ok_H^a{"); - infraRequests0.setVolumeGroupId(""); - infraRequests0.setNetworkId(""); - infraRequests0.setVnfId(""); - infraRequests0.setRequestType("?_I%o"); - infraRequests0.setProvStatus("niZk9/S^^Ok_H^a{"); - infraRequests0.setCallBackUrl(""); - infraRequests0.setServiceInstanceName("XA&Ybqzx!ro6hEU"); - infraRequests0.setLastModifiedBy(""); - infraRequests0.setRequestId(""); - infraRequests0.getRequestScope(); - infraRequests0.getNetworkName(); - infraRequests0.getVnfId(); - infraRequests0.setAaiServiceId(""); - infraRequests0.setTenantId("XA&Ybqzx!ro6hEU"); - infraRequests0.setVolumeGroupId("{O)c"); - infraRequests0.getAction(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getTenantId(); - infraRequests0.setServiceInstanceId(""); - assertNull(infraRequests0.getNetworkType()); - } - - @Test(timeout = 4000) - public void test043() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setTenantId(""); - infraRequests0.setNetworkName(""); - infraRequests0.setAction(""); - Long long0 = new Long(210L); - Long.compare(1164L, 210L); - infraRequests0.setProgress(long0); - infraRequests0.setVfModuleName(""); - Timestamp timestamp0 = new Timestamp(0L); - timestamp0.toInstant(); - timestamp0.setTime(210L); - Instant instant0 = MockInstant.ofEpochMilli(210L); - timestamp0.toLocalDateTime(); - Date.from(instant0); - infraRequests0.setModifyTime(timestamp0); - infraRequests0.setAicCloudRegion("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setRequestAction("qa^[z3j"); - infraRequests0.setVnfType(""); - infraRequests0.getEndTime(); - infraRequests0.setVnfId("wI"); - infraRequests0.getAicCloudRegion(); - infraRequests0.setServiceType(""); - infraRequests0.getAction(); - Timestamp timestamp1 = infraRequests0.getStartTime(); - assertNull(timestamp1); - } - - @Test(timeout = 4000) - public void test044() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("y_J8g=Q8E|gns?USs", "~6yl5nFR7N_I'Tv@."); - infraRequests0.setCallBackUrl("_w^p*-dH4_6v"); - infraRequests0.setVolumeGroupName("y_J8g=Q8E|gns?USs"); - String string0 = infraRequests0.getAction(); - assertEquals("~6yl5nFR7N_I'Tv@.", string0); - - InfraRequests infraRequests1 = new InfraRequests("S?cD1SU", ""); - assertEquals("S?cD1SU", infraRequests1.getRequestId()); - } - - @Test(timeout = 4000) - public void test045() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVolumeGroupName(""); - infraRequests0.setServiceInstanceName(""); - infraRequests0.setVfModuleName(""); - infraRequests0.setStatusMessage(""); - infraRequests0.setVnfName("GG-<o?t l"); - infraRequests0.setVnfName(""); - infraRequests0.setRequestBody(""); - infraRequests0.setCallBackUrl(""); - infraRequests0.setRequestAction(""); - infraRequests0.setVnfType(""); - infraRequests0.setVnfId(""); - infraRequests0.setServiceInstanceId("{CyVx7 >*vO|"); - infraRequests0.setVnfId(""); - infraRequests0.getProvStatus(); - infraRequests0.setProvStatus("{CyVx7 >*vO|"); - infraRequests0.setAicNodeClli("?g9!S#sMQWI4rg"); - infraRequests0.setVnfParams(""); - infraRequests0.setRequestAction("GG-<o?t l"); - infraRequests0.getRequestType(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getRequestAction(); - infraRequests0.getRequestStatus(); - InfraRequests infraRequests1 = new InfraRequests(); - String string0 = infraRequests1.getServiceInstanceId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test046() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setVnfName(""); - infraRequests0.setServiceInstanceId(""); - infraRequests0.setVolumeGroupId(""); - infraRequests0.setNetworkId("?"); - infraRequests0.setVnfName(""); - infraRequests0.setServiceType(""); - infraRequests0.setSource(""); - infraRequests0.getRequestType(); - InfraRequests infraRequests1 = new InfraRequests(); - infraRequests1.setVolumeGroupName(")Na<;z"); - infraRequests1.setRequestAction(""); - infraRequests1.getAicNodeClli(); - infraRequests1.setResponseBody((String) null); - infraRequests1.setVnfType((String) null); - infraRequests1.getVnfName(); - infraRequests1.getVnfType(); - infraRequests0.getServiceInstanceId(); - infraRequests0.setRequestType(""); - infraRequests1.getVnfName(); - infraRequests0.getRequestBody(); - infraRequests1.getVnfType(); - infraRequests1.setRequestAction("Yy"); - infraRequests0.setVnfParams("DnrZ78}s"); - infraRequests0.setServiceInstanceId("]V55Aq\u0003(z<Ct92L`F"); - infraRequests1.setVfModuleName((String) null); - assertNull(infraRequests1.getNetworkId()); - } - - @Test(timeout = 4000) - public void test047() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.getAction(); - infraRequests0.setVnfName(""); - infraRequests0.getNetworkType(); - infraRequests0.getVnfParams(); - infraRequests0.setLastModifiedBy((String) null); - String string0 = infraRequests0.getAaiServiceId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test048() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setNetworkType(""); - infraRequests0.setStatusMessage(""); - infraRequests0.setRequestAction(""); - infraRequests0.setSource(""); - infraRequests0.setVnfId((String) null); - infraRequests0.setLastModifiedBy((String) null); - infraRequests0.setVolumeGroupId((String) null); - infraRequests0.setRequestScope(""); - infraRequests0.getServiceType(); - infraRequests0.setRequestBody((String) null); - infraRequests0.getProgress(); - infraRequests0.setVnfType((String) null); - infraRequests0.setSource((String) null); - infraRequests0.getVfModuleModelName(); - infraRequests0.getStatusMessage(); - infraRequests0.setResponseBody(""); - infraRequests0.setRequestStatus((String) null); - infraRequests0.getAicCloudRegion(); - Timestamp timestamp0 = new Timestamp(2519L); - infraRequests0.setEndTime(timestamp0); - String string0 = infraRequests0.getRequestBody(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test049() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("$V/<$XAp+o>Im\"*", "$V/<$XAp+o>Im\"*"); - infraRequests0.setNetworkName("$V/<$XAp+o>Im\"*"); - infraRequests0.setVnfName((String) null); - infraRequests0.setVfModuleId(""); - infraRequests0.getServiceInstanceName(); - infraRequests0.setAaiServiceId(""); - infraRequests0.setRequestScope(""); - infraRequests0.getAaiServiceId(); - infraRequests0.getModifyTime(); - infraRequests0.setNetworkName((String) null); - infraRequests0.setSource(""); - infraRequests0.getRequestBody(); - infraRequests0.setVnfType(""); - infraRequests0.setStatusMessage(""); - assertNull(infraRequests0.getVolumeGroupId()); - } - - @Test(timeout = 4000) - public void test050() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestStatus(""); - infraRequests0.getServiceInstanceName(); - infraRequests0.setRequestBody((String) null); - infraRequests0.getAction(); - infraRequests0.setVnfParams(""); - infraRequests0.setAction((String) null); - infraRequests0.getSource(); - infraRequests0.getAicCloudRegion(); - infraRequests0.getRequestType(); - infraRequests0.getClientRequestId(); - infraRequests0.getServiceInstanceId(); - infraRequests0.setResponseBody(""); - infraRequests0.getVolumeGroupId(); - infraRequests0.getRequestStatus(); - infraRequests0.getRequestScope(); - infraRequests0.setAicCloudRegion(""); - Long long0 = new Long(0L); - Long.getLong("TQRm 6Q}I>x7UHTd!cH"); - // Undeclared exception! - try { - Long.remainderUnsigned((-1L), 0L); - fail("Expecting exception: ArithmeticException"); - - } catch(ArithmeticException e) { - // - // BigInteger divide by zero - // - verifyException("java.math.MutableBigInteger", e); - } - } - - @Test(timeout = 4000) - public void test051() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setProvStatus(""); - infraRequests0.setClientRequestId(""); - infraRequests0.setVnfType("BJ@B"); - infraRequests0.setProvStatus(""); - infraRequests0.setRequestType(""); - infraRequests0.setAaiServiceId("k^;d!:UH+Z"); - infraRequests0.setRequestType(""); - infraRequests0.setTenantId(""); - infraRequests0.getCallBackUrl(); - InfraRequests infraRequests1 = new InfraRequests(); - infraRequests1.setVnfName("C,,\"N"); - infraRequests0.setVnfParams((String) null); - InfraRequests infraRequests2 = new InfraRequests("", ""); - infraRequests1.setVolumeGroupId(""); - infraRequests2.setTenantId("k^;d!:UH+Z"); - infraRequests1.setVfModuleName(""); - infraRequests2.setVnfType("eDfR<b$HYx"); - infraRequests2.setStatusMessage((String) null); - infraRequests2.setVnfId(""); - infraRequests1.getVolumeGroupId(); - infraRequests0.setAicCloudRegion("BJ@B"); - infraRequests1.setNetworkType(""); - String string0 = infraRequests2.getRequestBody(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test052() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setRequestStatus(""); - infraRequests0.getAicNodeClli(); - infraRequests0.setVolumeGroupName("=xQ^U6%j?LcGU"); - infraRequests0.setVolumeGroupId("~L$J"); - infraRequests0.setVnfOutputs("C"); - infraRequests0.setVnfId("YU GUY+c}[>6+QI83q"); - infraRequests0.setVfModuleName(""); - infraRequests0.getRequestId(); - infraRequests0.setVfModuleModelName("S9h|[hF*h/aEBZ--"); - infraRequests0.setCallBackUrl(""); - infraRequests0.getVnfId(); - infraRequests0.setVnfParams(""); - infraRequests0.getSource(); - infraRequests0.getVnfType(); - InfraRequests infraRequests1 = new InfraRequests("", ""); - infraRequests0.setAaiServiceId("S9h|[hF*h/aEBZ--"); - infraRequests0.setVnfParams(""); - infraRequests1.getRequestBody(); - Month month0 = Month.MARCH; - // Undeclared exception! - try { - MockLocalDateTime.of(1, month0, 1, 1, 0, (-1068)); - fail("Expecting exception: DateTimeException"); - - } catch(DateTimeException e) { - // - // Invalid value for SecondOfMinute (valid values 0 - 59): -1068 - // - verifyException("java.time.temporal.ValueRange", e); - } - } - - @Test(timeout = 4000) - public void test053() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setLastModifiedBy("M+YL/d"); - infraRequests0.setCorrelator("M+YL/d"); - infraRequests0.getLastModifiedBy(); - Month month0 = Month.MAY; - // Undeclared exception! - try { - MockLocalDateTime.of((-574), month0, (-574), (-574), 0); - fail("Expecting exception: DateTimeException"); - - } catch(DateTimeException e) { - // - // Invalid value for DayOfMonth (valid values 1 - 28/31): -574 - // - verifyException("java.time.temporal.ValueRange", e); - } - } - - @Test(timeout = 4000) - public void test054() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestType(""); - infraRequests0.setEndTime((Timestamp) null); - Long long0 = new Long(0L); - Long.compare(0L, 0L); - Long.min(0L, 0L); - infraRequests0.setProvStatus(""); - Long.compare(0L, 0L); - Long.max(0, 0L); - Long.divideUnsigned((-1239L), 561L); - Long.divideUnsigned(0, 31L); - Long.sum(0, 31L); - Long.getLong("}'{?rnxwE~m.*b/<", (-2588L)); - infraRequests0.setProgress(long0); - infraRequests0.setProvStatus(""); - infraRequests0.setVnfParams(""); - infraRequests0.setRequestScope("Gz0xF^~M`"); - infraRequests0.setRequestType(""); - infraRequests0.getAaiServiceId(); - infraRequests0.setCallBackUrl(""); - infraRequests0.setNetworkName(""); - infraRequests0.setRequestStatus("No<5t"); - infraRequests0.setVolumeGroupId(""); - infraRequests0.getEndTime(); - infraRequests0.getProgress(); - String string0 = infraRequests0.getRequestScope(); - assertEquals("Gz0xF^~M`", string0); - } - - @Test(timeout = 4000) - public void test055() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("K66EFm]%0}Hi", "K66EFm]%0}Hi"); - infraRequests0.setVnfName("K66EFm]%0}Hi"); - infraRequests0.getVfModuleModelName(); - infraRequests0.getProgress(); - infraRequests0.setStatusMessage("K66EFm]%0}Hi"); - infraRequests0.setVolumeGroupId((String) null); - infraRequests0.setVolumeGroupName("K66EFm]%0}Hi"); - infraRequests0.setRequestBody("J1UB"); - assertNull(infraRequests0.getResponseBody()); - } - - @Test(timeout = 4000) - public void test056() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "UwUvkc"); - infraRequests0.setVolumeGroupName("UwUvkc"); - infraRequests0.getVfModuleId(); - ZoneOffset zoneOffset0 = ZoneOffset.MIN; - ZoneOffset zoneOffset1 = (ZoneOffset)ZoneId.ofOffset("", zoneOffset0); - LocalDateTime localDateTime0 = MockLocalDateTime.now((ZoneId) zoneOffset1); - Timestamp timestamp0 = Timestamp.valueOf(localDateTime0); - infraRequests0.setModifyTime(timestamp0); - String string0 = infraRequests0.getRequestId(); - assertEquals("", string0); - - infraRequests0.getCorrelator(); - assertEquals("UwUvkc", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test057() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getVnfName(); - infraRequests0.setAction((String) null); - infraRequests0.getVfModuleName(); - infraRequests0.getNetworkId(); - infraRequests0.getVnfId(); - infraRequests0.setRequestId((String) null); - infraRequests0.setNetworkId((String) null); - infraRequests0.setRequestStatus((String) null); - infraRequests0.setAaiServiceId("wL6o_:EmO)#"); - infraRequests0.setSource((String) null); - infraRequests0.setVnfType("yMKDqB`W?]q"); - infraRequests0.setRequestType((String) null); - infraRequests0.setRequestType(""); - infraRequests0.setRequestScope((String) null); - infraRequests0.getVfModuleName(); - infraRequests0.getVolumeGroupName(); - infraRequests0.getSource(); - infraRequests0.setAicCloudRegion((String) null); - infraRequests0.getSource(); - infraRequests0.getRequestBody(); - infraRequests0.getAaiServiceId(); - infraRequests0.setVnfType((String) null); - String string0 = infraRequests0.getClientRequestId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test058() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setSource("c"); - infraRequests0.setRequestType("*Q}l.yW`VI`i_Q8YL]"); - infraRequests0.setRequestId(""); - infraRequests0.setCorrelator("Y;5!~N0v@x"); - infraRequests0.setNetworkType(""); - infraRequests0.setRequestAction("Y;5!~N0v@x"); - infraRequests0.setLastModifiedBy(""); - infraRequests0.setSource(""); - infraRequests0.setAction(""); - infraRequests0.setTenantId(""); - infraRequests0.setAicCloudRegion(""); - infraRequests0.getRequestScope(); - infraRequests0.setAicNodeClli("Y;5!~N0v@x"); - infraRequests0.getAicCloudRegion(); - infraRequests0.setVnfId("qn|b,'x[1 h*z\"#h"); - assertNull(infraRequests0.getRequestScope()); - } - - @Test(timeout = 4000) - public void test059() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setVnfType("SRPBs.zeX&dK@&XRQj"); - infraRequests0.setCallBackUrl(""); - infraRequests0.setVnfType("%a26GFoFhBEe"); - infraRequests0.setServiceInstanceName((String) null); - infraRequests0.setVfModuleName((String) null); - infraRequests0.getLastModifiedBy(); - infraRequests0.getVnfType(); - String string0 = infraRequests0.getServiceInstanceName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test060() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getEndTime(); - MockDate mockDate0 = new MockDate(965L); - Instant instant0 = mockDate0.toInstant(); - Date.from(instant0); - infraRequests0.setEndTime((Timestamp) null); - infraRequests0.getEndTime(); - infraRequests0.getCorrelator(); - Long long0 = new Long(965L); - infraRequests0.setProgress(long0); - String string0 = infraRequests0.getTenantId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test061() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("qx?)", "qx?)"); - Timestamp timestamp0 = new Timestamp(1390L); - infraRequests0.setStartTime(timestamp0); - infraRequests0.getRequestScope(); - infraRequests0.setVolumeGroupId("qx?)"); - infraRequests0.getVolumeGroupId(); - infraRequests0.setProvStatus((String) null); - timestamp0.setNanos(0); - infraRequests0.setCorrelator(""); - infraRequests0.setVnfOutputs(""); - infraRequests0.setModifyTime(timestamp0); - infraRequests0.getServiceType(); - infraRequests0.setVolumeGroupName("5#&B!D"); - infraRequests0.setVfModuleId("a"); - infraRequests0.setNetworkName("a"); - infraRequests0.getClientRequestId(); - infraRequests0.setRequestScope("qx?)"); - infraRequests0.setVolumeGroupName((String) null); - infraRequests0.getRequestId(); - infraRequests0.setRequestScope("-W#aB<Km<U("); - infraRequests0.getVnfParams(); - infraRequests0.getServiceInstanceName(); - infraRequests0.getCorrelator(); - infraRequests0.setAicNodeClli(""); - infraRequests0.setAction(""); - infraRequests0.setStartTime(timestamp0); - assertNull(infraRequests0.getServiceInstanceName()); - } - - @Test(timeout = 4000) - public void test062() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("N.Z5|phE", ""); - infraRequests0.getClientRequestId(); - assertEquals("N.Z5|phE", infraRequests0.getRequestId()); - assertEquals("", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test063() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "h."); - infraRequests0.setRequestStatus(""); - infraRequests0.getVnfParams(); - infraRequests0.setNetworkType(""); - assertEquals("h.", infraRequests0.getAction()); - assertEquals("", infraRequests0.getRequestId()); - } - - @Test(timeout = 4000) - public void test064() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setRequestType(""); - infraRequests0.getServiceInstanceId(); - infraRequests0.setVnfParams("`jECciBa[T7M"); - infraRequests0.setRequestBody("4ap}Bu0R,P"); - String string0 = infraRequests0.getRequestType(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test065() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - String string0 = infraRequests0.getAicCloudRegion(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test066() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("org.openecomp.mso.requestsdb.InfraRequests", "org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setRequestStatus(""); - infraRequests0.getResponseBody(); - String string0 = infraRequests0.getRequestAction(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test067() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", (String) null); - infraRequests0.setNetworkId("x^qIF~ru"); - infraRequests0.setServiceInstanceId("IL'5l;^7N^;>0"); - infraRequests0.setLastModifiedBy("h dET"); - infraRequests0.setVfModuleModelName("h dET"); - infraRequests0.setVnfType(""); - infraRequests0.setVfModuleId(""); - infraRequests0.setVfModuleName(""); - infraRequests0.setClientRequestId(""); - infraRequests0.setVnfId("W1Vd+"); - infraRequests0.getVnfName(); - infraRequests0.getNetworkType(); - infraRequests0.getServiceInstanceId(); - infraRequests0.setNetworkName("o-"); - assertNull(infraRequests0.getServiceType()); - } - - @Test(timeout = 4000) - public void test068() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("4E!AHGB", ""); - infraRequests0.getRequestStatus(); - String string0 = infraRequests0.getRequestId(); - assertEquals("4E!AHGB", string0); - - infraRequests0.setRequestScope("F"); - infraRequests0.getVfModuleId(); - infraRequests0.setAicNodeClli("zM4bS"); - infraRequests0.setServiceInstanceName("4E!AHGB"); - infraRequests0.setServiceType(""); - infraRequests0.getVnfType(); - infraRequests0.setAicNodeClli((String) null); - assertEquals("", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test069() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setServiceInstanceName("}<+55QA6'/xzr"); - infraRequests0.getModifyTime(); - infraRequests0.getProvStatus(); - infraRequests0.setVnfOutputs(""); - infraRequests0.getAction(); - infraRequests0.setAicCloudRegion("~W -^JP41(-Dg'.+|p$"); - assertNull(infraRequests0.getServiceType()); - } - - @Test(timeout = 4000) - public void test070() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setAaiServiceId("PJ60cl#^59FDR_>aLqF"); - infraRequests0.setLastModifiedBy("PJ60cl#^59FDR_>aLqF"); - infraRequests0.setCorrelator(""); - infraRequests0.getNetworkType(); - infraRequests0.setAaiServiceId("PJ60cl#^59FDR_>aLqF"); - infraRequests0.getAicNodeClli(); - String string0 = infraRequests0.getVnfType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test071() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(" ?)Ec.r]zDe6pa).i", "LZP&!xPsP /f"); - infraRequests0.setVnfType("5YWNFYfj=3.[9u?N"); - infraRequests0.setSource("LZP&!xPsP /f"); - infraRequests0.setVfModuleName("9"); - infraRequests0.getVnfId(); - Timestamp timestamp0 = new Timestamp(2083L); - LocalDateTime localDateTime0 = timestamp0.toLocalDateTime(); - Timestamp timestamp1 = Timestamp.valueOf(localDateTime0); - infraRequests0.setModifyTime(timestamp1); - infraRequests0.getCorrelator(); - infraRequests0.getEndTime(); - assertEquals(" ?)Ec.r]zDe6pa).i", infraRequests0.getRequestId()); - assertEquals("LZP&!xPsP /f", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test072() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVnfId(""); - String string0 = infraRequests0.getVnfId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test073() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setAaiServiceId(""); - String string0 = infraRequests0.getServiceType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test074() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVolumeGroupName(""); - String string0 = infraRequests0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test075() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVnfOutputs(""); - infraRequests0.setNetworkId("RU^6`fci#/"); - infraRequests0.getVolumeGroupId(); - infraRequests0.getModifyTime(); - infraRequests0.setVnfType((String) null); - String string0 = infraRequests0.getNetworkName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test076() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - Long long0 = new Long((-1725L)); - infraRequests0.setProgress(long0); - Long long1 = infraRequests0.getProgress(); - assertEquals((-1725L), (long)long1); - } - - @Test(timeout = 4000) - public void test077() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("\"}G", ""); - Timestamp timestamp0 = new Timestamp((-231L)); - infraRequests0.setModifyTime(timestamp0); - infraRequests0.getServiceInstanceId(); - infraRequests0.getVnfName(); - infraRequests0.setVfModuleName("org.openecomp.mso.requestsdb.InfraRequests"); - assertEquals("\"}G", infraRequests0.getRequestId()); - assertEquals("", infraRequests0.getAction()); - } - - @Test(timeout = 4000) - public void test078() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getAicNodeClli(); - infraRequests0.getAicNodeClli(); - String string0 = infraRequests0.getVnfOutputs(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test079() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - InfraRequests infraRequests1 = new InfraRequests(); - infraRequests1.getEndTime(); - infraRequests0.setStartTime((Timestamp) null); - infraRequests0.setTenantId("#X=o2!~:^_LF!mu%"); - assertNull(infraRequests0.getVfModuleModelName()); - } - - @Test(timeout = 4000) - public void test080() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getNetworkId(); - infraRequests0.setRequestAction((String) null); - infraRequests0.getSource(); - infraRequests0.setVnfOutputs("5K\u0002}.V3dm%yU_&r"); - assertNull(infraRequests0.getRequestScope()); - } - - @Test(timeout = 4000) - public void test081() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests((String) null, "org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.setVfModuleName((String) null); - infraRequests0.setServiceType("org.openecomp.mso.requestsdb.InfraRequests"); - infraRequests0.getServiceInstanceId(); - infraRequests0.getRequestId(); - infraRequests0.getVolumeGroupId(); - String string0 = infraRequests0.getNetworkType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test082() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVolumeGroupId("<LXzO"); - assertNull(infraRequests0.getRequestType()); - } - - @Test(timeout = 4000) - public void test083() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setRequestAction(""); - infraRequests0.setServiceInstanceId(""); - infraRequests0.setAicNodeClli(""); - assertNull(infraRequests0.getServiceType()); - } - - @Test(timeout = 4000) - public void test084() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "Z={83xlme_b)?zb8"); - infraRequests0.setSource(""); - infraRequests0.getStartTime(); - infraRequests0.getSource(); - infraRequests0.getModifyTime(); - assertEquals("Z={83xlme_b)?zb8", infraRequests0.getAction()); - assertEquals("", infraRequests0.getRequestId()); - } - - @Test(timeout = 4000) - public void test085() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVnfName("d(8}Oc 4|@w8hBNICH"); - infraRequests0.setRequestScope("d(8}Oc 4|@w8hBNICH"); - String string0 = infraRequests0.getAaiServiceId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test086() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setVfModuleId("bS&'!@{LdL0&"); - infraRequests0.setRequestStatus("bS&'!@{LdL0&"); - infraRequests0.setRequestAction((String) null); - infraRequests0.setVfModuleModelName("z"); - infraRequests0.getSource(); - infraRequests0.getServiceInstanceName(); - infraRequests0.getVnfName(); - String string0 = infraRequests0.getAction(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test087() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getRequestType(); - infraRequests0.setVnfOutputs((String) null); - infraRequests0.getCorrelator(); - infraRequests0.setCallBackUrl((String) null); - infraRequests0.setVnfParams(">'n"); - assertNull(infraRequests0.getVfModuleModelName()); - } - - @Test(timeout = 4000) - public void test088() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("I\"as", (String) null); - infraRequests0.getVolumeGroupName(); - infraRequests0.getRequestBody(); - infraRequests0.setTenantId((String) null); - infraRequests0.getResponseBody(); - // Undeclared exception! - try { - MockURI.create((String) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.net.URI$Parser", e); - } - } - - @Test(timeout = 4000) - public void test089() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", ""); - infraRequests0.setResponseBody(""); - infraRequests0.setRequestId(""); - infraRequests0.setNetworkId(""); - infraRequests0.getEndTime(); - infraRequests0.getVolumeGroupId(); - String string0 = infraRequests0.getStatusMessage(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test090() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests((String) null, "&6KF"); - infraRequests0.setRequestBody("&6KF"); - assertNull(infraRequests0.getRequestScope()); - } - - @Test(timeout = 4000) - public void test091() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("/WcV", "/WcV"); - infraRequests0.setVnfParams("\"w"); - String string0 = infraRequests0.getVnfParams(); - assertEquals("\"w", string0); - } - - @Test(timeout = 4000) - public void test092() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(">?ozK", ">?ozK"); - infraRequests0.setVnfOutputs(">?ozK"); - infraRequests0.setVnfId(""); - infraRequests0.getLastModifiedBy(); - infraRequests0.setAicCloudRegion((String) null); - infraRequests0.setProvStatus(">?ozK"); - infraRequests0.setStatusMessage((String) null); - String string0 = infraRequests0.getRequestScope(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test093() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setEndTime((Timestamp) null); - infraRequests0.setRequestType(""); - assertNull(infraRequests0.getProvStatus()); - } - - @Test(timeout = 4000) - public void test094() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "Z={83xlme_b)?zb8"); - infraRequests0.getStartTime(); - } - - @Test(timeout = 4000) - public void test095() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - String string0 = infraRequests0.getRequestStatus(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test096() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("gpXsJ>b/G", "gpXsJ>b/G"); - infraRequests0.setClientRequestId("gpXsJ>b/G"); - infraRequests0.setCallBackUrl(""); - infraRequests0.setNetworkType("TF3Cf[F..K"); - assertNull(infraRequests0.getAicNodeClli()); - } - - @Test(timeout = 4000) - public void test097() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getVfModuleName(); - infraRequests0.setAicCloudRegion((String) null); - String string0 = infraRequests0.getVnfName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test098() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.setNetworkName("K|it"); - infraRequests0.setAction("hc}j,"); - infraRequests0.getServiceInstanceId(); - infraRequests0.getCallBackUrl(); - String string0 = infraRequests0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test099() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - String string0 = infraRequests0.getServiceInstanceId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test100() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - infraRequests0.getProvStatus(); - String string0 = infraRequests0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test101() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests(); - String string0 = infraRequests0.getCallBackUrl(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test102() throws Throwable { - InfraRequests infraRequests0 = new InfraRequests("", "j28UDln3go*x"); - assertEquals("j28UDln3go*x", infraRequests0.getAction()); - - infraRequests0.setAction("X;{A n=y"); - infraRequests0.setTenantId(""); - assertEquals("", infraRequests0.getRequestId()); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTestscaffolding.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTestscaffolding.java deleted file mode 100644 index 9ab77f5ad2..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsESTestscaffolding.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Wed Dec 14 15:15:48 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -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; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; - -@EvoSuiteClassExclude -public class InfraRequestsESTestscaffolding { - - @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.requestsdb.InfraRequests"; - 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(InfraRequestsESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.requestsdb.InfraRequests" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(InfraRequestsESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.requestsdb.InfraRequests" - ); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTest.java deleted file mode 100644 index 7c1b39979a..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:15:27 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -import org.junit.Test; -import static org.junit.Assert.*; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.RequestsDatabase; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class RequestsDatabaseESTest extends RequestsDatabaseESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - RequestsDatabase requestsDatabase0 = (RequestsDatabase)PrivateAccess.callDefaultConstructorOfTheClassUnderTest(); - assertNotNull(requestsDatabase0); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTestscaffolding.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTestscaffolding.java deleted file mode 100644 index 6d5c31ff57..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseESTestscaffolding.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Wed Dec 14 15:15:27 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -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; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; - -@EvoSuiteClassExclude -public class RequestsDatabaseESTestscaffolding { - - @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.requestsdb.RequestsDatabase"; - 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(RequestsDatabaseESTestscaffolding.class.getClassLoader() , - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger", - "org.hibernate.engine.spi.Mapping", - "org.hibernate.criterion.Order", - "org.openecomp.mso.requestsdb.InfraRequests", - "org.openecomp.mso.requestsdb.HibernateUtil", - "com.att.eelf.configuration.SLF4jWrapper", - "org.hibernate.Query", - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.requestsdb.RequestsDatabase", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.hibernate.criterion.Criterion", - "org.openecomp.mso.requestsdb.InfraActiveRequests", - "org.openecomp.mso.logger.MessageEnum", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.hibernate.SessionFactory", - "com.att.eelf.configuration.EELFManager", - "com.att.eelf.i18n.EELFMsgs", - "org.openecomp.mso.entity.MsoRequest", - "com.att.eelf.configuration.EELFLogger$Level", - "org.hibernate.BasicQueryContract", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.requestsdb.MockRequestsDatabase", - "org.openecomp.mso.requestsdb.SiteStatus", - "org.openecomp.mso.logger.MsoLogger" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RequestsDatabaseESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.openecomp.mso.requestsdb.HibernateUtil", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.requestsdb.RequestsDatabase" - ); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTest.java deleted file mode 100644 index 75d7b19c33..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:16:15 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -import org.junit.Test; -import static org.junit.Assert.*; -import java.sql.Timestamp; -import java.time.Instant; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.mock.java.time.MockInstant; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.SiteStatus; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class SiteStatusESTest extends SiteStatusESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - siteStatus0.setSiteName("h8w;`)o;(SRi+0Q-"); - String string0 = siteStatus0.getSiteName(); - assertEquals("h8w;`)o;(SRi+0Q-", string0); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - siteStatus0.setSiteName(""); - String string0 = siteStatus0.getSiteName(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - Timestamp timestamp0 = new Timestamp((-1L)); - siteStatus0.setCreated(timestamp0); - Timestamp timestamp1 = siteStatus0.getCreated(); - assertSame(timestamp1, timestamp0); - } - - @Test(timeout = 4000) - public void test3() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - Instant instant0 = MockInstant.ofEpochSecond(5121L); - Timestamp timestamp0 = Timestamp.from(instant0); - siteStatus0.setCreated(timestamp0); - Timestamp timestamp1 = siteStatus0.getCreated(); - assertEquals(0, timestamp1.getNanos()); - } - - @Test(timeout = 4000) - public void test4() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - boolean boolean0 = siteStatus0.getStatus(); - assertFalse(boolean0); - } - - @Test(timeout = 4000) - public void test5() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - String string0 = siteStatus0.getSiteName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test6() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - siteStatus0.setStatus(true); - boolean boolean0 = siteStatus0.getStatus(); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test7() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - String string0 = siteStatus0.toString(); - assertEquals("SiteStatus{status=false, siteName='null', created=null}", string0); - } - - @Test(timeout = 4000) - public void test8() throws Throwable { - SiteStatus siteStatus0 = new SiteStatus(); - Timestamp timestamp0 = siteStatus0.getCreated(); - assertNull(timestamp0); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTestscaffolding.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTestscaffolding.java deleted file mode 100644 index 2d50450c60..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusESTestscaffolding.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Wed Dec 14 15:16:15 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -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; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; - -@EvoSuiteClassExclude -public class SiteStatusESTestscaffolding { - - @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.requestsdb.SiteStatus"; - 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(SiteStatusESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.logger.MessageEnum", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFManager", - "com.att.eelf.configuration.EELFLogger", - "com.att.eelf.i18n.EELFMsgs", - "org.openecomp.mso.entity.MsoRequest", - "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "com.att.eelf.configuration.SLF4jWrapper", - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.requestsdb.SiteStatus", - "org.openecomp.mso.logger.MsoLogger", - "org.openecomp.mso.logger.MsoLogger$ErrorCode" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(SiteStatusESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResourceManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.requestsdb.SiteStatus" - ); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTest.java deleted file mode 100644 index ea3238916e..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:14:31 GMT 2016 - */ - -package org.openecomp.mso.requestsdb.adapter; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.runtime.EvoAssertions.*; -import java.sql.Timestamp; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.adapter.TimestampXMLAdapter; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class TimestampXMLAdapterESTest extends TimestampXMLAdapterESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - TimestampXMLAdapter timestampXMLAdapter0 = new TimestampXMLAdapter(); - Long long0 = new Long((-3027L)); - Timestamp timestamp0 = timestampXMLAdapter0.unmarshal(long0); - Long long1 = timestampXMLAdapter0.marshal(timestamp0); - assertTrue(long1.equals((Object)long0)); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - TimestampXMLAdapter timestampXMLAdapter0 = new TimestampXMLAdapter(); - Long long0 = new Long(861L); - Timestamp timestamp0 = timestampXMLAdapter0.unmarshal(long0); - Long long1 = timestampXMLAdapter0.marshal(timestamp0); - assertEquals(861L, (long)long1); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - TimestampXMLAdapter timestampXMLAdapter0 = new TimestampXMLAdapter(); - try { - timestampXMLAdapter0.marshal((Timestamp) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.requestsdb.adapter.TimestampXMLAdapter", e); - } - } - - @Test(timeout = 4000) - public void test3() throws Throwable { - TimestampXMLAdapter timestampXMLAdapter0 = new TimestampXMLAdapter(); - Timestamp timestamp0 = timestampXMLAdapter0.unmarshal((Long) null); - Long long0 = timestampXMLAdapter0.marshal(timestamp0); - assertEquals(0L, (long)long0); - } - - @Test(timeout = 4000) - public void test4() throws Throwable { - TimestampXMLAdapter timestampXMLAdapter0 = new TimestampXMLAdapter(); - Long long0 = new Long(497L); - Timestamp timestamp0 = timestampXMLAdapter0.unmarshal(long0); - Long long1 = timestampXMLAdapter0.marshal(timestamp0); - assertEquals(497L, (long)long1); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTestscaffolding.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTestscaffolding.java deleted file mode 100644 index 0fdfcd2c07..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapterESTestscaffolding.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Wed Dec 14 15:14:31 GMT 2016 - */ - -package org.openecomp.mso.requestsdb.adapter; - -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; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; - -@EvoSuiteClassExclude -public class TimestampXMLAdapterESTestscaffolding { - - @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.requestsdb.adapter.TimestampXMLAdapter"; - 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(TimestampXMLAdapterESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.requestsdb.adapter.TimestampXMLAdapter" - ); - } - - private static void resetClasses() { - } -} diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index c4e1bbb50d..aabb2b89ad 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -20,12 +20,6 @@ </modules> <dependencies> - <dependency> - <groupId>org.evosuite</groupId> - <artifactId>evosuite-standalone-runtime</artifactId> - <version>${evosuiteVersion}</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> |