congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CoreEvent.getVariables
Code IndexAdd Tabnine to your IDE (free)

How to use
getVariables
method
in
org.mule.runtime.core.api.event.CoreEvent

Best Java code snippets using org.mule.runtime.core.api.event.CoreEvent.getVariables (Showing top 20 results out of 315)

origin: mulesoft/mule

@Test
public void testHardcodedXsdType1AndExtractFieldsInVarsFlow() throws Exception {
 final CoreEvent muleEvent = flowRunner("testHardcodedXsdType1AndExtractFieldsInVarsFlow").run();
 for (Map.Entry<String, Object> entry : USER_DATA.entrySet()) {
  assertThat(muleEvent.getVariables().containsKey("extracted-user-" + entry.getKey()), is(true));
  assertThat(muleEvent.getVariables().get("extracted-user-" + entry.getKey()).getValue(), is(entry.getValue()));
 }
}
origin: mulesoft/mule

@Test
public void testHardcodedType1AndExtractFieldsInVarsFlow() throws Exception {
 final CoreEvent muleEvent = flowRunner("testHardcodedType1AndExtractFieldsInVarsFlow").run();
 for (Map.Entry<String, Object> entry : EXPECTED_TYPE_1.entrySet()) {
  assertThat(muleEvent.getVariables().get("extracted-" + entry.getKey()).getValue(), is(entry.getValue()));
 }
}
origin: mulesoft/mule

@Test
public void testExtractingJsonResponseAndFeedingSimpleType() throws Exception {
 final CoreEvent muleEvent = flowRunner("testExtractingJsonResponseAndFeedingSimpleType").run();
 final Map<String, TypedValue<?>> variables = muleEvent.getVariables();
 assertThat(variables.get("checkingNotAvenue").getValue(), is(false));
 assertThat(variables.get("checkingFromExpression").getValue(), is(true));
 assertThat(variables.get("checkingFromHardcodedType1").getValue(), is(true));
 assertThat(variables.get("checkingFromHardcodedType1WithVariables").getValue(), is(true));
}
origin: mulesoft/mule

@Test
public void pagedOperationInTx() throws Exception {
 CoreEvent event = flowRunner("pagedOperationInTx").run();
 Collection<Integer> accumulator = (Collection<Integer>) event.getVariables().get("accumulator").getValue();
 assertThat(accumulator, is(notNullValue()));
 assertThat(accumulator, hasSize(2));
 Iterator<Integer> it = accumulator.iterator();
 Integer id1 = it.next();
 Integer id2 = it.next();
 assertThat(id1, equalTo(id2));
}
origin: mulesoft/mule

@Test
public void munitSpy() throws Exception {
 CoreEvent internalEvent = flowRunner("munitSpy").run();
 assertThat(internalEvent.getVariables().get("before").getValue(), is("true"));
 assertThat(internalEvent.getVariables().get("after").getValue(), is("true"));
}
origin: mulesoft/mule

@Test
@Description("Stores an object stream in a variable leaving without modifying the original payload")
public void getObjectStreamWithTargetValue() throws Exception {
 CoreEvent event = flowRunner("getStreamWithTargetValue").withPayload(data).run();
 assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), is(instanceOf(String.class)));
 assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), equalTo(data.get(0)));
}
origin: mulesoft/mule

@Test
public void variablesAddedBeforeNextProcessorNotPropagatedToIt() throws MuleException {
 CoreEvent initialEventWithVars = CoreEvent.builder(initialEvent).addVariable(INIT_VAR_NAME, INIT_VAR_VALUE).build();
 when(policy.getPolicyChain().apply(any())).thenAnswer(invocation -> subscriberContext()
   .flatMap(ctx -> Mono.<CoreEvent>from(invocation.getArgument(0)).transform(ctx.get(POLICY_NEXT_OPERATION))));
 just(initialEventWithVars).transform(policyProcessor).block();
 verify(flowProcessor).apply(eventCaptor.capture());
 assertEquals(((CoreEvent) from(eventCaptor.getValue()).block()).getVariables().keySet(),
        initialEventWithVars.getVariables().keySet());
}
origin: mulesoft/mule

@Test
public void munitSpyNoBefore() throws Exception {
 CoreEvent internalEvent = flowRunner("munitSpyNoBefore").run();
 assertThat(internalEvent.getMessage().getPayload().getValue(), is("1"));
 assertThat(internalEvent.getVariables().get("before"), is(nullValue()));
 assertThat(internalEvent.getVariables().get("after").getValue(), is("true"));
}
origin: mulesoft/mule

@Test
public void testSetPayloadHardcodedFlowWithTarget() throws Exception {
 CoreEvent event = flowRunner("testSetPayloadHardcodedFlowWithTarget").run();
 assertThat(event.getMessage().getPayload().getValue(), nullValue());
 final TypedValue<?> targetVariable = event.getVariables().get("target-variable");
 assertThat(targetVariable, notNullValue());
 assertThat(targetVariable.getValue(), instanceOf(Message.class));
 Message targetMessage = (Message) targetVariable.getValue();
 assertThat(targetMessage.getPayload().getValue(), is("hardcoded value"));
}
origin: mulesoft/mule

@Test
public void testSetPayloadHardcodedFlowWithTargetOverridingAnExistingVariable() throws Exception {
 CoreEvent event = flowRunner("testSetPayloadHardcodedFlowWithTargetOverridingAnExistingVariable").run();
 assertThat(event.getMessage().getPayload().getValue(), nullValue());
 final TypedValue<?> targetVariable = event.getVariables().get("existing-variable");
 assertThat(targetVariable, notNullValue());
 assertThat(targetVariable.getValue(), instanceOf(Message.class));
 Message targetMessage = (Message) targetVariable.getValue();
 assertThat(targetMessage.getPayload().getValue(), is("hardcoded value"));
}
origin: mulesoft/mule

@Test
public void testDoNothingFlow() throws Exception {
 CoreEvent muleEvent = flowRunner("testDoNothingFlow").run();
 assertThat(muleEvent.getMessage().getPayload().getValue(), is("before calling"));
 assertThat(muleEvent.getVariables().get("variableBeforeCalling").getValue(), is("value of flowvar before calling"));
}
origin: mulesoft/mule

@Test
public void twoRoutesRouterOther() throws Exception {
 CoreEvent internalEvent = flowRunner("twoRoutesRouter")
   .withVariable("executeWhen", false)
   .withVariable("executeOther", true).run();
 assertThat(internalEvent.getMessage().getPayload().getValue(), is("mule:set-payload"));
 assertThat(internalEvent.getVariables().get("newPayload"), is(nullValue()));
 assertThat(internalEvent.getVariables().get("newAttributes"), is(nullValue()));
}
origin: mulesoft/mule

protected void mockFlowReturningEvent(CoreEvent event) {
 when(flowProcessor.apply(any())).thenAnswer(inv -> from(inv.getArgument(0))
   .map(e -> {
    final Builder builder = PrivilegedEvent.builder((CoreEvent) e)
      .message(event.getMessage())
      .variables(event.getVariables());
    if (event instanceof PrivilegedEvent) {
     builder.session(((PrivilegedEvent) event).getSession());
    }
    return builder.build();
   }));
}
origin: mulesoft/mule

@Test
@Description("Rewing a stream and consume it twice")
public void rewind() throws Exception {
 CoreEvent result = flowRunner("rewind").withPayload(data).run();
 Message firstRead = (Message) result.getVariables().get("firstRead").getValue();
 Message secondRead = (Message) result.getVariables().get("secondRead").getValue();
 assertThat(firstRead.getPayload().getValue(), equalTo(data));
 assertThat(secondRead.getPayload().getValue(), equalTo(data));
}
origin: mulesoft/mule

@Test
@Description("Stores an object stream in a variable leaving without modifying the original payload")
public void getObjectStreamWithTargetVariable() throws Exception {
 CoreEvent event = flowRunner("getStreamWithTarget").keepStreamsOpen().withPayload(data).run();
 assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), is(instanceOf(CursorIteratorProvider.class)));
 assertThat(IteratorUtils.toList(((CursorIteratorProvider) event.getVariables().get(MY_STREAM_VAR).getValue()).openCursor()),
       equalTo(data));
 assertThat(event.getMessage().getPayload().getValue(), is(instanceOf(List.class)));
 assertThat(event.getMessage().getPayload().getValue(), equalTo(data));
}
origin: mulesoft/mule

@Test
public void voidRouter() throws Exception {
 CoreEvent internalEvent = flowRunner("voidRouter").withPayload("message").withAttributes("other").run();
 assertThat(internalEvent.getMessage().getPayload().getValue(), is("message"));
 assertThat(internalEvent.getMessage().getAttributes().getValue(), is("other"));
 assertThat(internalEvent.getVariables().get("newAttributes"), is(nullValue()));
}
origin: mulesoft/mule

@Test
public void twoRoutesRouterWhen() throws Exception {
 CoreEvent internalEvent = flowRunner("twoRoutesRouter")
   .withVariable("executeWhen", true)
   .withVariable("executeOther", false).run();
 assertThat(internalEvent.getMessage().getPayload().getValue(), is("mule:set-payload"));
 assertThat(internalEvent.getVariables().get("newPayload").getValue(), is("mule:set-payload"));
}
origin: mulesoft/mule

@Test
public void testFlowVarNamesRemoveImmutable() throws Exception {
 CoreEvent event = getEventBuilder()
   .message(of("whatever"))
   .addVariable("test", "val")
   .build();
 event = CoreEvent.builder(event).addVariable("test", "val").build();
 expectedException.expect(UnsupportedOperationException.class);
 event.getVariables().keySet().remove("test");
}
origin: mulesoft/mule

@Test
public void flowVariable() throws Exception {
 Message message = of("");
 CoreEvent event = InternalEvent.builder(context).message(message).addVariable("foo", "bar").build();
 assertEquals(event.getVariables().get("foo").getValue(), evaluate("flowVars['foo']", event));
}
origin: mulesoft/mule

@Test
public void assignValueToFlowVariable() throws Exception {
 Message message = of("");
 CoreEvent event = InternalEvent.builder(context).message(message).addVariable("foo", "bar_old").build();
 CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
 evaluate("flowVars['foo']='bar'", event, eventBuilder);
 assertEquals("bar", eventBuilder.build().getVariables().get("foo").getValue());
}
org.mule.runtime.core.api.eventCoreEventgetVariables

Popular methods of CoreEvent

  • getMessage
  • builder
    Create new Builder based on an existing CoreEvent instance. The existing EventContext is conserved.
  • getContext
  • getError
  • getSecurityContext
    The security context for this session. If not null outbound, inbound and/or method invocations will
  • asBindingContext
  • getCorrelationId
  • getFlowCallStack
    Events have a stack of executed flows (same as a call stack), so that at any given instant an applic
  • getItemSequenceInfo
  • getAuthentication
  • getGroupCorrelation
    Returns the correlation metadata of this message. See GroupCorrelation.
  • getVariableValueOrNull
    Helper method to get the value of a given variable in a null-safe manner such that null is returned
  • getGroupCorrelation,
  • getVariableValueOrNull

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • startActivity (Activity)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • ImageIO (javax.imageio)
  • JList (javax.swing)
  • JPanel (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now