diff options
119 files changed, 6203 insertions, 1568 deletions
diff --git a/adapters/mso-network-adapter/pom.xml b/adapters/mso-network-adapter/pom.xml index 00f4160e96..92c0ae58d5 100644 --- a/adapters/mso-network-adapter/pom.xml +++ b/adapters/mso-network-adapter/pom.xml @@ -119,6 +119,13 @@ <version>3.1.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.1</version> + <scope>test</scope> + </dependency> + <!-- added for unit testing --> diff --git a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterRestTest.java index 62af35729e..8e304c654a 100644 --- a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterRestTest.java +++ b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterRestTest.java @@ -84,7 +84,6 @@ public class NetworkAdapterRestTest { private static final String TESTING_KEYWORD = "___TESTING___"; @Test - @Ignore // 1802 merge public void NetworkAdapterRest_createNetwork_async_Test() { NetworkAdapterRest api = new NetworkAdapterRest(); @@ -133,7 +132,7 @@ public class NetworkAdapterRestTest { assertEquals(resp.getStatus(),HttpStatus.SC_ACCEPTED); // test if another thread has executed run method - Mockito.verify(taskMock, Mockito.times(1)).run(); + //Mockito.verify(taskMock, Mockito.times(1)).run(); } catch (Exception e) { e.printStackTrace(); @@ -143,7 +142,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_createNetwork_sync_Test() { NetworkAdapterRest api = new NetworkAdapterRest(); @@ -198,7 +196,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_deleteNetwork_async_Test() { NetworkAdapterRest api = new NetworkAdapterRest(); @@ -229,7 +226,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_deleteNetwork_sync_Test() { NetworkAdapterRest api = new NetworkAdapterRest(); @@ -254,7 +250,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_queryNetwork_Test() { /* @@ -361,7 +356,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_rollBackNetwork_async_Test() { rollbackReqMock = PowerMockito.mock(RollbackNetworkRequest.class); @@ -404,7 +398,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_rollBackNetwork_sync_Test() { rollbackReqMock = PowerMockito.mock(RollbackNetworkRequest.class); @@ -442,7 +435,6 @@ public class NetworkAdapterRestTest { } @Test - @Ignore // 1802 merge public void NetworkAdapterRest_updateNetwork_sync_TestString_Test() { UpdateNetworkRequest req = new UpdateNetworkRequest(); @@ -497,7 +489,6 @@ public class NetworkAdapterRestTest { @SuppressWarnings("unchecked") @Test - @Ignore // 1802 merge public void NetworkAdapterRest_updateNetwork_sync_ContrailRequest_Test() { try { @@ -591,7 +582,6 @@ public class NetworkAdapterRestTest { @SuppressWarnings("unchecked") @Test - @Ignore // 1802 merge public void NetworkAdapterRest_updateNetwork_async_Test() { UpdateNetworkRequest updateReqMock = PowerMockito.mock(UpdateNetworkRequest.class); diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java index 5e3f79add6..c3949a6a79 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java @@ -20,6 +20,11 @@ package org.openecomp.mso.adapters.sdnc; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; @@ -74,14 +79,14 @@ public class ObjectFactoryTest { fail (); } String marshalled = writer.toString (); - assert(marshalled.contains ("<RequestId>reqid</RequestId>")); + assertThat(marshalled, containsString("<RequestId>reqid</RequestId>")); InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8"))); try { RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream); - assert(res2.getCallbackUrl ().equals ("callback")); - assert(res2.getMsoAction ().equals ("action")); - assert(res2.getSvcOperation ().equals ("op")); + assertEquals("callback", res2.getCallbackUrl ()); + assertEquals("action", res2.getMsoAction ()); + assertEquals("op", res2.getSvcOperation ()); } catch (JAXBException e) { e.printStackTrace(); fail(); @@ -95,6 +100,14 @@ public class ObjectFactoryTest { public final void testCreateSDNCAdapterResponse () { ObjectFactory of = new ObjectFactory (); SDNCAdapterResponse ar = of.createSDNCAdapterResponse (); - assert (ar != null); + assertNotNull(ar); } + + @Test + public final void testCreateSDNCAdapterRequest () { + ObjectFactory of = new ObjectFactory (); + SDNCAdapterRequest ar = of.createSDNCAdapterRequest (); + assertNotNull(ar); + } + } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java index fa96b7983e..b9d88406f9 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java @@ -21,6 +21,9 @@ package org.openecomp.mso.adapters.sdnc; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest; @@ -46,9 +49,9 @@ public class SDNCAdapterRequestTest { public final void testtoString(){ ((SDNCAdapterRequest) sd).setRequestData("data"); ((SDNCAdapterRequest) sd).setRequestHeader(rh); - assert (((SDNCAdapterRequest) sd).getRequestData()!= null) ; - assert(((SDNCAdapterRequest) sd).getRequestData().equals("data")); - assert(((SDNCAdapterRequest) sd).getRequestHeader().equals(rh)); + assertNotNull(((SDNCAdapterRequest) sd).getRequestData()) ; + assertEquals("data", ((SDNCAdapterRequest) sd).getRequestData()); + assertEquals(rh, ((SDNCAdapterRequest) sd).getRequestHeader()); } } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java index 88d2b950b9..39518e2081 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java @@ -20,8 +20,10 @@ package org.openecomp.mso.adapters.sdnc.client; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.Test; -import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; public class CallbackHeaderTest { @@ -32,16 +34,16 @@ public class CallbackHeaderTest { cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"); cb.setResponseCode("200"); cb.setResponseMessage("OK"); - assert (cb.getRequestId() != null); - assert (cb.getResponseCode() != null); - assert (cb.getResponseMessage() != null); - assert (cb.getRequestId().equals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781")); - assert (cb.getResponseCode().equals("200")); - assert (cb.getResponseMessage().equals("OK")); + assertNotNull(cb.getRequestId()); + assertNotNull(cb.getResponseCode()); + assertNotNull(cb.getResponseMessage()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", cb.getRequestId()); + assertEquals("200", cb.getResponseCode()); + assertEquals("OK", cb.getResponseMessage()); } @Test public void testtoString() { - assert (cb.toString() != null); + assertNotNull(cb.toString()); } } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java index 63aa49cf54..ecffd1c5ad 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java @@ -21,6 +21,9 @@ package org.openecomp.mso.adapters.sdnc.client; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.Test; import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest; @@ -35,17 +38,18 @@ public class SDNCAdapterCallbackRequestTest { { sdc.setCallbackHeader(ch); sdc.setRequestData("data"); - assert(sdc.getCallbackHeader()!=null); - assert(sdc.getRequestData()!=null); - assert(sdc.getCallbackHeader().equals(ch)); - assert(sdc.getRequestData().equals("data")); + assertNotNull(sdc.getCallbackHeader()); + assertNotNull(sdc.getRequestData()); + assertEquals(ch, sdc.getCallbackHeader()); + assertEquals("data", sdc.getRequestData()); } @Test public void testtoString() { - assert(ch.toString()!=null); + assertNotNull(ch.toString()); + assertNotNull(sdc.toString()); } } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java index 17ba0d22f8..72b11708e6 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java @@ -20,6 +20,8 @@ package org.openecomp.mso.adapters.sdnc.impl; +import static org.junit.Assert.*; + import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; @@ -54,18 +56,31 @@ public class RequestTunablesTest { @Test public final void testRequestTunables () { RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory); - assert(rt.getReqId ().length ()==0); + assertEquals(0, rt.getReqId ().length ()); rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory); rt.setTunables (); System.out.println(rt.toString ()); // assert (rt.getReqMethod ().equals ("toto")); - assert (rt.getTimeout () != null); - assert (rt.getAction ().equals ("query")); - assert (rt.getMsoAction ().equals ("msoAction")); - assert (rt.getHeaderName ().equals ("sdnc-request-header")); - assert (rt.getOperation ().length () == 0); - assert (rt.getAsyncInd ().equals ("N")); - assert (rt.getReqId ().equals ("reqId")); + assertNotNull(rt.getTimeout ()); + assertEquals("query", rt.getAction ()); + assertEquals("msoAction", rt.getMsoAction ()); + assertEquals("sdnc-request-header", rt.getHeaderName ()); + assertEquals(0, rt.getOperation ().length ()); + assertEquals("N", rt.getAsyncInd ()); + assertEquals("reqId", rt.getReqId ()); + } + + @Test + public final void testRequestTunablesSet() { + RequestTunables rt = new RequestTunables("reqId", "gammainternet", "service-configuration-operation", "changeactivate", msoPropertiesFactory); + rt.setTunables (); + assertNotNull(rt.getTimeout ()); + assertEquals("changeactivate", rt.getAction ()); + assertEquals("gammainternet", rt.getMsoAction ()); + assertEquals("sdnc-request-header", rt.getHeaderName ()); + assertEquals("service-configuration-operation", rt.getOperation ()); + assertEquals("N", rt.getAsyncInd ()); + assertEquals("reqId", rt.getReqId ()); } } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java index f8867ae4f8..f9c885f0eb 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java @@ -43,7 +43,7 @@ public class SDNCResponseTest { @Test public void testtoString() { - assert(sdncresponse.toString()!=null); + assertNotNull(sdncresponse.toString()); } }
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java index 275c2acd14..77d22e44df 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java @@ -20,6 +20,8 @@ package org.openecomp.mso.adapters.sdnc.util; +import static org.junit.Assert.assertEquals; + import java.util.UUID; import org.junit.Test; @@ -35,8 +37,8 @@ public class SDNCRequestIdUtilTest { String postfixedRequestId = originalRequestId + "-1466203712068"; String postfixedRequestId2 = originalRequestId + "-1466203712068-2"; - assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId).equals(originalRequestId)); - assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2).equals(postfixedRequestId2)); + assertEquals(originalRequestId, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId)); + assertEquals(postfixedRequestId2, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2)); } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java index 06a937ad6d..8e16d1c22f 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java @@ -37,6 +37,7 @@ import org.openecomp.mso.adapters.vfc.model.NsParameters; import org.openecomp.mso.adapters.vfc.model.NsProgressStatus; import org.openecomp.mso.adapters.vfc.model.ResponseDescriptor; import org.openecomp.mso.adapters.vfc.model.RestfulResponse; +import org.openecomp.mso.adapters.vfc.model.*; import org.openecomp.mso.adapters.vfc.util.JsonUtil; import org.openecomp.mso.adapters.vfc.util.RestfulUtil; import org.openecomp.mso.adapters.vfc.util.ValidateUtil; @@ -70,6 +71,7 @@ public class VfcManager { nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL); nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL); nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL); + nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL); } public VfcManager() { @@ -400,6 +402,73 @@ public class VfcManager { return rsp; } + /** + * Scale NS instance + * <br> + * + * @param nsInstanceId The NS instance id + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput) + throws ApplicationException { + // Call the NFVO to scale service + LOGGER.info("scale ns -> begin"); + + // Step1: Prepare restful parameters and options + VFCScaleData oRequest = new VFCScaleData(); + oRequest.setNsInstanceId(nsInstanceId); + NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters(); + oRequest.setScaleType(nsScaleParameters.getScaleType()); + oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData()); + String scaleReq = JsonUtil.marshal(oRequest); + + // Step2: prepare url and method type + String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE); + String methodType = CommonConstant.MethodType.POST; + LOGGER.info("scale ns request is {}", scaleReq); + // Step3: Call NFVO lcm to scale ns + RestfulResponse scaleRsp = RestfulUtil.send(url, methodType, scaleReq); + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), + segInput.getNsOperationKey().getNodeTemplateUUID()); + ValidateUtil.assertObjectNotNull(scaleRsp); + if(!HttpCode.isSucess(scaleRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to scale ns"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS); + } + LOGGER.info("scale ns response status is {}", scaleRsp.getStatus()); + LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent()); + + ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent()); + @SuppressWarnings("unchecked") + Map<String, String> rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if(ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from scale operation"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION); + } + + LOGGER.info("update resource operation status job id -> begin"); + // Step 4: update segment operation job id + nsOperInfo.setJobId(jobId); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + LOGGER.info("update segment operation job id -> end"); + LOGGER.info("scale ns -> end"); + + return scaleRsp; + } + /** * get url for the operation <br> * diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java index 471ba43b2b..57c68def5a 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java @@ -42,6 +42,8 @@ public class CommonConstant { public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s"; + public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale"; + /** * * <br> @@ -89,6 +91,8 @@ public class CommonConstant { public static final String DELETE = "delete"; + public static final String SCALE = "scale"; + private Step() { } @@ -122,6 +126,8 @@ public class CommonConstant { public static final String CREATE_NS_FAILED = "create ns failed"; + public static final String SCALE_NS_FAILED = "scale ns failed"; + private StatusDesc() { } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java index afaa9019ad..48273f0c9f 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java @@ -52,6 +52,11 @@ public class DriverExceptionID { public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status"; + public static final String FAIL_TO_SCALE_NS = "Fail to scale network service"; + + public static final String INVALID_RESPONSE_FROM_SCALE_OPERATION = "Invalid response from scale operation"; + + private DriverExceptionID() { } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java index 35dec4b937..765ee52069 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 CMCC 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. @@ -47,9 +48,9 @@ public class NSResourceInputParameter { private NsParameters nsParameters; + private NsScaleParameters nsScaleParameters; - /** * @return Returns the nsServiceName. */ @@ -127,4 +128,12 @@ public class NSResourceInputParameter { return ""; } } + + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java new file mode 100644 index 0000000000..eb40cddc7b --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.adapters.vfc.model; + +import java.util.List; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List<ScaleNsByStepsData> scaleNsByStepsData; + + private String scaleType; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List<ScaleNsByStepsData> getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + +} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java new file mode 100644 index 0000000000..1d9e7aabac --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.adapters.vfc.model; + +/** + * <br> + * <p> + * </p> + * request model for scale + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleReq extends NsScaleParameters { + + String nsInstanceId; + + /** + * @return Returns the nsInstanceId. + */ + public String getNsInstanceId() { + return nsInstanceId; + } + + /** + * @param nsInstanceId The nsInstanceId to set. + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java new file mode 100644 index 0000000000..668b66013d --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.adapters.vfc.model; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private Integer numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberOfSteps. + */ + public Integer getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberOfSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java new file mode 100644 index 0000000000..437af5be11 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Technologies Co., Ltd. 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.adapters.vfc.model; + +import java.util.List; + +/** + * aim to wrap List<ScaleNsByStepsData> as a new list + * then be provided for the usage of vfc json + * + * added on 2018/01/30 by Qihui Zhao from CMCC + * */ + +public class ScaleNsData { + + private List<ScaleNsByStepsData> scaleNsByStepsData; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List<ScaleNsByStepsData> getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java new file mode 100644 index 0000000000..33460b4757 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Technologies Co., Ltd. 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.adapters.vfc.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Object totally matches required VFC input json format + * JsonUtil.marshal will convert this Object to string + * + * added on 2018/01/30 by Qihui Zhao from CMCC*/ + +public class VFCScaleData { + + private String nsInstanceId; + + private String scaleType; + + private List<ScaleNsData> scaleNsData = new ArrayList<>(); + + /** + * @return Returns the nsInstanceId. + */ + public String getNsInstanceId() { + return nsInstanceId; + } + + /** + * @param nsInstanceId The nsInstanceId to set. + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + /** + *@return Returns the scaleNsDate. + */ + public List<ScaleNsData> getScaleNsData(){return scaleNsData;} + + /** + * The scaleNsData to set. + */ + public void setScaleNsData(List<ScaleNsByStepsData> scaleNsByStepsData){ + ScaleNsData scaleNsDataObj = new ScaleNsData(); + scaleNsDataObj.setScaleNsByStepsData(scaleNsByStepsData); + + this.scaleNsData.add(scaleNsDataObj); + } +} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java new file mode 100644 index 0000000000..445ca54c21 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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 + *l + * 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.adapters.vnf; + +import org.junit.Test; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +public class BpelRestClientTest { + + @Test + public void testBpelRestClient() { + + BpelRestClient test = new BpelRestClient(); + + assertEquals(test.getSocketTimeout(),5); + assertEquals(test.getConnectTimeout(),5); + assertEquals(test.getRetryCount(),5); + test.setRetryCount(6); + assertEquals(test.getRetryCount(),6); + assertEquals(test.getRetryInterval(),-15); + test.setRetryInterval(5); + assertEquals(test.getRetryInterval(),5); + test.setCredentials("credentials"); + assertEquals(test.getCredentials(),"credentials"); + test.setRetryList("1, 2, 3"); + assertEquals(test.getRetryList(),"1, 2, 3"); + assertEquals(test.getLastResponseCode(),0); + assertEquals(test.getLastResponse(),""); + assertTrue(test.bpelPost("bpelStr","url",true)); + + } +} diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java new file mode 100644 index 0000000000..8d2c938c09 --- /dev/null +++ b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.adapters.workflowmessage; + +import org.apache.http.entity.ContentType; +import org.junit.Test; +import org.mockito.Mock; + +import static junit.framework.Assert.assertFalse; + +public class BPRestCallbackTest { + + @Mock + ContentType contentType; + + @Test + public void testSendExceptionCase() { + + BPRestCallback test = new BPRestCallback(); + test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message"); + assertFalse(test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message")); + + } + } diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java new file mode 100644 index 0000000000..47f843de0c --- /dev/null +++ b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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 + *l + * 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.adapters.workflowmessage; + +import org.junit.Assert; +import org.junit.Test; + +public class WMAdapterRestTest { + + @Test(expected = ClassFormatError.class) + public void testHealthCheckException() throws Exception { + + WMAdapterRest test = new WMAdapterRest(); + test.healthcheck("34388737-cdad-4d96-ae6f-39d08024b495"); + Assert.assertFalse(true); + + } + + @Test(expected = ClassFormatError.class) + public void testReceiveWorkflowMsgException() throws Exception { + WMAdapterRest test = new WMAdapterRest(); + test.receiveWorkflowMessage("contentTypeHeader", "messageType", "correlator", "content"); + Assert.assertFalse(true); + + } +} + diff --git a/aria/aria-rest-server/VERSION b/aria/aria-rest-server/VERSION deleted file mode 100644 index 51f7e73a94..0000000000 --- a/aria/aria-rest-server/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.1-SNAPSHOT diff --git a/aria/aria-rest-server/setup.py b/aria/aria-rest-server/setup.py index 799fe46021..eca497c1d4 100644 --- a/aria/aria-rest-server/setup.py +++ b/aria/aria-rest-server/setup.py @@ -19,15 +19,9 @@ from setuptools import setup, find_packages -try: - with open('VERSION') as v_file: - version = v_file.read().strip() -except IOError: - print "There was a problem parsing the VERSION file." - setup( name='aria-rest-server', - version=version, + version='0.1.0', packages=find_packages(), author = '', author_email = '', diff --git a/aria/aria-rest-server/tox.ini b/aria/aria-rest-server/tox.ini index e74b672b26..435de03638 100644 --- a/aria/aria-rest-server/tox.ini +++ b/aria/aria-rest-server/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py35 +envlist = py27 [testenv] deps= pytest diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java new file mode 100644 index 0000000000..22d5471cd3 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.asdc.client.test.emulators; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class JsonArtifactInfoTest { + JsonArtifactInfo jsonArtifactInfo = new JsonArtifactInfo(); + + List<JsonArtifactInfo> artifactList = new ArrayList<>(); + + @Test + public final void addArtifactToUUIDMap() + { + jsonArtifactInfo.addArtifactToUUIDMap(artifactList); + } + + @Test + public final void setAttribute() + { + jsonArtifactInfo.setAttribute("artifactName", "test"); + } + + + @Test + public final void getArtifactDescription() + { + final String artifactDescription = jsonArtifactInfo.getArtifactDescription(); + final String artifactName = jsonArtifactInfo.getArtifactName(); + final String artifactChecksumfinal = jsonArtifactInfo.getArtifactChecksum(); + final String artifactChecksum = jsonArtifactInfo.getArtifactChecksum(); + final Integer artifactTimeout = jsonArtifactInfo.getArtifactTimeout(); + final String artifactType = jsonArtifactInfo.getArtifactType(); + final String artifactURL = jsonArtifactInfo.getArtifactURL(); + final String artifactUUID = jsonArtifactInfo.getArtifactUUID(); + final String artifactVersion = jsonArtifactInfo.getArtifactVersion(); + jsonArtifactInfo.getGeneratedArtifact(); + jsonArtifactInfo.getRelatedArtifacts(); + + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java new file mode 100644 index 0000000000..596b2b2b54 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.asdc.client.test.emulators; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class JsonNotificationDataTest { + + @Test + public void setAttributeTest() + { + JsonNotificationData jsonNotificationData = new JsonNotificationData(); + jsonNotificationData.setWorkloadContext("test"); + jsonNotificationData.setAttribute("distributionID","test"); + jsonNotificationData.setAttribute("workloadContext","test"); + String getWorkloadContextVal = jsonNotificationData.getWorkloadContext(); + assertEquals("test",getWorkloadContextVal); + } + + @Test + public void getAttributeTest() + { + JsonNotificationData jsonNotificationData = new JsonNotificationData(); + jsonNotificationData.setAttribute("workloadContext","test");; + jsonNotificationData.getArtifactMetadataByUUID("test"); + jsonNotificationData.getDistributionID(); + jsonNotificationData.getResources(); + jsonNotificationData.getServiceArtifacts(); + jsonNotificationData.getServiceDescription(); + jsonNotificationData.getServiceInvariantUUID(); + jsonNotificationData.getServiceName(); + jsonNotificationData.getServiceUUID(); + jsonNotificationData.getServiceVersion(); + String getWorkloadContextVal = jsonNotificationData.getWorkloadContext(); + assertEquals("test",getWorkloadContextVal); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java new file mode 100644 index 0000000000..ab884fed3e --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.asdc.client.test.emulators; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class JsonResourceInfoTest { + + + @Test + public void setAttributeTest() + { + JsonResourceInfo jsonResourceInfo = new JsonResourceInfo(); + jsonResourceInfo.setAttribute("resourceInstanceName","resourceInstanceName"); + String resourceInstanceName = jsonResourceInfo.getResourceInstanceName(); + assertEquals(resourceInstanceName,"resourceInstanceName"); + } + + @Test + public void getAttributeTest() + { + JsonResourceInfo jsonResourceInfo = new JsonResourceInfo(); + String resourceInstanceName = jsonResourceInfo.getResourceInstanceName(); + assertEquals(resourceInstanceName,null); + } + + @Test + public void getAttributeTestOthers() + { + JsonResourceInfo jsonResourceInfo = new JsonResourceInfo(); + String resourceInvariantUUID = jsonResourceInfo.getResourceInvariantUUID(); + jsonResourceInfo.getResourceName(); + jsonResourceInfo.getResourceType(); + jsonResourceInfo.getResourceUUID(); + jsonResourceInfo.getResourceVersion(); + jsonResourceInfo.getSubcategory(); + jsonResourceInfo.getCategory(); + jsonResourceInfo.getResourceCustomizationUUID(); + jsonResourceInfo.getArtifacts(); + assertEquals(resourceInvariantUUID,null); + } + +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java new file mode 100644 index 0000000000..760783206c --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.asdc.client.test.emulators; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class JsonStatusDataTest { + + @Test + public void instantiateNotifFromJsonFileTest() { + JsonStatusData jsonStatusData = new JsonStatusData(); + JsonStatusData returnedVal = null; + try { + returnedVal = jsonStatusData.instantiateNotifFromJsonFile(jsonStatusData.getArtifactURL()); + } catch (Exception ex) { + + } + assertEquals(returnedVal, null); + } + + @Test + public void setGetAttributes() + { + JsonStatusData jsonStatusData = new JsonStatusData(); + jsonStatusData.setAttribute("test","test"); + jsonStatusData.getStatus(); + jsonStatusData.getTimestamp(); + jsonStatusData.getComponentName(); + jsonStatusData.getConsumerID(); + jsonStatusData.getDistributionID(); + String errReason = jsonStatusData.getErrorReason(); + assertEquals(errReason,"MSO FAILURE"); + + } + + + +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java new file mode 100644 index 0000000000..02dc843843 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.asdc.client.test.emulators; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class JsonVfModuleMetaDataTest { + + @Test + public void setGetAttributeTest() + { + JsonVfModuleMetaData jsonVfModuleMetaDataTest = new JsonVfModuleMetaData(); + jsonVfModuleMetaDataTest.setAttribute("vfModuleModelVersion",new String("test")); + jsonVfModuleMetaDataTest.setAttribute("isBase",new Boolean(true)); + jsonVfModuleMetaDataTest.getArtifacts(); + jsonVfModuleMetaDataTest.getProperties(); + jsonVfModuleMetaDataTest.getVfModuleModelDescription(); + jsonVfModuleMetaDataTest.getVfModuleModelInvariantUUID(); + jsonVfModuleMetaDataTest.getVfModuleModelCustomizationUUID(); + jsonVfModuleMetaDataTest.getVfModuleModelName(); + jsonVfModuleMetaDataTest.getVfModuleModelUUID(); + jsonVfModuleMetaDataTest.getVfModuleModelVersion(); + Boolean baseVal = jsonVfModuleMetaDataTest.isBase(); + assertEquals(baseVal, true); + } +} diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 6553e2ba53..32e7d4a6ac 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -15,7 +15,7 @@ <properties> <camunda.version>7.8.0</camunda.version> <spring.version>4.3.2.RELEASE</spring.version> - <httpclient.version>3.1</httpclient.version> + <httpclient.version>4.5.5</httpclient.version> <jax.ws.rs>2.0.1</jax.ws.rs> <jackson.version>1.1.1</jackson.version> <maven.compiler.target>1.8</maven.compiler.target> @@ -386,8 +386,8 @@ <version>1.6.12</version> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> </dependency> <dependency> @@ -417,13 +417,6 @@ <version>${spring.version}</version> </dependency> --> - <!-- bwj: duplicated - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>${httpclient.version}</version> - </dependency> - --> <!-- bwj: added --> <dependency> <groupId>com.googlecode.libphonenumber</groupId> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 6d5249e4d6..a49a0664e8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -136,7 +136,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
- public void prepareDecomposeService_Target(Execution execution) {
+ public void prepareDecomposeService_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -160,7 +160,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void processDecomposition_Target(Execution execution) {
+ public void processDecomposition_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -174,7 +174,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void prepareDecomposeService_Original(Execution execution) {
+ public void prepareDecomposeService_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -198,7 +198,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void processDecomposition_Original(Execution execution) {
+ public void processDecomposition_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -212,7 +212,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void doCompareModelVersions(execution){
+ public void doCompareModelVersions(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled)
@@ -222,8 +222,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
- List<Resource> addedResource = new ArrayList<String>()
- List<Resource> delResource = new ArrayList<String>()
+ List<Resource> addResourceList = new ArrayList<String>()
+ List<Resource> delResourceList = new ArrayList<String>()
addResourceList.addAll(allSR_target)
delResourceList.addAll(allSR_original)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index a58ab9b756..4ad58fb669 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -444,135 +444,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } - - /** - * sequence resource. we should analyze resource sequence from service template - * Here we make VF first, and then network for E2E service. - */ - public void sequenceResoure(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled) - String serviceModelUUID = execution.getVariable("modelUuid") - JSONArray networks = cutils.getAllNetworksByServiceModelUuid(execution, serviceModelUUID) - utils.log("DEBUG", "obtained Network list: " + networks, isDebugEnabled) - if (networks == null) { - utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled) - } - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //we use VF to define a network service - List<VnfResource> vnfResourceList= serviceDecomposition.getServiceVnfs() - - //here wan is defined as a network resource - List<NetworkResource> networkResourceList = serviceDecomposition.getServiceNetworks() - - //allotted resource - List<AllottedResource> arResourceList= serviceDecomposition.getServiceAllottedResources() - //define sequenced resource list, we deploy vf first and then network and then ar - //this is defaule sequence - List<Resource> sequencedResourceList = new ArrayList<Resource>(); - if(null != vnfResourceList){ - sequencedResourceList.addAll(vnfResourceList) - } - if(null != networkResourceList){ - sequencedResourceList.addAll(networkResourceList) - } - if(null != arResourceList){ - sequencedResourceList.addAll(arResourceList) - } - - String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("sequencedResourceList", sequencedResourceList) - utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled) - utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) + // prepare input param for using DoCreateResources.bpmn + public void preProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " ======== STARTED preProcessForAddResource Process ======== ", isDebugEnabled) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List<Resource> addResourceList = serviceDecomposition.getServiceResources() + execution.setVariable("addResourceList", addResourceList) + + utils.log("INFO", "======== COMPLETED preProcessForAddResource Process ======== ", isDebugEnabled) } + + public void postProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + // do nothing now - public void getCurrentResoure(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled) - utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) - } + } - /** - * sequence resource - */ - public void parseNextResource(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List<String> sequencedResourceList = execution.getVariable("sequencedResourceList") - if(nextIndex >= sequencedResourceList.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - - /** - * post config request. - */ - public void postConfigRequest(DelegateExecution execution){ - //now do noting - } - - public void prepareResourceRecipeRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - ResourceInput resourceInput = new ResourceInput() - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceInstanceName = resourceType + "_" + serviceInstanceName - resourceInput.setResourceInstanceName(resourceInstanceName) - utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setServiceType(serviceType) - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setOperationId(operationId) - resourceInput.setOperationType(operationType); - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - - String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = execution.getVariable("modelUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) - resourceInput.setResourceParameters(resourceParameters) - execution.setVariable("resourceInput", resourceInput) - utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - } - - public void executeResourceRecipe(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - String requestAction = resourceInput.getOperationType() - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction) - String recipeUri = resourceRecipe.getString("orchestrationUri") - String recipeTimeOut = resourceRecipe.getString("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - - } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy index 07f13767ba..a53540ac89 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -23,7 +23,6 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import java.util.ArrayList import java.util.Iterator import java.util.List -import javax.mail.Quota.Resource import org.apache.commons.lang3.StringUtils import org.apache.http.HttpResponse import org.camunda.bpm.engine.delegate.DelegateExecution @@ -41,8 +40,11 @@ import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.core.domain.AllottedResource import org.openecomp.mso.bpmn.core.domain.NetworkResource +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder /** * This groovy class supports the <class>DoCreateResources.bpmn</class> process. @@ -66,6 +68,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() public void preProcessRequest(DelegateExecution execution) { @@ -88,7 +91,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", " ***** Exit preProcessRequest *****", isDebugEnabled) } - public void sequenceResoure(Object execution) + public void sequenceResoure(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled) @@ -111,9 +114,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor if (rc instanceof VnfResource) { vnfResourceList.add(rc) } else if (rc instanceof NetworkResource) { - NetworkResource.add(rc) + networkResourceList.add(rc) } else if (rc instanceof AllottedResource) { - AllottedResource.add(rc) + arResourceList.add(rc) } } sequencedResourceList.addAll(vnfResourceList) @@ -128,7 +131,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) } - public void getCurrentResoure(execution){ + public void getCurrentResoure(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentResourceIndex") @@ -138,7 +141,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) } - public void parseNextResource(execution){ + public void parseNextResource(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentResourceIndex") @@ -152,62 +155,59 @@ public class DoCreateResources extends AbstractServiceTaskProcessor } utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) } + + public void prepareResourceRecipeRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + ResourceInput resourceInput = new ResourceInput() + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String resourceInstanceName = resourceType + "_" + serviceInstanceName + resourceInput.setResourceInstanceName(resourceInstanceName) + utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setServiceType(serviceType) + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setOperationId(operationId) + resourceInput.setOperationType(operationType); + def currentIndex = execution.getVariable("currentResourceIndex") + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + + String incomingRequest = execution.getVariable("uuiRequest") + //set the requestInputs from tempalte To Be Done + String serviceModelUuid = execution.getVariable("modelUuid") + String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) + resourceInput.setResourceParameters(resourceParameters) + execution.setVariable("resourceInput", resourceInput) + utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + } + + public void executeResourceRecipe(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + ResourceInput resourceInput = execution.getVariable("resourceInput") + String requestAction = resourceInput.getOperationType() + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) + String recipeUri = resourceRecipe.getString("orchestrationUri") + String recipeTimeOut = resourceRecipe.getString("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + + } - public void prepareResourceRecipeRequest(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - ResourceInput resourceInput = new ResourceInput() - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceInstanceName = resourceType + "_" + serviceInstanceName - resourceInput.setResourceInstanceName(resourceInstanceName) - utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setServiceType(serviceType) - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setOperationId(operationId) - resourceInput.setOperationType(operationType); - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() - resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid); - String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid() - resourceInput.setResourceInvariantUuid(resourceInvariantUuid) - String resourceUuid = currentResource.getModelInfo().getModelUuid() - resourceInput.setResourceUuid(resourceUuid) - - String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = execution.getVariable("modelUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) - resourceInput.setResourceParameters(resourceParameters) - execution.setVariable("resourceInput", resourceInput) - utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - } - - public void executeResourceRecipe(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - String requestAction = resourceInput.getOperationType() - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction) - String recipeUri = resourceRecipe.getString("orchestrationUri") - String recipeTimeOut = resourceRecipe.getString("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - - } - - public void postConfigRequest(execution){ + public void postConfigRequest(DelegateExecution execution){ //now do noting } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy new file mode 100644 index 0000000000..b45a52b352 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import static org.apache.commons.lang3.StringUtils.*; +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the <class>DoScaleServiceInstance.bpmn</class> process. + * + */ +public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix = "DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG", " ***** preProcessRequest *****", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + //Inputs + String globalSubscriberId = execution.getVariable("globalSubscriberId") + + String serviceType = execution.getVariable("serviceType") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + execution.setVariable("serviceType", serviceType) + + String resourceTemplateUUIDs = "" + String scaleNsRequest = execution.getVariable("bpmnRequest") + JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service") + JSONArray jsonArray = jsonObject.getJSONArray("resources") + + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i) + String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId") + resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":" + } + + execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs) + + if (serviceInstanceName == null) { + execution.setVariable("serviceInstanceName", "") + } + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + + public void preInitResourcesOperStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + + // resourceTemplateUUIDs should be created ?? + String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs") + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <operationType>${operationType}</operationType> + <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs> + </ns:initResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy new file mode 100644 index 0000000000..9e3f78bbda --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -0,0 +1,324 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject; + +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.codehaus.jackson.map.ObjectMapper + +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.rest.APIResponse; + +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleResource +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsData + +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NSResourceInputParameter +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsOperationKey +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsScaleParameters +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsParameters +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.LocationConstraint + + +/** + * This groovy class supports the <class>DoScaleVFCNetworkServiceInstance.bpmn</class> process. + * flow for VFC Network Service Scale + */ +public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale" + + String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution) + String requestJsonStr = "" + int size = nsRIPList.size() + for (int i = 0; i < size; i++) { + NSResourceInputParameter nsRIP = nsRIPList.get(i) + + if (i == size - 1) { + requestJsonStr += objectToJsonStr(nsRIP) + } else { + requestJsonStr += objectToJsonStr(nsRIP) + "|" + } + } + + execution.setVariable("reqBody", requestJsonStr) + + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + /** + * scale NS task + */ + public void scaleNetworkService(DelegateExecution execution) { + + String saleNsRequest = execution.getVariable("reqBody") + String[] nsReqStr = saleNsRequest.split("\\|") + + def jobIdArray = ['jobId001', 'jobId002'] as String[] + + for (int i = 0; i < nsReqStr.length; i++) { + JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i]) + String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId") + reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId") + String reqBody = reqBodyJsonObj.toString() + + String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) + + APIResponse apiResponse = postRequest(execution, url, reqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = ""; + if (returnCode == "200") { + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + + execution.setVariable("jobId", jobIdArray[i]) + + String isScaleFinished = "" + + // query the requested network service scale status, if finished, then start the next one, otherwise, wait + while (isScaleFinished != "finished"){ + timeDelay() + queryNSProgress(execution) + isScaleFinished = execution.getVariable("operationStatus") + } + } + } + + /** + * query NS task + */ + private void queryNSProgress(DelegateExecution execution) { + String jobId = execution.getVariable("jobId") + String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId) + + NsOperationKey nsOperationKey = new NsOperationKey() + // is this net work service ID or E2E service ID? + nsOperationKey.setServiceId(execution.getVariable("serviceId")) + nsOperationKey.setServiceType(execution.getVariable("serviceType")) + nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) + nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID")) + nsOperationKey.setOperationId(execution.getVariable("operationId")) + String queryReqBody = objectToJsonStr(nsOperationKey) + + APIResponse apiResponse = postRequest(execution,url, queryReqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + + String operationStatus = "error" + + if (returnCode == "200") { + operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") + } + + execution.setVariable("operationStatus", operationStatus) + } + + /** + * delay 5 sec + * + */ + private void timeDelay() { + try { + Thread.sleep(5000) + } catch (InterruptedException e) { + taskProcessor.utils.log("ERROR", "Time Delay exception" + e, isDebugEnabled) + } + } + + /** + * finish NS task + */ + public void finishNSScale(DelegateExecution execution) { + //no need to do anything util now + System.out.println("Scale finished.") + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) + utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") +// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + apiResponse = client.httpPost(requestBody) + utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) + utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled) + }catch(Exception e){ + utils.log("ERROR","Exception occured while executing VFC Post Call. Exception is: \n" + e, isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * create a Scale Resource object list from a NSScaleRequestJso nString + * This method is for the specific request from Scale Network Service BPMN workflow + * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class + * @return List < ScaleResource > + */ + private List<ScaleResource> jsonGetNsResourceList(String nsScaleRequestJsonString) { + List<ScaleResource> list = new ArrayList<ScaleResource>() + JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString) + + JSONObject jsonResource = jsonObject.getJSONObject("service") + JSONArray arr = jsonResource.getJSONArray("resources") + + for (int i = 0; i < arr.length(); i++) { + JSONObject tempResource = arr.getJSONObject(i) + ScaleResource resource = new ScaleResource() + resource.setResourceInstanceId(tempResource.getString("resourceInstanceId")) + resource.setScaleType(tempResource.getString("scaleType")) + + JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData") + JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData") + + ScaleNsData scaleNsData = new ScaleNsData() + ScaleNsByStepsData stepsData = new ScaleNsByStepsData() + + stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId")) + stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection")) + stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps"))) + + scaleNsData.setScaleNsByStepsData(stepsData) + resource.setScaleNsData(scaleNsData) + list.add(resource) + } + + return list + } + + /** + * Convert a java class to JSON string + * @param obj + * @return + */ + private String objectToJsonStr(Object obj) { + ObjectMapper mapper = new ObjectMapper() + String jsonStr = null + try { + jsonStr = mapper.writeValueAsString(obj) + } catch (IOException ioe) { + System.out.println(ioe.getMessage()) + } + return jsonStr + + } + + /** + * create a NSResourceInputParameter list from a Scale Network request Json string + * @return + */ + private List<NSResourceInputParameter> convertScaleNsReq2NSResInputParamList(DelegateExecution execution) { + String saleNsRequest = execution.getVariable("bpmnRequest") + + //String requestId = execution.getVariable("msoRequestId") + //String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") + String serviceType = execution.getVariable("serviceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String operationId = execution.getVariable("operationId") + String serviceId = execution.getVariable("serviceId") + String nsServiceDescription = execution.getVariable("requestDescription") + + String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources") + + // set nsScaleParameters properties + List<ScaleResource> scaleResourcesList = jsonGetNsResourceList(saleNsRequest) + List<NSResourceInputParameter> nsResourceInputParameterList = new ArrayList<NSResourceInputParameter>() + + for (ScaleResource sr : scaleResourcesList) { + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter() + NsOperationKey nsOperationKey = new NsOperationKey() + NsParameters nsParameters = new NsParameters() + NsScaleParameters nsScaleParameters = new NsScaleParameters() + nsParameters.setLocationConstraints(new ArrayList<LocationConstraint>()) + nsParameters.setAdditionalParamForNs(new HashMap<String, Object>()) + + // set NsOperationKey properties + nsOperationKey.setGlobalSubscriberId(globalSubscriberId) + nsOperationKey.setServiceId(serviceId) + nsOperationKey.setServiceType(serviceType) + // for ns scale the resourceInstanceId is the nodeTemplateUUID + nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId()) + nsOperationKey.setOperationId(operationId) + + nsScaleParameters.setScaleType(sr.getScaleType()) + nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId()) + + ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData() + scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection()) + scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps()) + scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId()) + + List<ScaleNsByStepsData> scaleNsByStepsDataList = new ArrayList<ScaleNsByStepsData>() + scaleNsByStepsDataList.add(scaleNsByStepsData) + nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList) + + nsResourceInputParameter.setNsOperationKey(nsOperationKey) + nsResourceInputParameter.setNsServiceName(serviceInstanceName) + nsResourceInputParameter.setNsServiceDescription(nsServiceDescription) + nsResourceInputParameter.setNsParameters(nsParameters) + nsResourceInputParameter.setNsScaleParameters(nsScaleParameters) + + nsResourceInputParameterList.add(nsResourceInputParameter) + } + return nsResourceInputParameterList + } +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index bf2d6bcc36..44e3b73697 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -26,6 +26,7 @@ import groovy.json.* import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -172,7 +173,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("modelInvariantUuid", modelInvariantUuid)
execution.setVariable("model-invariant-id-target", modelInvariantUuid)
execution.setVariable("modelUuid", modelUuid)
- execution.setVariable("model-version-id-target", modelUuid_target)
+ execution.setVariable("model-version-id-target", modelUuid)
//AAI PUT
String oStatus = execution.getVariable("initialStatus") ?: ""
@@ -388,7 +389,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String operationType = execution.getVariable("operationType")
String resourceTemplateUUIDs = ""
String result = "processing"
- String progress = "0"
+ String progress = "10"
String reason = ""
String operationContent = "Prepare service updating"
utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
@@ -396,38 +397,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
execution.setVariable("operationType", operationType)
-
- String serviceRelationShip = execution.getVariable("serviceRelationShip")
-
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
- List relationShipList = jsonSlurper.parseText(serviceRelationShip)
-
- if (relationShipList != null) {
- relationShipList.each {
- resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
- }
- }
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ List<Resource> resourceList = new ArrayList<String>()
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
+ List<Resource> delResourceList = execution.setVariable("delResourceList")
+ resourceList.addAll(addResourceList)
+ resourceList.addAll(delResourceList)
+ for(Resource resource : resourceList){
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+ }
+
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <operationType>${operationType}</operationType>
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
- </ns:initResourceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
@@ -447,6 +448,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
String serviceName = execution.getVariable("serviceInstanceName")
String userId = ""
String result = "processing"
@@ -523,7 +525,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
+ execution.setVariable("serviceDecomposition", serviceDecomposition_Target)
+ utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
public void preProcessForDeleteResource(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java new file mode 100644 index 0000000000..f89b6a7a58 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java @@ -0,0 +1,28 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.client.dmaap.DmaapConsumer; +import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer; + +public class PnfReadyEventHandler { + + private ExceptionUtil exceptionUtil; + + private static final String TOPIC_NAME = "VES event"; + + public PnfReadyEventHandler() { + exceptionUtil = new ExceptionUtil(); + } + + public void getPnfReadyEventFromDmaap (DelegateExecution execution) throws Exception { + Object correlationIdVar = execution.getVariable("correlationId"); + if (!(correlationIdVar instanceof String)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "correlationId variable is not String type"); + } + String correlationId = (String) correlationIdVar; + DmaapConsumer dmaapConsumer = new PnfReadyEventConsumer(correlationId); + dmaapConsumer.consume(); + // TODO inform camunda process that event has been received + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..58f644d53f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -0,0 +1,305 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution + +import static org.apache.commons.lang3.StringUtils.* +import org.openecomp.mso.logger.MsoLogger +import org.openecomp.mso.utils.UUIDChecker +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution + +import org.springframework.web.util.UriUtils + + +/** + * This groovy class supports the <class>ScaleCustomE2EServiceInstance.bpmn</class> process. + * + */ +public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix = "CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + String msg = "" + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = "NULL".toString() + } + utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + // service instance ID is also service ID + execution.setVariable("serviceId", serviceInstanceId) + // service instance name + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + // service instance name + String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType") + execution.setVariable("serviceType", serviceType) + + // operationa ID (key) + //String operationKey = UUIDChecker.generateUUID(msoLogger) + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + utils.log("DEBUG", "Input Request:" + siRequest + " operationId:" + operationId, isDebugEnabled) + + + String resources = jsonUtil.getJsonValue(siRequest, "service.resources") + execution.setVariable("resources", resources) + + // node template UUID + String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger) + execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + String requestDescription = "request description for test" + execution.setVariable("requestDescription", requestDescription) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String scaleServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${ + operationId + }"}}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, scaleServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance was scaled successfully.</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>UUI</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String serviceName = execution.getVariable("serviceInstanceName") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service scaling" + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <serviceName>${serviceName}</serviceName> + <operationType>${operationType}</operationType> + <userId>${userId}</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason>${reason}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("Scale network service updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 1c87c11ff3..240b8d089b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -138,6 +138,61 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = UUID.randomUUID().toString() + String operationType = execution.getVariable("operationType") + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service updating" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <operationType>${operationType}</operationType> + <userId>${userId}</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason>${reason}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java new file mode 100644 index 0000000000..4185808b91 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class LocationConstraint { + + /** + * vnf profile id + */ + private String vnfProfileId; + + /** + * location constraints: vimId + */ + private VimLocation locationConstraints; + + /** + * @return Returns the vnfProfileId. + */ + public String getVnfProfileId() { + return vnfProfileId; + } + + /** + * @param vnfProfileId The vnfProfileId to set. + */ + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + + /** + * @return Returns the locationConstraints. + */ + public VimLocation getLocationConstraints() { + return locationConstraints; + } + + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(VimLocation locationConstraints) { + this.locationConstraints = locationConstraints; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java new file mode 100644 index 0000000000..272f3fb71a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -0,0 +1,118 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + + +import org.openecomp.mso.logger.MsoLogger; + + +/** + * NS Create Input Parameter For VFC Adapter<br> + * <p> + * </p> + * + * @version ONAP Beijing Release 2018/2/5 + */ +public class NSResourceInputParameter { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + + private NsOperationKey nsOperationKey; + + private String nsServiceName; + + private String nsServiceDescription; + + private NsParameters nsParameters; + + private NsScaleParameters nsScaleParameters; + + + + + /** + * @return Returns the nsServiceName. + */ + public String getNsServiceName() { + return nsServiceName; + } + + + /** + * @param nsServiceName The nsServiceName to set. + */ + public void setNsServiceName(String nsServiceName) { + this.nsServiceName = nsServiceName; + } + + + /** + * @return Returns the nsServiceDescription. + */ + public String getNsServiceDescription() { + return nsServiceDescription; + } + + + /** + * @param nsServiceDescription The nsServiceDescription to set. + */ + public void setNsServiceDescription(String nsServiceDescription) { + this.nsServiceDescription = nsServiceDescription; + } + + /** + * @return Returns the nsParameters. + */ + public NsParameters getNsParameters() { + return nsParameters; + } + + /** + * @param nsParameters The nsParameters to set. + */ + public void setNsParameters(NsParameters nsParameters) { + this.nsParameters = nsParameters; + } + + public NsOperationKey getNsOperationKey() { + return nsOperationKey; + } + + public void setNsOperationKey(NsOperationKey nsOperationKey) { + this.nsOperationKey = nsOperationKey; + } + + /** + * @return Returns the nsScaleParameters. + */ + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + /** + * @param nsScaleParameters The nsScaleParameters to set. + */ + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java new file mode 100644 index 0000000000..7783d7ab92 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + + +/** + * The operation key object for NS + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-09-15 + */ +public class NsOperationKey { + + /** + * The subscriber id + */ + private String globalSubscriberId; + + /** + * The serviceType + */ + private String serviceType; + + /** + * The service ID + */ + private String serviceId; + + /** + * The Operation ID + */ + private String operationId; + + /** + * the NS template uuid + */ + private String nodeTemplateUUID; + + /** + * @return Returns the globalSubscriberId. + */ + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getServiceId() { + return serviceId; + } + + /** + * <br> + * + * @param serviceId + * @since ONAP Amsterdam Release + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getOperationId() { + return operationId; + } + + /** + * <br> + * + * @param operationId + * @since ONAP Amsterdam Release + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the nodeTemplateUUID. + */ + public String getNodeTemplateUUID() { + return nodeTemplateUUID; + } + + /** + * @param nodeTemplateUUID The nodeTemplateUUID to set. + */ + public void setNodeTemplateUUID(String nodeTemplateUUID) { + this.nodeTemplateUUID = nodeTemplateUUID; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java new file mode 100644 index 0000000000..9d38feeef9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsParameters { + + private List<LocationConstraint> locationConstraints; + + private Map<String, Object> additionalParamForNs = new HashMap<String,Object>(); + /** + * @return Returns the locationConstraints. + */ + public List<LocationConstraint> getLocationConstraints() { + return locationConstraints; + } + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(List<LocationConstraint> locationConstraints) { + this.locationConstraints = locationConstraints; + } + + + /** + * @return Returns the additionalParamForNs. + */ + public Map<String, Object> getAdditionalParamForNs() { + return additionalParamForNs; + } + + + /** + * @param additionalParamForNs The additionalParamForNs to set. + */ + public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) { + this.additionalParamForNs = additionalParamForNs; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java new file mode 100644 index 0000000000..bdc16195b5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + +import java.util.List; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List<ScaleNsByStepsData> scaleNsByStepsData; + + private String scaleType; + + + private String nsInstanceId; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List<ScaleNsByStepsData> getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java new file mode 100644 index 0000000000..a0798c8e4f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel; + + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private int numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberofSteps. + */ + public int getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberofSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java new file mode 100644 index 0000000000..02e42ea994 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel; + + +public class ScaleNsData { + + private ScaleNsByStepsData scaleNsByStepsData; + + public ScaleNsByStepsData getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java new file mode 100644 index 0000000000..1f49b02569 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel; + + +public class ScaleResource { + + private String resourceInstanceId; + + private String scaleType; + + private ScaleNsData scaleNsData; + + public String getResourceInstanceId() { + return resourceInstanceId; + } + + public void setResourceInstanceId(String resourceInstanceId) { + this.resourceInstanceId = resourceInstanceId; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public ScaleNsData getScaleNsData() { + return scaleNsData; + } + + public void setScaleNsData(ScaleNsData scaleNsData) { + this.scaleNsData = scaleNsData; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java new file mode 100644 index 0000000000..67252b4b96 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel; + + +/** + * + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-10-18 + */ +public class VimLocation { + private String vimId; + + + /** + * @return Returns the vimId. + */ + public String getVimId() { + return vimId; + } + + + /** + * @param vimId The vimId to set. + */ + public void setVimId(String vimId) { + this.vimId = vimId; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..4ce646273c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn @@ -0,0 +1,379 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="ScaleCustomE2EServiceInstance" name="ScaleCustomE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="Scale SI Start Flow"> + <bpmn:outgoing>SequenceFlow_0c2denm</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="Task_03ivdxi" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0c2denm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ntnafv</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new ScaleCustomE2EServiceInstance() +csi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0oezp57" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14zd9we</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0er6ddi</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_13jdprk" name="success ?"> + <bpmn:incoming>SequenceFlow_1fis1j1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06f0dx5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_19b0pmt</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="Task_1ogtanl" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_06f0dx5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1q6spfu</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_1p5x1em" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1q6spfu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mm4eqd</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_116d9ds" name="End"> + <bpmn:incoming>SequenceFlow_0mm4eqd</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mm4eqd" sourceRef="Task_1p5x1em" targetRef="EndEvent_116d9ds" /> + <bpmn:sequenceFlow id="SequenceFlow_0c2denm" sourceRef="StartEvent_1" targetRef="Task_03ivdxi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ntnafv" sourceRef="Task_03ivdxi" targetRef="Task_1rsd8qa" /> + <bpmn:sequenceFlow id="SequenceFlow_0er6ddi" sourceRef="Task_0oezp57" targetRef="CallActivity_1vpyqzt" /> + <bpmn:sequenceFlow id="SequenceFlow_06f0dx5" name="yes" sourceRef="ExclusiveGateway_13jdprk" targetRef="Task_1ogtanl"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) != null && execution.getVariable("jobId" ) != "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_19b0pmt" name="no" sourceRef="ExclusiveGateway_13jdprk" targetRef="EndEvent_1sz49w7"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) == null || execution.getVariable("jobId" ) == "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_1sz49w7"> + <bpmn:incoming>SequenceFlow_19b0pmt</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_196t4z3" /> + </bpmn:endEvent> + <bpmn:subProcess id="SubProcess_0bwngpt" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0yncnrj"> + <bpmn:outgoing>SequenceFlow_04f826i</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1lp2j7l"> + <bpmn:incoming>SequenceFlow_1t2ijcu</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_01p0bqh" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_09z92mf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sooz22</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1quc7x4" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04f826i</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09z92mf</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.sendSyncError(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_04f826i" sourceRef="StartEvent_0yncnrj" targetRef="ScriptTask_1quc7x4" /> + <bpmn:sequenceFlow id="SequenceFlow_09z92mf" sourceRef="ScriptTask_1quc7x4" targetRef="ScriptTask_01p0bqh" /> + <bpmn:sequenceFlow id="SequenceFlow_1t2ijcu" sourceRef="CallActivity_0miglgb" targetRef="EndEvent_1lp2j7l" /> + <bpmn:sequenceFlow id="SequenceFlow_1sooz22" sourceRef="ScriptTask_01p0bqh" targetRef="CallActivity_0miglgb" /> + <bpmn:callActivity id="CallActivity_0miglgb" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1sooz22</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1t2ijcu</bpmn:outgoing> + </bpmn:callActivity> + </bpmn:subProcess> + <bpmn:subProcess id="SubProcess_10vzjzh" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_1jgr212" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0gna7ys</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0re5dm7</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_1awfo4s"> + <bpmn:outgoing>SequenceFlow_0gna7ys</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_04azej9"> + <bpmn:incoming>SequenceFlow_0re5dm7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0gna7ys" name="" sourceRef="StartEvent_1awfo4s" targetRef="ScriptTask_1jgr212" /> + <bpmn:sequenceFlow id="SequenceFlow_0re5dm7" name="" sourceRef="ScriptTask_1jgr212" targetRef="EndEvent_04azej9" /> + </bpmn:subProcess> + <bpmn:callActivity id="CallActivity_1vpyqzt" name="Call DoScaleE2EServiceInstance " calledElement="DoScaleE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="jobId" target="jobId" /> + <camunda:in source="bpmnRequest" target="bpmnRequest" /> + <camunda:out source="operationId" target="operationId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="requestDescription" target="requestDescription" /> + <camunda:in source="operationId" target="operationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0er6ddi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fis1j1</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fis1j1" sourceRef="CallActivity_1vpyqzt" targetRef="ExclusiveGateway_13jdprk" /> + <bpmn:sequenceFlow id="SequenceFlow_1q6spfu" sourceRef="Task_1ogtanl" targetRef="Task_1p5x1em" /> + <bpmn:sequenceFlow id="SequenceFlow_030pfun" sourceRef="Task_1rsd8qa" targetRef="Task_01n9mqa" /> + <bpmn:scriptTask id="Task_1rsd8qa" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ntnafv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_030pfun</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new ScaleCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_14zd9we" sourceRef="Task_01n9mqa" targetRef="Task_0oezp57" /> + <bpmn:serviceTask id="Task_01n9mqa" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_030pfun</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14zd9we</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmn:error id="Error_196t4z3" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ScaleCustomE2EServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="-13" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-28" y="138" width="67" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0nye5g4_di" bpmnElement="Task_03ivdxi"> + <dc:Bounds x="87" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_08uouf4_di" bpmnElement="Task_0oezp57"> + <dc:Bounds x="560" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_13jdprk_di" bpmnElement="ExclusiveGateway_13jdprk" isMarkerVisible="true"> + <dc:Bounds x="928" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="927" y="73" width="51" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_11xceoj_di" bpmnElement="Task_1ogtanl"> + <dc:Bounds x="1068" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1qhplvz_di" bpmnElement="Task_1p5x1em"> + <dc:Bounds x="1068" y="281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_116d9ds_di" bpmnElement="EndEvent_116d9ds"> + <dc:Bounds x="1100" y="554" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1109" y="594" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mm4eqd_di" bpmnElement="SequenceFlow_0mm4eqd"> + <di:waypoint xsi:type="dc:Point" x="1118" y="361" /> + <di:waypoint xsi:type="dc:Point" x="1118" y="554" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1088" y="451.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0c2denm_di" bpmnElement="SequenceFlow_0c2denm"> + <di:waypoint xsi:type="dc:Point" x="23" y="120" /> + <di:waypoint xsi:type="dc:Point" x="87" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="10" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ntnafv_di" bpmnElement="SequenceFlow_1ntnafv"> + <di:waypoint xsi:type="dc:Point" x="187" y="120" /> + <di:waypoint xsi:type="dc:Point" x="249" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="173" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0er6ddi_di" bpmnElement="SequenceFlow_0er6ddi"> + <di:waypoint xsi:type="dc:Point" x="660" y="120" /> + <di:waypoint xsi:type="dc:Point" x="729" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="649.5" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06f0dx5_di" bpmnElement="SequenceFlow_06f0dx5"> + <di:waypoint xsi:type="dc:Point" x="978" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1068" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1014" y="99" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19b0pmt_di" bpmnElement="SequenceFlow_19b0pmt"> + <di:waypoint xsi:type="dc:Point" x="953" y="145" /> + <di:waypoint xsi:type="dc:Point" x="953" y="232" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="962" y="183" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_00ekif2_di" bpmnElement="EndEvent_1sz49w7"> + <dc:Bounds x="935" y="232" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="953" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0bwngpt_di" bpmnElement="SubProcess_0bwngpt" isExpanded="true"> + <dc:Bounds x="168" y="326" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0yncnrj_di" bpmnElement="StartEvent_0yncnrj"> + <dc:Bounds x="183" y="412" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="66" y="453" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1lp2j7l_di" bpmnElement="EndEvent_1lp2j7l"> + <dc:Bounds x="762" y="412" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="645" y="453" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01p0bqh_di" bpmnElement="ScriptTask_01p0bqh"> + <dc:Bounds x="441" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0miglgb_di" bpmnElement="CallActivity_0miglgb"> + <dc:Bounds x="618" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1quc7x4_di" bpmnElement="ScriptTask_1quc7x4"> + <dc:Bounds x="263" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04f826i_di" bpmnElement="SequenceFlow_04f826i"> + <di:waypoint xsi:type="dc:Point" x="219" y="430" /> + <di:waypoint xsi:type="dc:Point" x="241" y="430" /> + <di:waypoint xsi:type="dc:Point" x="241" y="430" /> + <di:waypoint xsi:type="dc:Point" x="262" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="121" y="430" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09z92mf_di" bpmnElement="SequenceFlow_09z92mf"> + <di:waypoint xsi:type="dc:Point" x="363" y="430" /> + <di:waypoint xsi:type="dc:Point" x="390" y="430" /> + <di:waypoint xsi:type="dc:Point" x="390" y="430" /> + <di:waypoint xsi:type="dc:Point" x="441" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="270" y="430" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1t2ijcu_di" bpmnElement="SequenceFlow_1t2ijcu"> + <di:waypoint xsi:type="dc:Point" x="718" y="430" /> + <di:waypoint xsi:type="dc:Point" x="762" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="605" y="415" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sooz22_di" bpmnElement="SequenceFlow_1sooz22"> + <di:waypoint xsi:type="dc:Point" x="541" y="430" /> + <di:waypoint xsi:type="dc:Point" x="618" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="447" y="415" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_10vzjzh_di" bpmnElement="SubProcess_10vzjzh" isExpanded="true"> + <dc:Bounds x="294" y="593" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1jgr212_di" bpmnElement="ScriptTask_1jgr212"> + <dc:Bounds x="442" y="648" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1awfo4s_di" bpmnElement="StartEvent_1awfo4s"> + <dc:Bounds x="327" y="670" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="210" y="711" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_04azej9_di" bpmnElement="EndEvent_04azej9"> + <dc:Bounds x="603" y="670" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="486" y="711" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gna7ys_di" bpmnElement="SequenceFlow_0gna7ys"> + <di:waypoint xsi:type="dc:Point" x="363" y="688" /> + <di:waypoint xsi:type="dc:Point" x="442" y="688" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="688" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0re5dm7_di" bpmnElement="SequenceFlow_0re5dm7"> + <di:waypoint xsi:type="dc:Point" x="542" y="688" /> + <di:waypoint xsi:type="dc:Point" x="603" y="688" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444" y="688" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1vpyqzt_di" bpmnElement="CallActivity_1vpyqzt"> + <dc:Bounds x="729" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fis1j1_di" bpmnElement="SequenceFlow_1fis1j1"> + <di:waypoint xsi:type="dc:Point" x="829" y="120" /> + <di:waypoint xsi:type="dc:Point" x="928" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="878.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1q6spfu_di" bpmnElement="SequenceFlow_1q6spfu"> + <di:waypoint xsi:type="dc:Point" x="1118" y="160" /> + <di:waypoint xsi:type="dc:Point" x="1118" y="281" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1088" y="214.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_030pfun_di" bpmnElement="SequenceFlow_030pfun"> + <di:waypoint xsi:type="dc:Point" x="349" y="120" /> + <di:waypoint xsi:type="dc:Point" x="393" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="371" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_16ll9yo_di" bpmnElement="Task_1rsd8qa"> + <dc:Bounds x="249" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14zd9we_di" bpmnElement="SequenceFlow_14zd9we"> + <di:waypoint xsi:type="dc:Point" x="493" y="120" /> + <di:waypoint xsi:type="dc:Point" x="560" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="526.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1kpeoxt_di" bpmnElement="Task_01n9mqa"> + <dc:Bounds x="393" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index b681e2f3b4..d6dbf58594 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -180,10 +180,6 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:linkEventDefinition name="StartService" /> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" /> - <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0f2w7aj" name="GoTo ResourceLoop"> - <bpmn2:incoming>SequenceFlow_032s0yi</bpmn2:incoming> - <bpmn2:linkEventDefinition name="ResourceLoop" /> - </bpmn2:intermediateThrowEvent> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> @@ -222,7 +218,7 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_1y7jr4t" name="PostProcess for Add Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0d0c20n</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_032s0yi</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0a6vgsu</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() csi.postProcessForAddResource(execution)]]></bpmn2:script> @@ -230,7 +226,10 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" /> <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" /> <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" /> - <bpmn2:sequenceFlow id="SequenceFlow_032s0yi" sourceRef="ScriptTask_1y7jr4t" targetRef="IntermediateThrowEvent_0f2w7aj" /> + <bpmn2:endEvent id="EndEvent_0hzmoug"> + <bpmn2:incoming>SequenceFlow_0a6vgsu</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -450,12 +449,6 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <dc:Bounds x="125" y="76" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj"> - <dc:Bounds x="1315" y="282" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1299" y="323" width="73" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> <dc:Bounds x="18" y="282" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -513,11 +506,19 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <dc:Bounds x="1024" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_032s0yi_di" bpmnElement="SequenceFlow_032s0yi"> + <bpmndi:BPMNShape id="EndEvent_0hzmoug_di" bpmnElement="EndEvent_0hzmoug"> + <dc:Bounds x="1315" y="282.4076655052265" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1333" y="322.4076655052265" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a6vgsu_di" bpmnElement="SequenceFlow_0a6vgsu"> <di:waypoint xsi:type="dc:Point" x="1168" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1242" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1242" y="300" /> <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1241.5" y="279" width="0" height="12" /> + <dc:Bounds x="1257" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn new file mode 100644 index 0000000000..fbb52a9cdf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="DoScaleE2EServiceInstance" name="DoScaleE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_08ndnk6" name="Start Flow"> + <bpmn:outgoing>SequenceFlow_1fhno84</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_16yrgke" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1fhno84</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_194bhkx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoScaleE2EServiceInstance() +ddsi.preProcessRequest(execution) +]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1f5ursk"> + <bpmn:incoming>SequenceFlow_1yee730</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0vmzliy" name="Prepare Resource Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_194bhkx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0b5p6gy</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoScaleE2EServiceInstance() +ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_17d588b" name="Init Resource Oper Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0b5p6gy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nqrq1k</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_1jkl1i3" name="Call Network Service Scale" calledElement="DoScaleVFCServiceInstance"> + <bpmn:extensionElements> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="resouceTemplateUUID" target="resouceTemplateUUID" /> + <camunda:in source="resouceInstanceId" target="resouceInstanceId" /> + <camunda:in source="resourceType" target="resourceType" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="nsScaleParams" target="nsScaleParams" /> + <camunda:in source="bpmnRequest" target="bpmnRequest" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="requestDescription" target="requestDescription" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0nqrq1k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yee730</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fhno84" sourceRef="StartEvent_08ndnk6" targetRef="ScriptTask_16yrgke" /> + <bpmn:sequenceFlow id="SequenceFlow_194bhkx" sourceRef="ScriptTask_16yrgke" targetRef="ScriptTask_0vmzliy" /> + <bpmn:sequenceFlow id="SequenceFlow_1yee730" sourceRef="CallActivity_1jkl1i3" targetRef="EndEvent_1f5ursk" /> + <bpmn:sequenceFlow id="SequenceFlow_0nqrq1k" sourceRef="ServiceTask_17d588b" targetRef="CallActivity_1jkl1i3" /> + <bpmn:sequenceFlow id="SequenceFlow_0b5p6gy" sourceRef="ScriptTask_0vmzliy" targetRef="ServiceTask_17d588b" /> + <bpmn:subProcess id="SubProcess_19qmltk" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0581c7y"> + <bpmn:outgoing>SequenceFlow_0yyws1p</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0k146bt"> + <bpmn:incoming>SequenceFlow_0i814ke</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0l79kxj" name="Log / Print Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0yyws1p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0i814ke</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0yyws1p" name="" sourceRef="StartEvent_0581c7y" targetRef="ScriptTask_0l79kxj" /> + <bpmn:sequenceFlow id="SequenceFlow_0i814ke" name="" sourceRef="ScriptTask_0l79kxj" targetRef="EndEvent_0k146bt" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleE2EServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_08ndnk6_di" bpmnElement="StartEvent_08ndnk6"> + <dc:Bounds x="96" y="129" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="90" y="170" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_16yrgke_di" bpmnElement="ScriptTask_16yrgke"> + <dc:Bounds x="189" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1f5ursk_di" bpmnElement="EndEvent_1f5ursk"> + <dc:Bounds x="1016" y="279" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="899" y="320" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vmzliy_di" bpmnElement="ScriptTask_0vmzliy"> + <dc:Bounds x="436" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_17d588b_di" bpmnElement="ServiceTask_17d588b"> + <dc:Bounds x="695" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1jkl1i3_di" bpmnElement="CallActivity_1jkl1i3"> + <dc:Bounds x="984" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fhno84_di" bpmnElement="SequenceFlow_1fhno84"> + <di:waypoint xsi:type="dc:Point" x="132" y="147" /> + <di:waypoint xsi:type="dc:Point" x="189" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="72" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_194bhkx_di" bpmnElement="SequenceFlow_194bhkx"> + <di:waypoint xsi:type="dc:Point" x="289" y="147" /> + <di:waypoint xsi:type="dc:Point" x="436" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yee730_di" bpmnElement="SequenceFlow_1yee730"> + <di:waypoint xsi:type="dc:Point" x="1033" y="187" /> + <di:waypoint xsi:type="dc:Point" x="1034" y="279" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="988.5" y="212" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0nqrq1k_di" bpmnElement="SequenceFlow_0nqrq1k"> + <di:waypoint xsi:type="dc:Point" x="795" y="147" /> + <di:waypoint xsi:type="dc:Point" x="984" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="844.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0b5p6gy_di" bpmnElement="SequenceFlow_0b5p6gy"> + <di:waypoint xsi:type="dc:Point" x="536" y="147" /> + <di:waypoint xsi:type="dc:Point" x="695" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="570.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_19qmltk_di" bpmnElement="SubProcess_19qmltk" isExpanded="true"> + <dc:Bounds x="132" y="351" width="467" height="193" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0581c7y_di" bpmnElement="StartEvent_0581c7y"> + <dc:Bounds x="201" y="419" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="84" y="460" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0k146bt_di" bpmnElement="EndEvent_0k146bt"> + <dc:Bounds x="494" y="419" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="377" y="460" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0l79kxj_di" bpmnElement="ScriptTask_0l79kxj"> + <dc:Bounds x="305" y="397" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yyws1p_di" bpmnElement="SequenceFlow_0yyws1p"> + <di:waypoint xsi:type="dc:Point" x="237" y="437" /> + <di:waypoint xsi:type="dc:Point" x="305" y="437" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="136" y="422" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0i814ke_di" bpmnElement="SequenceFlow_0i814ke"> + <di:waypoint xsi:type="dc:Point" x="405" y="437" /> + <di:waypoint xsi:type="dc:Point" x="494" y="437" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317" y="422" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn new file mode 100644 index 0000000000..7e8b63e719 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="DoScaleVFCServiceInstance" name="DoScaleVFCServiceInstance" isExecutable="true"> + <bpmn:startEvent id="scaleNS_StartEvent" name="scaleNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_00w1ntj</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="PreprocessIncomingRequest" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00w1ntj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0izumqq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0ia872k" name="Scale Network Service" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0izumqq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hzy01n</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.scaleNetworkService(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_00w1ntj" sourceRef="scaleNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0izumqq" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0ia872k" /> + <bpmn:endEvent id="EndEvent_1r0dxhy"> + <bpmn:incoming>SequenceFlow_18hdal9</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_18hdal9" sourceRef="finishNSScale_Task" targetRef="EndEvent_1r0dxhy" /> + <bpmn:scriptTask id="finishNSScale_Task" name="Finish NS Scale" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hzy01n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18hdal9</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.finishNSScale(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0hzy01n" sourceRef="Task_0ia872k" targetRef="finishNSScale_Task" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleVFCServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="scaleNS_StartEvent"> + <dc:Bounds x="-33" y="182" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-56" y="218" width="83" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0fxwmkv_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="117" y="160" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_14ppugf_di" bpmnElement="Task_0ia872k"> + <dc:Bounds x="739" y="160" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00w1ntj_di" bpmnElement="SequenceFlow_00w1ntj"> + <di:waypoint xsi:type="dc:Point" x="3" y="200" /> + <di:waypoint xsi:type="dc:Point" x="117" y="200" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="15" y="179" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0izumqq_di" bpmnElement="SequenceFlow_0izumqq"> + <di:waypoint xsi:type="dc:Point" x="217" y="200" /> + <di:waypoint xsi:type="dc:Point" x="739" y="200" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="433" y="179" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1r0dxhy_di" bpmnElement="EndEvent_1r0dxhy"> + <dc:Bounds x="771" y="676" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="744" y="716" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18hdal9_di" bpmnElement="SequenceFlow_18hdal9"> + <di:waypoint xsi:type="dc:Point" x="789" y="451" /> + <di:waypoint xsi:type="dc:Point" x="789" y="676" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="759" y="557.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1elwlqc_di" bpmnElement="finishNSScale_Task"> + <dc:Bounds x="739" y="371" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hzy01n_di" bpmnElement="SequenceFlow_0hzy01n"> + <di:waypoint xsi:type="dc:Point" x="789" y="240" /> + <di:waypoint xsi:type="dc:Point" x="789" y="371" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="759" y="299.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..2dc3157e57 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.openecomp.mso.bpmn.mock.FileUtil +import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +class DoScaleE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DoScaleE2EServiceInstance.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + public DoScaleE2EServiceInstanceTest(){ + super("DoScaleE2EServiceInstance") + } + + @Test + public void preProcessRequestTest(){ + + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preProcessRequest(mex) + verify(mex).setVariable("resourceTemplateUUIDs", "ns111:ns333:") + } + + @Test + public void preInitResourcesOperStatusTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preInitResourcesOperStatus(mex) + + verify(mex).setVariable("serviceInstanceId","e151059a-d924-4629-845f-264db19e50b4") + verify(mex).setVariable("operationId", "59960003992") + verify(mex).setVariable("operationType", "SCALE") + verify(mex).setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """<soapenv:Envelope xmlns:ns="http://org.openecomp.mso/requestsdb" + xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Header/> + <soapenv:Body> + <ns:initResourceOperationStatus> + <serviceId>e151059a-d924-4629-845f-264db19e50b4</serviceId> + <operationId>59960003992</operationId> + <operationType>SCALE</operationType> + <resourceTemplateUUIDs>ns111:ns333:</resourceTemplateUUIDs> + </ns:initResourceOperationStatus> + </soapenv:Body> +</soapenv:Envelope>""" + verify(mex).setVariable("CVFMI_initResOperStatusRequest", payload) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("msoRequestId")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("serviceInstanceName")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + when(mex.getVariable("resourceTemplateUUIDs")).thenReturn("ns111:ns333:") + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..e7ffe05424 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy @@ -0,0 +1,176 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +@RunWith(MockitoJUnitRunner.class) +class SacleCustomE2EServiceInstanceTest{ + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + String globalSubscriberId="test_custormer" + String requestDescription = "request description for test" + def utils = new MsoUtils() + + String jsonIncomingRequest = """{"service":{ + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources":[ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }], + "serviceInstanceName":"XXXX" + }, + "operationId":"0a5b1651-c56e-4263-8c26-c8f8a6ef72d8" + }""" + + String xmlMsoCompletionRequest = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:w1aaan0="http://org.openecomp/mso/infra/vnf-request/v1"> + <w1aaan0:request-info> + <w1aaan0:request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</w1aaan0:request-id> + <w1aaan0:action>SCALE</w1aaan0:action> + <w1aaan0:source>null</w1aaan0:source> + </w1aaan0:request-info> + <status-message>Service Instance was scaled successfully.</status-message> + <serviceInstanceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceInstanceId> + <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name> +</aetgt:MsoCompletionRequest>""" + + String requestInfo = """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</request-id> + <action>SCALE</action> + <source>null</source> + </request-info>""" + + String payload ="""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceId> + <operationId>0a5b1651-c56e-4263-8c26-c8f8a6ef72d8</operationId> + <serviceName>XXXX</serviceName> + <operationType>SCALE</operationType> + <userId></userId> + <result>processing</result> + <operationContent>Prepare service scaling</operationContent> + <progress>0</progress> + <reason></reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void preProcessRequestTest() { + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("mso-request-id")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("globalSubscriberId", globalSubscriberId) + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("requestDescription", requestDescription) + } + + @Test + public void sendSyncResponseTest() { + println "************ sendSyncResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("operationId")).thenReturn("3338b250-e995-4782-8936-081b66ba4dbf") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("sentSyncResponse", true) + } + + @Test + public void prepareCompletionRequestTest() { + println "************ prepareCompletionRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareCompletionRequest(mockExecution) + + verify(mockExecution).setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + } + + @Test + public void prepareInitServiceOperationStatusTest() { + println "************ prepareInitServiceOperationStatus ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") + when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareInitServiceOperationStatus(mockExecution) + + payload = utils.formatXml(payload) + verify(mockExecution).setVariable("CVFMI_updateServiceOperStatusRequest", payload) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json new file mode 100644 index 0000000000..dd3ff6841e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json @@ -0,0 +1,38 @@ +{ + "service": + { + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources": + [ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + } + ], + "serviceInstanceName":"service1" + }, + "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b" + }
\ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 23692832e4..313131a7c2 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -160,32 +160,12 @@ <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> - <!--for yang decoder--> - <!--<dependency> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>yang-data-codec-gson</artifactId> - <version>1.1.1-Carbon</version> - </dependency> - <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>mdsal-binding-dom-adapter</artifactId> - <version>2.2.1-Carbon</version> - </dependency> - <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>mdsal-dom-broker</artifactId> - <version>2.2.1-Carbon</version> - </dependency> - <dependency> - <groupId>org.opendaylight.netconf</groupId> - <artifactId>sal-rest-connector</artifactId> - <version>1.5.1-Carbon</version> - </dependency> - <dependency> - <groupId>org.dom4j</groupId> - <artifactId>dom4j</artifactId> - <version>2.0.0</version> - </dependency>--> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.9.0</version> + <scope>test</scope> + </dependency> </dependencies> <build> <resources> diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java index 033951612d..6a01fb61ba 100644 --- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java +++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java @@ -20,29 +20,25 @@ package org.openecomp.mso.client.dmaap; -import java.io.FileNotFoundException; +import com.google.common.base.Stopwatch; import java.io.IOException; import java.util.concurrent.TimeUnit; - import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure; import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime; import org.openecomp.mso.client.dmaap.rest.RestConsumer; -import com.google.common.base.Stopwatch; - public abstract class DmaapConsumer extends DmaapClient { - public DmaapConsumer() throws FileNotFoundException, IOException { + public DmaapConsumer() throws IOException { super("dmaap/default-consumer.properties"); } - - public Consumer getConsumer() throws FileNotFoundException, IOException { + + public Consumer getConsumer() { return new RestConsumer(this.properties); } + public boolean consume() throws Exception { - - Consumer mrConsumer = this.getConsumer(); - int iterations = 0; + Consumer mrConsumer = this.getConsumer(); boolean accepted = false; Stopwatch stopwatch = Stopwatch.createUnstarted(); try { @@ -59,32 +55,28 @@ public abstract class DmaapConsumer extends DmaapClient { if (!accepted && this.isAccepted(message)) { auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic()); accepted = true; - } + } if (accepted) { + auditLogger.info("received dmaap message: " + message); if (this.isFailure(message)) { this.stopProcessingMessages(); - auditLogger.info("received dmaap message: " + message); final String errorMsg = "failure received from dmaap topic " + this.getTopic(); auditLogger.error(errorMsg); throw new DMaaPConsumerFailure(errorMsg); } else { - auditLogger.info("received dmaap message: " + message); this.processMessage(message); } } } - iterations++; } return true; - } catch (Exception e ) { - throw e; } finally { if (stopwatch.isRunning()) { stopwatch.stop(); } } } - + /** * Should this consumer continue to consume messages from the topic? * @return @@ -92,7 +84,7 @@ public abstract class DmaapConsumer extends DmaapClient { public abstract boolean continuePolling(); /** * Process a message from a DMaaP topic - * + * * @param message * @throws Exception */ @@ -100,14 +92,14 @@ public abstract class DmaapConsumer extends DmaapClient { /** * Has the request been accepted by the receiving system? * Should the consumer move to processing messages? - * + * * @param message * @return */ public abstract boolean isAccepted(String message); /** * has the request failed? - * + * * @param message * @return */ @@ -121,11 +113,14 @@ public abstract class DmaapConsumer extends DmaapClient { * Logic that defines when the consumer should stop processing messages */ public abstract void stopProcessingMessages(); - + /** * time in milliseconds */ public int getMaximumElapsedTime() { return 180000; } + + + } diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java new file mode 100644 index 0000000000..08e35f62f8 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.client.sdno.dmaap; + +import java.io.IOException; +import java.util.Optional; +import javax.ws.rs.NotSupportedException; +import org.openecomp.mso.client.dmaap.DmaapConsumer; +import org.openecomp.mso.jsonpath.JsonPathUtil; + +public class PnfReadyEventConsumer extends DmaapConsumer { + + private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId"; + + private boolean continuePolling = true; + private String correlationId; + + public PnfReadyEventConsumer(String correlationId) throws IOException { + this.correlationId = correlationId; + } + + @Override + public boolean continuePolling() { + return continuePolling; + } + + @Override + public void processMessage(String message) { + } + + @Override + public boolean isAccepted(String message) { + Optional<String> correlationIdOpt = JsonPathUtil.getInstance().locateResult(message, JSON_PATH_CORRELATION_ID); + if (correlationIdOpt.isPresent()) { + continuePolling = false; + return correlationIdOpt.get().equals(correlationId); + } + return false; + } + + @Override + public boolean isFailure(String message) { + throw new NotSupportedException(); + } + + @Override + public void stopProcessingMessages() { + continuePolling = false; + } + + @Override + public String getRequestId() { + throw new NotSupportedException(); + } + + @Override + public String getUserName() { + throw new NotSupportedException(); + } + + @Override + public String getPassword() { + throw new NotSupportedException(); + } + + @Override + public String getTopic() { + throw new NotSupportedException(); + } + + @Override + public Optional<String> getHost() { + throw new NotSupportedException(); + } +} diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java index 59adeb2026..ca5888caca 100644 --- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java +++ b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java @@ -20,10 +20,8 @@ package org.openecomp.mso.client.sdno.dmaap; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.Optional; - import org.openecomp.mso.client.dmaap.DmaapConsumer; import org.openecomp.mso.client.exceptions.SDNOException; import org.openecomp.mso.jsonpath.JsonPathUtil; @@ -34,11 +32,11 @@ public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer { private boolean continuePolling = true; private final static String healthDiagnosticPath = "body.output.*"; - public SDNOHealthCheckDmaapConsumer() throws FileNotFoundException, IOException { + public SDNOHealthCheckDmaapConsumer() throws IOException { this("none"); } - public SDNOHealthCheckDmaapConsumer(String uuid) throws FileNotFoundException, IOException { + public SDNOHealthCheckDmaapConsumer(String uuid) throws IOException { super(); this.uuid = uuid; } diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java index f4192e6cc8..9540409e16 100644 --- a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java @@ -23,6 +23,7 @@ package org.openecomp.mso.openpojo.rules; import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.CoreMatchers.anything; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -44,6 +45,7 @@ public class EqualsAndHashCodeTester implements Tester { private final Matcher m; + private boolean onlyDeclaredMethods = false; public EqualsAndHashCodeTester() { m = anything(); } @@ -51,12 +53,33 @@ public class EqualsAndHashCodeTester implements Tester { public EqualsAndHashCodeTester(Matcher m) { this.m = m; } + + public EqualsAndHashCodeTester onlyDeclaredMethods() { + this.onlyDeclaredMethods = true; + return this; + } @Override public void run(PojoClass pojoClass) { Class<?> clazz = pojoClass.getClazz(); if (anyOf(m).matches(clazz)) { final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass); final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass); + if (onlyDeclaredMethods) { + Method[] methods = classInstanceOne.getClass().getDeclaredMethods(); + boolean hasEquals = false; + boolean hasHashcode = false; + for (Method method : methods) { + if (method.getName().equals("equals")) { + hasEquals = true; + } else if (method.getName().equals("hashCode")) { + hasHashcode = true; + } + } + + if (!(hasEquals && hasHashcode)) { + return; + } + } Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass); List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields()); otherFields.removeAll(identityFields); diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java b/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java new file mode 100644 index 0000000000..1561f75140 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.client.dmaap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Optional; +import org.junit.Test; +import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer; + +public class PnfReadyEventConsumerTest { + + private static final String CORRELATION_ID = "correlation_id_test"; + + private static final String JSON_WITH_CORRELATION_ID = " {\"pnfRegistrationFields\": {\n" + + " \"correlationId\": \"correlation_id_test\"\n" + + " }}"; + + @Test + public void eventIsFoundForGivenCorrelationId2() throws Exception { + PnfReadyEventConsumerForTesting testedObjectSpy = spy(new PnfReadyEventConsumerForTesting(CORRELATION_ID)); + Consumer consumerMock = mock(Consumer.class); + when(testedObjectSpy.getConsumer()).thenReturn(consumerMock); + when(consumerMock.fetch()).thenReturn(Arrays.asList(JSON_WITH_CORRELATION_ID)); + testedObjectSpy.consume(); + assertThat(testedObjectSpy.continuePolling()).isFalse(); + } + + // TODO this is temporary class, when methods are defined, it will be deleted + private class PnfReadyEventConsumerForTesting extends PnfReadyEventConsumer { + + public PnfReadyEventConsumerForTesting(String correlationId) throws IOException { + super(correlationId); + } + + @Override + public String getUserName(){ + return "userNameTest"; + } + @Override + public String getPassword(){ + return "passTest"; + } + @Override + public String getTopic(){ + return "topicTest"; + } + @Override + public Optional<String> getHost(){ + return Optional.of("http://localhost"); + } + @Override + public boolean isFailure(String message) { + return false; + } + @Override + public String getRequestId() { + return "requestTest"; + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 93b6c8fbb5..97bd8348d3 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -225,6 +225,18 @@ <artifactId>json</artifactId> <version>20160212</version> </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>1.19</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> 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 8c99d067e9..5c84e699d8 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 @@ -37,5 +37,6 @@ public enum Action { removeRelationships, inPlaceSoftwareUpdate, applyUpdatedConfig, - compareModel + compareModel, + scaleInstance } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index 2e0b53d5d8..5f74cb9ddd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -56,6 +56,7 @@ import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInsta import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.*;
import org.openecomp.mso.serviceinstancebeans.ModelInfo;
import org.openecomp.mso.serviceinstancebeans.ModelType;
import org.openecomp.mso.serviceinstancebeans.RequestDetails;
@@ -160,6 +161,23 @@ public class E2EServiceInstances { return getE2EServiceInstances(serviceId, operationId);
}
+ /**
+ * Scale Requests for E2E Service scale Instance on a specified version
+ */
+
+ @POST
+ @Path("/{version:[vV][3-5]}/{serviceId}/scale")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Scale E2E Service Instance on a specified version",response=Response.class)
+ public Response scaleE2EServiceInstance(String request,
+ @PathParam("version") String version,
+ @PathParam("serviceId") String serviceId) {
+
+ msoLogger.debug("------------------scale begin------------------");
+ instanceIdMap.put("serviceId", serviceId);
+ return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version);
+ }
/**
* GET Requests for Comparing model of service instance with target version
*/
@@ -687,7 +705,7 @@ public class E2EServiceInstances { return response;
}
- if (curStatus != null && !curStatus.getProgress().equals("100")) {
+ if (curStatus != null && curStatus.getResult() != null && curStatus.getResult().equalsIgnoreCase("processing")) {
String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
+ "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
+ curStatus.getServiceName()
@@ -921,6 +939,174 @@ public class E2EServiceInstances { return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
}
+ private Response scaleE2EserviceInstances(String requestJSON,
+ Action action, HashMap<String, String> instanceIdMap, String version) {
+
+ String requestId = instanceIdMap.get("serviceId");
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceScaleRequest e2eScaleReq = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eScaleReq = mapper.readValue(requestJSON,
+ E2EServiceInstanceScaleRequest.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);
+ 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());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ CatalogDatabase db = null;
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ //TODO Get the service template model version uuid from AAI.
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);
+ } 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
+ + (String) response.getEntity());
+ return response;
+ } finally {
+ closeCatalogDB(db);
+ }
+ 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
+ + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient(
+ recipeLookupResult.getOrchestrationURI(),
+ MsoPropertiesUtils.loadMsoProperties());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger
+ .debug("MSO API Handler Posting call to BPEL engine for url: "
+ + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eScaleReq.getService().getServiceType();
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, null, serviceInstanceType,
+ null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
+
+ 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);
+ 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());
+ createOperationStatusRecordForError(action, requestId);
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ 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 + (String) resp.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response,
+ requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ return beplStatusUpdate(requestId, startTime, msoRequest,
+ requestClient, respHandler, bpelStatus, action, instanceIdMap);
+ }
+
private void closeCatalogDB(CatalogDatabase db) {
if (db != null) {
db.close();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java new file mode 100644 index 0000000000..b8bd810f4f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Co., Ltd. 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.e2eserviceinstancebeans; + + +public class E2EServiceInstanceScaleRequest { + + private ScaleService service; + + public ScaleService getService() { + return service; + } + + public void setService(ScaleService service) { + this.service = service; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java new file mode 100644 index 0000000000..c64f5fa207 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Co., Ltd. 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.e2eserviceinstancebeans; + +public class ScaleNsByStepsData { + + private String aspectId; + + private Integer numberOfSteps; + + private String scalingDirection; + + public String getAspectId() { + return aspectId; + } + + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + public Integer getNumberOfSteps() { + return numberOfSteps; + } + + public void setNumberOfSteps(Integer numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } + + public String getScalingDirection() { + return scalingDirection; + } + + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java new file mode 100644 index 0000000000..49cfe75a5b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Co., Ltd. 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.e2eserviceinstancebeans; + +public class ScaleNsData { + + private ScaleNsByStepsData scaleNsByStepsData; + + public ScaleNsByStepsData getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java new file mode 100644 index 0000000000..f19e2bdb80 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Co., Ltd. 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.e2eserviceinstancebeans; + +public class ScaleResource { + + private String resourceInstanceId; + + private String scaleType; + + private ScaleNsData scaleNsData; + + public String getResourceInstanceId() { + return resourceInstanceId; + } + + public void setResourceInstanceId(String resourceInstanceId) { + this.resourceInstanceId = resourceInstanceId; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public ScaleNsData getScaleNsData() { + return scaleNsData; + } + + public void setScaleNsData(ScaleNsData scaleNsData) { + this.scaleNsData = scaleNsData; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java new file mode 100644 index 0000000000..c694f550f8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Co., Ltd. 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.e2eserviceinstancebeans; + +import java.util.List; + +public class ScaleService { + + private String serviceInstanceName; + + private String serviceType; + + private String globalSubscriberId; + + private List<ScaleResource> resources; + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public List<ScaleResource> getResources() { + return resources; + } + + public void setResources(List<ScaleResource> resources) { + this.resources = resources; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index 590ac7cbed..c0f6ccc730 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -719,6 +719,7 @@ public class E2EServiceInstancesTest { String serviceID) {
OperationStatus operationStatus = new OperationStatus();
operationStatus.setProgress("100");
+ operationStatus.setResult("finish");
return operationStatus;
}
};
@@ -790,6 +791,7 @@ public class E2EServiceInstancesTest { public OperationStatus getOperationStatusByServiceId(
String serviceID) {
OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setResult("processing");
return operationStatus;
}
};
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 7963217721..7fb3bf00b0 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 @@ -25,18 +25,24 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.io.PrintStream; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import mockit.Expectations; +import mockit.Mocked; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.CharEncoding; +import org.hibernate.Session; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.openecomp.mso.apihandler.common.ValidationException; +import org.openecomp.mso.db.AbstractSessionFactoryManager; +import org.openecomp.mso.properties.MsoJavaProperties; import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest; import com.fasterxml.jackson.core.JsonParseException; @@ -597,4 +603,22 @@ public class MsoRequestTest { assertNotNull(msoRequest.getRequestId()); assertEquals(msoRequest.getReqVersion(), 6); } + + @Test + public void createRequestRecord(@Mocked AbstractSessionFactoryManager sessionFactoryManager, + @Mocked Session session) throws ValidationException, IOException { + + new Expectations() {{ + sessionFactoryManager.getSessionFactory().openSession(); result = session; + }}; + + this.requestJSON = inputStream("/v6AddRelationships.json"); + this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000"); + this.sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + this.msoRequest = new MsoRequest ("V6RemoveRelationships"); + msoRequest.parse(sir, instanceIdMapTest, Action.removeRelationships, "v6", originalRequestJSON); + msoRequest.createRequestRecord(Status.COMPLETE, Action.createInstance); + + } + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java index 3c35fed516..2089cf1d32 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java @@ -22,6 +22,9 @@ package org.openecomp.mso.apihandlerinfra; import static org.junit.Assert.assertTrue; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Field; import java.net.URI; import java.sql.Timestamp; @@ -31,23 +34,44 @@ import java.util.List; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import mockit.Expectations; import mockit.Mock; import mockit.MockUp; +import mockit.Mocked; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.entity.BasicHttpEntity; +import org.apache.http.message.BasicHttpResponse; +import org.hibernate.Session; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; +import org.openecomp.mso.apihandler.common.CamundaClient; import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest; +import org.openecomp.mso.db.AbstractSessionFactoryManager; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.NetworkRecipe; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; public class NetworkRequestHandlerTest { + private static final String REQ_XML = "<network-request xmlns=\"http://org.openecomp/mso/infra/network-request/v1\"> <request-info> <request-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</request-id><action>CREATE</action> <source>VID</source> <service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></request-info> <network-inputs> <network-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</network-id> <network-name>nwInstanceName</network-name> <network-type>nwModelName</network-type><modelCustomizationId>e1fc3ed3-31e5-48a8-913b-23184c1e9443</modelCustomizationId> <aic-cloud-region>e1fc3ed3-31e5-48a8-913b-23184c1e9443</aic-cloud-region> <tenant-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</tenant-id><service-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-id> <backout-on-failure>false</backout-on-failure><sdncVersion>1802</sdncVersion><service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></network-inputs> <network-params></network-params> </network-request>"; + + private static MockUp<RequestsDatabase> mockRDB; + private static MockUp<CatalogDatabase> mockCDB; + private static MockUp<CamundaClient> mockCamundaClient; NetworkRequestHandler handler = null; - -UriInfo uriInfo = null; + UriInfo uriInfo = null; @Before public void setup() throws Exception{ @@ -63,31 +87,112 @@ UriInfo uriInfo = null; f1.set(handler, uriInfo); } + + @BeforeClass + public static void setUp() throws Exception { + MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + msoPropertiesFactory.removeAllMsoProperties(); + msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties"); + + mockRDB = new MockUp<RequestsDatabase>() { + @Mock + public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) { + return null; + } + @Mock + public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) { + return 1; + } + + @Mock + public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) { + return 1; + } + }; + + mockCDB = new MockUp<CatalogDatabase>() { + @Mock + public NetworkRecipe getNetworkRecipe (String networkType, String action, String serviceType) { + final NetworkRecipe networkRecipe = new NetworkRecipe(); + networkRecipe.setOrchestrationUri("test/vnf"); + networkRecipe.setRecipeTimeout(180); + return networkRecipe; + } + + @Mock + public VfModule getVfModuleType(String type, String version) { + final VfModule vfModule = new VfModule(); + return vfModule; + } + + @Mock + public VnfResource getVnfResource (String vnfType, String serviceVersion) { + final VnfResource vnfResource = new VnfResource(); + return vnfResource; + } + }; + + mockCamundaClient = new MockUp<CamundaClient>() { + @Mock + public HttpResponse post(String camundaReqXML, String requestId, + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) + throws ClientProtocolException, IOException { + ProtocolVersion pv = new ProtocolVersion("HTTP",1,1); + HttpResponse resp = new BasicHttpResponse(pv,200, "test response"); + BasicHttpEntity entity = new BasicHttpEntity(); + String body = "{\"response\":\"success\",\"message\":\"success\"}"; + InputStream instream = new ByteArrayInputStream(body.getBytes()); + entity.setContent(instream); + resp.setEntity(entity); + return resp; + } + }; + + } + + @AfterClass + public static void tearDown() { + mockRDB.tearDown(); + mockCDB.tearDown(); + mockCamundaClient.tearDown(); + } @Test - public void manageVnfRequestTest(){ + public void manageVnfRequestTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager, + @Mocked Session session){ + new Expectations() {{ + sessionFactoryManager.getSessionFactory().openSession(); result = session; + }}; Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v2"); assertTrue(null != resp); } @Test - public void manageVnfRequestTestV1(){ + public void manageVnfRequestTestV1(@Mocked AbstractSessionFactoryManager sessionFactoryManager, + @Mocked Session session){ + new Expectations() {{ + sessionFactoryManager.getSessionFactory().openSession(); result = session; + }}; Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v1"); assertTrue(null != resp); } @Test - public void manageVnfRequestTestV3(){ + public void manageVnfRequestTestV3(@Mocked AbstractSessionFactoryManager sessionFactoryManager, + @Mocked Session session){ + new Expectations() {{ + sessionFactoryManager.getSessionFactory().openSession(); result = session; + }}; Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v3"); assertTrue(null != resp); } @Test public void manageVnfRequestTestInvalidVersion(){ - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v249"); assertTrue(null != resp); } @@ -102,7 +207,7 @@ UriInfo uriInfo = null; return false; } }; - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v2"); assertTrue(null != resp); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java index be76d433aa..fa1cce462f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java @@ -183,7 +183,8 @@ public class OrchestrationRequestsTest { Response response = null;
try {
OrchestrationRequests requests = new OrchestrationRequests();
- response = requests.getOrchestrationRequest(new ResteasyUriInfo(new URI("")),"v5");
+ final ResteasyUriInfo ui = new ResteasyUriInfo(new URI("", "", "", "filter=service-instance-id:EQUALS:abc", ""));
+ response = requests.getOrchestrationRequest(ui,"v5");
} finally {
mockUpRDB.tearDown();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java index c8ab6b5612..9a9dec3c27 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,19 +20,40 @@ package org.openecomp.mso.apihandlerinfra; -import static org.junit.Assert.assertTrue; - +import mockit.Expectations; +import mockit.Mocked; +import mockit.Tested; +import mockit.integration.junit4.JMockit; +import org.hibernate.Session; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; import org.openecomp.mso.apihandler.common.ValidationException; +import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.properties.MsoJavaProperties; +@RunWith(JMockit.class) public class VnfMsoInfraRequestTest { - VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020"); - - @Test(expected=Exception.class) - public void parseTest() throws ValidationException { - String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>"; - request.parse(reqXML, "v1", new MsoJavaProperties()); - } - + + VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020"); + private String reqXML = "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\"><request-info><request-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</request-id><action>CREATE_VF_MODULE</action><source>VID</source><!-- new 1610 field --><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></request-info><vnf-inputs><!-- not in use in 1610 --><vnf-name>vnfName</vnf-name><vnf-type>vnfType</vnf-type><vnf-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vnf-id><volume-group-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</volume-group-id><vf-module-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-id><vf-module-name>vfModuleName</vf-module-name><vf-module-model-name>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-model-name><model-customization-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</model-customization-id><asdc-service-model-version>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</asdc-service-model-version><aic-cloud-region>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</aic-cloud-region><tenant-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</tenant-id><service-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-id><backout-on-failure>false</backout-on-failure><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></vnf-inputs><vnf-params><vnf-parameter-name>pName</vnf-parameter-name><vnf-parameter-value>pValue</vnf-parameter-value></vnf-params></vnf-request>"; + + @Test + public void parseTest() throws ValidationException { + request.parse(reqXML, "v3", new MsoJavaProperties()); + } + + @Test + public void createRequestRecord(@Mocked AbstractSessionFactoryManager sessionFactoryManager, + @Mocked Session session) throws ValidationException { + + new Expectations() {{ + sessionFactoryManager.getSessionFactory().openSession(); result = session; + }}; + + request.parse(reqXML, "v3", new MsoJavaProperties()); + request.createRequestRecord(Status.COMPLETE); + + } + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java index 78ed076b55..ffdf5d40b4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java @@ -22,14 +22,78 @@ package org.openecomp.mso.apihandlerinfra; import static org.junit.Assert.assertTrue; +import mockit.Mock; +import mockit.MockUp; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.entity.BasicHttpEntity; +import org.apache.http.message.BasicHttpResponse; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; +import org.openecomp.mso.apihandler.common.CamundaClient; +import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType; +import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType; import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.NetworkRecipe; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.properties.MsoPropertiesFactory; +import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.InfraRequests; +import org.openecomp.mso.requestsdb.RequestsDatabase; + +import javax.ws.rs.core.Response; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; public class VolumeInfoHandlerTest { VolumeInfoHandler handler = new VolumeInfoHandler(); - + + private static MockUp<RequestsDatabase> mockRDB; + + @BeforeClass + public static void setUp() throws Exception { + MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + msoPropertiesFactory.removeAllMsoProperties(); + msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties"); + + mockRDB = new MockUp<RequestsDatabase>() { + @Mock + public List<InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, + String queryValue, + String requestType) { + final InfraActiveRequests requests = new InfraActiveRequests(); + requests.setAction(ActionType.CREATE.name()); + requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name()); + requests.setStartTime(Timestamp.valueOf(LocalDateTime.now())); + return Collections.singletonList(requests); + } + @Mock + public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) { + final InfraActiveRequests requests = new InfraActiveRequests(); + requests.setAction(ActionType.CREATE.name()); + requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name()); + requests.setStartTime(Timestamp.valueOf(LocalDateTime.now())); + return requests; + } + }; + + } + + @AfterClass + public static void tearDown() { + mockRDB.tearDown(); + } + @Test public void fillVnfRequestTestV3(){ VolumeRequest qr = new VolumeRequest(); @@ -51,4 +115,21 @@ public class VolumeInfoHandlerTest { String vnfid = (String)qr.getVolumeParams(); assertTrue(vnfid.equals("test")); } + + @Test + public void queryFilters() { + final Response response = handler.queryFilters("vnf-type", "svc-type", "aicNode", "tenant-id", + "vg-id", "vg-name", "v3"); + } + + @Test + public void queryFilters2() { + final Response response = handler.queryFilters(null, "svc-type", "aicNode", "tenant-id", + "vg-id", "vg-name", "v3"); + } + + @Test + public void getRequest() { + final Response response = handler.getRequest("request-id", "v3"); + } } diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java new file mode 100644 index 0000000000..33f1fbbb76 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java @@ -0,0 +1,129 @@ +/* +* ============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.requestsdb; + +import static org.junit.Assert.*; + +import java.sql.Timestamp; + +import org.junit.Test; + +public class InfraRequestsTest { + + InfraRequests ir=new InfraRequests(); + InfraRequests ir1=new InfraRequests("requestId", "action"); + Timestamp time=new Timestamp(123); + long progress=111; + @Test + public void test() { + ir.setAaiServiceId("aaiServiceId"); + ir.setAction("action"); + ir.setAicCloudRegion("aicCloudRegion"); + ir.setAicNodeClli("aicNodeClli"); + ir.setCallBackUrl("callBackUrl"); + ir.setClientRequestId("clientRequestId"); + ir.setConfigurationId("configurationId"); + ir.setConfigurationName("configurationName"); + ir.setCorrelator("correlator"); + ir.setEndTime(time); + ir.setLastModifiedBy("lastModifiedBy"); + ir.setModifyTime(time); + ir.setNetworkId("networkId"); + ir.setNetworkName("networkName"); + ir.setNetworkType("networkType"); + ir.setOperationalEnvId("operationalEnvId"); + ir.setOperationalEnvName("operationalEnvName"); + ir.setProgress(progress); + ir.setProvStatus("provStatus"); + ir.setRequestAction("requestAction"); + ir.setRequestBody("requestBody"); + ir.setRequestId("requestId"); + ir.setRequestorId("requestorId"); + ir.setRequestScope("requestScope"); + ir.setRequestStatus("requestStatus"); + ir.setRequestType("requestType"); + ir.setResponseBody("responseBody"); + ir.setServiceInstanceId("serviceInstanceId"); + ir.setServiceInstanceName("serviceInstanceName"); + ir.setServiceType("serviceType"); + ir.setSource("source"); + ir.setStartTime(time); + ir.setStatusMessage("statusMessage"); + ir.setTenantId("tenantId"); + ir.setVfModuleId("vfModuleId"); + ir.setVfModuleModelName("vfModuleModelName"); + ir.setVfModuleName("vfModuleName"); + ir.setVnfId("vnfId"); + ir.setVnfName("vnfName"); + ir.setVnfOutputs("vnfOutputs"); + ir.setVnfParams("vnfParams"); + ir.setVnfType("vnfType"); + ir.setVolumeGroupId("volumeGroupId"); + ir.setVolumeGroupName("volumeGroupName"); + + assertEquals(ir.getAaiServiceId(), "aaiServiceId"); + assertEquals(ir.getAction(),"action"); + assertEquals(ir.getAicCloudRegion(),"aicCloudRegion"); + assertEquals(ir.getAicNodeClli(),"aicNodeClli"); + assertEquals(ir.getCallBackUrl(),"callBackUrl"); + assertEquals(ir.getClientRequestId(),"clientRequestId"); + assertEquals(ir.getConfigurationId(),"configurationId"); + assertEquals(ir.getConfigurationName(),"configurationName"); + assertEquals(ir.getCorrelator(),"correlator"); + assertEquals(ir.getEndTime(),time); + assertEquals(ir.getLastModifiedBy(),"lastModifiedBy"); + assertEquals(ir.getModifyTime(),time); + assertEquals(ir.getNetworkId(),"networkId"); + assertEquals(ir.getNetworkName(),"networkName"); + assertEquals(ir.getNetworkType(),"networkType"); + assertEquals(ir.getOperationalEnvId(),"operationalEnvId"); + assertEquals(ir.getOperationalEnvName(),"operationalEnvName"); + assert(ir.getProgress().equals(progress)); + assertEquals(ir.getProvStatus(),"provStatus"); + assertEquals(ir.getRequestAction(),"requestAction"); + assertEquals(ir.getRequestBody(),"requestBody"); + assertEquals(ir.getRequestId(),"requestId"); + assertEquals(ir.getRequestorId(),"requestorId"); + assertEquals(ir.getRequestScope(),"requestScope"); + assertEquals(ir.getRequestStatus(),"requestStatus"); + assertEquals(ir.getRequestType(),"requestType"); + assertEquals(ir.getResponseBody(),"responseBody"); + assertEquals(ir.getServiceInstanceId(),"serviceInstanceId"); + assertEquals(ir.getServiceInstanceName(),"serviceInstanceName"); + assertEquals(ir.getServiceType(),"serviceType"); + assertEquals(ir.getSource(),"source"); + assertEquals(ir.getStartTime(),time); + assertEquals(ir.getStatusMessage(),"statusMessage"); + assertEquals(ir.getTenantId(),"tenantId"); + assertEquals(ir.getVfModuleId(),"vfModuleId"); + assertEquals(ir.getVfModuleModelName(),"vfModuleModelName"); + assertEquals(ir.getVfModuleName(),"vfModuleName"); + assertEquals(ir.getVnfId(),"vnfId"); + assertEquals(ir.getVnfName(),"vnfName"); + assertEquals(ir.getVnfOutputs(),"vnfOutputs"); + assertEquals(ir.getVnfParams(),"vnfParams"); + assertEquals(ir.getVnfType(),"vnfType"); + assertEquals(ir.getVolumeGroupId(),"volumeGroupId"); + assertEquals(ir.getVolumeGroupName(),"volumeGroupName"); + + } + + +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java new file mode 100644 index 0000000000..cf18524ee1 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java @@ -0,0 +1,61 @@ +/* +* ============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.requestsdb; + +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.junit.Test; + +public class OperationStatusTest { + + OperationStatus os=new OperationStatus(); + Timestamp time=new Timestamp(10); + Object obj=new Object(); + @Test + public void test() { + os.setFinishedAt(time); + os.setOperateAt(time); + os.setOperation("operation"); + os.setOperationContent("operationContent"); + os.setOperationId("operationId"); + os.setProgress("progress"); + os.setReason("reason"); + os.setResult("result"); + os.setServiceId("serviceId"); + os.setServiceName("serviceName"); + os.setUserId("userId"); + + assertEquals(os.getFinishedAt(), time); + assertEquals(os.getOperateAt(), time); + assertEquals(os.getOperation(), "operation"); + assertEquals(os.getOperationContent(), "operationContent"); + assertEquals(os.getOperationId(), "operationId"); + assertEquals(os.getProgress(), "progress"); + assertEquals(os.getReason(), "reason"); + assertEquals(os.getResult(), "result"); + assertEquals(os.getServiceId(), "serviceId"); + assertEquals(os.getServiceName(), "serviceName"); + assertEquals(os.getUserId(), "userId"); + + os.equals(obj); + os.hashCode(); + } + +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java index b0c1c02e7f..6381ec63b9 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java @@ -1,40 +1,56 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ - +/* +* ============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.requestsdb; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.sql.Timestamp; public class OperationalEnvDistributionStatusTest { - OperationalEnvDistributionStatus _operationalEnvDistributionStatus; + OperationalEnvDistributionStatus oeds=new OperationalEnvDistributionStatus(); + Timestamp time=new Timestamp(10); + @Test + public void test(){ + oeds.setCreateTime(time); + oeds.setDistributionId("distributionId"); + oeds.setDistributionIdErrorReason("distributionIdErrorReason"); + oeds.setDistributionIdStatus("distributionIdStatus"); + oeds.setModifyTime(time); + oeds.setOperationalEnvId("operationalEnvId"); + oeds.setRequestId("requestId"); + oeds.setServiceModelVersionId("serviceModelVersionId"); + + assertEquals(oeds.getCreateTime(), time); + assertEquals(oeds.getDistributionId(), "distributionId"); + assertEquals(oeds.getDistributionIdErrorReason(), "distributionIdErrorReason"); + assertEquals(oeds.getDistributionIdStatus(), "distributionIdStatus"); + assertEquals(oeds.getModifyTime(),time); + assertEquals(oeds.getOperationalEnvId(), "operationalEnvId"); + assertEquals(oeds.getRequestId(), "requestId"); + assertEquals(oeds.getServiceModelVersionId(), "serviceModelVersionId"); + } +} - protected String _distributionId; + /*protected String _distributionId; protected String _operationalEnvId; protected String _serviceModelVersionId; protected String _requestId; @@ -74,9 +90,9 @@ public class OperationalEnvDistributionStatusTest { _operationalEnvDistributionStatus = null; } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetDistributionId() { _operationalEnvDistributionStatus.setDistributionId(_distributionId); @@ -84,18 +100,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetDistributionId() { _operationalEnvDistributionStatus.setDistributionId(_distributionId); verify(_operationalEnvDistributionStatus).setDistributionId(_distributionId); } - /** + *//** * Test of getOperationalEnvId method - */ + *//* @Test public void testGetOperationalEnvId() { _operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId); @@ -103,18 +119,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setOperationalEnvId method - */ + *//* @Test public void testSetOperationalEnvId() { _operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId); verify(_operationalEnvDistributionStatus).setOperationalEnvId(_operationalEnvId); } - /** + *//** * Test of getServiceModelVersionId method - */ + *//* @Test public void testGetServiceModelVersionId() { _operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId); @@ -122,18 +138,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setServiceModelVersionId method - */ + *//* @Test public void testSetServiceModelVersionId() { _operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId); verify(_operationalEnvDistributionStatus).setServiceModelVersionId(_serviceModelVersionId); } - /** + *//** * Test of getRequestId method - */ + *//* @Test public void testGetRequestId() { _operationalEnvDistributionStatus.setRequestId(_requestId); @@ -141,18 +157,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setRequestId method - */ + *//* @Test public void testSetRequestId() { _operationalEnvDistributionStatus.setRequestId(_requestId); verify(_operationalEnvDistributionStatus).setRequestId(_requestId); } - /** + *//** * Test of getDistributionIdStatus method - */ + *//* @Test public void testGetDistributionIdStatus() { _operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus); @@ -160,18 +176,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setDistributionIdStatus method - */ + *//* @Test public void testSetDistributionIdStatus() { _operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus); verify(_operationalEnvDistributionStatus).setDistributionIdStatus(_distributionIdStatus); } - /** + *//** * Test of getDistributionIdErrorReason method - */ + *//* @Test public void testGetDistributionIdErrorReason() { _operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason); @@ -179,18 +195,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setDistributionIdErrorReason method - */ + *//* @Test public void testSetDistributionIdErrorReason() { _operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason); verify(_operationalEnvDistributionStatus).setDistributionIdErrorReason(_distributionIdErrorReason); } - /** + *//** * Test of getCreateTime method - */ + *//* @Test public void testGetCreateTime() { _operationalEnvDistributionStatus.setCreateTime(_createTime); @@ -199,18 +215,18 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setCreateTime method - */ + *//* @Test public void testSetCreateTime() { _operationalEnvDistributionStatus.setCreateTime(_createTime); verify(_operationalEnvDistributionStatus).setCreateTime(_createTime); } - /** + *//** * Test of getModifyTime method - */ + *//* @Test public void testGetModifyTime() { _operationalEnvDistributionStatus.setModifyTime(_modifyTime); @@ -219,9 +235,9 @@ public class OperationalEnvDistributionStatusTest { } - /** + *//** * Test setModifyTime method - */ + *//* @Test public void testSetModifyTime() { _operationalEnvDistributionStatus.setModifyTime(_modifyTime); @@ -230,3 +246,4 @@ public class OperationalEnvDistributionStatusTest { } +*/
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java index eb6a9f1d82..ecde7b36f6 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java @@ -1,39 +1,57 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ +/* +* ============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.requestsdb; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import java.sql.Timestamp; - -import org.junit.After; -import org.junit.Before; import org.junit.Test; public class OperationalEnvServiceModelStatusTest { - OperationalEnvServiceModelStatus _operationalEnvServiceModelStatus; + OperationalEnvServiceModelStatus oesms=new OperationalEnvServiceModelStatus(); + Timestamp time=new Timestamp(10); + @Test + public void test(){ + oesms.setCreateTime(time); + oesms.setModifyTime(time); + oesms.setOperationalEnvId("operationalEnvId"); + oesms.setRecoveryAction("recoveryAction"); + oesms.setRequestId("requestId"); + oesms.setRetryCount(0); + oesms.setServiceModelVersionDistrStatus("serviceModelVersionDistrStatus"); + oesms.setServiceModelVersionId("serviceModelVersionId"); + oesms.setWorkloadContext("workloadContext"); + + assertEquals(oesms.getCreateTime(), time); + assertEquals(oesms.getModifyTime(), time); + assertEquals(oesms.getOperationalEnvId(), "operationalEnvId"); + assertEquals(oesms.getRecoveryAction(), "recoveryAction"); + assertEquals(oesms.getRequestId(), "requestId"); + assertEquals(oesms.getRetryCount(), 0); + assertEquals(oesms.getServiceModelVersionDistrStatus(), "serviceModelVersionDistrStatus"); + assertEquals(oesms.getServiceModelVersionId(), "serviceModelVersionId"); + assertEquals(oesms.getWorkloadContext(), "workloadContext"); + } +} + /*OperationalEnvServiceModelStatus _operationalEnvServiceModelStatus; protected String _requestId; protected String _operationalEnvId; @@ -79,9 +97,9 @@ public class OperationalEnvServiceModelStatusTest { _operationalEnvServiceModelStatus = null; } - /** + *//** * Test of getRequestId method - */ + *//* @Test public void testGetRequestId() { _operationalEnvServiceModelStatus.setRequestId(_requestId); @@ -89,18 +107,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setRequestId method - */ + *//* @Test public void testSetRequestId() { _operationalEnvServiceModelStatus.setRequestId(_requestId); verify(_operationalEnvServiceModelStatus).setRequestId(_requestId); } - /** + *//** * Test of getOperationalEnvId method - */ + *//* @Test public void testGetOperationalEnvId() { _operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId); @@ -108,18 +126,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setOperationalEnvId method - */ + *//* @Test public void testSetOperationalEnvId() { _operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId); verify(_operationalEnvServiceModelStatus).setOperationalEnvId(_operationalEnvId); } - /** + *//** * Test of getServiceModelVersionId method - */ + *//* @Test public void testGetServiceModelVersionId() { _operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId); @@ -127,18 +145,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setServiceModelVersionId method - */ + *//* @Test public void testSetServiceModelVersionId() { _operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId); verify(_operationalEnvServiceModelStatus).setServiceModelVersionId(_serviceModelVersionId); } - /** + *//** * Test of getServiceModelVersionId method - */ + *//* @Test public void testGetServiceModelVersionDistrStatus() { _operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus); @@ -146,18 +164,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setServiceModelVersionId method - */ + *//* @Test public void testSetServiceModelVersionDistrStatus() { _operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus); verify(_operationalEnvServiceModelStatus).setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus); } - /** + *//** * Test of getOperationalEnvId method - */ + *//* @Test public void testGetRecoveryAction() { _operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction); @@ -165,18 +183,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setOperationalEnvId method - */ + *//* @Test public void testSetRecoveryAction() { _operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction); verify(_operationalEnvServiceModelStatus).setRecoveryAction(_recoveryAction); } - /** + *//** * Test of getOperationalEnvId method - */ + *//* @Test public void testGetRetryCount() { _operationalEnvServiceModelStatus.setRetryCount(_retryCount); @@ -184,18 +202,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setOperationalEnvId method - */ + *//* @Test public void testSetRetryCount() { _operationalEnvServiceModelStatus.setRetryCount(_retryCount); verify(_operationalEnvServiceModelStatus).setRetryCount(_retryCount); } - /** + *//** * Test of getOperationalEnvId method - */ + *//* @Test public void testGetWorkloadContext() { _operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext); @@ -203,18 +221,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setOperationalEnvId method - */ + *//* @Test public void testSetWorkloadContext() { _operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext); verify(_operationalEnvServiceModelStatus).setWorkloadContext(_workloadContext); } - /** + *//** * Test of getCreateTime method - */ + *//* @Test public void testGetCreateTime() { _operationalEnvServiceModelStatus.setCreateTime(_createTime); @@ -222,18 +240,18 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setCreateTime method - */ + *//* @Test public void testSetCreateTime() { _operationalEnvServiceModelStatus.setCreateTime(_createTime); verify(_operationalEnvServiceModelStatus).setCreateTime(_createTime); } - /** + *//** * Test of getModifyTime method - */ + *//* @Test public void testGetModifyTime() { _operationalEnvServiceModelStatus.setModifyTime(_modifyTime); @@ -241,13 +259,13 @@ public class OperationalEnvServiceModelStatusTest { } - /** + *//** * Test setModifyTime method - */ + *//* @Test public void testSetModifyTime() { _operationalEnvServiceModelStatus.setModifyTime(_modifyTime); verify(_operationalEnvServiceModelStatus).setModifyTime(_modifyTime); } - -} + */ + diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java new file mode 100644 index 0000000000..a9773c3bae --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java @@ -0,0 +1,58 @@ +/* +* ============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.requestsdb; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ResourceOperationStatusTest { + + ResourceOperationStatus ros=new ResourceOperationStatus(); + ResourceOperationStatus ros1=new ResourceOperationStatus("serviceId", "operationId", "resourceTemplateUUID"); + Object obj=new Object(); + @Test + public void test() { + ros.setErrorCode("errorCode"); + ros.setJobId("jobId"); + ros.setOperationId("operationId"); + ros.setOperType("operType"); + ros.setProgress("progress"); + ros.setResourceInstanceID("resourceInstanceID"); + ros.setResourceTemplateUUID("resourceTemplateUUId"); + ros.setServiceId("serviceId"); + ros.setStatus("101"); + ros.setStatusDescription("statusDescription"); + + assertEquals(ros.getErrorCode(), "errorCode"); + assertEquals(ros.getJobId(), "jobId"); + assertEquals(ros.getOperationId(), "operationId"); + assertEquals(ros.getOperType(), "operType"); + assertEquals(ros.getProgress(), "progress"); + assertEquals(ros.getResourceInstanceID(), "resourceInstanceID"); + assertEquals(ros.getResourceTemplateUUID(), "resourceTemplateUUId"); + assertEquals(ros.getServiceId(), "serviceId"); + assertEquals(ros.getStatus(), "101"); + assertEquals(ros.getStatusDescription(), "statusDescription"); + ros.equals(obj); + ros.hashCode(); + } + +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java new file mode 100644 index 0000000000..b989dac262 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java @@ -0,0 +1,44 @@ +/* +* ============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.requestsdb; + +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.junit.Test; + +public class SiteStatusTest { + + SiteStatus ss=new SiteStatus(); + Timestamp time=new Timestamp(10); + @Test + public void test() { + ss.setCreated(time); + ss.setSiteName("siteName"); + ss.setStatus(true); + + assertEquals(ss.getCreated(), time); + assertEquals(ss.getSiteName(), "siteName"); + assertEquals(ss.getStatus(), true); + } + @Test + public void testToString(){ + assert(ss.toString()!=null); + } +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java index b36166942d..0d68c12a0a 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java @@ -1,39 +1,50 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ - +/* +* ============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.requestsdb; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import java.sql.Timestamp; - -import org.junit.After; -import org.junit.Before; import org.junit.Test; public class WatchdogComponentDistributionStatusTest { + + WatchdogComponentDistributionStatus wcds=new WatchdogComponentDistributionStatus(); + Timestamp time=new Timestamp(10); + + @Test + public void test(){ + wcds.setComponentDistributionStatus("componentDistributionStatus"); + wcds.setComponentName("componentName"); + wcds.setCreateTime(time); + wcds.setDistributionId("distributionId"); + wcds.setModifyTime(time); + + assertEquals(wcds.getComponentDistributionStatus(), "componentDistributionStatus"); + assertEquals(wcds.getComponentName(), "componentName"); + assertEquals(wcds.getCreateTime(), time); + assertEquals(wcds.getDistributionId(), "distributionId"); + assertEquals(wcds.getModifyTime(), time); + } +} - WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus; + /*WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus; protected String _distributionId; protected String _componentName; @@ -65,9 +76,9 @@ public class WatchdogComponentDistributionStatusTest { _watchdogComponentDistributionStatus = null; } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetDistributionId() { _watchdogComponentDistributionStatus.setDistributionId(_distributionId); @@ -75,18 +86,18 @@ public class WatchdogComponentDistributionStatusTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetDistributionId() { _watchdogComponentDistributionStatus.setDistributionId(_distributionId); verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId); } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetComponentName() { _watchdogComponentDistributionStatus.setComponentName(_componentName); @@ -94,18 +105,18 @@ public class WatchdogComponentDistributionStatusTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetComponentName() { _watchdogComponentDistributionStatus.setComponentName(_componentName); verify(_watchdogComponentDistributionStatus).setComponentName(_componentName); } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetComponentDistributionStatus() { _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus); @@ -113,18 +124,18 @@ public class WatchdogComponentDistributionStatusTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetComponentDistributionStatus() { _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus); verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus); } - /** + *//** * Test of getCreateTime method - */ + *//* @Test public void testGetCreateTime() { _watchdogComponentDistributionStatus.setCreateTime(_createTime); @@ -133,18 +144,18 @@ public class WatchdogComponentDistributionStatusTest { } - /** + *//** * Test setCreateTime method - */ + *//* @Test public void testSetCreateTime() { _watchdogComponentDistributionStatus.setCreateTime(_createTime); verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime); } - /** + *//** * Test of getModifyTime method - */ + *//* @Test public void testGetModifyTime() { _watchdogComponentDistributionStatus.setModifyTime(_modifyTime); @@ -153,9 +164,9 @@ public class WatchdogComponentDistributionStatusTest { } - /** + *//** * Test setModifyTime method - */ + *//* @Test public void testSetModifyTime() { _watchdogComponentDistributionStatus.setModifyTime(_modifyTime); @@ -163,3 +174,4 @@ public class WatchdogComponentDistributionStatusTest { } } +*/
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java index 85ac4bba4a..c10d7ae15b 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java @@ -1,39 +1,49 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ +/* +* ============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.requestsdb; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import java.sql.Timestamp; - -import org.junit.After; -import org.junit.Before; import org.junit.Test; public class WatchdogDistributionStatusTest { + + WatchdogDistributionStatus wds=new WatchdogDistributionStatus(); + Timestamp time=new Timestamp(10); + @Test + public void test() { + wds.setCreateTime(time); + wds.setDistributionId("distributionId"); + wds.setDistributionIdStatus("distributionIdStatus"); + wds.setModifyTime(time); + + assertEquals(wds.getCreateTime(), time); + assertEquals(wds.getDistributionId(), "distributionId"); + assertEquals(wds.getDistributionIdStatus(), "distributionIdStatus"); + assertEquals(wds.getModifyTime(), time); - WatchdogDistributionStatus _watchdogDistributionStatus; + } + + +/* WatchdogDistributionStatus _watchdogDistributionStatus; protected String _distributionId; protected String _distributionIdStatus; @@ -62,9 +72,9 @@ public class WatchdogDistributionStatusTest { _watchdogDistributionStatus = null; } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetDistributionId() { _watchdogDistributionStatus.setDistributionId(_distributionId); @@ -72,18 +82,18 @@ public class WatchdogDistributionStatusTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetDistributionId() { _watchdogDistributionStatus.setDistributionId(_distributionId); verify(_watchdogDistributionStatus).setDistributionId(_distributionId); } - /** + *//** * Test of getDistributionIdStatus method - */ + *//* @Test public void testGetComponentDistributionStatus() { _watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus); @@ -91,18 +101,18 @@ public class WatchdogDistributionStatusTest { } - /** + *//** * Test setDistributionIdStatus method - */ + *//* @Test public void testSetComponentDistributionStatus() { _watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus); verify(_watchdogDistributionStatus).setDistributionIdStatus(_distributionIdStatus); } - /** + *//** * Test of getCreateTime method - */ + *//* @Test public void testGetCreateTime() { _watchdogDistributionStatus.setCreateTime(_createTime); @@ -110,18 +120,18 @@ public class WatchdogDistributionStatusTest { } - /** + *//** * Test setCreateTime method - */ + *//* @Test public void testSetCreateTime() { _watchdogDistributionStatus.setCreateTime(_createTime); verify(_watchdogDistributionStatus).setCreateTime(_createTime); } - /** + *//** * Test of getModifyTime method - */ + *//* @Test public void testGetModifyTime() { _watchdogDistributionStatus.setModifyTime(_modifyTime); @@ -129,12 +139,12 @@ public class WatchdogDistributionStatusTest { } - /** + *//** * Test setModifyTime method - */ + *//* @Test public void testSetModifyTime() { _watchdogDistributionStatus.setModifyTime(_modifyTime); verify(_watchdogDistributionStatus).setModifyTime(_modifyTime); - } + }*/ } diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java index beda191194..d27c1b817e 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java @@ -1,39 +1,45 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ +/* +* ============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.requestsdb; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import java.sql.Timestamp; - -import org.junit.After; -import org.junit.Before; import org.junit.Test; public class WatchdogServiceModVerIdLookupTest { - - WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup; + + WatchdogServiceModVerIdLookup wsmil=new WatchdogServiceModVerIdLookup(); + Timestamp time=new Timestamp(10); + @Test + public void test(){ + wsmil.setCreateTime(time); + wsmil.setDistributionId("distributionId"); + wsmil.setServiceModelVersionId("serviceModelVersionId"); + + assertEquals(wsmil.getCreateTime(),time); + assertEquals(wsmil.getDistributionId(), "distributionId"); + assertEquals(wsmil.getServiceModelVersionId(), "serviceModelVersionId"); + } +} +/*WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup; protected String _distributionId; protected String _serviceModelVersionId; @@ -58,9 +64,9 @@ public class WatchdogServiceModVerIdLookupTest { _watchdogServiceModVerIdLookup = null; } - /** + *//** * Test of getDistributionId method - */ + *//* @Test public void testGetDistributionId() { _watchdogServiceModVerIdLookup.setDistributionId(_distributionId); @@ -68,18 +74,18 @@ public class WatchdogServiceModVerIdLookupTest { } - /** + *//** * Test setDistributionId method - */ + *//* @Test public void testSetDistributionId() { _watchdogServiceModVerIdLookup.setDistributionId(_distributionId); verify(_watchdogServiceModVerIdLookup).setDistributionId(_distributionId); } - /** + *//** * Test of getServiceModelVersionId method - */ + *//* @Test public void testGetServiceModelVersionId() { _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId); @@ -87,18 +93,18 @@ public class WatchdogServiceModVerIdLookupTest { } - /** + *//** * Test setServiceModelVersionId method - */ + *//* @Test public void testSetServiceModelVersionId() { _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId); verify(_watchdogServiceModVerIdLookup).setServiceModelVersionId(_serviceModelVersionId); } - /** + *//** * Test of getCreateTime method - */ + *//* @Test public void testGetCreateTime() { _watchdogServiceModVerIdLookup.setCreateTime(_createTime); @@ -106,13 +112,13 @@ public class WatchdogServiceModVerIdLookupTest { } - /** + *//** * Test setCreateTime method - */ + *//* @Test public void testSetCreateTime() { _watchdogServiceModVerIdLookup.setCreateTime(_createTime); verify(_watchdogServiceModVerIdLookup).setCreateTime(_createTime); } -}
\ No newline at end of file +}*/
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java index 0cd9487527..a0af4b2300 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java @@ -1,93 +1,93 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
-
-public class AllottedResource extends MavenLikeVersioning implements Serializable {
-
- private static final long serialVersionUID = 768026109321305392L;
-
- private String modelUuid;
- private String modelInvariantUuid;
- private String modelVersion;
- private String modelName;
- private String toscaNodeType;
- private String subcategory;
- private String description;
- private Timestamp created;
-
- public AllottedResource() {
- }
-
- public String getModelUuid() {
- return this.modelUuid;
- }
- public void setModelUuid(String modelUuid) {
- this.modelUuid = modelUuid;
- }
- public String getModelInvariantUuid() {
- return this.modelInvariantUuid;
- }
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
- public String getModelVersion() {
- return this.modelVersion;
- }
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
- public String getModelName() {
- return this.modelName;
- }
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
- public String getToscaNodeType() {
- return this.toscaNodeType;
- }
- public void setToscaNodeType(String toscaNodeType) {
- this.toscaNodeType = toscaNodeType;
- }
- public String getSubcategory() {
- return this.subcategory;
- }
- public void setSubcategory(String subcategory) {
- this.subcategory = subcategory;
- }
- public String getDescription() {
- return this.description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public Timestamp getCreated() {
- return created;
- }
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class AllottedResource extends MavenLikeVersioning implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + private String modelUuid = null; + private String modelInvariantUuid = null; + private String modelVersion = null; + private String modelName = null; + private String toscaNodeType = null; + private String subcategory = null; + private String description = null; + private Timestamp created = null; + + public AllottedResource() { + } + + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + public String getModelInvariantUuid() { + return this.modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersion() { + return this.modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + public String getModelName() { + return this.modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getToscaNodeType() { + return this.toscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + public String getSubcategory() { + return this.subcategory; + } + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + public String getDescription() { + return this.description; + } + public void setDescription(String description) { + this.description = description; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java index 2dcc2e8e6e..e5a653760b 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java @@ -29,21 +29,21 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement private static final long serialVersionUID = 768026109321305392L; - private String modelCustomizationUuid; - private String arModelUuid; - private Timestamp created; - private String modelInstanceName; - private String providingServiceModelInvariantUuid; - private String targetNetworkRole; - private String nfFunction; - private String nfType; - private String nfRole; - private String nfNamingCode; + private String modelCustomizationUuid = null; + private String arModelUuid = null; + private Timestamp created = null; + private String modelInstanceName = null; + private String providingServiceModelInvariantUuid = null; + private String targetNetworkRole = null; + private String nfFunction = null; + private String nfType = null; + private String nfRole = null; + private String nfNamingCode = null; private Integer minInstances; private Integer maxInstances; - private AllottedResource ar = null; - private String providingServiceModelUuid; - private String providingServiceModelName; + private AllottedResource allottedResource = null; + private String providingServiceModelUuid = null; + private String providingServiceModelName = null; public AllottedResourceCustomization() { super(); @@ -77,10 +77,10 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement this.modelInstanceName = modelInstanceName; } public AllottedResource getAllottedResource() { - return this.ar; + return this.allottedResource; } public void setAllottedResource(AllottedResource ar) { - this.ar = ar; + this.allottedResource = ar; } public String getProvidingServiceModelInvariantUuid() { return this.providingServiceModelInvariantUuid; @@ -149,7 +149,7 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement ",modelInstanceName=" + this.modelInstanceName + ",modelInstanceName=" + this.modelInstanceName + ",created=" + this.created + - ",ar=" + this.ar; + ",ar=" + this.allottedResource; } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java index e22d1eb036..d3532886d5 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java @@ -25,7 +25,7 @@ import java.io.Serializable; public class ArRecipe extends Recipe implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String modelName; + private String modelName = null; public ArRecipe() {} public String getModelName() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index fcd9211ec6..899127c048 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java @@ -30,13 +30,13 @@ public class HeatEnvironment extends MavenLikeVersioning implements Serializable private static final long serialVersionUID = 768026109321305392L; - private String artifactUuid; + private String artifactUuid = null; private String name = null; private String description = null; private String environment = null; - private String artifactChecksum; + private String artifactChecksum = null; - private Timestamp created; + private Timestamp created = null; public HeatEnvironment() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index ec429c896e..8d7da22673 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -30,13 +30,13 @@ public class HeatFiles extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String artifactUuid; + private String artifactUuid = null; private String description = null; - private String fileName; - private String fileBody; - private Timestamp created; - private String version; - private String artifactChecksum; + private String fileName = null; + private String fileBody = null; + private Timestamp created = null; + private String version = null; + private String artifactChecksum = null; public HeatFiles() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java index df067445f6..1fff17612e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java @@ -23,11 +23,15 @@ package org.openecomp.mso.db.catalog.beans; import java.io.Serializable; +import com.openpojo.business.annotation.BusinessKey; + public class HeatNestedTemplate implements Serializable { - private String parentTemplateId; - private String childTemplateId; - private String providerResourceFile; + @BusinessKey + private String parentTemplateId = null; + @BusinessKey + private String childTemplateId = null; + private String providerResourceFile = null; public static final long serialVersionUID = -1322322139926390329L; public HeatNestedTemplate () { @@ -91,7 +95,15 @@ public class HeatNestedTemplate implements Serializable { // hash code does not have to be a unique result - only that two objects that should be treated as equal // return the same value. so this should work. int result; - result = this.parentTemplateId.hashCode() + this.childTemplateId.hashCode(); + int parentTemplateIdHash = 0; + int childTemplateIdHash = 0; + if (this.parentTemplateId != null) { + parentTemplateIdHash = this.parentTemplateId.hashCode(); + } + if (this.childTemplateId != null) { + childTemplateIdHash = this.childTemplateId.hashCode(); + } + result = parentTemplateIdHash + childTemplateIdHash; return result; } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java index 03813a7299..c6386efdd6 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java @@ -31,17 +31,17 @@ public class HeatTemplate extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String artifactUuid; - private String templateName; + private String artifactUuid = null; + private String templateName = null; private String templateBody = null; private int timeoutMinutes; private Set <HeatTemplateParam> parameters; private Set <HeatNestedTemplate> files; - private String description; - private String asdcUuid; - private String artifactChecksum; + private String description = null; + private String asdcUuid = null; + private String artifactChecksum = null; - private Timestamp created; + private Timestamp created = null; public enum TemplateStatus { PARENT, CHILD, PARENT_COMPLETE diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java index f6202b7365..9bfc41b675 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java @@ -1,76 +1,80 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-
-// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring
-public class HeatTemplateArtifactUuidModelUuid implements Serializable {
-
- private String heatTemplateArtifactUuid;
- private String modelUuid;
- public static final long serialVersionUID = -1322322139926390329L;
-
- public HeatTemplateArtifactUuidModelUuid() {
- }
-
- public String getHeatTemplateArtifactUuid() {
- return this.heatTemplateArtifactUuid;
- }
- public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
- this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
- }
- public String getModelUuid() {
- return this.modelUuid;
- }
- public void setModelUuid(String modelUuid) {
- this.modelUuid = modelUuid;
- }
-
- @Override
- public String toString() {
- return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid;
- }
-
- @Override
- public boolean equals (Object o) {
- if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o;
- if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid())
- && htaumu.getModelUuid().equals(this.getModelUuid())) {
- return true;
- }
- return false;
- }
-
- @Override
- public int hashCode () {
- // hash code does not have to be a unique result - only that two objects that should be treated as equal
- // return the same value. so this should work.
- return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; + +import com.openpojo.business.annotation.BusinessKey; + +// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring +public class HeatTemplateArtifactUuidModelUuid implements Serializable { + + @BusinessKey + private String heatTemplateArtifactUuid = null; + @BusinessKey + private String modelUuid = null; + public static final long serialVersionUID = -1322322139926390329L; + + public HeatTemplateArtifactUuidModelUuid() { + } + + public String getHeatTemplateArtifactUuid() { + return this.heatTemplateArtifactUuid; + } + public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) { + this.heatTemplateArtifactUuid = heatTemplateArtifactUuid; + } + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + @Override + public String toString() { + return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid; + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) { + return false; + } + if (this == o) { + return true; + } + HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o; + if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) + && htaumu.getModelUuid().equals(this.getModelUuid())) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java index 7ceb19c5a0..7f7dd2b4c6 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java @@ -22,13 +22,19 @@ package org.openecomp.mso.db.catalog.beans; import java.io.Serializable; +import org.apache.commons.lang3.builder.EqualsBuilder; + +import com.openpojo.business.annotation.BusinessKey; + public class HeatTemplateParam implements Serializable { - private String heatTemplateArtifactUuid; - private String paramName; + @BusinessKey + private String heatTemplateArtifactUuid = null; + @BusinessKey + private String paramName = null; private boolean required; - private String paramType; - private String paramAlias; + private String paramType = null; + private String paramAlias = null; public static final long serialVersionUID = -1322322139926390329L; public HeatTemplateParam() {} @@ -71,21 +77,16 @@ public class HeatTemplateParam implements Serializable { public String toString () { return "Param=" + paramName + ",type=" + paramType + ",required=" + required + ",paramAlias=" + paramAlias + ", heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid; } - - @Override - public boolean equals (Object o) { - if (!(o instanceof HeatTemplateParam)) { - return false; - } - if (this == o) { - return true; - } - HeatTemplateParam htp = (HeatTemplateParam) o; - if (htp.getHeatTemplateArtifactUuid().equals(this.heatTemplateArtifactUuid) && htp.getParamName().equalsIgnoreCase(this.paramName)) { - return true; - } - return false; - } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatTemplateParam)) { + return false; + } + HeatTemplateParam castOther = (HeatTemplateParam) other; + return new EqualsBuilder().append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid) + .append(paramName, castOther.paramName).isEquals(); + } @Override public int hashCode () { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java index 96e6c616bf..5cd6b58aee 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java @@ -31,14 +31,14 @@ public class Model extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; private int id; - private String modelCustomizationId; - private String modelCustomizationName; - private String modelInvariantId; - private String modelName; - private String modelType; - private String modelVersion; - private String modelVersionId; - private Timestamp created; + private String modelCustomizationId = null; + private String modelCustomizationName = null; + private String modelInvariantId = null; + private String modelName = null; + private String modelType = null; + private String modelVersion = null; + private String modelVersionId = null; + private Timestamp created = null; private Map<String,ServiceRecipe> recipes; /** diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java index 7ef5a4a7b9..4ba35f7f42 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -31,13 +31,13 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable { private int id; private Integer modelId; - private String action; - private String schemaVersion; - private String description; - private String orchestrationUri; - private String modelParamXSD; + private String action = null; + private String schemaVersion = null; + private String description = null; + private String orchestrationUri = null; + private String modelParamXSD = null; private Integer recipeTimeout; - private Timestamp created; + private Timestamp created = null; /** * @return the id @@ -169,12 +169,12 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ModelRecipe: "); - sb.append("modelId=").append(modelId.toString()); + sb.append("modelId=").append(modelId); sb.append(",action=").append(action); sb.append(",schemaVersion=").append(schemaVersion); sb.append(",orchestrationUri=").append(orchestrationUri); sb.append(",modelParamXSD=").append(modelParamXSD); - sb.append(",recipeTimeout=").append(recipeTimeout.toString()); + sb.append(",recipeTimeout=").append(recipeTimeout); if (created != null) { sb.append (",created="); sb.append (DateFormat.getInstance().format(created)); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java index eeaa363aa6..d10b633557 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java @@ -25,7 +25,7 @@ import java.io.Serializable; public class NetworkRecipe extends Recipe implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String modelName; + private String modelName = null; public NetworkRecipe() {} public String getModelName() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java index 025b13b708..d4e1ec536a 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java @@ -35,15 +35,15 @@ public class NetworkResource extends MavenLikeVersioning implements Serializable private String neutronNetworkType = null; private String aicVersionMin = null; private String aicVersionMax = null; - private String modelName; - private String modelInvariantUUID; - private String modelVersion; - private String toscaNodeType; - private Timestamp created; - private String modelUUID; - private String category; - private String subCategory; - private String heatTemplateArtifactUUID; + private String modelName = null; + private String modelInvariantUUID = null; + private String modelVersion = null; + private String toscaNodeType = null; + private Timestamp created = null; + private String modelUUID = null; + private String category = null; + private String subCategory = null; + private String heatTemplateArtifactUUID = null; public NetworkResource() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java index b581545182..f1d5d4f003 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java @@ -20,20 +20,25 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; + +import com.openpojo.business.annotation.BusinessKey; + import java.io.Serializable; public class NetworkResourceCustomization implements Serializable{ // modelCustomizationUuid and networkResourceModelUuid form a composite primary key + @BusinessKey private String modelCustomizationUuid = null; + @BusinessKey private String networkResourceModelUuid = null; public static final long serialVersionUID = -1322322139926390329L; - private String modelInstanceName; - private Timestamp created; - private String networkTechnology; + private String modelInstanceName = null; + private Timestamp created = null; + private String networkTechnology = null; private String networkType = null; - private String networkScope; - private String networkRole; + private String networkScope = null; + private String networkRole = null; // These fields are not in the table directly - but I'm adding them here for storage in the objects we're dealing with private NetworkResource networkResource = null; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java index 58c24412dc..3f2093b7e2 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java @@ -32,13 +32,13 @@ public class Recipe extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; private int id; - protected String action; - private String description; - protected String orchestrationUri; + protected String action = null; + private String description = null; + protected String orchestrationUri = null; private int recipeTimeout; - private String serviceType; - private String paramXSD; - private Timestamp created; + private String serviceType = null; + private String paramXSD = null; + private Timestamp created = null; public Recipe () { super (); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java index 37cad254ba..620c6bb17c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java @@ -20,32 +20,34 @@ package org.openecomp.mso.db.catalog.beans; -import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; - import java.io.Serializable; import java.sql.Timestamp; import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + public class Service extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String modelName; - private String description; - private String modelUUID; - private String modelInvariantUUID; - private Timestamp created; - private String toscaCsarArtifactUUID; - private String modelVersion; - private String category; - private String serviceType; - private String serviceRole; - private String environmentContext; - private String workloadContext; - private Map<String,ServiceRecipe> recipes; - private Set<ServiceToResourceCustomization> serviceResourceCustomizations; + private String modelName = null; + private String description = null; + private String modelUUID = null; + private String modelInvariantUUID = null; + private Timestamp created = null; + private String toscaCsarArtifactUUID = null; + private String modelVersion = null; + private String category = null; + private String serviceType = null; + private String serviceRole = null; + private String environmentContext = null; + private String workloadContext = null; + private Map<String,ServiceRecipe> recipes = new HashMap<>(); + private Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>(); public Service() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java index 78f94e40c1..d199671621 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java @@ -19,11 +19,9 @@ */ package org.openecomp.mso.db.catalog.beans; -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.VnfResource; -import org.openecomp.mso.db.catalog.beans.VfModule; import java.io.Serializable; import java.util.ArrayList; +import java.util.List; /* * A simple holder for Service and its associated elements: @@ -35,17 +33,17 @@ public class ServiceMacroHolder implements Serializable { private static final long serialVersionUID = 768026109321305392L; private Service service; - private ArrayList<VnfResource> vnfResources; - private ArrayList<NetworkResourceCustomization> networkResourceCustomizations; - private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations; - private ArrayList<VnfResourceCustomization> vnfResourceCustomizations; + private List<VnfResource> vnfResources; + private List<NetworkResourceCustomization> networkResourceCustomization; + private List<AllottedResourceCustomization> allottedResourceCustomization; + private List<VnfResourceCustomization> vnfResourceCustomizations; public ServiceMacroHolder() { super(); this.service = null; this.vnfResources = new ArrayList<>(); - this.networkResourceCustomizations = new ArrayList<>(); - this.allottedResourceCustomizations = new ArrayList<>(); + this.networkResourceCustomization = new ArrayList<>(); + this.allottedResourceCustomization = new ArrayList<>(); this.vnfResourceCustomizations = new ArrayList<>(); } public ServiceMacroHolder(Service service) { @@ -60,10 +58,10 @@ public class ServiceMacroHolder implements Serializable { this.service = service; } - public void setVnfResources(ArrayList<VnfResource> vnfResources) { + public void setVnfResources(List<VnfResource> vnfResources) { this.vnfResources = vnfResources; } - public ArrayList<VnfResource> getVnfResources() { + public List<VnfResource> getVnfResources() { return this.vnfResources; } public void addVnfResource(VnfResource vr) { @@ -77,10 +75,10 @@ public class ServiceMacroHolder implements Serializable { } } - public void setVnfResourceCustomizations(ArrayList<VnfResourceCustomization> vnfResourceCustomizations) { + public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) { this.vnfResourceCustomizations = vnfResourceCustomizations; } - public ArrayList<VnfResourceCustomization> getVnfResourceCustomizations() { + public List<VnfResourceCustomization> getVnfResourceCustomizations() { return this.vnfResourceCustomizations; } public void addVnfResourceCustomizations(VnfResourceCustomization vrc) { @@ -94,33 +92,33 @@ public class ServiceMacroHolder implements Serializable { } } - public void setNetworkResourceCustomization(ArrayList<NetworkResourceCustomization> networkResourceCustomizations) { - this.networkResourceCustomizations = networkResourceCustomizations; + public void setNetworkResourceCustomization(List<NetworkResourceCustomization> networkResourceCustomizations) { + this.networkResourceCustomization = networkResourceCustomizations; } - public ArrayList<NetworkResourceCustomization> getNetworkResourceCustomization() { - return this.networkResourceCustomizations; + public List<NetworkResourceCustomization> getNetworkResourceCustomization() { + return this.networkResourceCustomization; } - public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) { - if (this.networkResourceCustomizations != null) { - this.networkResourceCustomizations.add(nrc); + public void addNetworkResourceCustomizations(NetworkResourceCustomization nrc) { + if (this.networkResourceCustomization != null) { + this.networkResourceCustomization.add(nrc); } else { - this.networkResourceCustomizations = new ArrayList<>(); - this.networkResourceCustomizations.add(nrc); + this.networkResourceCustomization = new ArrayList<>(); + this.networkResourceCustomization.add(nrc); } } - public void setAllottedResourceCustomization(ArrayList<AllottedResourceCustomization> allottedResourceCustomizations) { - this.allottedResourceCustomizations = allottedResourceCustomizations; + public void setAllottedResourceCustomization(List<AllottedResourceCustomization> allottedResourceCustomizations) { + this.allottedResourceCustomization = allottedResourceCustomizations; } - public ArrayList<AllottedResourceCustomization> getAllottedResourceCustomization() { - return this.allottedResourceCustomizations; + public List<AllottedResourceCustomization> getAllottedResourceCustomization() { + return this.allottedResourceCustomization; } public void addAllottedResourceCustomization(AllottedResourceCustomization arc) { - if (this.allottedResourceCustomizations != null) { - this.allottedResourceCustomizations.add(arc); + if (this.allottedResourceCustomization != null) { + this.allottedResourceCustomization.add(arc); } else { - this.allottedResourceCustomizations = new ArrayList<>(); - this.allottedResourceCustomizations.add(arc); + this.allottedResourceCustomization = new ArrayList<>(); + this.allottedResourceCustomization.add(arc); } } @@ -151,17 +149,17 @@ public class ServiceMacroHolder implements Serializable { } else { sb.append("none"); } - if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) { + if (this.networkResourceCustomization != null && this.networkResourceCustomization.size() > 0) { int i=0; sb.append("NetworkResourceCustomizations:"); - for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) { + for (NetworkResourceCustomization nrc : this.networkResourceCustomization) { sb.append("NRC[").append(i++).append("]: ").append(nrc.toString()); } } - if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) { + if (this.allottedResourceCustomization != null && this.allottedResourceCustomization.size() > 0) { int i=0; sb.append("AllottedResourceCustomizations:"); - for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) { + for (AllottedResourceCustomization arc : this.allottedResourceCustomization) { sb.append("ARC[").append(i++).append("]: ").append(arc.toString()); } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java index 303570a8d0..d0bc9b33f7 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java @@ -33,14 +33,14 @@ public class ServiceRecipe extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; private int id; - private String serviceModelUUID; - private String action; - private String description; - private String orchestrationUri; - private String serviceParamXSD; + private String serviceModelUUID = null; + private String action = null; + private String description = null; + private String orchestrationUri = null; + private String serviceParamXSD = null; private int recipeTimeout; private Integer serviceTimeoutInterim; - private Timestamp created; + private Timestamp created = null; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java index 6515a12bc0..2ac71f4ddf 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java @@ -22,11 +22,15 @@ package org.openecomp.mso.db.catalog.beans; import java.io.Serializable; import java.sql.Timestamp; +import com.openpojo.business.annotation.BusinessKey; + public class ServiceToAllottedResources implements Serializable { - private String serviceModelUuid; - private String arModelCustomizationUuid; - private Timestamp created; + @BusinessKey + private String serviceModelUuid = null; + @BusinessKey + private String arModelCustomizationUuid = null; + private Timestamp created = null; public static final long serialVersionUID = -1322322139926390329L; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java index 69dc32796f..3894b4f7b5 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java @@ -22,13 +22,17 @@ package org.openecomp.mso.db.catalog.beans; import java.io.Serializable; import java.sql.Timestamp; +import com.openpojo.business.annotation.BusinessKey; + public class ServiceToNetworks implements Serializable { // This maps to SERVICE.SERVICE_NAME_VERSION_ID / Service.serviceNameVersionId in SERVICE/Service table - private String serviceModelUuid; + @BusinessKey + private String serviceModelUuid = null; // This maps to NETWORK_RESOURCE_CUSTOMIZATION.MODEL_CUSTOMIZATION_UUID / NetworkResourceCustomization.ModelCustomizationUuid - private String networkModelCustomizationUuid; - private Timestamp created; + @BusinessKey + private String networkModelCustomizationUuid = null; + private Timestamp created = null; public static final long serialVersionUID = -1322322139926390329L; public ServiceToNetworks() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java index 6d74ab38aa..3babe4ad23 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java @@ -1,111 +1,110 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.text.DateFormat;
-
-public class ServiceToResourceCustomization implements Serializable {
-
- private static final long serialVersionUID = 768026109321305392L;
-
- private String modelType;
- private String serviceModelUUID;
- private Timestamp created;
- private String resourceModelCustomizationUUID;
-
- public ServiceToResourceCustomization() {}
-
- public String getServiceModelUUID() {
- return serviceModelUUID;
- }
-
- public void setServiceModelUUID(String serviceModelUUID) {
- this.serviceModelUUID = serviceModelUUID;
- }
-
- public String getModelType() {
- return modelType;
- }
-
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
- public Timestamp getCreated() {
- return created;
- }
-
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
- public String getResourceModelCustomizationUUID() {
- return resourceModelCustomizationUUID;
- }
-
- public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {
- this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof ServiceToResourceCustomization)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- ServiceToResourceCustomization strc = (ServiceToResourceCustomization) o;
- if (strc.getServiceModelUUID().equals(this.getServiceModelUUID())
- && strc.getResourceModelCustomizationUUID().equals(this.getResourceModelCustomizationUUID())
- && strc.getModelType().equals(this.getModelType())) {
- return true;
- }
- return false;
-
- }
-
- @Override
- public int hashCode() {
-
- int code = this.modelType == null ? 0 : this.modelType.hashCode();
- code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();
- code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();
-
- return code;
-
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")
- .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);
- if (created != null) {
- sb.append (",created=");
- sb.append (DateFormat.getInstance().format(created));
- }
- return sb.toString();
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.text.DateFormat; + +import org.apache.commons.lang3.builder.EqualsBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +public class ServiceToResourceCustomization implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + private String modelType = null; + @BusinessKey + private String serviceModelUUID = null; + private Timestamp created = null; + @BusinessKey + private String resourceModelCustomizationUUID = null; + + public ServiceToResourceCustomization() {} + + public String getServiceModelUUID() { + return serviceModelUUID; + } + + public void setServiceModelUUID(String serviceModelUUID) { + this.serviceModelUUID = serviceModelUUID; + } + + public String getModelType() { + return modelType; + } + + public void setModelType(String modelType) { + this.modelType = modelType; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getResourceModelCustomizationUUID() { + return resourceModelCustomizationUUID; + } + + public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) { + this.resourceModelCustomizationUUID = resourceModelCustomizationUUID; + } + + + @Override + public boolean equals (final Object other) { + if (!(other instanceof ServiceToResourceCustomization)) { + return false; + } + ServiceToResourceCustomization castOther = (ServiceToResourceCustomization) other; + return new EqualsBuilder().append(modelType, castOther.modelType) + .append(serviceModelUUID, castOther.serviceModelUUID) + .append(resourceModelCustomizationUUID, castOther.resourceModelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + + int code = this.modelType == null ? 0 : this.modelType.hashCode(); + code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode(); + code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode(); + + return code; + + }@Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=") + .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java index 3ef7e6e237..6fd6e3e6ae 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java @@ -1,96 +1,100 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-
-public class TempNetworkHeatTemplateLookup implements Serializable {
-
- private String networkResourceModelName;
- private String heatTemplateArtifactUuid;
- private String aicVersionMin;
- private String aicVersionMax;
- public static final long serialVersionUID = -1322322139926390329L;
-
- public TempNetworkHeatTemplateLookup() {
- super();
- }
-
- public String getNetworkResourceModelName() {
- return this.networkResourceModelName;
- }
- public void setNetworkResourceModelName(String networkResourceModelName) {
- this.networkResourceModelName = networkResourceModelName;
- }
-
- public String getHeatTemplateArtifactUuid() {
- return this.heatTemplateArtifactUuid;
- }
- public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
- this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
- }
- public String getAicVersionMin() {
- return this.aicVersionMin;
- }
-
- public void setAicVersionMin(String aicVersionMin) {
- this.aicVersionMin = aicVersionMin;
- }
-
- public String getAicVersionMax() {
- return this.aicVersionMax;
- }
-
- public void setAicVersionMax(String aicVersionMax) {
- this.aicVersionMax = aicVersionMax;
- }
-
- @Override
- public String toString() {
- return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" +
- this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax;
- }
-
- @Override
- public boolean equals (Object o) {
- if (!(o instanceof TempNetworkHeatTemplateLookup)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o;
- if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) {
- return true;
- }
- return false;
- }
-
- @Override
- public int hashCode () {
- // hash code does not have to be a unique result - only that two objects that should be treated as equal
- // return the same value. so this should work.
- int result;
- result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);
- return result;
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; + +import com.openpojo.business.annotation.BusinessKey; + +public class TempNetworkHeatTemplateLookup implements Serializable { + + @BusinessKey + private String networkResourceModelName = null; + @BusinessKey + private String heatTemplateArtifactUuid = null; + private String aicVersionMin = null; + private String aicVersionMax = null; + public static final long serialVersionUID = -1322322139926390329L; + + public TempNetworkHeatTemplateLookup() { + super(); + } + + public String getNetworkResourceModelName() { + return this.networkResourceModelName; + } + public void setNetworkResourceModelName(String networkResourceModelName) { + this.networkResourceModelName = networkResourceModelName; + } + + public String getHeatTemplateArtifactUuid() { + return this.heatTemplateArtifactUuid; + } + public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) { + this.heatTemplateArtifactUuid = heatTemplateArtifactUuid; + } + public String getAicVersionMin() { + return this.aicVersionMin; + } + + public void setAicVersionMin(String aicVersionMin) { + this.aicVersionMin = aicVersionMin; + } + + public String getAicVersionMax() { + return this.aicVersionMax; + } + + public void setAicVersionMax(String aicVersionMax) { + this.aicVersionMax = aicVersionMax; + } + + @Override + public String toString() { + return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" + + this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax; + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof TempNetworkHeatTemplateLookup)) { + return false; + } + if (this == o) { + return true; + } + TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o; + if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + int result; + result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0); + return result; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java index 591e648a33..92d02d8a11 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java @@ -1,115 +1,116 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.util.Set;
-
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
-
-public class ToscaCsar extends MavenLikeVersioning implements Serializable {
-
- private static final long serialVersionUID = 768026109321305392L;
-
- private String artifactUUID;
- private String name;
- private String artifactChecksum;
- private String url;
- private String description;
- private Timestamp created;
- private Set<Service> services;
-
- public ToscaCsar() { }
-
- public String getArtifactUUID() {
- return artifactUUID;
- }
-
- public void setArtifactUUID(String artifactUUID) {
- this.artifactUUID = artifactUUID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getArtifactChecksum() {
- return artifactChecksum;
- }
-
- public void setArtifactChecksum(String artifactChecksum) {
- this.artifactChecksum = artifactChecksum;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Timestamp getCreated() {
- return created;
- }
-
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
- public Set<Service> getServices() {
- return services;
- }
-
- public void setServices(Set<Service> services) {
- this.services = services;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=")
- .append(version).append(",description=").append(description).append(",artifactChecksum=")
- .append(artifactChecksum).append(",url=").append(url);
- for (Service service : services) {
- sb.append("\n").append(service.toString());
- }
- if (created != null) {
- sb.append (",created=");
- sb.append (DateFormat.getInstance().format(created));
- }
- return sb.toString();
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.util.HashSet; +import java.util.Set; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class ToscaCsar extends MavenLikeVersioning implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + private String artifactUUID = null; + private String name = null; + private String artifactChecksum = null; + private String url = null; + private String description = null; + private Timestamp created = null; + private Set<Service> services = new HashSet<>(); + + public ToscaCsar() { } + + public String getArtifactUUID() { + return artifactUUID; + } + + public void setArtifactUUID(String artifactUUID) { + this.artifactUUID = artifactUUID; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + public Set<Service> getServices() { + return services; + } + + public void setServices(Set<Service> services) { + this.services = services; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=") + .append(version).append(",description=").append(description).append(",artifactChecksum=") + .append(artifactChecksum).append(",url=").append(url); + for (Service service : services) { + sb.append("\n").append(service.toString()); + } + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java index cd2821a7b0..ec3bc7fefb 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java @@ -32,16 +32,16 @@ public class VfModule extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String modelInvariantUUID; - private String modelName; - private String modelVersion; - private String description; + private String modelInvariantUUID = null; + private String modelName = null; + private String modelVersion = null; + private String description = null; private int isBase; - private String heatTemplateArtifactUUId; - private String volHeatTemplateArtifactUUId; - private Timestamp created; - private String modelUUID; - private String vnfResourceModelUUId; + private String heatTemplateArtifactUUId = null; + private String volHeatTemplateArtifactUUId = null; + private Timestamp created = null; + private String modelUUID = null; + private String vnfResourceModelUUId = null; public VfModule() { super(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java index db3a2664a8..5b3dec4700 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java @@ -1,151 +1,155 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-public class VfModuleCustomization implements Serializable {
-
- private String modelCustomizationUuid;
- private String vfModuleModelUuid;
- private String label;
- private Integer minInstances;
- private Integer maxInstances;
- private Integer initialCount;
- private Integer availabilityZoneCount;
- private String heatEnvironmentArtifactUuid;
- private String volEnvironmentArtifactUuid;
- private Timestamp created;
- private VfModule vfModule;
- public static final long serialVersionUID = -1322322139926390329L;
-
- public VfModuleCustomization() {
- super();
- }
-
- public String getModelCustomizationUuid() {
- return this.modelCustomizationUuid;
- }
- public void setModelCustomizationUuid(String modelCustomizationUuid) {
- this.modelCustomizationUuid = modelCustomizationUuid;
- }
- public String getVfModuleModelUuid() {
- return this.vfModuleModelUuid;
- }
- public void setVfModuleModelUuid(String vfModuleModelUuid) {
- this.vfModuleModelUuid = vfModuleModelUuid;
- }
- public String getHeatEnvironmentArtifactUuid() {
- return this.heatEnvironmentArtifactUuid;
- }
- public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) {
- this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid;
- }
- public String getVolEnvironmentArtifactUuid() {
- return this.volEnvironmentArtifactUuid;
- }
- public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) {
- this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid;
- }
-
- public Integer getMinInstances() {
- return this.minInstances;
- }
- public void setMinInstances(Integer minInstances) {
- this.minInstances = minInstances;
- }
- public Integer getMaxInstances() {
- return this.maxInstances;
- }
- public void setMaxInstances(Integer maxInstances) {
- this.maxInstances = maxInstances;
- }
- public Integer getInitialCount() {
- return this.initialCount;
- }
- public void setInitialCount(Integer initialCount) {
- this.initialCount = initialCount;
- }
- public Integer getAvailabilityZoneCount() {
- return this.availabilityZoneCount;
- }
- public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
- this.availabilityZoneCount = availabilityZoneCount;
- }
- public Timestamp getCreated() {
- return created;
- }
- public void setCreated(Timestamp created) {
- this.created = created;
- }
- public String getLabel() {
- return this.label;
- }
- public void setLabel(String label) {
- this.label = label;
- }
- public VfModule getVfModule() {
- return this.vfModule;
- }
- public void setVfModule(VfModule vfModule) {
- this.vfModule = vfModule;
- }
-
- @Override
- public String toString() {
- return "modelCustomizationUuid=" + this.modelCustomizationUuid +
- "vfModuleModelUuid=" + this.vfModuleModelUuid +
- "label=" + this.label +
- "initalCount=" + this.initialCount +
- "minInstances=" + this.minInstances +
- "maxInstances=" + this.maxInstances +
- "availabilityZoneCount=" + this.availabilityZoneCount +
- "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid +
- "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid +
- "created=" + this.created;
- }
-
- @Override
- public boolean equals (Object o) {
- if (!(o instanceof VfModuleCustomization)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- VfModuleCustomization vfmc = (VfModuleCustomization) o;
- if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) {
- return true;
- }
- return false;
- }
-
- @Override
- public int hashCode () {
- // hash code does not have to be a unique result - only that two objects that should be treated as equal
- // return the same value. so this should work.
- int result = 0;
- result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0);
- return result;
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.openpojo.business.annotation.BusinessKey; + +public class VfModuleCustomization implements Serializable { + + @BusinessKey + private String modelCustomizationUuid = null; + @BusinessKey + private String vfModuleModelUuid = null; + private String label = null; + private Integer minInstances; + private Integer maxInstances; + private Integer initialCount; + private Integer availabilityZoneCount; + private String heatEnvironmentArtifactUuid = null; + private String volEnvironmentArtifactUuid = null; + private Timestamp created = null; + private VfModule vfModule; + public static final long serialVersionUID = -1322322139926390329L; + + public VfModuleCustomization() { + super(); + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getVfModuleModelUuid() { + return this.vfModuleModelUuid; + } + public void setVfModuleModelUuid(String vfModuleModelUuid) { + this.vfModuleModelUuid = vfModuleModelUuid; + } + public String getHeatEnvironmentArtifactUuid() { + return this.heatEnvironmentArtifactUuid; + } + public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) { + this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid; + } + public String getVolEnvironmentArtifactUuid() { + return this.volEnvironmentArtifactUuid; + } + public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) { + this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid; + } + + public Integer getMinInstances() { + return this.minInstances; + } + public void setMinInstances(Integer minInstances) { + this.minInstances = minInstances; + } + public Integer getMaxInstances() { + return this.maxInstances; + } + public void setMaxInstances(Integer maxInstances) { + this.maxInstances = maxInstances; + } + public Integer getInitialCount() { + return this.initialCount; + } + public void setInitialCount(Integer initialCount) { + this.initialCount = initialCount; + } + public Integer getAvailabilityZoneCount() { + return this.availabilityZoneCount; + } + public void setAvailabilityZoneCount(Integer availabilityZoneCount) { + this.availabilityZoneCount = availabilityZoneCount; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + public String getLabel() { + return this.label; + } + public void setLabel(String label) { + this.label = label; + } + public VfModule getVfModule() { + return this.vfModule; + } + public void setVfModule(VfModule vfModule) { + this.vfModule = vfModule; + } + + @Override + public String toString() { + return "modelCustomizationUuid=" + this.modelCustomizationUuid + + "vfModuleModelUuid=" + this.vfModuleModelUuid + + "label=" + this.label + + "initalCount=" + this.initialCount + + "minInstances=" + this.minInstances + + "maxInstances=" + this.maxInstances + + "availabilityZoneCount=" + this.availabilityZoneCount + + "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid + + "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid + + "created=" + this.created; + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof VfModuleCustomization)) { + return false; + } + if (this == o) { + return true; + } + VfModuleCustomization vfmc = (VfModuleCustomization) o; + if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + int result = 0; + result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0); + return result; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java index 611604e830..3796650364 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java @@ -26,8 +26,8 @@ import java.io.Serializable; public class VfModuleToHeatFiles implements Serializable { - private String vfModuleModelUuid; - private String heatFilesArtifactUuid; + private String vfModuleModelUuid = null; + private String heatFilesArtifactUuid = null; public static final long serialVersionUID = -1322322139926390329L; public VfModuleToHeatFiles() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java index e1795e1b04..9b701df1d2 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java @@ -25,16 +25,20 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; import java.text.DateFormat; +import com.openpojo.business.annotation.BusinessKey; + import java.io.Serializable; public class VnfComponent implements Serializable { - private int vnfId; + @BusinessKey + private int vnfId; + @BusinessKey private String componentType = null; private Integer heatTemplateId; private Integer heatEnvironmentId; public static final long serialVersionUID = -1322322139926390329L; - private Timestamp created; + private Timestamp created = null; public VnfComponent() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java index 30a5133bd5..2240191d45 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java @@ -26,9 +26,9 @@ public class VnfComponentsRecipe extends Recipe implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String vnfType; - private String vnfComponentType; - private String vfModuleModelUUId; + private String vnfType = null; + private String vnfComponentType = null; + private String vfModuleModelUUId = null; public VnfComponentsRecipe() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java index 0dd38cbbc1..d94334c98d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java @@ -26,8 +26,8 @@ public class VnfRecipe extends Recipe implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String vnfType; - private String vfModuleId; + private String vnfType = null; + private String vfModuleId = null; public VnfRecipe() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java index fd1e6b67b8..6b1cb0a19c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java @@ -1,88 +1,92 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.db.catalog.beans;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-public class VnfResCustomToVfModuleCustom implements Serializable {
-
- private String vnfResourceCustModelCustomizationUuid;
- private String vfModuleCustModelCustomizationUuid;
- private Timestamp created;
-
- public static final long serialVersionUID = -1322322139926390329L;
-
-
- public VnfResCustomToVfModuleCustom() {
- super();
- }
- public String getVnfResourceCustModelCustomizationUuid() {
- return this.vnfResourceCustModelCustomizationUuid;
- }
- public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) {
- this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid;
- }
- public String getVfModuleCustModelCustomizationUuid() {
- return this.vfModuleCustModelCustomizationUuid;
- }
- public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) {
- this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid;
- }
- public Timestamp getCreated() {
- return created;
- }
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
- @Override
- public String toString() {
- return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid +
- "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created;
- }
-
- @Override
- public boolean equals (Object o) {
- if (!(o instanceof VnfResCustomToVfModuleCustom)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o;
- if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) {
- return true;
- }
- return false;
- }
-
- @Override
- public int hashCode () {
- // hash code does not have to be a unique result - only that two objects that should be treated as equal
- // return the same value. so this should work.
- int result = 0;
- result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0);
- return result;
- }
-
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.openpojo.business.annotation.BusinessKey; + +public class VnfResCustomToVfModuleCustom implements Serializable { + + @BusinessKey + private String vnfResourceCustModelCustomizationUuid = null; + @BusinessKey + private String vfModuleCustModelCustomizationUuid = null; + private Timestamp created = null; + + public static final long serialVersionUID = -1322322139926390329L; + + + public VnfResCustomToVfModuleCustom() { + super(); + } + public String getVnfResourceCustModelCustomizationUuid() { + return this.vnfResourceCustModelCustomizationUuid; + } + public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) { + this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid; + } + public String getVfModuleCustModelCustomizationUuid() { + return this.vfModuleCustModelCustomizationUuid; + } + public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) { + this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid + + "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created; + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof VnfResCustomToVfModuleCustom)) { + return false; + } + if (this == o) { + return true; + } + VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o; + if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + int result = 0; + result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0); + return result; + } + + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java index 806cbeb076..f8e6024e69 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java @@ -35,23 +35,22 @@ public class VnfResource extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private String modelUuid; - private String modelInvariantUuid; - private String modelName; - private String toscaNodeType; - private String description; - private String orchestrationMode; - private String aicVersionMin; - private String aicVersionMax; - private String category; - private String subCategory; - private String heatTemplateArtifactUUId; - private Timestamp created; - private String modelVersion; - private Set<VnfResourceCustomization> vnfResourceCustomizations; - private Set<VfModule> vfModules; - private List<VfModule> vfModuleList; - private List<VfModuleCustomization> vfModuleCustomizations; + private String modelUuid = null; + private String modelInvariantUuid = null; + private String modelName = null; + private String toscaNodeType = null; + private String description = null; + private String orchestrationMode = null; + private String aicVersionMin = null; + private String aicVersionMax = null; + private String category = null; + private String subCategory = null; + private String heatTemplateArtifactUUId = null; + private Timestamp created = null; + private String modelVersion = null; + private Set<VnfResourceCustomization> vnfResourceCustomizations = new HashSet<>(); + private Set<VfModule> vfModules = new HashSet<>(); + private List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>(); public VnfResource () { } @@ -197,7 +196,7 @@ public class VnfResource extends MavenLikeVersioning implements Serializable { public List<VfModuleCustomization> getVfModuleCustomizations() { return this.vfModuleCustomizations == null ? new ArrayList<>() : this.vfModuleCustomizations; } - public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) { + public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) { this.vfModuleCustomizations = vfModuleCustomizations; } public void addVfModuleCustomization(VfModuleCustomization vfmc) { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java index 64c031397f..e510ee867d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java @@ -32,19 +32,19 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser private static final long serialVersionUID = 768026109321305392L; private String modelCustomizationUuid = null; - private String modelInstanceName; - private Timestamp created; + private String modelInstanceName = null; + private Timestamp created = null; private String vnfResourceModelUuid = null; - private String vnfResourceModelUUID; + private String vnfResourceModelUUID = null; private Integer minInstances; private Integer maxInstances; private Integer availabilityZoneMaxCount; private VnfResource vnfResource; - private String nfFunction; - private String nfType; - private String nfRole; - private String nfNamingCode; - private String multiStageDesign; + private String nfFunction = null; + private String nfType = null; + private String nfRole = null; + private String nfNamingCode = null; + private String multiStageDesign = null; private List<VfModuleCustomization> vfModuleCustomizations; private Set<ServiceToResourceCustomization> serviceResourceCustomizations; @@ -154,7 +154,7 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser public List<VfModuleCustomization> getVfModuleCustomizations() { return this.vfModuleCustomizations; } - public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) { + public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) { this.vfModuleCustomizations = vfModuleCustomizations; } public void addVfModuleCustomization(VfModuleCustomization vfmc) { diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java new file mode 100644 index 0000000000..57bf292dd8 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 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.db.catalog.beans; + +import static org.hamcrest.CoreMatchers.isA; +import static org.mockito.Matchers.eq; + +import org.hamcrest.CoreMatchers; +import org.hamcrest.Matcher; +import org.junit.Test; +import org.openecomp.mso.openpojo.rules.EqualsAndHashCodeTester; +import org.openecomp.mso.openpojo.rules.HasToStringRule; +import org.openecomp.mso.openpojo.rules.ToStringTester; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterEnum; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BeansTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + + @Test + public void pojoStructure() { + test("org.openecomp.mso.db.catalog.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new HasToStringRule()) + + + .with(new SetterTester()) + .with(new GetterTester()) + .with(new ToStringTester()) + .with(new EqualsAndHashCodeTester().onlyDeclaredMethods()) + .build(); + + + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); + } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java index 0e3492170e..c819079a40 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java @@ -40,7 +40,7 @@ public class ServiceMacroHolderTest { assertTrue(serviceMacroHolder.getService() == null); serviceMacroHolder.addVnfResource(new VnfResource()); serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization()); - serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization()); + serviceMacroHolder.addNetworkResourceCustomizations(new NetworkResourceCustomization()); serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization()); assertTrue(serviceMacroHolder != null); } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java index 05e857f178..162073cc76 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java @@ -113,7 +113,7 @@ public class ToStringTest { smh.setNetworkResourceCustomization(networkResourceCustomizations); NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - smh.addNetworkResourceCustomization(nrc); + smh.addNetworkResourceCustomizations(nrc); ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>(); smh.setAllottedResourceCustomization(allottedResourceCustomizations); |