use of org.apache.nifi.registry.extension.ExtensionManager in project nifi-registry by apache.
the class TestStandardProviderFactory method testFlowProviderClassNotFound.
@Test(expected = ProviderFactoryException.class)
public void testFlowProviderClassNotFound() {
final NiFiRegistryProperties props = new NiFiRegistryProperties();
props.setProperty(NiFiRegistryProperties.PROVIDERS_CONFIGURATION_FILE, "src/test/resources/provider/providers-class-not-found.xml");
final ExtensionManager extensionManager = Mockito.mock(ExtensionManager.class);
when(extensionManager.getExtensionClassLoader(any(String.class))).thenReturn(this.getClass().getClassLoader());
final ProviderFactory providerFactory = new StandardProviderFactory(props, extensionManager);
providerFactory.initialize();
providerFactory.getFlowPersistenceProvider();
}
use of org.apache.nifi.registry.extension.ExtensionManager in project nifi-registry by apache.
the class TestStandardProviderFactory method testGetFlowProviderBeforeInitializingShouldThrowException.
@Test(expected = ProviderFactoryException.class)
public void testGetFlowProviderBeforeInitializingShouldThrowException() {
final NiFiRegistryProperties props = new NiFiRegistryProperties();
props.setProperty(NiFiRegistryProperties.PROVIDERS_CONFIGURATION_FILE, "src/test/resources/provider/providers-good.xml");
final ExtensionManager extensionManager = Mockito.mock(ExtensionManager.class);
when(extensionManager.getExtensionClassLoader(any(String.class))).thenReturn(this.getClass().getClassLoader());
final ProviderFactory providerFactory = new StandardProviderFactory(props, extensionManager);
providerFactory.getFlowPersistenceProvider();
}
use of org.apache.nifi.registry.extension.ExtensionManager in project nifi-registry by apache.
the class TestStandardProviderFactory method testProvidersConfigDoesNotExist.
@Test(expected = ProviderFactoryException.class)
public void testProvidersConfigDoesNotExist() {
final NiFiRegistryProperties props = new NiFiRegistryProperties();
props.setProperty(NiFiRegistryProperties.PROVIDERS_CONFIGURATION_FILE, "src/test/resources/provider/providers-does-not-exist.xml");
final ExtensionManager extensionManager = Mockito.mock(ExtensionManager.class);
when(extensionManager.getExtensionClassLoader(any(String.class))).thenReturn(this.getClass().getClassLoader());
final ProviderFactory providerFactory = new StandardProviderFactory(props, extensionManager);
providerFactory.initialize();
}
use of org.apache.nifi.registry.extension.ExtensionManager in project nifi-registry by apache.
the class TestStandardProviderFactory method testGetProvidersSuccess.
@Test
public void testGetProvidersSuccess() {
final NiFiRegistryProperties props = new NiFiRegistryProperties();
props.setProperty(NiFiRegistryProperties.PROVIDERS_CONFIGURATION_FILE, "src/test/resources/provider/providers-good.xml");
final ExtensionManager extensionManager = Mockito.mock(ExtensionManager.class);
when(extensionManager.getExtensionClassLoader(any(String.class))).thenReturn(this.getClass().getClassLoader());
final ProviderFactory providerFactory = new StandardProviderFactory(props, extensionManager);
providerFactory.initialize();
final FlowPersistenceProvider flowPersistenceProvider = providerFactory.getFlowPersistenceProvider();
assertNotNull(flowPersistenceProvider);
final MockFlowPersistenceProvider mockFlowProvider = (MockFlowPersistenceProvider) flowPersistenceProvider;
assertNotNull(mockFlowProvider.getProperties());
assertEquals("flow foo", mockFlowProvider.getProperties().get("Flow Property 1"));
assertEquals("flow bar", mockFlowProvider.getProperties().get("Flow Property 2"));
}
Aggregations