Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
FlowAssert |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.tck.functional; | |
8 | ||
9 | import java.util.ArrayList; | |
10 | import java.util.List; | |
11 | import java.util.Map; | |
12 | import java.util.TreeMap; | |
13 | ||
14 | 0 | public class FlowAssert |
15 | { | |
16 | ||
17 | 0 | private static Map<String, List<AssertionMessageProcessor>> assertions = new TreeMap<String, List<AssertionMessageProcessor>>(); |
18 | ||
19 | public static void verify() throws Exception | |
20 | { | |
21 | 0 | for (List<AssertionMessageProcessor> flowAssertions : assertions.values()) |
22 | { | |
23 | 0 | for (AssertionMessageProcessor assertion : flowAssertions) |
24 | { | |
25 | 0 | assertion.verify(); |
26 | } | |
27 | } | |
28 | 0 | } |
29 | ||
30 | public static void verify(String flowName) throws Exception | |
31 | { | |
32 | ||
33 | 0 | List<AssertionMessageProcessor> flowAssertions = assertions.get(flowName); |
34 | 0 | if (flowAssertions != null) |
35 | { | |
36 | 0 | for (AssertionMessageProcessor assertion : flowAssertions) |
37 | { | |
38 | 0 | assertion.verify(); |
39 | } | |
40 | } | |
41 | 0 | } |
42 | ||
43 | static void addAssertion(String flowName, AssertionMessageProcessor assertion) | |
44 | { | |
45 | 0 | if (assertions.get(flowName) == null) |
46 | { | |
47 | 0 | assertions.put(flowName, new ArrayList<AssertionMessageProcessor>()); |
48 | } | |
49 | 0 | assertions.get(flowName).add(assertion); |
50 | 0 | } |
51 | ||
52 | public static void reset() | |
53 | { | |
54 | 0 | assertions = new TreeMap<String, List<AssertionMessageProcessor>>(); |
55 | 0 | } |
56 | ||
57 | } |