Search in sources :

Example 6 with StorageCategory

use of com.amplifyframework.storage.StorageCategory in project amplify-android by aws-amplify.

the class RxStorageBindingTest method createBindingInFrontOfMockPlugin.

/**
 * Creates a StorageCategory backed by a mock plugin. Uses this category
 * as a backing for an Rx Binding, under test.
 * @throws AmplifyException On failure to add plugin or config/init the storage category
 */
@Before
public void createBindingInFrontOfMockPlugin() throws AmplifyException {
    delegate = mock(StoragePlugin.class);
    when(delegate.getPluginKey()).thenReturn(RandomString.string());
    final StorageCategory storageCategory = new StorageCategory();
    storageCategory.addPlugin(delegate);
    storageCategory.configure(new StorageCategoryConfiguration(), mock(Context.class));
    storageCategory.initialize(mock(Context.class));
    rxStorage = new RxStorageBinding(storageCategory);
}
Also used : StorageCategoryConfiguration(com.amplifyframework.storage.StorageCategoryConfiguration) Context(android.content.Context) StorageCategory(com.amplifyframework.storage.StorageCategory) StoragePlugin(com.amplifyframework.storage.StoragePlugin) Before(org.junit.Before)

Aggregations

StorageCategory (com.amplifyframework.storage.StorageCategory)6 Context (android.content.Context)4 ApplicationProvider.getApplicationContext (androidx.test.core.app.ApplicationProvider.getApplicationContext)4 Credential (com.amplifyframework.storage.s3.UserCredentials.Credential)3 IdentityIdSource (com.amplifyframework.storage.s3.UserCredentials.IdentityIdSource)3 BeforeClass (org.junit.BeforeClass)3 AmplifyException (com.amplifyframework.AmplifyException)2 StorageCategoryConfiguration (com.amplifyframework.storage.StorageCategoryConfiguration)2 Before (org.junit.Before)2 TransferListener (com.amazonaws.mobileconnectors.s3.transferutility.TransferListener)1 TransferObserver (com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver)1 TransferState (com.amazonaws.mobileconnectors.s3.transferutility.TransferState)1 ObjectMetadata (com.amazonaws.services.s3.model.ObjectMetadata)1 CategoryConfiguration (com.amplifyframework.core.category.CategoryConfiguration)1 StorageException (com.amplifyframework.storage.StorageException)1 StorageItem (com.amplifyframework.storage.StorageItem)1 StoragePlugin (com.amplifyframework.storage.StoragePlugin)1 StorageDownloadFileResult (com.amplifyframework.storage.result.StorageDownloadFileResult)1 StorageGetUrlResult (com.amplifyframework.storage.result.StorageGetUrlResult)1 StorageListResult (com.amplifyframework.storage.result.StorageListResult)1