8458fc5e95f913f308a840f8f3cbdec6a581bc61
[sdc/sdc-workflow-designer.git] /
1 /**
2  * Copyright (c) 2018 ZTE Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the Apache License, Version 2.0
5  * and the Eclipse Public License v1.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     ZTE - initial API and implementation and/or initial documentation
11  */
12 package org.onap.sdc.workflowdesigner.resources.entity;
13
14 import static org.junit.Assert.*;
15
16 import java.util.HashMap;
17 import java.util.Map;
18
19 import org.junit.After;
20 import org.junit.Before;
21 import org.junit.Test;
22 import org.onap.sdc.workflowdesigner.utils.JsonUtils;
23
24 /**
25  *
26  */
27 public class ContentTest {
28
29   /**
30    * @throws java.lang.Exception
31    */
32   @Before
33   public void setUp() throws Exception {}
34
35   /**
36    * @throws java.lang.Exception
37    */
38   @After
39   public void tearDown() throws Exception {}
40
41   @Test
42   public void test() {
43 //    String clazz = "clazz";
44     String script = "script";
45     String scriptFormat = "scriptFormat";
46     Map<String, InputOutput> inputs = new HashMap<String, InputOutput>();
47     Map<String, InputOutput> outputs = new HashMap<String, InputOutput>();
48     
49     Content c = new Content();
50 //    c.setClass(clazz);
51     c.setInputs(inputs);
52     c.setOutputs(outputs);
53     c.setScript(script);
54     c.setScriptFormat(scriptFormat);
55     
56 //    assertEquals(clazz, c.getClazz());
57     assertEquals(inputs, c.getInputs());
58     assertEquals(outputs, c.getOutputs());
59     assertEquals(script, c.getScript());
60     assertEquals(scriptFormat, c.getScriptFormat());
61   }
62   
63   @Test
64   public void testGson() {
65     String json = "{\r\n" + 
66         "      \"class\": \"aaaa\",\r\n" + 
67         "      \"inputs\": {}\r\n" + 
68         "    }";
69     Content content = JsonUtils.fromJson(json, Content.class);
70     assertNotNull(content);
71   }
72
73 }