Search in sources :

Example 6 with PolicyStateId

use of org.mule.runtime.core.api.policy.PolicyStateId in project mule by mulesoft.

the class DefaultPolicyStateHandlerTestCase method sameExecutionDifferentPolicyId.

@Test
public void sameExecutionDifferentPolicyId() {
    PolicyStateId policy1StateExecutionId = new PolicyStateId(TEST_EXECUTION_ID, TEST_POLICY_ID);
    PolicyStateId policy2StateExecutionId = new PolicyStateId(TEST_EXECUTION_ID, TEST_POLICY_ID2);
    defaultPolicyStateHandler.updateState(policy1StateExecutionId, eventTestExecutionId);
    defaultPolicyStateHandler.updateState(policy2StateExecutionId, eventTestExecutionId2);
    assertThat(defaultPolicyStateHandler.getLatestState(policy1StateExecutionId).get(), is(eventTestExecutionId));
    assertThat(defaultPolicyStateHandler.getLatestState(policy2StateExecutionId).get(), is(eventTestExecutionId2));
}
Also used : PolicyStateId(org.mule.runtime.core.api.policy.PolicyStateId) Test(org.junit.Test)

Example 7 with PolicyStateId

use of org.mule.runtime.core.api.policy.PolicyStateId in project mule by mulesoft.

the class DefaultPolicyStateHandlerTestCase method samePolicyDifferentExecutionId.

@Test
public void samePolicyDifferentExecutionId() {
    PolicyStateId policyStateExecutionId = new PolicyStateId(TEST_EXECUTION_ID, TEST_POLICY_ID);
    PolicyStateId policyStateExecutionId2 = new PolicyStateId(TEST_EXECUTION_ID2, TEST_POLICY_ID);
    defaultPolicyStateHandler.updateState(policyStateExecutionId, eventTestExecutionId);
    defaultPolicyStateHandler.updateState(policyStateExecutionId2, eventTestExecutionId2);
    assertThat(defaultPolicyStateHandler.getLatestState(policyStateExecutionId).get(), is(eventTestExecutionId));
    assertThat(defaultPolicyStateHandler.getLatestState(policyStateExecutionId2).get(), is(eventTestExecutionId2));
}
Also used : PolicyStateId(org.mule.runtime.core.api.policy.PolicyStateId) Test(org.junit.Test)

Aggregations

PolicyStateId (org.mule.runtime.core.api.policy.PolicyStateId)7 Test (org.junit.Test)4 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)3 Processor (org.mule.runtime.core.api.processor.Processor)3 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)3 MuleException (org.mule.runtime.api.exception.MuleException)2 PolicyStateHandler (org.mule.runtime.core.api.policy.PolicyStateHandler)2 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)2 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)2 MessageProcessors.processToApply (org.mule.runtime.core.privileged.processor.MessageProcessors.processToApply)2 Publisher (org.reactivestreams.Publisher)2 Logger (org.slf4j.Logger)2 LoggerFactory.getLogger (org.slf4j.LoggerFactory.getLogger)2 Mono.from (reactor.core.publisher.Mono.from)2 Optional (java.util.Optional)1 Optional.ofNullable (java.util.Optional.ofNullable)1 BiConsumer (java.util.function.BiConsumer)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Inject (javax.inject.Inject)1