diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
5 files changed, 155 insertions, 21 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 6067982b99..a0a5a24e3f 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -348,7 +348,7 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> - <version>${spring.version}</version> + <version>4.3.14.RELEASE</version> </dependency> <dependency> <groupId>org.openecomp.sdc.sdc-tosca</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java index 109da17ea2..2443169151 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java @@ -51,7 +51,7 @@ public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter { MsoLogger.setLogContext(request.getRequestId(), null);
try {
session.beginTransaction();
- String queryString = "update InfraActiveRequests set ";
+ StringBuilder queryString = new StringBuilder("update InfraActiveRequests set ");
String statusMessage = null;
String responseBody = null;
RequestStatusType requestStatus = null;
@@ -67,72 +67,72 @@ public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter { String configurationId = null;
String configurationName = null;
if (request.getStatusMessage() != null) {
- queryString += "statusMessage = :statusMessage, ";
+ queryString.append("statusMessage = :statusMessage, ");
statusMessage = request.getStatusMessage();
}
if (request.getResponseBody() != null) {
- queryString += "responseBody = :responseBody, ";
+ queryString.append("responseBody = :responseBody, ");
responseBody = request.getResponseBody();
}
if (request.getRequestStatus() != null) {
- queryString += "requestStatus = :requestStatus, ";
+ queryString.append("requestStatus = :requestStatus, ");
requestStatus = request.getRequestStatus();
}
if (request.getProgress() != null) {
- queryString += "progress = :progress, ";
+ queryString.append("progress = :progress, ");
progress = request.getProgress();
}
if (request.getVnfOutputs() != null) {
- queryString += "vnfOutputs = :vnfOutputs, ";
+ queryString.append("vnfOutputs = :vnfOutputs, ");
vnfOutputs = request.getVnfOutputs();
}
if (request.getServiceInstanceId() != null) {
- queryString += "serviceInstanceId = :serviceInstanceId, ";
+ queryString.append("serviceInstanceId = :serviceInstanceId, ");
serviceInstanceId = request.getServiceInstanceId();
}
if (request.getNetworkId() != null) {
- queryString += "networkId = :networkId, ";
+ queryString.append("networkId = :networkId, ");
networkId = request.getNetworkId();
}
if (request.getVnfId() != null) {
- queryString += "vnfId = :vnfId, ";
+ queryString.append("vnfId = :vnfId, ");
vnfId = request.getVnfId();
}
if (request.getVfModuleId() != null) {
- queryString += "vfModuleId = :vfModuleId, ";
+ queryString.append("vfModuleId = :vfModuleId, ");
vfModuleId = request.getVfModuleId();
}
if (request.getVolumeGroupId() != null) {
- queryString += "volumeGroupId = :volumeGroupId, ";
+ queryString.append("volumeGroupId = :volumeGroupId, ");
volumeGroupId = request.getVolumeGroupId();
}
if (request.getServiceInstanceName() != null) {
- queryString += "serviceInstanceName = :serviceInstanceName, ";
+ queryString.append("serviceInstanceName = :serviceInstanceName, ");
serviceInstanceName = request.getServiceInstanceName();
}
if (request.getVfModuleName() != null) {
- queryString += "vfModuleName = :vfModuleName, ";
+ queryString.append("vfModuleName = :vfModuleName, ");
vfModuleName = request.getVfModuleName();
}
if (request.getConfigurationId() != null) {
- queryString += "configurationId = :configurationId, ";
+ queryString.append("configurationId = :configurationId, ");
configurationId = request.getConfigurationId();
}
if (request.getConfigurationName() != null) {
- queryString += "configurationName = :configurationName, ";
+ queryString.append("configurationName = :configurationName, ");
configurationName = request.getConfigurationName();
}
if (request.getRequestStatus() == RequestStatusType.COMPLETE
|| request.getRequestStatus() == RequestStatusType.FAILED) {
- queryString += "endTime = :endTime, ";
+ queryString.append("endTime = :endTime, ");
} else {
- queryString += "modifyTime = :modifyTime, ";
+ queryString.append("modifyTime = :modifyTime, ");
}
- queryString += "lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId";
+ queryString.append("lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId");
- LOGGER.debug("Executing update: " + queryString);
+ LOGGER.debug("Executing update: " + queryString.toString());
- Query query = session.createQuery(queryString);
+ Query query = session.createQuery(queryString.toString());
query.setParameter("requestId", request.getRequestId());
if (statusMessage != null) {
query.setParameter("statusMessage", statusMessage);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java new file mode 100644 index 0000000000..f0c6e7ec52 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java @@ -0,0 +1,33 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.client.adapter.requests.db.entities; + +import org.junit.Test; + +public class MsoRequestsDbExceptionBeanTest { + + @Test + public void test() { + MsoRequestsDbExceptionBean mrde=new MsoRequestsDbExceptionBean("msg"); + mrde.setMessage("msg"); + assert(mrde.getMessage().equals("msg")); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java new file mode 100644 index 0000000000..28b8cc991f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java @@ -0,0 +1,37 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.client.adapter.requests.db.entities; + +import org.junit.Test; + +public class MsoRequestsDbExceptionTest { + + @Test + public void test() { + Throwable e = new Throwable(); + MsoRequestsDbExceptionBean mredb=new MsoRequestsDbExceptionBean(); + MsoRequestsDbException mrde=new MsoRequestsDbException("msg",e); + MsoRequestsDbException mrd=new MsoRequestsDbException("msg"); + MsoRequestsDbException mrd1=new MsoRequestsDbException(e); + mrde.setFaultInfo(mredb); + assert(mrde.getFaultInfo().equals(mredb)); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java new file mode 100644 index 0000000000..d01c11948b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java @@ -0,0 +1,64 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.client.adapter.requests.db.entities; + +import org.junit.Test; + +public class UpdateInfraRequestTest { + + @Test + public void test() { + UpdateInfraRequest uir=new UpdateInfraRequest(); + RequestStatusType requestStatus=RequestStatusType.COMPLETE; + uir.setConfigurationId("configurationId"); + uir.setConfigurationName("configurationName"); + uir.setLastModifiedBy("lastModifiedBy"); + uir.setNetworkId("networkId"); + uir.setProgress("progress"); + uir.setRequestId("requestId"); + uir.setRequestStatus(requestStatus); + uir.setResponseBody("responseBody"); + uir.setServiceInstanceId("serviceInstanceId"); + uir.setServiceInstanceName("serviceInstanceName"); + uir.setStatusMessage("statusMessage"); + uir.setVfModuleId("vfModuleId"); + uir.setVfModuleName("vfModuleName"); + uir.setVnfId("vnfId"); + uir.setVnfOutputs("vnfOutputs"); + uir.setVolumeGroupId("volumeGroupId"); + assert(uir.getConfigurationId().equals("configurationId")); + assert(uir.getConfigurationName().equals("configurationName")); + assert(uir.getLastModifiedBy().equals("lastModifiedBy")); + assert(uir.getNetworkId().equals("networkId")); + assert(uir.getProgress().equals("progress")); + assert(uir.getRequestId().equals("requestId")); + assert(uir.getRequestStatus().equals(requestStatus)); + assert(uir.getResponseBody().equals("responseBody")); + assert(uir.getServiceInstanceId().equals("serviceInstanceId")); + assert(uir.getServiceInstanceName().equals("serviceInstanceName")); + assert(uir.getStatusMessage().equals("statusMessage")); + assert(uir.getVfModuleId().equals("vfModuleId")); + assert(uir.getVnfOutputs().equals("vnfOutputs")); + assert(uir.getVolumeGroupId().equals("volumeGroupId")); + assert(uir.getVfModuleName().equals("vfModuleName")); + assert(uir.getVnfId().equals("vnfId")); + } +} |