mirror of https://github.com/apache/jclouds.git
removed unused imports, variables, printlns, commented out code
This commit is contained in:
parent
227611d599
commit
96e7abe865
|
@ -112,7 +112,6 @@ import org.jclouds.logging.Logger;
|
||||||
* @author Alfredo "Rainbowbreeze" Morresi
|
* @author Alfredo "Rainbowbreeze" Morresi
|
||||||
*/
|
*/
|
||||||
public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
|
public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
|
||||||
private static final String BACK_SLASH = "\\";
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
|
@ -46,9 +46,6 @@ public class FilesystemBlobStorePropertiesBuilder extends PropertiesBuilder {
|
||||||
properties.setProperty(PROPERTY_IDENTITY, System.getProperty("user.name"));
|
properties.setProperty(PROPERTY_IDENTITY, System.getProperty("user.name"));
|
||||||
properties.setProperty(PROPERTY_USER_THREADS, "0");
|
properties.setProperty(PROPERTY_USER_THREADS, "0");
|
||||||
properties.setProperty(PROPERTY_IO_WORKER_THREADS, "0");
|
properties.setProperty(PROPERTY_IO_WORKER_THREADS, "0");
|
||||||
|
|
||||||
System.out.println("Properties:"+properties );
|
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,12 @@ import com.google.inject.Scopes;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.ConcurrentMap;
|
|
||||||
import org.jclouds.blobstore.AsyncBlobStore;
|
import org.jclouds.blobstore.AsyncBlobStore;
|
||||||
import org.jclouds.blobstore.BlobStore;
|
import org.jclouds.blobstore.BlobStore;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.attr.ConsistencyModel;
|
import org.jclouds.blobstore.attr.ConsistencyModel;
|
||||||
import org.jclouds.blobstore.config.BlobStoreMapModule;
|
import org.jclouds.blobstore.config.BlobStoreMapModule;
|
||||||
import org.jclouds.blobstore.config.BlobStoreObjectModule;
|
import org.jclouds.blobstore.config.BlobStoreObjectModule;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
|
||||||
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
|
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
|
||||||
import org.jclouds.blobstore.util.BlobUtils;
|
import org.jclouds.blobstore.util.BlobUtils;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
@ -64,29 +61,12 @@ public class FilesystemBlobStoreContextModule extends AbstractModule {
|
||||||
bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class);
|
bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Provides
|
|
||||||
@Singleton
|
|
||||||
Set<Location> provideLocations(Location defaultLocation) {
|
|
||||||
return ImmutableSet.of(defaultLocation);
|
|
||||||
}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
BlobStore provide(FilesystemBlobStore in) {
|
BlobStore provide(FilesystemBlobStore in) {
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Provides
|
|
||||||
@Singleton
|
|
||||||
Location provideDefaultLocation() {
|
|
||||||
return new LocationImpl(LocationScope.PROVIDER, "filesystem", "filesystem", null);
|
|
||||||
}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Supplier<Set<? extends Location>> provideLocations(Supplier<Location> defaultLocation) {
|
Supplier<Set<? extends Location>> provideLocations(Supplier<Location> defaultLocation) {
|
||||||
|
|
|
@ -234,6 +234,9 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy
|
||||||
File containerFile = openFolder(container);
|
File containerFile = openFolder(container);
|
||||||
final int containerPathLenght = containerFile.getAbsolutePath().length() + 1;
|
final int containerPathLenght = containerFile.getAbsolutePath().length() + 1;
|
||||||
Set<String> blobNames = new HashSet<String>() {
|
Set<String> blobNames = new HashSet<String>() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3152191346558570795L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(String e) {
|
public boolean add(String e) {
|
||||||
return super.add(e.substring(containerPathLenght));
|
return super.add(e.substring(containerPathLenght));
|
||||||
|
|
|
@ -64,8 +64,6 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
= "src/main/resources/logging.properties";
|
= "src/main/resources/logging.properties";
|
||||||
|
|
||||||
private static final String PROVIDER = "filesystem";
|
private static final String PROVIDER = "filesystem";
|
||||||
private static final String KEY1 = "";
|
|
||||||
private static final String KEY2 = "";
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -80,14 +78,6 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
/* Enumeration<String> 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
|
//create context for filesystem container
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
|
prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
|
||||||
|
@ -126,7 +116,7 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
//no base directory declared in properties
|
//no base directory declared in properties
|
||||||
try {
|
try {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
BlobStoreContext testContext = (BlobStoreContext) new BlobStoreContextFactory().createContext(
|
new BlobStoreContextFactory().createContext(
|
||||||
PROVIDER, props);
|
PROVIDER, props);
|
||||||
fail("No error if base directory is not specified");
|
fail("No error if base directory is not specified");
|
||||||
} catch (CreationException e) {
|
} catch (CreationException e) {
|
||||||
|
@ -136,7 +126,7 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
try {
|
try {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null);
|
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null);
|
||||||
BlobStoreContext testContext = (BlobStoreContext) new BlobStoreContextFactory().createContext(
|
new BlobStoreContextFactory().createContext(
|
||||||
PROVIDER, props);
|
PROVIDER, props);
|
||||||
fail("No error if base directory is null in the option");
|
fail("No error if base directory is null in the option");
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
@ -147,11 +137,11 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
* Test of list method of the root context
|
* Test of list method of the root context
|
||||||
*/
|
*/
|
||||||
public void testList_Root() throws IOException {
|
public void testList_Root() throws IOException {
|
||||||
PageSet<StorageMetadata> containersRetrieved;
|
PageSet<? extends StorageMetadata> containersRetrieved;
|
||||||
Set<String> containersCreated = new HashSet<String>();
|
Set<String> containersCreated = new HashSet<String>();
|
||||||
|
|
||||||
// Testing list with no containers
|
// Testing list with no containers
|
||||||
containersRetrieved = (PageSet<StorageMetadata>) blobStore.list();
|
containersRetrieved = blobStore.list();
|
||||||
assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
|
assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
|
||||||
|
|
||||||
// Testing list with some containers
|
// Testing list with some containers
|
||||||
|
@ -162,7 +152,7 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
containersCreated.add(containerName);
|
containersCreated.add(containerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
containersRetrieved = (PageSet<StorageMetadata>) blobStore.list();
|
containersRetrieved = blobStore.list();
|
||||||
assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container");
|
assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container");
|
||||||
|
|
||||||
for(StorageMetadata data:containersRetrieved) {
|
for(StorageMetadata data:containersRetrieved) {
|
||||||
|
@ -177,7 +167,7 @@ public class FilesystemAsyncBlobStoreTest {
|
||||||
//delete all creaded containers
|
//delete all creaded containers
|
||||||
blobStore.deleteContainer(containerName);
|
blobStore.deleteContainer(containerName);
|
||||||
}
|
}
|
||||||
containersRetrieved = (PageSet<StorageMetadata>) blobStore.list();
|
containersRetrieved = blobStore.list();
|
||||||
assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
|
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<String> expectedBlobKeys) {
|
private void checkForContainerContent(final String containerName, Set<String> expectedBlobKeys) {
|
||||||
ListContainerOptions options = ListContainerOptions.Builder.recursive();
|
ListContainerOptions options = ListContainerOptions.Builder.recursive();
|
||||||
|
|
||||||
PageSet<StorageMetadata> blobsRetrieved = (PageSet<StorageMetadata>) blobStore.list(containerName, options);
|
PageSet<? extends StorageMetadata> blobsRetrieved = blobStore.list(containerName, options);
|
||||||
|
|
||||||
//nothing expected
|
//nothing expected
|
||||||
if (null == expectedBlobKeys) {
|
if (null == expectedBlobKeys) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||||
import org.jclouds.io.payloads.FilePayload;
|
import org.jclouds.io.payloads.FilePayload;
|
||||||
import org.testng.annotations.*;
|
import org.testng.annotations.*;
|
||||||
|
@ -387,7 +386,7 @@ public class FilesystemStorageStrategyImplTest {
|
||||||
public void testWritePayloadOnFile_SourceFileDoesntExist() {
|
public void testWritePayloadOnFile_SourceFileDoesntExist() {
|
||||||
File sourceFile = new File("asdfkjsadkfjasdlfasdflk.asdfasdfas");
|
File sourceFile = new File("asdfkjsadkfjasdlfasdflk.asdfasdfas");
|
||||||
try {
|
try {
|
||||||
FilePayload filePayload = new FilePayload(sourceFile);
|
new FilePayload(sourceFile);
|
||||||
fail("Exception not throwed");
|
fail("Exception not throwed");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,6 @@ public class TestUtils {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Set<String> createBlobsInContainer(String containerName, String[] blobNames) throws IOException {
|
public static Set<String> createBlobsInContainer(String containerName, String[] blobNames) throws IOException {
|
||||||
boolean result;
|
|
||||||
|
|
||||||
Set<String> blobNamesCreatedInContainer = new HashSet<String>();
|
Set<String> blobNamesCreatedInContainer = new HashSet<String>();
|
||||||
for (String blobName : blobNames) {
|
for (String blobName : blobNames) {
|
||||||
createBlobAsFile(containerName, blobName, getImageForBlobPayload());
|
createBlobAsFile(containerName, blobName, getImageForBlobPayload());
|
||||||
|
|
Loading…
Reference in New Issue