aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be
diff options
context:
space:
mode:
Diffstat (limited to 'vnfmarket-be')
-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);