From 2054888fb1cbb442a70e3677139dc7a26348671d Mon Sep 17 00:00:00 2001 From: Andre F de Miranda Date: Mon, 12 Sep 2016 01:49:01 +1000 Subject: [PATCH] NIFI-2756 - Add displayName to maven archetypes and remove unused import - Code generated generated by the NiFi archetypes should pass contrib-check by default This closes #1004. Signed-off-by: Bryan Bende --- .../src/main/java/MyProcessor.java | 18 +++++++++++++----- .../src/main/java/StandardMyService.java | 4 ++-- .../src/test/java/TestStandardMyService.java | 1 - 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/nifi-maven-archetypes/nifi-processor-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-processors/src/main/java/MyProcessor.java b/nifi-maven-archetypes/nifi-processor-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-processors/src/main/java/MyProcessor.java index ca5d903d7a..588561e42d 100644 --- a/nifi-maven-archetypes/nifi-processor-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-processors/src/main/java/MyProcessor.java +++ b/nifi-maven-archetypes/nifi-processor-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-processors/src/main/java/MyProcessor.java @@ -17,9 +17,7 @@ package ${package}; import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.PropertyValue; import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.processor.*; import org.apache.nifi.annotation.behavior.ReadsAttribute; import org.apache.nifi.annotation.behavior.ReadsAttributes; import org.apache.nifi.annotation.behavior.WritesAttribute; @@ -29,9 +27,18 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription; import org.apache.nifi.annotation.documentation.SeeAlso; import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.AbstractProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.ProcessorInitializationContext; +import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.util.StandardValidators; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; @Tags({"example"}) @CapabilityDescription("Provide a description") @@ -41,14 +48,15 @@ import java.util.*; public class MyProcessor extends AbstractProcessor { public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor - .Builder().name("My Property") + .Builder().name("MY_PROPERTY") + .displayName("My property") .description("Example Property") .required(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .build(); public static final Relationship MY_RELATIONSHIP = new Relationship.Builder() - .name("my_relationship") + .name("MY_RELATIONSHIP") .description("Example relationship") .build(); diff --git a/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java b/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java index 193e6b7e20..71473ea128 100644 --- a/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java +++ b/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java @@ -19,7 +19,6 @@ package ${package}; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.concurrent.TimeUnit; import org.apache.nifi.annotation.documentation.CapabilityDescription; import org.apache.nifi.annotation.documentation.Tags; @@ -37,7 +36,8 @@ import org.apache.nifi.reporting.InitializationException; public class StandardMyService extends AbstractControllerService implements MyService { public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor - .Builder().name("My Property") + .Builder().name("MY_PROPERTY") + .displayName("My Property") .description("Example Property") .required(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) diff --git a/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java b/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java index 3f430e6726..e7035f0f8f 100644 --- a/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java +++ b/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java @@ -19,7 +19,6 @@ package ${package}; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Assert; import org.junit.Before; import org.junit.Test;