use of org.apache.nifi.registry.variable.FileBasedVariableRegistry in project nifi by apache.
the class StandardFlowSerializerTest method setUp.
@Before
public void setUp() throws Exception {
final FlowFileEventRepository flowFileEventRepo = Mockito.mock(FlowFileEventRepository.class);
final AuditService auditService = Mockito.mock(AuditService.class);
final Map<String, String> otherProps = new HashMap<>();
otherProps.put(NiFiProperties.PROVENANCE_REPO_IMPLEMENTATION_CLASS, MockProvenanceRepository.class.getName());
otherProps.put("nifi.remote.input.socket.port", "");
otherProps.put("nifi.remote.input.secure", "");
final NiFiProperties nifiProperties = NiFiProperties.createBasicNiFiProperties(propsFile, otherProps);
final StringEncryptor encryptor = StringEncryptor.createEncryptor(nifiProperties);
// use the system bundle
systemBundle = SystemBundle.create(nifiProperties);
ExtensionManager.discoverExtensions(systemBundle, Collections.emptySet());
final AbstractPolicyBasedAuthorizer authorizer = new MockPolicyBasedAuthorizer();
final VariableRegistry variableRegistry = new FileBasedVariableRegistry(nifiProperties.getVariableRegistryPropertiesPaths());
final BulletinRepository bulletinRepo = Mockito.mock(BulletinRepository.class);
controller = FlowController.createStandaloneInstance(flowFileEventRepo, nifiProperties, authorizer, auditService, encryptor, bulletinRepo, variableRegistry, Mockito.mock(FlowRegistryClient.class));
serializer = new StandardFlowSerializer(encryptor);
}
use of org.apache.nifi.registry.variable.FileBasedVariableRegistry in project nifi by apache.
the class TestFileBasedVariableRegistry method testCreateCustomVariableRegistry.
@Test
public void testCreateCustomVariableRegistry() {
final Path fooPath = Paths.get("src/test/resources/TestVariableRegistry/foobar.properties");
final Path testPath = Paths.get("src/test/resources/TestVariableRegistry/test.properties");
Path[] paths = { fooPath, testPath };
final String vendorUrl = System.getProperty("java.vendor.url");
VariableRegistry variableRegistry = new FileBasedVariableRegistry(paths);
final Map<VariableDescriptor, String> variables = variableRegistry.getVariableMap();
assertTrue(variables.containsKey(new VariableDescriptor("fake.property.3")));
assertEquals(vendorUrl, variableRegistry.getVariableValue("java.vendor.url"));
assertEquals("test me out 3, test me out 4", variableRegistry.getVariableValue("fake.property.3"));
}
Aggregations