Search in sources :

Example 1 with DeprecatedProcessor

use of org.apache.nifi.documentation.example.DeprecatedProcessor in project nifi by apache.

the class ProcessorDocumentationWriterTest method testDeprecatedProcessor.

@Test
public void testDeprecatedProcessor() throws IOException {
    DeprecatedProcessor processor = new DeprecatedProcessor();
    ProcessorInitializer initializer = new ProcessorInitializer();
    initializer.initialize(processor);
    DocumentationWriter writer = new HtmlProcessorDocumentationWriter();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writer.write(processor, baos, false);
    initializer.teardown(processor);
    String results = new String(baos.toByteArray());
    XmlValidator.assertXmlValid(results);
    assertContains(results, DeprecatedProcessor.DIRECTORY.getDisplayName());
    assertContains(results, DeprecatedProcessor.DIRECTORY.getDescription());
    assertContains(results, DeprecatedProcessor.OPTIONAL_PROPERTY.getDisplayName());
    assertContains(results, DeprecatedProcessor.OPTIONAL_PROPERTY.getDescription());
    assertContains(results, DeprecatedProcessor.POLLING_INTERVAL.getDisplayName());
    assertContains(results, DeprecatedProcessor.POLLING_INTERVAL.getDescription());
    assertContains(results, DeprecatedProcessor.POLLING_INTERVAL.getDefaultValue());
    assertContains(results, DeprecatedProcessor.RECURSE.getDisplayName());
    assertContains(results, DeprecatedProcessor.RECURSE.getDescription());
    assertContains(results, DeprecatedProcessor.REL_SUCCESS.getName());
    assertContains(results, DeprecatedProcessor.REL_SUCCESS.getDescription());
    assertContains(results, DeprecatedProcessor.REL_FAILURE.getName());
    assertContains(results, DeprecatedProcessor.REL_FAILURE.getDescription());
    assertContains(results, "Controller Service API: ");
    assertContains(results, "SampleService");
    assertContains(results, "CLUSTER, LOCAL");
    assertContains(results, "state management description");
    assertContains(results, "processor restriction description");
    assertNotContains(results, "iconSecure.png");
    assertContains(results, DeprecatedProcessor.class.getAnnotation(CapabilityDescription.class).value());
    // Check for the existence of deprecation notice
    assertContains(results, "Deprecation notice: ");
    // assertContains(results, DeprecatedProcessor.class.getAnnotation(DeprecationNotice.class.));
    assertNotContains(results, "This component has no required or optional properties.");
    assertNotContains(results, "No description provided.");
    assertNotContains(results, "No tags provided.");
    assertNotContains(results, "Additional Details...");
    // verify the right OnRemoved and OnShutdown methods were called
    Assert.assertEquals(0, processor.getOnRemovedArgs());
    Assert.assertEquals(0, processor.getOnRemovedNoArgs());
    Assert.assertEquals(1, processor.getOnShutdownArgs());
    Assert.assertEquals(1, processor.getOnShutdownNoArgs());
}
Also used : DeprecatedProcessor(org.apache.nifi.documentation.example.DeprecatedProcessor) ProcessorInitializer(org.apache.nifi.init.ProcessorInitializer) DocumentationWriter(org.apache.nifi.documentation.DocumentationWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DocumentationWriter (org.apache.nifi.documentation.DocumentationWriter)1 DeprecatedProcessor (org.apache.nifi.documentation.example.DeprecatedProcessor)1 ProcessorInitializer (org.apache.nifi.init.ProcessorInitializer)1 Test (org.junit.Test)1