Search in sources :

Example 1 with FlowPersistenceProvider

use of org.apache.nifi.registry.flow.FlowPersistenceProvider 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"));
}
Also used : ExtensionManager(org.apache.nifi.registry.extension.ExtensionManager) FlowPersistenceProvider(org.apache.nifi.registry.flow.FlowPersistenceProvider) NiFiRegistryProperties(org.apache.nifi.registry.properties.NiFiRegistryProperties) Test(org.junit.Test)

Example 2 with FlowPersistenceProvider

use of org.apache.nifi.registry.flow.FlowPersistenceProvider in project nifi-registry by apache.

the class TestRegistryService method setup.

@Before
public void setup() {
    metadataService = mock(MetadataService.class);
    flowPersistenceProvider = mock(FlowPersistenceProvider.class);
    snapshotSerializer = mock(VersionedProcessGroupSerializer.class);
    final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
    validator = validatorFactory.getValidator();
    registryService = new RegistryService(metadataService, flowPersistenceProvider, snapshotSerializer, validator);
}
Also used : VersionedProcessGroupSerializer(org.apache.nifi.registry.serialization.VersionedProcessGroupSerializer) ValidatorFactory(javax.validation.ValidatorFactory) FlowPersistenceProvider(org.apache.nifi.registry.flow.FlowPersistenceProvider) Before(org.junit.Before)

Aggregations

FlowPersistenceProvider (org.apache.nifi.registry.flow.FlowPersistenceProvider)2 ValidatorFactory (javax.validation.ValidatorFactory)1 ExtensionManager (org.apache.nifi.registry.extension.ExtensionManager)1 NiFiRegistryProperties (org.apache.nifi.registry.properties.NiFiRegistryProperties)1 VersionedProcessGroupSerializer (org.apache.nifi.registry.serialization.VersionedProcessGroupSerializer)1 Before (org.junit.Before)1 Test (org.junit.Test)1