diff options
author | YuanHu <yuan.hu1@zte.com.cn> | 2018-02-07 16:46:51 +0800 |
---|---|---|
committer | YuanHu <yuan.hu1@zte.com.cn> | 2018-02-07 16:46:51 +0800 |
commit | 97f57847360ecabcde9200a17db9d527671c7dc3 (patch) | |
tree | b84a0a1b049a7856e5db15694f250a473f4f5b5f /sdc-workflow-designer-server/src/test/java | |
parent | ad71da0a315d7f4516825c0cb7b39a1216d8a4fd (diff) |
Provide the rest api of saving workflow data.
Save temporary files to local.
Issue-ID: SDC-1004
Change-Id: I09f52cdf4ff39e103b7f75041e070c4148b23e07
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src/test/java')
-rw-r--r-- | sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java new file mode 100644 index 00000000..b8d4319c --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ + +package org.onap.sdc.workflowdesigner.utils; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class FileCommonUtilsTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + /** + * Test method for + * {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(String, String)} . + */ + @Test + public final void writeStringString() { + String fileName = "test.json"; + String content = "{\"aaa\": \"节点\"}"; + + try { + FileCommonUtils.write(fileName, content); + String s = FileCommonUtils.readString(fileName); + assertEquals(s, content); + } catch (IOException e) { + } + } + + /** + * Test method for + * {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#writetoAbsoluteFile(String, String, String)} + * . + */ + @Test + public final void saveFileStringStringString() { + String fileName = "test1.json"; + String content = "{\"aaa\": \"节点\"}"; + + try { + FileCommonUtils.writetoAbsoluteFile(".", fileName, content); + String s = FileCommonUtils.readString(fileName); + assertEquals(s, content); + } catch (IOException e) { + } + } + +} |