Search in sources :

Example 6 with Ricin

use of org.mule.test.heisenberg.extension.model.Ricin in project mule by mulesoft.

the class AbstractHeisenbergConfigTestCase method getStartUpRegistryObjects.

@Override
protected Map<String, Object> getStartUpRegistryObjects() {
    final Map<String, Object> objects = new HashMap<>();
    objects.put("recipes", ImmutableMap.<String, Long>builder().put("methylamine", 75l).put("pseudoephedrine", 0l).put("P2P", 25l).build());
    objects.put("deathsBySeasons", ImmutableMap.<String, List<String>>builder().put("s01", ImmutableList.<String>builder().add("emilio").add("domingo").build()).put("s02", ImmutableList.<String>builder().add("tuco").add("tortuga").build()).build());
    Ricin ricin = new Ricin(new KnockeableDoor("Lidia", "Stevia coffe shop"), 22L);
    objects.put("labeledRicins", ImmutableMap.<String, Ricin>builder().put("pojo", ricin).build());
    objects.put("monthlyIncomes", ImmutableList.<Long>builder().add(12000L).add(500L).build());
    objects.put("enemies", ImmutableList.<String>builder().add("Gustavo Fring").add("Hank").build());
    objects.put("ricinPacks", ImmutableSet.<Ricin>builder().add(ricin).build());
    objects.put("candidateDoors", ImmutableMap.<String, KnockeableDoor>builder().put("skyler", new KnockeableDoor("Skyler", "308 Negra Arroyo Lane")).put("saul", new KnockeableDoor("Saul", "Shopping Mall")).build());
    return objects;
}
Also used : HashMap(java.util.HashMap) Ricin(org.mule.test.heisenberg.extension.model.Ricin) KnockeableDoor(org.mule.test.heisenberg.extension.model.KnockeableDoor) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList)

Example 7 with Ricin

use of org.mule.test.heisenberg.extension.model.Ricin in project mule by mulesoft.

the class OperationExecutionTestCase method operationWhichConsumesAListOfNonInstantiableArgument.

@Test
public void operationWhichConsumesAListOfNonInstantiableArgument() throws Exception {
    Ricin ricinWeapon1 = new Ricin();
    ricinWeapon1.setMicrogramsPerKilo(10L);
    Ricin ricinWeapon2 = new Ricin();
    ricinWeapon2.setMicrogramsPerKilo(10L);
    List<Weapon> weaponList = Arrays.asList(ricinWeapon1, ricinWeapon2);
    CoreEvent event = flowRunner("killWithMultipleWeapons").withPayload(EMPTY).withVariable("weapons", weaponList).run();
    List<String> result = weaponList.stream().map(Weapon::kill).collect(Collectors.toList());
    assertThat(event.getMessage().getPayload().getValue(), is(result));
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Weapon(org.mule.test.heisenberg.extension.model.Weapon) Test(org.junit.Test)

Example 8 with Ricin

use of org.mule.test.heisenberg.extension.model.Ricin in project mule by mulesoft.

the class OperationExecutionTestCase method operationWhichConsumesANonInstantiableArgument.

@Test
public void operationWhichConsumesANonInstantiableArgument() throws Exception {
    Ricin ricinWeapon = new Ricin();
    ricinWeapon.setMicrogramsPerKilo(10L);
    CoreEvent event = flowRunner("killWithWeapon").withPayload(EMPTY).withVariable("weapon", ricinWeapon).run();
    assertThat(event.getMessage().getPayload().getValue(), is(KILL_RESULT));
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 9 with Ricin

use of org.mule.test.heisenberg.extension.model.Ricin in project mule by mulesoft.

the class ExtensionsClientTestCase method executeOperationWithComplexType.

@Test
@Description("Executes an operation with a complex type parameter using the client and the DefaultOperationParametersBuilder")
public void executeOperationWithComplexType() throws Throwable {
    Weapon.WeaponAttributes attributes = new Weapon.WeaponAttributes();
    attributes.setBrand("brand");
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("weapon", Ricin.class, builder().addParameter("destination", KnockeableDoor.class, builder().addParameter("address", "ADdresss").addParameter("victim", "victim!1231")).addParameter("microgramsPerKilo", 123L)).addParameter("type", FIRE_WEAPON).addParameter("attributesOfWeapon", attributes).build();
    Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "killWithWeapon", params);
    assertThat(result.getOutput(), is("Killed with: You have been killed with Ricin , Type FIRE_WEAPON and attribute brand"));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Ricin(org.mule.test.heisenberg.extension.model.Ricin) KnockeableDoor(org.mule.test.heisenberg.extension.model.KnockeableDoor) Weapon(org.mule.test.heisenberg.extension.model.Weapon) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 10 with Ricin

use of org.mule.test.heisenberg.extension.model.Ricin in project mule by mulesoft.

the class RoutersExecutionTestCase method stereotypedRoutes.

@Test
public void stereotypedRoutes() throws Exception {
    Event routeEvent = flowRunner("stereotypedRoutes").run();
    Ricin ricin = ((List<Ricin>) routeEvent.getMessage().getPayload().getValue()).get(0);
    assertThat(ricin.getDestination().getVictim(), is("bye bye, someName"));
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) Event(org.mule.runtime.api.event.Event) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) List(java.util.List) Test(org.junit.Test)

Aggregations

Ricin (org.mule.test.heisenberg.extension.model.Ricin)10 Test (org.junit.Test)7 List (java.util.List)4 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)3 ArrayList (java.util.ArrayList)2 KnockeableDoor (org.mule.test.heisenberg.extension.model.KnockeableDoor)2 Weapon (org.mule.test.heisenberg.extension.model.Weapon)2 ImmutableList (com.google.common.collect.ImmutableList)1 Description (io.qameta.allure.Description)1 HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Event (org.mule.runtime.api.event.Event)1 OperationParameters (org.mule.runtime.extension.api.client.OperationParameters)1 HeisenbergExtension (org.mule.test.heisenberg.extension.HeisenbergExtension)1 Revolver (org.mule.test.subtypes.extension.Revolver)1