From 96e7abe865e493622c7dbf6cb2abdbfc4493db8d Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 1 Sep 2010 08:45:17 -0700 Subject: [PATCH] removed unused imports, variables, printlns, commented out code --- .../filesystem/FilesystemAsyncBlobStore.java | 1 - .../FilesystemBlobStorePropertiesBuilder.java | 3 --- .../FilesystemBlobStoreContextModule.java | 20 ---------------- .../utils/FilesystemStorageStrategyImpl.java | 5 +++- .../FilesystemAsyncBlobStoreTest.java | 24 ++++++------------- .../FilesystemStorageStrategyImplTest.java | 3 +-- .../jclouds/filesystem/utils/TestUtils.java | 2 -- 7 files changed, 12 insertions(+), 46 deletions(-) diff --git a/filesystem/src/main/java/org/jclouds/filesystem/FilesystemAsyncBlobStore.java b/filesystem/src/main/java/org/jclouds/filesystem/FilesystemAsyncBlobStore.java index 82182ee42c..9e4cce87c2 100644 --- a/filesystem/src/main/java/org/jclouds/filesystem/FilesystemAsyncBlobStore.java +++ b/filesystem/src/main/java/org/jclouds/filesystem/FilesystemAsyncBlobStore.java @@ -112,7 +112,6 @@ import org.jclouds.logging.Logger; * @author Alfredo "Rainbowbreeze" Morresi */ public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore { - private static final String BACK_SLASH = "\\"; @Resource protected Logger logger = Logger.NULL; diff --git a/filesystem/src/main/java/org/jclouds/filesystem/FilesystemBlobStorePropertiesBuilder.java b/filesystem/src/main/java/org/jclouds/filesystem/FilesystemBlobStorePropertiesBuilder.java index 903d461f6d..4798ed1f33 100644 --- a/filesystem/src/main/java/org/jclouds/filesystem/FilesystemBlobStorePropertiesBuilder.java +++ b/filesystem/src/main/java/org/jclouds/filesystem/FilesystemBlobStorePropertiesBuilder.java @@ -46,9 +46,6 @@ public class FilesystemBlobStorePropertiesBuilder extends PropertiesBuilder { properties.setProperty(PROPERTY_IDENTITY, System.getProperty("user.name")); properties.setProperty(PROPERTY_USER_THREADS, "0"); properties.setProperty(PROPERTY_IO_WORKER_THREADS, "0"); - - System.out.println("Properties:"+properties ); - return properties; } diff --git a/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java b/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java index 740c4dac18..cc19f21400 100644 --- a/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java +++ b/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java @@ -28,15 +28,12 @@ import com.google.inject.Scopes; import com.google.inject.Singleton; import com.google.inject.TypeLiteral; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import org.jclouds.blobstore.AsyncBlobStore; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.attr.ConsistencyModel; import org.jclouds.blobstore.config.BlobStoreMapModule; import org.jclouds.blobstore.config.BlobStoreObjectModule; -import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.internal.BlobStoreContextImpl; import org.jclouds.blobstore.util.BlobUtils; import org.jclouds.domain.Location; @@ -64,29 +61,12 @@ public class FilesystemBlobStoreContextModule extends AbstractModule { bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class); } - /* @Provides - @Singleton - Set provideLocations(Location defaultLocation) { - return ImmutableSet.of(defaultLocation); - } - * - */ - @Provides @Singleton BlobStore provide(FilesystemBlobStore in) { return in; } - /*@Provides - @Singleton - Location provideDefaultLocation() { - return new LocationImpl(LocationScope.PROVIDER, "filesystem", "filesystem", null); - } - * - */ - - @Provides @Singleton Supplier> provideLocations(Supplier defaultLocation) { diff --git a/filesystem/src/main/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImpl.java b/filesystem/src/main/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImpl.java index d1d2949d67..a565d1095a 100644 --- a/filesystem/src/main/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImpl.java +++ b/filesystem/src/main/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImpl.java @@ -234,7 +234,10 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy File containerFile = openFolder(container); final int containerPathLenght = containerFile.getAbsolutePath().length() + 1; Set blobNames = new HashSet() { - @Override + + private static final long serialVersionUID = 3152191346558570795L; + + @Override public boolean add(String e) { return super.add(e.substring(containerPathLenght)); } diff --git a/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java b/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java index 00d82bc336..9e2306da48 100644 --- a/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java +++ b/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java @@ -64,8 +64,6 @@ public class FilesystemAsyncBlobStoreTest { = "src/main/resources/logging.properties"; private static final String PROVIDER = "filesystem"; - private static final String KEY1 = ""; - private static final String KEY2 = ""; static { @@ -80,14 +78,6 @@ public class FilesystemAsyncBlobStoreTest { @BeforeMethod protected void setUp() throws Exception { -/* Enumeration loggerNames = LogManager.getLogManager().getLoggerNames(); - while(loggerNames.hasMoreElements()) { - String loggerName = loggerNames.nextElement(); - System.out.println("Logger "+loggerName); - System.out.println("Livello "+LogManager.getLogManager().getLogger(loggerName).getLevel()); - - }*/ - //create context for filesystem container Properties prop = new Properties(); prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR); @@ -126,7 +116,7 @@ public class FilesystemAsyncBlobStoreTest { //no base directory declared in properties try { Properties props = new Properties(); - BlobStoreContext testContext = (BlobStoreContext) new BlobStoreContextFactory().createContext( + new BlobStoreContextFactory().createContext( PROVIDER, props); fail("No error if base directory is not specified"); } catch (CreationException e) { @@ -136,7 +126,7 @@ public class FilesystemAsyncBlobStoreTest { try { Properties props = new Properties(); props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null); - BlobStoreContext testContext = (BlobStoreContext) new BlobStoreContextFactory().createContext( + new BlobStoreContextFactory().createContext( PROVIDER, props); fail("No error if base directory is null in the option"); } catch (NullPointerException e) { @@ -147,11 +137,11 @@ public class FilesystemAsyncBlobStoreTest { * Test of list method of the root context */ public void testList_Root() throws IOException { - PageSet containersRetrieved; + PageSet containersRetrieved; Set containersCreated = new HashSet(); // Testing list with no containers - containersRetrieved = (PageSet) blobStore.list(); + containersRetrieved = blobStore.list(); assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container"); // Testing list with some containers @@ -162,7 +152,7 @@ public class FilesystemAsyncBlobStoreTest { containersCreated.add(containerName); } - containersRetrieved = (PageSet) blobStore.list(); + containersRetrieved = blobStore.list(); assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container"); for(StorageMetadata data:containersRetrieved) { @@ -177,7 +167,7 @@ public class FilesystemAsyncBlobStoreTest { //delete all creaded containers blobStore.deleteContainer(containerName); } - containersRetrieved = (PageSet) blobStore.list(); + containersRetrieved = blobStore.list(); assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container"); } @@ -788,7 +778,7 @@ public class FilesystemAsyncBlobStoreTest { private void checkForContainerContent(final String containerName, Set expectedBlobKeys) { ListContainerOptions options = ListContainerOptions.Builder.recursive(); - PageSet blobsRetrieved = (PageSet) blobStore.list(containerName, options); + PageSet blobsRetrieved = blobStore.list(containerName, options); //nothing expected if (null == expectedBlobKeys) { diff --git a/filesystem/src/test/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImplTest.java b/filesystem/src/test/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImplTest.java index fd7ec1b453..a13f3b6c74 100644 --- a/filesystem/src/test/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImplTest.java +++ b/filesystem/src/test/java/org/jclouds/filesystem/utils/FilesystemStorageStrategyImplTest.java @@ -32,7 +32,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; -import org.apache.commons.io.FileUtils; import org.jclouds.blobstore.options.ListContainerOptions; import org.jclouds.io.payloads.FilePayload; import org.testng.annotations.*; @@ -387,7 +386,7 @@ public class FilesystemStorageStrategyImplTest { public void testWritePayloadOnFile_SourceFileDoesntExist() { File sourceFile = new File("asdfkjsadkfjasdlfasdflk.asdfasdfas"); try { - FilePayload filePayload = new FilePayload(sourceFile); + new FilePayload(sourceFile); fail("Exception not throwed"); } catch (Exception ex) { } diff --git a/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java b/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java index 0416ef0cd2..34b65f8e33 100644 --- a/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java +++ b/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java @@ -78,8 +78,6 @@ public class TestUtils { * @throws IOException */ public static Set createBlobsInContainer(String containerName, String[] blobNames) throws IOException { - boolean result; - Set blobNamesCreatedInContainer = new HashSet(); for (String blobName : blobNames) { createBlobAsFile(containerName, blobName, getImageForBlobPayload());