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

ASF GitHub Bot commented on METRON-502:
---------------------------------------

Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/311#discussion_r83644949
  
    --- Diff: 
metron-platform/metron-integration-test/src/main/java/org/apache/metron/integration/ProcessorResult.java
 ---
    @@ -0,0 +1,90 @@
    +/**
    + * 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 org.apache.metron.integration;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +public class ProcessorResult<T> {
    +    public static class Builder<T>{
    +        T result;
    +        List<byte[]> processErrors;
    +        List<byte[]> processInvalids;
    +
    +        public Builder(){}
    +
    +        public Builder withResult(T result){
    +            this.result = result;
    +            return this;
    +        }
    +
    +        public Builder withProcessErrors(List<byte[]> processErrors){
    +            this.processErrors = processErrors;
    +            return this;
    +        }
    +
    +        public Builder withProcessInvalids(List<byte[]> processInvalids){
    +            this.processInvalids = processInvalids;
    +            return this;
    +        }
    +
    +        public ProcessorResult<T> build(){
    +            return new 
ProcessorResult<T>(result,processErrors,processInvalids);
    +        }
    +
    +    }
    +
    +    T result;
    +    List<byte[]> processErrors;
    +    List<byte[]> processInvalids;
    +    @SuppressWarnings("unchecked")
    +    public ProcessorResult(T result,List<byte[]> processErrors, 
List<byte[]> processInvalids){
    +        this.result = result;
    +        this.processErrors = processErrors == null ? new ArrayList() : 
processErrors;
    +        this.processInvalids = processInvalids == null ? new ArrayList() : 
processInvalids;
    +    }
    +
    +    public T getResult(){
    +        return result;
    +    }
    +
    +    public List<byte[]> getProcessErrors(){
    +        return processErrors;
    +    }
    +
    +    public List<byte[]> getProcessInvalids(){
    +        return processInvalids;
    +    }
    +
    +    public boolean failed(){
    +        return processErrors.size() > 0 || processInvalids.size() > 0;
    +    }
    +
    +    public void printBadResults(){
    --- End diff --
    
    Maybe pass a StringBuffer here and have it accumulate, so the caller can 
decide what to do with the bad results?


> Make the ParserIntegrationTest more clear on errors
> ---------------------------------------------------
>
>                 Key: METRON-502
>                 URL: https://issues.apache.org/jira/browse/METRON-502
>             Project: Metron
>          Issue Type: Improvement
>    Affects Versions: 0.2.1BETA
>            Reporter: Casey Stella
>
> Right now the ParserIntegrationTest fails if it does not receive the expected 
> number of messages after a given amount of time.  In situations where 
> messages get redirected to the error or invalid queues, this results in the 
> test waiting and failing at the end of a timeout.  The developer cannot 
> determine if the cause is a timeout or actual errors.
> We should, instead, dump out the error and invalid queue as soon as it 
> becomes populated and fail the test with more specific reason.



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

Reply via email to