aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace
diff options
context:
space:
mode:
authorMurali Mohan Murthy Potham <murali.p@huawei.com>2017-10-13 04:40:37 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-13 04:40:37 +0000
commit69a9d350fd9cf1d0f494ad9ebb8cd40dd18fb714 (patch)
tree05a8fb98659eaced0c4af4bbacd430b7a78d9a44 /vnfmarket-be/vnf-sdk-marketplace
parent580a25e38b1c6d37979abb75e793a7888eacf865 (diff)
parent916a1cec4f97d4ca9e8a1b337ab2f9f3c8fcb380 (diff)
Merge "modify filemanage unit test"
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java (renamed from vnfmarket-be/vnf-sdk-marketplace/src/test/filemanage/FileManageTest.java)48
1 files changed, 20 insertions, 28 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/filemanage/FileManageTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java
index 2fbaf756..901251c3 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/filemanage/FileManageTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java
@@ -58,14 +58,17 @@ public class FileManageTest {
}
@Before
- public void createTestFile()
+ public void createTestFile() throws IOException
{
- String srcPath = "./srcPathForTest";
- String dstPath = "./dstPathForTest";
+ String srcPath = "." + File.separator + "srcPathForTest";
+ String dstPath = "." + File.separator + "dstPathForTest";
+ String testFilePath = srcPath + File.separator + "fileForTest";
File src = new File(srcPath);
File dst = new File(dstPath);
+ File testFile = new File(testFilePath);
src.mkdir();
dst.mkdir();
+ testFile.createNewFile();
}
@Test
@@ -76,23 +79,17 @@ public class FileManageTest {
return FileManagerType.http;
}
};
-
- FileManager ManagerImpl = FileManagerFactory.createFileManager();
- String srcPath = "./srcPathForTest";
new MockUp<ToolUtil>() {
@Mock
private String getHttpServerAbsolutePath() {
- return null;
- }
- };
- new MockUp<ToolUtil>() {
- @Mock
- private boolean deleteDir(File dir) {
- return true;
+ return "";
}
};
- assertEquals(ManagerImpl.delete(srcPath), true);
+ FileManager ManagerImpl = FileManagerFactory.createFileManager();
+ String dstPath = "./dstPathForTest";
+
+ assertEquals(ManagerImpl.delete(dstPath), true);
}
@Test
@@ -103,28 +100,23 @@ public class FileManageTest {
return FileManagerType.http;
}
};
-
- FileManager ManagerImpl = FileManagerFactory.createFileManager();
- String srcPath = "./srcPathForTest";
- String dstPath = "./dstPathForTest";
new MockUp<ToolUtil>() {
@Mock
private String getHttpServerAbsolutePath() {
- return null;
- }
- };
- new MockUp<ToolUtil>() {
- @Mock
- private boolean copyDirectory(String srcDirName, String destDirName, boolean overlay) {
- return true;
+ return "";
}
};
+
+ FileManager ManagerImpl = FileManagerFactory.createFileManager();
+ String srcPath = "./srcPathForTest";
+ String dstPath = "./dstPathForTest";
+
assertEquals(ManagerImpl.upload(srcPath, dstPath), true);
- File src = new File(srcPath);
- if (src.exists())
+ File srcDir = new File(srcPath);
+ if (srcDir.exists())
{
- src.delete();
+ ManagerImpl.delete(srcPath);
}
assertEquals(ManagerImpl.upload(srcPath, dstPath), false);