2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.tosca.datatypes.model;
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.openecomp.sdc.tosca.services.YamlUtil;
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
34 * @since September 07, 2016.
36 public class RequirementDefinitionTest {
39 public void cloneTest() {
40 RequirementDefinition reqDef1 = new RequirementDefinition();
41 reqDef1.setNode("node1");
42 reqDef1.setRelationship("my Relationship");
43 reqDef1.setCapability("capabilities");
44 reqDef1.setOccurrences(new Object[]{1, 1});
46 RequirementDefinition reqDef2 = reqDef1.clone();
47 NodeType nodeType = new NodeType();
49 List<Map<String, RequirementDefinition>> requirements = new ArrayList<>();
50 Map<String, RequirementDefinition> reqMap1 = new HashMap<>();
51 reqMap1.put("req1", reqDef1);
52 requirements.add(reqMap1);
53 Map<String, RequirementDefinition> reqMap2 = new HashMap<>();
54 reqMap2.put("req2", reqDef2);
55 requirements.add(reqMap2);
56 nodeType.setRequirements(requirements);
58 String yamlString = new YamlUtil().objectToYaml(nodeType);
59 Boolean passResult = !yamlString.contains("&") && !yamlString.contains("*");
60 Assert.assertEquals(true, passResult);