Repository: nifi Updated Branches: refs/heads/develop a4f0afce7 -> 6fc52a4e9
NIFI-736 Creating a Maven Archetype for ControllerServices NIFI-736 Addressing feedback from review: - Removing "-service" from artifact ids - Removing impl in favor of standard - Defaulting to 0.3.0-SNAPSHOT for NiFi version - Cleaning up example service and unit test NIFI-736 Removing IT test due Maven issue MNG-5809 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/6fc52a4e Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/6fc52a4e Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/6fc52a4e Branch: refs/heads/develop Commit: 6fc52a4e9977cc219430f5c8e0e7aa41f7043066 Parents: a4f0afc Author: Bryan Bende <[email protected]> Authored: Sat Jun 27 09:58:32 2015 -0400 Committer: Bryan Bende <[email protected]> Committed: Fri Aug 14 11:00:21 2015 -0400 ---------------------------------------------------------------------- .../nifi-service-bundle-archetype/pom.xml | 48 ++++++++++++ .../META-INF/maven/archetype-metadata.xml | 55 ++++++++++++++ .../nifi-__artifactBaseName__-api-nar/pom.xml | 42 ++++++++++ .../nifi-__artifactBaseName__-api/pom.xml | 35 +++++++++ .../src/main/java/MyService.java | 30 ++++++++ .../nifi-__artifactBaseName__-nar/pom.xml | 43 +++++++++++ .../nifi-__artifactBaseName__/pom.xml | 59 +++++++++++++++ .../src/main/java/StandardMyService.java | 80 ++++++++++++++++++++ ...org.apache.nifi.controller.ControllerService | 15 ++++ .../src/test/java/TestProcessor.java | 45 +++++++++++ .../src/test/java/TestStandardMyService.java | 45 +++++++++++ .../main/resources/archetype-resources/pom.xml | 37 +++++++++ nifi/nifi-maven-archetypes/pom.xml | 1 + 13 files changed, 535 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/pom.xml new file mode 100644 index 0000000..a18d0b3 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-maven-archetypes</artifactId> + <version>0.3.0-SNAPSHOT</version> + </parent> + + <artifactId>nifi-service-bundle-archetype</artifactId> + <packaging>maven-archetype</packaging> + + <build> + <extensions> + <extension> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-packaging</artifactId> + <version>2.2</version> + </extension> + </extensions> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.2</version> + </plugin> + </plugins> + </pluginManagement> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000..5ed0b1d --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<archetype-descriptor name="${artifactId}"> + <requiredProperties> + <requiredProperty key="artifactBaseName" /> + <requiredProperty key="nifiVersion" > + <defaultValue>0.3.0-SNAPSHOT</defaultValue> + </requiredProperty> + <requiredProperty key="package"> + <defaultValue>${groupId}.${artifactBaseName}</defaultValue> + </requiredProperty> + </requiredProperties> + <fileSets> + <fileSet filtered="true" packaged="false" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__-api</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__-api/src/main/java</directory> + </fileSet> + <fileSet filtered="true" packaged="false" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__/src/main/java</directory> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__/src/test/java</directory> + </fileSet> + <fileSet filtered="true" packaged="false" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__-api-nar</directory> + </fileSet> + <fileSet filtered="true" packaged="false" encoding="UTF-8"> + <directory>nifi-__artifactBaseName__-nar</directory> + </fileSet> + </fileSets> +</archetype-descriptor> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api-nar/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api-nar/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api-nar/pom.xml new file mode 100644 index 0000000..52a3264 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api-nar/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}</artifactId> + <version>${version}</version> + </parent> + + <artifactId>nifi-${artifactBaseName}-api-nar</artifactId> + <version>${version}</version> + <packaging>nar</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-standard-services-api-nar</artifactId> + <type>nar</type> + </dependency> + <dependency> + <groupId>${groupId}</groupId> + <artifactId>nifi-${artifactBaseName}-api</artifactId> + <version>${version}</version> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/pom.xml new file mode 100644 index 0000000..26c11d6 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/pom.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}</artifactId> + <version>${version}</version> + </parent> + + <artifactId>nifi-${artifactBaseName}-api</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-api</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/src/main/java/MyService.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/src/main/java/MyService.java b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/src/main/java/MyService.java new file mode 100644 index 0000000..df58f5e --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-api/src/main/java/MyService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}; + +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.ControllerService; +import org.apache.nifi.processor.exception.ProcessException; + +@Tags({"example"}) +@CapabilityDescription("Example Service API.") +public interface MyService extends ControllerService { + + public void execute() throws ProcessException; + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-nar/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-nar/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-nar/pom.xml new file mode 100644 index 0000000..0d8ea56 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__-nar/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}</artifactId> + <version>${version}</version> + </parent> + + <artifactId>nifi-${artifactBaseName}-nar</artifactId> + <version>${version}</version> + <packaging>nar</packaging> + + <dependencies> + <dependency> + <groupId>${groupId}</groupId> + <artifactId>nifi-${artifactBaseName}-api-nar</artifactId> + <version>${version}</version> + <type>nar</type> + </dependency> + <dependency> + <groupId>${groupId}</groupId> + <artifactId>nifi-${artifactBaseName}</artifactId> + <version>${version}</version> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/pom.xml new file mode 100644 index 0000000..fdbb58b --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/pom.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}</artifactId> + <version>${version}</version> + </parent> + + <artifactId>nifi-${artifactBaseName}</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>${groupId}</groupId> + <artifactId>nifi-${artifactBaseName}-api</artifactId> + <version>${version}</version> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-processor-utils</artifactId> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-mock</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java new file mode 100644 index 0000000..193e6b7 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/java/StandardMyService.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.reporting.InitializationException; + +@Tags({ "example"}) +@CapabilityDescription("Example ControllerService implementation of MyService.") +public class StandardMyService extends AbstractControllerService implements MyService { + + public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor + .Builder().name("My Property") + .description("Example Property") + .required(true) + .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) + .build(); + + private static final List<PropertyDescriptor> properties; + + static { + final List<PropertyDescriptor> props = new ArrayList<>(); + props.add(MY_PROPERTY); + properties = Collections.unmodifiableList(props); + } + + @Override + protected List<PropertyDescriptor> getSupportedPropertyDescriptors() { + return properties; + } + + /** + * @param context + * the configuration context + * @throws InitializationException + * if unable to create a database connection + */ + @OnEnabled + public void onEnabled(final ConfigurationContext context) throws InitializationException { + + } + + @OnDisabled + public void shutdown() { + + } + + @Override + public void execute() throws ProcessException { + + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService new file mode 100644 index 0000000..811fcd3 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +${package}.StandardMyService \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestProcessor.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestProcessor.java b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestProcessor.java new file mode 100644 index 0000000..be00a70 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestProcessor.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.processor.AbstractProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.exception.ProcessException; + +public class TestProcessor extends AbstractProcessor { + + @Override + public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException { + } + + @Override + protected List<PropertyDescriptor> getSupportedPropertyDescriptors() { + List<PropertyDescriptor> propDescs = new ArrayList<>(); + propDescs.add(new PropertyDescriptor.Builder() + .name("MyService test processor") + .description("MyService test processor") + .identifiesControllerService(MyService.class) + .required(true) + .build()); + return propDescs; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java new file mode 100644 index 0000000..3f430e6 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/nifi-__artifactBaseName__/src/test/java/TestStandardMyService.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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; + +public class TestStandardMyService { + + @Before + public void init() { + + } + + @Test + public void testService() throws InitializationException { + final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); + final StandardMyService service = new StandardMyService(); + runner.addControllerService("test-good", service); + + runner.setProperty(service, StandardMyService.MY_PROPERTY, "test-value"); + runner.enableControllerService(service); + + runner.assertValid(service); + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/pom.xml b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000..0f32431 --- /dev/null +++ b/nifi/nifi-maven-archetypes/nifi-service-bundle-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-nar-bundles</artifactId> + <version>${nifiVersion}</version> + </parent> + + <groupId>${groupId}</groupId> + <artifactId>${artifactId}</artifactId> + <version>${version}</version> + <packaging>pom</packaging> + + <modules> + <module>nifi-${artifactBaseName}-api</module> + <module>nifi-${artifactBaseName}-api-nar</module> + <module>nifi-${artifactBaseName}</module> + <module>nifi-${artifactBaseName}-nar</module> + </modules> + +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6fc52a4e/nifi/nifi-maven-archetypes/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-maven-archetypes/pom.xml b/nifi/nifi-maven-archetypes/pom.xml index 74f544b..b817604 100644 --- a/nifi/nifi-maven-archetypes/pom.xml +++ b/nifi/nifi-maven-archetypes/pom.xml @@ -25,5 +25,6 @@ <packaging>pom</packaging> <modules> <module>nifi-processor-bundle-archetype</module> + <module>nifi-service-bundle-archetype</module> </modules> </project>
