All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mule.tck.functional.FlowAssert Maven / Gradle / Ivy

/*
 * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */
package org.mule.tck.functional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class FlowAssert
{

    private static Map> assertions = new TreeMap>();

    public static void verify() throws Exception
    {
        for (List flowAssertions : assertions.values())
        {
            for (AssertionMessageProcessor assertion : flowAssertions)
            {
                assertion.verify();
            }
        }
    }

    public static void verify(String flowName) throws Exception
    {

        List flowAssertions = assertions.get(flowName);
        if (flowAssertions != null)
        {
            for (AssertionMessageProcessor assertion : flowAssertions)
            {
                assertion.verify();
            }
        }
    }

    static void addAssertion(String flowName, AssertionMessageProcessor assertion)
    {
        if (assertions.get(flowName) == null)
        {
            assertions.put(flowName, new ArrayList());
        }
        assertions.get(flowName).add(assertion);
    }

    public static void reset()
    {
        assertions = new TreeMap>();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy