diff options
34 files changed, 1294 insertions, 557 deletions
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-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..c4aebf9717 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java @@ -0,0 +1,57 @@ +/*- + * ============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/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/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/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/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/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 2d0e9ee621..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 @@ -705,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()
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/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java index 3c35fed516..b182192257 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; @@ -34,20 +37,38 @@ import javax.ws.rs.core.UriInfo; 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.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.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<NetworkMsoInfraRequest> mockMsoRequest; + 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 +84,127 @@ 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; + } + }; + + mockMsoRequest = new MockUp<NetworkMsoInfraRequest>() { + @Mock + public void createRequestRecord (Status status) { + return; + } + }; + + 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(); + mockMsoRequest.tearDown(); + mockCDB.tearDown(); + mockCamundaClient.tearDown(); + } @Test public void manageVnfRequestTest(){ 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(){ 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(){ 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 manageNetworkRequestTestV3Duplicate(){ + + MockUp<RequestsDatabase> mockDuplicate = new MockUp<RequestsDatabase>() { + @Mock + public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType) { + return new InfraActiveRequests(); + } + }; + + try { + Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); + Response resp = handler.manageNetworkRequest(REQ_XML, "v3"); + assertTrue(null != resp); + } finally { + mockDuplicate.tearDown(); + } + }*/ @Test public void manageVnfRequestTestInvalidVersion(){ - Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249"); + Response resp = handler.manageNetworkRequest(REQ_XML, "v249"); assertTrue(null != resp); } @@ -102,7 +219,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/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 |