Merge "Reorder modifiers"
[so.git] / adapters / mso-adapter-utils / src / test / java / org / openecomp / mso / cloudify / beans / DeploymentInfoTest.java
1 /*\r
2 * ============LICENSE_START=======================================================\r
3 * ONAP : SO\r
4 * ================================================================================\r
5 * Copyright 2018 TechMahindra\r
6 *=================================================================================\r
7 * Licensed under the Apache License, Version 2.0 (the "License");\r
8 * you may not use this file except in compliance with the License.\r
9 * You may obtain a copy of the License at\r
10 *\r
11 *     http://www.apache.org/licenses/LICENSE-2.0\r
12 *\r
13 * Unless required by applicable law or agreed to in writing, software\r
14 * distributed under the License is distributed on an "AS IS" BASIS,\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 * See the License for the specific language governing permissions and\r
17 * limitations under the License.\r
18 * ============LICENSE_END=========================================================\r
19 */\r
20 \r
21 package org.openecomp.mso.cloudify.beans;\r
22 \r
23 import static org.mockito.Mockito.mock;\r
24 import java.util.HashMap;\r
25 import java.util.Map;\r
26 import org.junit.Test;\r
27 import org.mockito.Mock;\r
28 import org.openecomp.mso.cloudify.v3.model.Deployment;\r
29 import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs;\r
30 import org.openecomp.mso.cloudify.v3.model.Execution;\r
31 import org.powermock.api.mockito.PowerMockito;\r
32 \r
33 public class DeploymentInfoTest {\r
34     \r
35     @Mock\r
36     DeploymentStatus status;\r
37     \r
38     @Mock\r
39     DeploymentOutputs out;\r
40     \r
41     @Mock\r
42     Execution execution;\r
43     \r
44     @Mock\r
45     Deployment deployment;\r
46 \r
47     @Test\r
48     public void test() {\r
49         Deployment deployment=mock(Deployment.class);\r
50         Map<String,Object> dep=new HashMap();\r
51         Map<String,Object> outputs = new HashMap<String,Object>();\r
52         Map<String,Object> inputs = new HashMap<String,Object>();\r
53         inputs.put("id",dep);\r
54         status=DeploymentStatus.CREATED;\r
55         outputs.put("id", out);\r
56         dep.put("id", outputs);\r
57         DeploymentInfo dinfo=new DeploymentInfo(deployment);\r
58         DeploymentInfo dinfi=new DeploymentInfo("id");\r
59         DeploymentInfo din=new DeploymentInfo("id",outputs);\r
60         DeploymentInfo dfo=new DeploymentInfo("id", status);\r
61         DeploymentInfo dfoi=new DeploymentInfo(deployment, out, execution);\r
62         dinfo=PowerMockito.spy(new DeploymentInfo());\r
63         dinfo.setId("id");\r
64         dinfi.setInputs(inputs);\r
65         din.setStatus(status);\r
66         din.setOutputs(outputs); \r
67         assert(din.toString()!=null);\r
68         assert(din.getOutputs().equals(outputs));\r
69         assert(din.getId().equals("id"));\r
70         assert(din.getStatus().equals(status));\r
71         din.getLastAction();\r
72         din.getErrorMessage();\r
73         din.getActionStatus();\r
74     }\r
75 \r
76 }\r