Search in sources :

Example 1 with WindowAndTriggerNamespace

use of org.apache.beam.runners.core.StateNamespaces.WindowAndTriggerNamespace in project beam by apache.

the class TriggerStateMachineTester method assertCleared.

/**
   * Asserts that the trigger has actually cleared all of its state for the given window. Since
   * the trigger under test is the root, this makes the assert for all triggers regardless
   * of their position in the trigger tree.
   */
public void assertCleared(W window) {
    for (StateNamespace untypedNamespace : stateInternals.getNamespacesInUse()) {
        if (untypedNamespace instanceof WindowAndTriggerNamespace) {
            @SuppressWarnings("unchecked") WindowAndTriggerNamespace<W> namespace = (WindowAndTriggerNamespace<W>) untypedNamespace;
            if (namespace.getWindow().equals(window)) {
                Set<?> tagsInUse = stateInternals.getTagsInUse(namespace);
                assertTrue("Trigger has not cleared tags: " + tagsInUse, tagsInUse.isEmpty());
            }
        }
    }
}
Also used : WindowAndTriggerNamespace(org.apache.beam.runners.core.StateNamespaces.WindowAndTriggerNamespace) StateNamespace(org.apache.beam.runners.core.StateNamespace)

Aggregations

StateNamespace (org.apache.beam.runners.core.StateNamespace)1 WindowAndTriggerNamespace (org.apache.beam.runners.core.StateNamespaces.WindowAndTriggerNamespace)1