Project

General

Profile

« Previous | Next » 

Revision 5a5c5045

Added by Andreas Kohlbecker over 3 years ago

page health check for Drupal errors and warnings configurable

View differences:

src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java
9 9
import java.net.MalformedURLException;
10 10
import java.net.URL;
11 11
import java.util.ArrayList;
12
import java.util.EnumSet;
12 13
import java.util.List;
13 14
import java.util.Map;
14 15
import java.util.Map.Entry;
......
49 50
 */
50 51
public abstract class PortalPage {
51 52

  
52
    /**
53
     *
54
     */
55 53
    public static final int WAIT_SECONDS = 25;
56 54

  
57 55
    public static final Logger logger = Logger.getLogger(PortalPage.class);
......
72 70
        return wait;
73 71
    }
74 72

  
73
    public static enum HealthChecks {
74
        NO_ERROR, NO_WARNING;
75
    }
76

  
77
    public EnumSet<HealthChecks> getAciveHealthChecks() {
78
        return aciveHealthChecks;
79
    }
80

  
81

  
82
    public void setAciveHealthChecks(EnumSet<HealthChecks> aciveHealthChecks) {
83
        this.aciveHealthChecks = aciveHealthChecks;
84
    }
85

  
86
    private EnumSet<HealthChecks> aciveHealthChecks = EnumSet.allOf(HealthChecks.class);
87

  
75 88

  
76 89
    /**
77 90
     * Implementations of this method will supply the relative
......
183 196
     */
184 197
    protected void pageHealthChecks() {
185 198
        try {
186
            String ignore_error = null;
187
            List<String> errors = getErrors().stream().filter(str -> ignore_error != null && str.startsWith(ignore_error)).collect(Collectors.toList());
188
            assertTrue("The page must not show an error box", errors.size() == 0);
199
            if(getAciveHealthChecks().contains(HealthChecks.NO_ERROR)) {
200
                String ignore_error = null;
201
                List<String> errors = getErrors().stream().filter(str -> ignore_error != null && str.startsWith(ignore_error)).collect(Collectors.toList());
202
                assertTrue("The page must not show an error box", errors.size() == 0);
203
            }
204
            if(getAciveHealthChecks().contains(HealthChecks.NO_WARNING)) {
205
                String ignore_warning = null;
206
                List<String> warnings = getErrors().stream().filter(str -> ignore_warning != null && str.startsWith(ignore_warning)).collect(Collectors.toList());
207
                assertTrue("The page must not show an warning box", warnings.size() == 0);
208
            }
189 209
        } catch (NoSuchElementException e) {
190 210
            //IGNORE since this is expected!
191 211
        }

Also available in: Unified diff