Search in sources :

Example 1 with InstanceIdentifier

use of org.apache.nifi.toolkit.tls.configuration.InstanceIdentifier in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testNoGlobalOrder.

@Test
public void testNoGlobalOrder() throws CommandLineParseException {
    String hostname1 = "other0[4-6]";
    String hostname2 = "nifi3(2)";
    tlsToolkitStandaloneCommandLine.parse("-n", hostname1, "-n", hostname2);
    Map<InstanceIdentifier, InstanceDefinition> definitionMap = tlsToolkitStandaloneCommandLine.createConfig().getInstanceDefinitions().stream().collect(Collectors.toMap(InstanceDefinition::getInstanceIdentifier, Function.identity()));
    assertEquals(5, definitionMap.size());
    InstanceDefinition nifi3_1 = definitionMap.get(new InstanceIdentifier("nifi3", 1));
    assertNotNull(nifi3_1);
    assertEquals(1, nifi3_1.getInstanceIdentifier().getNumber());
    assertEquals(1, nifi3_1.getNumber());
    InstanceDefinition nifi3_2 = definitionMap.get(new InstanceIdentifier("nifi3", 2));
    assertNotNull(nifi3_2);
    assertEquals(2, nifi3_2.getInstanceIdentifier().getNumber());
    assertEquals(2, nifi3_2.getNumber());
    InstanceDefinition other04 = definitionMap.get(new InstanceIdentifier("other04", 1));
    assertNotNull(other04);
    assertEquals(1, other04.getInstanceIdentifier().getNumber());
    assertEquals(1, other04.getNumber());
    InstanceDefinition other05 = definitionMap.get(new InstanceIdentifier("other05", 1));
    assertNotNull(other05);
    assertEquals(1, other05.getInstanceIdentifier().getNumber());
    assertEquals(1, other05.getNumber());
    InstanceDefinition other06 = definitionMap.get(new InstanceIdentifier("other06", 1));
    assertNotNull(other06);
    assertEquals(1, other06.getInstanceIdentifier().getNumber());
    assertEquals(1, other06.getNumber());
}
Also used : InstanceDefinition(org.apache.nifi.toolkit.tls.configuration.InstanceDefinition) InstanceIdentifier(org.apache.nifi.toolkit.tls.configuration.InstanceIdentifier) Test(org.junit.Test)

Example 2 with InstanceIdentifier

use of org.apache.nifi.toolkit.tls.configuration.InstanceIdentifier in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testGlobalOrder.

@Test
public void testGlobalOrder() throws CommandLineParseException {
    String hostname1 = "other0[4-6]";
    String hostname2 = "nifi3(2)";
    String globalOrder1 = "nifi[1-5](2),other[01-4]";
    String globalOrder2 = "other[05-10]";
    tlsToolkitStandaloneCommandLine.parse("-n", hostname1, "-n", hostname2, "-G", globalOrder1, "-G", globalOrder2);
    Map<InstanceIdentifier, InstanceDefinition> definitionMap = tlsToolkitStandaloneCommandLine.createConfig().getInstanceDefinitions().stream().collect(Collectors.toMap(InstanceDefinition::getInstanceIdentifier, Function.identity()));
    assertEquals(5, definitionMap.size());
    InstanceDefinition nifi3_1 = definitionMap.get(new InstanceIdentifier("nifi3", 1));
    assertNotNull(nifi3_1);
    assertEquals(1, nifi3_1.getInstanceIdentifier().getNumber());
    assertEquals(5, nifi3_1.getNumber());
    InstanceDefinition nifi3_2 = definitionMap.get(new InstanceIdentifier("nifi3", 2));
    assertNotNull(nifi3_2);
    assertEquals(2, nifi3_2.getInstanceIdentifier().getNumber());
    assertEquals(6, nifi3_2.getNumber());
    InstanceDefinition other04 = definitionMap.get(new InstanceIdentifier("other04", 1));
    assertNotNull(other04);
    assertEquals(1, other04.getInstanceIdentifier().getNumber());
    assertEquals(14, other04.getNumber());
    InstanceDefinition other05 = definitionMap.get(new InstanceIdentifier("other05", 1));
    assertNotNull(other05);
    assertEquals(1, other05.getInstanceIdentifier().getNumber());
    assertEquals(15, other05.getNumber());
    InstanceDefinition other06 = definitionMap.get(new InstanceIdentifier("other06", 1));
    assertNotNull(other06);
    assertEquals(1, other06.getInstanceIdentifier().getNumber());
    assertEquals(16, other06.getNumber());
}
Also used : InstanceDefinition(org.apache.nifi.toolkit.tls.configuration.InstanceDefinition) InstanceIdentifier(org.apache.nifi.toolkit.tls.configuration.InstanceIdentifier) Test(org.junit.Test)

Aggregations

InstanceDefinition (org.apache.nifi.toolkit.tls.configuration.InstanceDefinition)2 InstanceIdentifier (org.apache.nifi.toolkit.tls.configuration.InstanceIdentifier)2 Test (org.junit.Test)2