From a8b19d9cc2c5d948822b5c0e1c6d660086668983 Mon Sep 17 00:00:00 2001 From: Bon-Yong Lee Date: Tue, 23 Oct 2012 17:37:58 +0900 Subject: [PATCH] [Title] Enhance test case [Desc.] [Issue] --- .../tizen/common/file/ClasspathFileHandler.java | 101 +++++++++++++++++++++ .../org/tizen/common/file/VirtualFileHandler.java | 1 + .../src/org/tizen/common/util/EFSUtilTest.java | 11 ++- .../src/org/tizen/common/util/ImageUtilTest.java | 10 +- .../org/tizen/common/util/url/cp/HandlerTest.java | 14 +-- 5 files changed, 123 insertions(+), 14 deletions(-) create mode 100755 org.tizen.common/src/org/tizen/common/file/ClasspathFileHandler.java mode change 100644 => 100755 org.tizen.common/test/src/org/tizen/common/util/EFSUtilTest.java mode change 100644 => 100755 org.tizen.common/test/src/org/tizen/common/util/ImageUtilTest.java mode change 100644 => 100755 org.tizen.common/test/src/org/tizen/common/util/url/cp/HandlerTest.java diff --git a/org.tizen.common/src/org/tizen/common/file/ClasspathFileHandler.java b/org.tizen.common/src/org/tizen/common/file/ClasspathFileHandler.java new file mode 100755 index 0000000..5b6be8e --- /dev/null +++ b/org.tizen.common/src/org/tizen/common/file/ClasspathFileHandler.java @@ -0,0 +1,101 @@ +package org.tizen.common.file; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; + +public class +ClasspathFileHandler +extends AbstractFileHandler +{ + protected String cwd; + + @Override + public String getCurrentWorkingDirectory() + { + return cwd; + } + + @Override + public void setCurrentWorkingDirectory(String cwd) + { + this.cwd = cwd; + } + + @Override + public void makeDirectory(String path) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void moveDirectory(String source, String target) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void copyDirectory(String source, String target) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeDirectory(String path) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public Collection list(String path) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void write(String path, InputStream out) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public InputStream read(String path) throws IOException + { + // TODO Auto-generated method stub + return null; + } + + @Override + public void moveFile(String source, String target) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void copyFile(String source, String target) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeFile(String path) throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public Object get(String path, Attribute name) throws IOException + { + // TODO Auto-generated method stub + return null; + } + + @Override + public void set(String path, Attribute name, Object value) + throws IOException + { + // TODO Auto-generated method stub + + } + +} diff --git a/org.tizen.common/src/org/tizen/common/file/VirtualFileHandler.java b/org.tizen.common/src/org/tizen/common/file/VirtualFileHandler.java index 92ebb3f..7cf2c9b 100755 --- a/org.tizen.common/src/org/tizen/common/file/VirtualFileHandler.java +++ b/org.tizen.common/src/org/tizen/common/file/VirtualFileHandler.java @@ -613,6 +613,7 @@ extends AbstractFileHandler ) throws IOException { + logger.trace( "Read {}", path ); final File file = getFile( path ); if ( file instanceof Directory ) { diff --git a/org.tizen.common/test/src/org/tizen/common/util/EFSUtilTest.java b/org.tizen.common/test/src/org/tizen/common/util/EFSUtilTest.java old mode 100644 new mode 100755 index 27097d2..7ca9108 --- a/org.tizen.common/test/src/org/tizen/common/util/EFSUtilTest.java +++ b/org.tizen.common/test/src/org/tizen/common/util/EFSUtilTest.java @@ -94,10 +94,13 @@ public class EFSUtilTest { */ @After public void tearDown() { - if ( null == oldConfig ) { - System.getProperties().remove( PROP_PKG ); - } else { - System.setProperty( PROP_PKG, oldConfig ); + if ( null == oldConfig ) + { + System.clearProperty( "java.protocol.handler.pkgs" ); + } + else + { + System.setProperty( "java.protocol.handler.pkgs", oldConfig ); } } diff --git a/org.tizen.common/test/src/org/tizen/common/util/ImageUtilTest.java b/org.tizen.common/test/src/org/tizen/common/util/ImageUtilTest.java old mode 100644 new mode 100755 index 5894536..ceb5eff --- a/org.tizen.common/test/src/org/tizen/common/util/ImageUtilTest.java +++ b/org.tizen.common/test/src/org/tizen/common/util/ImageUtilTest.java @@ -92,12 +92,14 @@ public class ImageUtilTest ImageUtil.pluginSurrogate = null; ImageUtil.platformSurrogate = null; - if ( null == oldConfig ) + if ( null == oldConfig ) { - System.getProperties().remove( PROP_PKG ); - return ; + System.clearProperty( PROP_PKG ); + } + else + { + System.setProperty( PROP_PKG, oldConfig ); } - System.setProperty( PROP_PKG, oldConfig ); } /** diff --git a/org.tizen.common/test/src/org/tizen/common/util/url/cp/HandlerTest.java b/org.tizen.common/test/src/org/tizen/common/util/url/cp/HandlerTest.java old mode 100644 new mode 100755 index 34d0a33..d92218f --- a/org.tizen.common/test/src/org/tizen/common/util/url/cp/HandlerTest.java +++ b/org.tizen.common/test/src/org/tizen/common/util/url/cp/HandlerTest.java @@ -74,12 +74,14 @@ HandlerTest @After public void tearDown() { - if ( null == oldConfig ) - { - System.getProperties().remove( PROP_PKG ); - return ; - } - System.setProperty( PROP_PKG, oldConfig ); + if ( null == oldConfig ) + { + System.clearProperty( "java.protocol.handler.pkgs" ); + } + else + { + System.setProperty( "java.protocol.handler.pkgs", oldConfig ); + } } /** -- 2.7.4