use of org.datatransferproject.spi.api.auth.AuthServiceProviderRegistry in project data-transfer-project by google.
the class PortabilityAuthServiceExtensionRegistryTest method testGetExportServices2.
@Test
public void testGetExportServices2() {
List<String> supportedServiceTypes1 = ImmutableList.of("PHOTOS", "CONTACTS");
List<String> supportedServiceTypes2 = ImmutableList.of("CONTACTS");
AuthServiceExtension mockAuthProvider1 = getMockedAuthProvider(supportedServiceTypes1, supportedServiceTypes1, "mockAuthProvider1");
AuthServiceExtension mockAuthProvider2 = getMockedAuthProvider(supportedServiceTypes2, supportedServiceTypes2, "mockAuthProvider2");
AuthServiceProviderRegistry registry = new PortabilityAuthServiceProviderRegistry(ImmutableMap.of("mockServiceProvider1", mockAuthProvider1, "mockServiceProvider2", mockAuthProvider2));
Set<String> actual = registry.getExportServices("PHOTOS");
final String[] services = new String[] { "mockAuthProvider1" };
Set<String> expected = new HashSet<>(Arrays.asList(services));
Assert.assertEquals(actual, expected);
}
use of org.datatransferproject.spi.api.auth.AuthServiceProviderRegistry in project data-transfer-project by google.
the class PortabilityAuthServiceExtensionRegistryTest method testGetImportServices2.
@Test
public void testGetImportServices2() {
List<String> supportedServiceTypes1 = ImmutableList.of("PHOTOS", "CONTACTS");
List<String> supportedServiceTypes2 = ImmutableList.of("CONTACTS");
AuthServiceExtension mockAuthProvider1 = getMockedAuthProvider(supportedServiceTypes1, supportedServiceTypes1, "mockAuthProvider1");
AuthServiceExtension mockAuthProvider2 = getMockedAuthProvider(supportedServiceTypes2, supportedServiceTypes2, "mockAuthProvider2");
AuthServiceProviderRegistry registry = new PortabilityAuthServiceProviderRegistry(ImmutableMap.of("mockServiceProvider1", mockAuthProvider1, "mockServiceProvider2", mockAuthProvider2));
Set<String> actual = registry.getImportServices("PHOTOS");
final String[] services = new String[] { "mockAuthProvider1" };
Set<String> expected = new HashSet<>(Arrays.asList(services));
Assert.assertEquals(actual, expected);
}
use of org.datatransferproject.spi.api.auth.AuthServiceProviderRegistry in project data-transfer-project by google.
the class PortabilityAuthServiceExtensionRegistryTest method testGetAuthDataGenerator.
@Test
public void testGetAuthDataGenerator() {
List<String> supportedServiceTypes = ImmutableList.of("PHOTOS", "CONTACTS");
AuthServiceExtension mockAuthProvider = getMockedAuthProvider(supportedServiceTypes, supportedServiceTypes, "mockAuthProvider");
when(mockAuthProvider.getAuthDataGenerator("CONTACTS", AuthServiceProviderRegistry.AuthMode.EXPORT)).thenReturn(mock(AuthDataGenerator.class));
AuthServiceProviderRegistry registry = new PortabilityAuthServiceProviderRegistry(ImmutableMap.of("mockServiceProvider", mockAuthProvider));
AuthDataGenerator actual = registry.getAuthDataGenerator("mockServiceProvider", "CONTACTS", AuthServiceProviderRegistry.AuthMode.EXPORT);
Assert.assertNotNull(actual);
}
use of org.datatransferproject.spi.api.auth.AuthServiceProviderRegistry in project data-transfer-project by google.
the class DataTypesActionTest method testGetRequestType.
@Test
public void testGetRequestType() {
AuthServiceProviderRegistry registry = mock(AuthServiceProviderRegistry.class);
DataTypesAction dataTypesAction = new DataTypesAction(registry, new Monitor() {
});
Class<GetDataTypes> actual = dataTypesAction.getRequestType();
Assert.assertNotEquals(actual, null);
Assert.assertEquals(actual, GetDataTypes.class);
}
Aggregations