Search in sources :

Example 11 with FlowSynchronizer

use of org.apache.nifi.controller.serialization.FlowSynchronizer in project nifi by apache.

the class TestFlowController method testSynchronizeFlowWhenAuthorizationsAreEqual.

@Test
public void testSynchronizeFlowWhenAuthorizationsAreEqual() {
    final FlowSynchronizer standardFlowSynchronizer = new StandardFlowSynchronizer(StringEncryptor.createEncryptor(nifiProperties), nifiProperties);
    // create a mock proposed data flow with the same auth fingerprint as the current authorizer
    final String authFingerprint = authorizer.getFingerprint();
    final DataFlow proposedDataFlow = Mockito.mock(DataFlow.class);
    when(proposedDataFlow.getAuthorizerFingerprint()).thenReturn(authFingerprint.getBytes(StandardCharsets.UTF_8));
    controller.synchronize(standardFlowSynchronizer, proposedDataFlow);
    assertEquals(authFingerprint, authorizer.getFingerprint());
}
Also used : FlowSynchronizer(org.apache.nifi.controller.serialization.FlowSynchronizer) DataFlow(org.apache.nifi.cluster.protocol.DataFlow) Test(org.junit.Test)

Aggregations

FlowSynchronizer (org.apache.nifi.controller.serialization.FlowSynchronizer)11 Test (org.junit.Test)10 DataFlow (org.apache.nifi.cluster.protocol.DataFlow)8 LogRepository (org.apache.nifi.logging.LogRepository)4 HashSet (java.util.HashSet)3 LinkedHashSet (java.util.LinkedHashSet)3 MockPolicyBasedAuthorizer (org.apache.nifi.authorization.MockPolicyBasedAuthorizer)3 ControllerServiceNode (org.apache.nifi.controller.service.ControllerServiceNode)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 StandardCharsets (java.nio.charset.StandardCharsets)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2