package org.gcube.data.access.fs; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Collections; import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.UserInfo; import org.gcube.common.authorization.library.utils.Caller; import org.gcube.common.storagehub.model.items.nodes.Content; import org.gcube.common.storagehub.model.storages.MetaInfo; import org.gcube.common.storagehub.model.storages.StorageBackend; import org.gcube.data.access.storagehub.storage.backend.impl.DefaultGcubeMinIoStorageBackendFactory; import org.junit.Assert; import org.junit.Test; public class StorageTest { @Test public void testS3() throws Exception{ try { AuthorizationProvider.instance.set(new Caller(new UserInfo("testUser", Collections.emptyList()), "")); DefaultGcubeMinIoStorageBackendFactory factory = new DefaultGcubeMinIoStorageBackendFactory(); factory.init(); File file = new File("/home/lucio/Downloads/lombok.jar"); InputStream stream = new FileInputStream(file); Assert.assertNotNull(stream); StorageBackend sb = factory.create(null); Assert.assertNotNull(sb); MetaInfo inof = sb.upload(stream, "/path", "uploadTest", file.length()); Content content = new Content(); content.setStorageId(inof.getStorageId()); sb.onDelete(content); }catch (Exception e) { e.printStackTrace(); throw e; } } }