summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.core
diff options
context:
space:
mode:
authorShireesh Anjal <shireesh@gluster.com>2011-06-09 19:46:40 +0530
committerShireesh Anjal <shireesh@gluster.com>2011-06-09 19:54:08 +0530
commit03deae0a3067483df28299d7690a10e182d1ef2f (patch)
tree9104e6ff0d2bd5642f65b1f2487bc3a6fb43dc37 /src/com.gluster.storage.management.core
parent81e667e15bb51c6f998050c5dee231fb433845c9 (diff)
SSL communication between console and gateway
Diffstat (limited to 'src/com.gluster.storage.management.core')
-rw-r--r--src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/TestFileUtil.java9
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java16
2 files changed, 6 insertions, 19 deletions
diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/TestFileUtil.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/TestFileUtil.java
index 8902ae8f..699346f7 100644
--- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/TestFileUtil.java
+++ b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/TestFileUtil.java
@@ -72,13 +72,4 @@ public class TestFileUtil {
assertTrue("File contents expected [" + fileContent + "], actual [" + readContent + "]",
readContent.equals(fileContent));
}
-
- /**
- * Test method for {@link com.gluster.storage.management.core.utils.FileUtil#loadResource(java.lang.String)}.
- */
- @Test
- public final void testLoadResource() {
- InputStream inputStream = fileUtil.loadResource("test/test.txt");
- Assert.assertNotNull(inputStream);
- }
}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java
index 8c77fbab..d93ab2fb 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java
@@ -30,7 +30,7 @@ import com.gluster.storage.management.core.constants.CoreConstants;
import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
public class FileUtil {
- public String readFileAsString(File file) {
+ public static String readFileAsString(File file) {
try {
return new String(readFileAsByteArray(file), CoreConstants.ENCODING_UTF8);
} catch (Exception e) {
@@ -39,7 +39,7 @@ public class FileUtil {
}
}
- public byte[] readFileAsByteArray(File file) throws FileNotFoundException, IOException {
+ public static byte[] readFileAsByteArray(File file) throws FileNotFoundException, IOException {
FileInputStream fileInputStream = new FileInputStream(file);
byte[] data = new byte[fileInputStream.available()];
fileInputStream.read(data);
@@ -47,11 +47,7 @@ public class FileUtil {
return data;
}
- public InputStream loadResource(String resourcePath) {
- return this.getClass().getClassLoader().getResourceAsStream(resourcePath);
- }
-
- public void createTextFile(String fileName, String contents) {
+ public static void createTextFile(String fileName, String contents) {
try {
FileWriter writer = new FileWriter(fileName);
writer.write(contents);
@@ -61,7 +57,7 @@ public class FileUtil {
}
}
- public String getTempDirName() {
+ public static String getTempDirName() {
return System.getProperty("java.io.tmpdir");
}
@@ -72,7 +68,7 @@ public class FileUtil {
* @return the new directory
* @throws IOException if there is an error creating the temporary directory
*/
- public File createTempDir()
+ public static File createTempDir()
{
final File sysTempDir = new File(getTempDirName());
File newTempDir;
@@ -111,7 +107,7 @@ public class FileUtil {
* the file or dir to delete
* @return true if all files are successfully deleted
*/
- public boolean recursiveDelete(File fileOrDir)
+ public static boolean recursiveDelete(File fileOrDir)
{
if(fileOrDir.isDirectory())
{