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());
}
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"));
}
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));
}
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"));
}
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();
}
Aggregations