2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 package org.onap.clamp.clds.model.prop;
26 import org.onap.clamp.clds.transform.TransformUtil;
27 import org.junit.Assert;
28 import org.junit.Test;
30 import java.io.IOException;
33 * Test org.onap.clamp.ClampDesigner.model.prop package using ModelProperties.
35 public class ModelPropertiesTest {
38 public void testJsonParse() throws IOException {
39 String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
40 String modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
41 String modName = "example-model-name";
42 String controlName = "example-control-name";
44 ModelProperties prop = new ModelProperties(modName, controlName, null, modelBpmnProp, modelProp);
45 Assert.assertEquals(modName, prop.getModelName());
46 Assert.assertEquals(controlName, prop.getControlName());
47 Assert.assertEquals(null, prop.getActionCd());
49 Global g = prop.getGlobal();
50 Assert.assertEquals("df6fcd2b-1932-429e-bb13-0cd0d32113cb", g.getService());
51 Assert.assertEquals("[SNDGCA64, ALPRGAED]", g.getLocation().toString());
52 Assert.assertEquals("[4b49acee-cf70-4b20-b956-a4fe0c1a8239]", g.getResourceVf().toString());
54 Collector c = prop.getCollector();
55 Assert.assertEquals("Collector_", c.getId());
56 Assert.assertEquals("DCAE-COLLECTOR-UCSNMP", c.getTopicPublishes());
58 StringMatch sm = prop.getStringMatch();
59 Assert.assertEquals("StringMatch_", sm.getId());
60 Assert.assertEquals("DCAE-CL-EVENT", sm.getTopicPublishes());
62 Policy p = prop.getPolicy();
63 Assert.assertEquals("Policy_", p.getId());
64 Assert.assertEquals(null, p.getTopicPublishes());
65 Assert.assertEquals("DCAE-CL-EVENT", p.getTopicSubscribes());
66 Assert.assertEquals(500, p.getTimeout().intValue());
68 Tca t = prop.getTca();
69 Assert.assertEquals("Narra", t.getTcaItems().get(0).getTcaName());
70 Assert.assertEquals(Integer.valueOf(4), t.getTcaItems().get(0).getTcaThreshholds().get(0).getThreshhold());