[ 
https://issues.apache.org/jira/browse/NIFI-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036394#comment-15036394
 ] 

Mark Payne commented on NIFI-34:
--------------------------------

We should probably structure this so that there is a BestPractices enumeration, 
something like:

{code}
public enum BestPractices {
    MISSING_TAGS_ANNOTATION("The component has no @Tags annotation associated 
with it. The @Tags annotation provides the ability to associate tags, or 
keywords, with a component, so that users are able to discover the component 
quickly and easily. The annotation should be added to your component's class.");
    // other Best Practices

    private final String explanation;
    private BestPractices(final String explanation) {
        this.explanation = explanation;
    }

    public String getExplanation() {
        return explanation;
    }

    public void fail() {
        // for some use cases, we should detect the line of code in the 
processor where the Best Practice was violated and indicate this here.
        // For example, if session is throwing an Exception because it was 
given a flowfile that wasn't the newest, we should show where that
        // call was made and additionally keep track of what line in the code 
made the last call into session.write, session.putAttribute, etc. and
        // indicate this in the error message.
        Assert.fail(getExplanation());
    }
}
{code}

> Mock Framework should provide option to detect common bad practices/bugs
> ------------------------------------------------------------------------
>
>                 Key: NIFI-34
>                 URL: https://issues.apache.org/jira/browse/NIFI-34
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Mark Payne
>            Priority: Minor
>             Fix For: 0.5.0
>
>
> Mock Framework should detect common errors such as:
> * Processor has member variable that is a PropertyDescriptor, but the 
> PropertyDescriptor isn't returned in the list of supported property 
> descriptors.
> * Processor has member variable that is a Relationship, but the Relationship 
> isn't returned in the Set of Relationships.
> * Processor has multiple properties or relationships as member variables with 
> the same name.
> * No META-INF/services file
> * META-INF/services file doesn't contain the Component's Fully Qualified 
> Class Name
> * No @CapabilityDescription annotation
> * No @Tags annotation
> Mock Framework should automatically detect these things and fail the unit 
> test unless checking is disabled. This requires building an object that 
> allows developer to enable/disable each of these checks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to