From c769742d9b10145c26a0b6cd75b9ae75bbdc9589 Mon Sep 17 00:00:00 2001 From: danbress Date: Sun, 28 Jun 2015 16:42:52 -0400 Subject: [PATCH] NIFI-735: removing call to OnRemoved and updating unit tests --- .../documentation/init/ControllerServiceInitializer.java | 2 -- .../nifi/documentation/init/ProcessorInitializer.java | 2 -- .../documentation/init/ReportingTaskingInitializer.java | 2 -- .../documentation/html/HtmlDocumentationWriterTest.java | 8 ++++---- .../html/ProcessorDocumentationWriterTest.java | 4 ++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java index 7839254977..441033c090 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.documentation.init; -import org.apache.nifi.annotation.lifecycle.OnRemoved; import org.apache.nifi.annotation.lifecycle.OnShutdown; import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.controller.ControllerService; @@ -52,7 +51,6 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia final ProcessorLog logger = new MockProcessorLogger(); final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, org.apache.nifi.processor.annotation.OnRemoved.class, controllerService, logger, context); ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, controllerService, logger, context); } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java index 5808c3558b..7a0752d3b9 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.documentation.init; -import org.apache.nifi.annotation.lifecycle.OnRemoved; import org.apache.nifi.annotation.lifecycle.OnShutdown; import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.documentation.ConfigurableComponentInitializer; @@ -50,7 +49,6 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer { final ProcessorLog logger = new MockProcessorLogger(); final MockProcessContext context = new MockProcessContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, org.apache.nifi.processor.annotation.OnRemoved.class, processor, logger, context); ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, processor, logger, context); } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java index 23b45009ff..e9642e3cd9 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.documentation.init; -import org.apache.nifi.annotation.lifecycle.OnRemoved; import org.apache.nifi.annotation.lifecycle.OnShutdown; import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.documentation.ConfigurableComponentInitializer; @@ -49,7 +48,6 @@ public class ReportingTaskingInitializer implements ConfigurableComponentInitial try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, org.apache.nifi.processor.annotation.OnRemoved.class, reportingTask, new MockProcessorLogger(), context); ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, reportingTask, new MockProcessorLogger(), context); } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java index 5a138dc785..ae04f46b53 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java @@ -78,8 +78,8 @@ public class HtmlDocumentationWriterTest { assertContains(results, "Sensitive Property: true"); // verify the right OnRemoved and OnShutdown methods were called - Assert.assertEquals(1, controllerService.getOnRemovedArgs()); - Assert.assertEquals(1, controllerService.getOnRemovedNoArgs()); + Assert.assertEquals(0, controllerService.getOnRemovedArgs()); + Assert.assertEquals(0, controllerService.getOnRemovedNoArgs()); Assert.assertEquals(1, controllerService.getOnShutdownArgs()); Assert.assertEquals(1, controllerService.getOnShutdownNoArgs()); @@ -115,8 +115,8 @@ public class HtmlDocumentationWriterTest { assertContains(results, "false"); // verify the right OnRemoved and OnShutdown methods were called - Assert.assertEquals(1, reportingTask.getOnRemovedArgs()); - Assert.assertEquals(1, reportingTask.getOnRemovedNoArgs()); + Assert.assertEquals(0, reportingTask.getOnRemovedArgs()); + Assert.assertEquals(0, reportingTask.getOnRemovedNoArgs()); Assert.assertEquals(1, reportingTask.getOnShutdownArgs()); Assert.assertEquals(1, reportingTask.getOnShutdownNoArgs()); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java index 31fe73e477..447e2e9ccd 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java @@ -75,8 +75,8 @@ public class ProcessorDocumentationWriterTest { assertNotContains(results, "Additional Details..."); // verify the right OnRemoved and OnShutdown methods were called - Assert.assertEquals(1, processor.getOnRemovedArgs()); - Assert.assertEquals(1, processor.getOnRemovedNoArgs()); + Assert.assertEquals(0, processor.getOnRemovedArgs()); + Assert.assertEquals(0, processor.getOnRemovedNoArgs()); Assert.assertEquals(1, processor.getOnShutdownArgs()); Assert.assertEquals(1, processor.getOnShutdownNoArgs());