Search in sources :

Example 1 with Ricin

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

the class OperationExecutionTestCase method operationWithListPojoAsChildElementsOverridesDefault.

@Test
public void operationWithListPojoAsChildElementsOverridesDefault() throws Exception {
    List<Ricin> ricins = (List<Ricin>) flowRunner("killWithRicinAsChildElement").withPayload(EMPTY).run().getMessage().getPayload().getValue();
    assertThat(ricins, hasSize(2));
    assertThat(ricins.get(0), instanceOf(Ricin.class));
    assertThat(ricins.get(1), instanceOf(Ricin.class));
    Ricin ricin1 = ricins.get(0);
    assertThat(ricin1.getMicrogramsPerKilo(), is(20L));
    assertThat(ricin1.getDestination().getVictim(), is("Lidia"));
    assertThat(ricin1.getDestination().getAddress(), is("Stevia coffe shop"));
    Ricin ricin2 = ricins.get(1);
    assertThat(ricin2.getMicrogramsPerKilo(), is(22L));
    assertThat(ricin2.getDestination().getVictim(), is("Gustavo Fring"));
    assertThat(ricin2.getDestination().getAddress(), is("pollos hermanos"));
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with Ricin

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

the class OperationExecutionTestCase method operationWithListPojoAsDefaultPayload.

@Test
public void operationWithListPojoAsDefaultPayload() throws Exception {
    Ricin ricinWeapon1 = new Ricin();
    ricinWeapon1.setMicrogramsPerKilo(20L);
    Ricin ricinWeapon2 = new Ricin();
    ricinWeapon2.setMicrogramsPerKilo(22L);
    List<Ricin> ricins = (List<Ricin>) flowRunner("killWithRicinDefaultPayload").withPayload(Arrays.asList(ricinWeapon1, ricinWeapon2)).run().getMessage().getPayload().getValue();
    assertThat(ricins, hasSize(2));
    assertThat(ricins.get(0), instanceOf(Ricin.class));
    assertThat(ricins.get(1), instanceOf(Ricin.class));
    Ricin ricin1 = ricins.get(0);
    assertThat(ricin1.getMicrogramsPerKilo(), is(20L));
    Ricin ricin2 = ricins.get(1);
    assertThat(ricin2.getMicrogramsPerKilo(), is(22L));
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with Ricin

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

the class ParameterizedConfigParserTestCase method assertLabeledRicin.

private void assertLabeledRicin(HeisenbergExtension heisenberg) {
    Map<String, Ricin> labeledRicin = heisenberg.getRicinGroup().getLabeledRicin();
    assertNotNull(labeledRicin);
    assertThat(labeledRicin.size(), equalTo(1));
    assertThat(labeledRicin.get("pojo"), instanceOf(Ricin.class));
    Ricin ricin = labeledRicin.get("pojo");
    assertNotNull(ricin);
    assertThat(ricin.getMicrogramsPerKilo(), equalTo(MICROGRAMS_PER_KILO));
    assertDoor(ricin.getDestination(), LIDIA, STEVIA_COFFE_SHOP);
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 4 with Ricin

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

the class ParameterizedConfigParserTestCase method assertRicinPacks.

private void assertRicinPacks(HeisenbergExtension heisenberg) {
    Set<Ricin> ricinPacks = heisenberg.getRicinGroup().getRicinPacks();
    assertNotNull(ricinPacks);
    assertThat(ricinPacks.size(), equalTo(1));
    Ricin ricin = ricinPacks.iterator().next();
    assertThat(ricin.getMicrogramsPerKilo(), equalTo(MICROGRAMS_PER_KILO));
    assertDoor(ricin.getDestination(), LIDIA, STEVIA_COFFE_SHOP);
}
Also used : Ricin(org.mule.test.heisenberg.extension.model.Ricin)

Example 5 with Ricin

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

the class SubTypesMappingParserTestCase method subtypeContributionToOtherExtension.

@Test
public void subtypeContributionToOtherExtension() throws Exception {
    HeisenbergExtension heisenberg = lookupHeisenberg("heisenberg");
    assertThat(heisenberg, is(notNullValue()));
    List<? extends Weapon> wildCardWeapons = heisenberg.getWildCardWeapons();
    assertThat(wildCardWeapons, is(notNullValue()));
    assertThat(wildCardWeapons, hasSize(2));
    assertThat(wildCardWeapons.get(0), instanceOf(Ricin.class));
    assertThat(((Ricin) wildCardWeapons.get(0)).getMicrogramsPerKilo(), is(10L));
    assertThat(((Ricin) wildCardWeapons.get(0)).getDestination(), is(notNullValue()));
    assertThat(((Ricin) wildCardWeapons.get(0)).getDestination().getVictim(), is("Krazy-8"));
    assertThat(wildCardWeapons.get(1), instanceOf(Revolver.class));
    assertThat(((Revolver) wildCardWeapons.get(1)).getBullets(), is(3));
}
Also used : Revolver(org.mule.test.subtypes.extension.Revolver) Ricin(org.mule.test.heisenberg.extension.model.Ricin) HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) 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