Search in sources :

Example 6 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class TransformDiscoveryTestCase method testSimpleDiscovery.

@Test
public void testSimpleDiscovery() throws Exception {
    MuleRegistry registry = ((MuleContextWithRegistries) muleContext).getRegistry();
    Transformer t = registry.lookupTransformer(DataType.STRING, DataType.fromType(Apple.class));
    assertNotNull(t);
    assertEquals(StringToApple.class, t.getClass());
    t = registry.lookupTransformer(DataType.STRING, DataType.fromType(Orange.class));
    assertNotNull(t);
    assertEquals(StringToOrange.class, t.getClass());
    try {
        registry.lookupTransformer(DataType.STRING, DataType.fromType(Banana.class));
        fail("There is no transformer to go from String to Banana");
    } catch (TransformerException e) {
    // expected
    }
    registry.registerTransformer(new StringToRedApple());
    t = registry.lookupTransformer(DataType.STRING, DataType.fromType(RedApple.class));
    assertNotNull(t);
    assertEquals(StringToRedApple.class, t.getClass());
}
Also used : Apple(org.mule.tck.testmodels.fruit.Apple) RedApple(org.mule.tck.testmodels.fruit.RedApple) Transformer(org.mule.runtime.core.api.transformer.Transformer) MuleContextWithRegistries(org.mule.runtime.core.internal.context.MuleContextWithRegistries) MuleRegistry(org.mule.runtime.core.internal.registry.MuleRegistry) TransformerException(org.mule.runtime.core.api.transformer.TransformerException) Banana(org.mule.tck.testmodels.fruit.Banana) Test(org.junit.Test)

Example 7 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class ConfigAliasTestCase method parseConnectionProviderWithAlias.

@Test
public void parseConnectionProviderWithAlias() throws Exception {
    Banana connection = (Banana) runFlow("alias").getMessage().getPayload().getValue();
    assertThat(connection, is(notNullValue()));
    assertThat(connection.getOrigin(), is("Brazil"));
}
Also used : Banana(org.mule.tck.testmodels.fruit.Banana) Test(org.junit.Test)

Example 8 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class DefaultMuleContextFactoryTestCase method before.

@Before
public void before() {
    Map<String, Object> objects = new HashMap<>();
    objects.put(TEST_STRING_KEY, TEST_STRING_VALUE);
    objects.put(TEST_OBJECT_NAME, new Banana());
    testConfigBuilder = new SimpleConfigurationBuilder(objects);
    testConfigBuilder2 = new SimpleConfigurationBuilder(singletonMap(TEST_STRING_KEY2, TEST_STRING_VALUE2));
}
Also used : HashMap(java.util.HashMap) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) Banana(org.mule.tck.testmodels.fruit.Banana) Before(org.junit.Before)

Example 9 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class TestContextFactory method populateTestData.

protected void populateTestData(Context context) throws NamingException {
    context.bind("fruit/apple", new Apple());
    context.bind("fruit/banana", new Banana());
    context.bind("fruit/orange", new Orange(new Integer(8), new Double(10), "Florida Sunny"));
}
Also used : Apple(org.mule.tck.testmodels.fruit.Apple) Orange(org.mule.tck.testmodels.fruit.Orange) Banana(org.mule.tck.testmodels.fruit.Banana)

Example 10 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class CachedConnectionHandlerTestCase method returnsAlwaysSameConnectionAndConnectOnlyOnce.

@Test
public void returnsAlwaysSameConnectionAndConnectOnlyOnce() throws Exception {
    Banana connection1 = managedConnection.getConnection();
    Banana connection2 = managedConnection.getConnection();
    assertThat(connection1, is(sameInstance(connection2)));
    verify(connectionProvider).connect();
}
Also used : Banana(org.mule.tck.testmodels.fruit.Banana) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

Banana (org.mule.tck.testmodels.fruit.Banana)17 Test (org.junit.Test)13 Apple (org.mule.tck.testmodels.fruit.Apple)7 SmallTest (org.mule.tck.size.SmallTest)6 Orange (org.mule.tck.testmodels.fruit.Orange)5 FruitBowl (org.mule.tck.testmodels.fruit.FruitBowl)4 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)3 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)2 Fruit (org.mule.tck.testmodels.fruit.Fruit)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Before (org.junit.Before)1 ConnectionProvider (org.mule.runtime.api.connection.ConnectionProvider)1 Message (org.mule.runtime.api.message.Message)1 Latch (org.mule.runtime.api.util.concurrent.Latch)1 SimpleConfigurationBuilder (org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder)1 Transformer (org.mule.runtime.core.api.transformer.Transformer)1 TransformerException (org.mule.runtime.core.api.transformer.TransformerException)1 MuleContextWithRegistries (org.mule.runtime.core.internal.context.MuleContextWithRegistries)1