Search in sources :

Example 1 with PortSchema

use of org.apache.nifi.minifi.commons.schema.PortSchema in project nifi-minifi by apache.

the class ConfigTransformer method addProcessGroup.

protected static void addProcessGroup(Document doc, Element element, ProcessGroupSchema processGroupSchema, ParentGroupIdResolver parentGroupIdResolver) throws ConfigurationChangeException {
    try {
        String processGroupId = processGroupSchema.getId();
        addTextElement(element, "id", processGroupId);
        addTextElement(element, "name", processGroupSchema.getName());
        addPosition(element);
        addTextElement(element, "comment", processGroupSchema.getComment());
        for (ProcessorSchema processorConfig : processGroupSchema.getProcessors()) {
            addProcessor(element, processorConfig);
        }
        for (PortSchema portSchema : processGroupSchema.getInputPortSchemas()) {
            addPort(doc, element, portSchema, "inputPort");
        }
        for (PortSchema portSchema : processGroupSchema.getOutputPortSchemas()) {
            addPort(doc, element, portSchema, "outputPort");
        }
        for (FunnelSchema funnelSchema : processGroupSchema.getFunnels()) {
            addFunnel(element, funnelSchema);
        }
        for (ProcessGroupSchema child : processGroupSchema.getProcessGroupSchemas()) {
            Element processGroups = doc.createElement("processGroup");
            element.appendChild(processGroups);
            addProcessGroup(doc, processGroups, child, parentGroupIdResolver);
        }
        for (RemoteProcessGroupSchema remoteProcessGroupSchema : processGroupSchema.getRemoteProcessGroups()) {
            addRemoteProcessGroup(element, remoteProcessGroupSchema);
        }
        for (ConnectionSchema connectionConfig : processGroupSchema.getConnections()) {
            addConnection(element, connectionConfig, parentGroupIdResolver);
        }
        for (ControllerServiceSchema controllerServiceSchema : processGroupSchema.getControllerServices()) {
            addControllerService(element, controllerServiceSchema);
        }
    } catch (ConfigurationChangeException e) {
        throw e;
    } catch (Exception e) {
        throw new ConfigurationChangeException("Failed to parse the config YAML while trying to creating the root Process Group", e);
    }
}
Also used : ConnectionSchema(org.apache.nifi.minifi.commons.schema.ConnectionSchema) RemoteProcessGroupSchema(org.apache.nifi.minifi.commons.schema.RemoteProcessGroupSchema) ProcessGroupSchema(org.apache.nifi.minifi.commons.schema.ProcessGroupSchema) Element(org.w3c.dom.Element) ControllerServiceSchema(org.apache.nifi.minifi.commons.schema.ControllerServiceSchema) ConfigurationChangeException(org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeException) FunnelSchema(org.apache.nifi.minifi.commons.schema.FunnelSchema) RemotePortSchema(org.apache.nifi.minifi.commons.schema.RemotePortSchema) PortSchema(org.apache.nifi.minifi.commons.schema.PortSchema) InvalidConfigurationException(org.apache.nifi.minifi.bootstrap.exception.InvalidConfigurationException) ConfigurationChangeException(org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeException) TransformerException(javax.xml.transform.TransformerException) DOMException(org.w3c.dom.DOMException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) ProcessorSchema(org.apache.nifi.minifi.commons.schema.ProcessorSchema) RemoteProcessGroupSchema(org.apache.nifi.minifi.commons.schema.RemoteProcessGroupSchema)

Example 2 with PortSchema

use of org.apache.nifi.minifi.commons.schema.PortSchema in project nifi-minifi by apache.

the class PortSchemaFunctionTest method testNoId.

@Test
public void testNoId() {
    portDTO.setId(null);
    PortSchema portSchema = portSchemaFunction.apply(portDTO);
    assertEquals("", portSchema.getId());
    assertEquals(testName, portSchema.getName());
    assertFalse(portSchema.isValid());
}
Also used : PortSchema(org.apache.nifi.minifi.commons.schema.PortSchema) Test(org.junit.Test)

Example 3 with PortSchema

use of org.apache.nifi.minifi.commons.schema.PortSchema in project nifi-minifi by apache.

the class PortSchemaFunctionTest method testNoName.

@Test
public void testNoName() {
    portDTO.setName(null);
    PortSchema portSchema = portSchemaFunction.apply(portDTO);
    assertEquals(testId, portSchema.getId());
    assertEquals("", portSchema.getName());
    assertTrue(portSchema.isValid());
}
Also used : PortSchema(org.apache.nifi.minifi.commons.schema.PortSchema) Test(org.junit.Test)

Example 4 with PortSchema

use of org.apache.nifi.minifi.commons.schema.PortSchema in project nifi-minifi by apache.

the class PortSchemaFunctionTest method testFullMap.

@Test
public void testFullMap() {
    PortSchema portSchema = portSchemaFunction.apply(portDTO);
    assertEquals(testId, portSchema.getId());
    assertEquals(testName, portSchema.getName());
    assertTrue(portSchema.isValid());
}
Also used : PortSchema(org.apache.nifi.minifi.commons.schema.PortSchema) Test(org.junit.Test)

Aggregations

PortSchema (org.apache.nifi.minifi.commons.schema.PortSchema)4 Test (org.junit.Test)3 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 TransformerException (javax.xml.transform.TransformerException)1 ConfigurationChangeException (org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeException)1 InvalidConfigurationException (org.apache.nifi.minifi.bootstrap.exception.InvalidConfigurationException)1 ConnectionSchema (org.apache.nifi.minifi.commons.schema.ConnectionSchema)1 ControllerServiceSchema (org.apache.nifi.minifi.commons.schema.ControllerServiceSchema)1 FunnelSchema (org.apache.nifi.minifi.commons.schema.FunnelSchema)1 ProcessGroupSchema (org.apache.nifi.minifi.commons.schema.ProcessGroupSchema)1 ProcessorSchema (org.apache.nifi.minifi.commons.schema.ProcessorSchema)1 RemotePortSchema (org.apache.nifi.minifi.commons.schema.RemotePortSchema)1 RemoteProcessGroupSchema (org.apache.nifi.minifi.commons.schema.RemoteProcessGroupSchema)1 DOMException (org.w3c.dom.DOMException)1 Element (org.w3c.dom.Element)1