Search in sources :

Example 31 with DataType

use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.

the class DataTypeBuilderTestCase method invalidMimeType.

@Test
public void invalidMimeType() {
    expected.expect(IllegalArgumentException.class);
    final DataType dataType = DataType.builder().mediaType("imInvalid").build();
}
Also used : DefaultFunctionDataType(org.mule.runtime.core.internal.metadata.DefaultFunctionDataType) SimpleDataType(org.mule.runtime.core.internal.metadata.SimpleDataType) FunctionDataType(org.mule.runtime.api.metadata.FunctionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) DataType(org.mule.runtime.api.metadata.DataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) Test(org.junit.Test)

Example 32 with DataType

use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.

the class DataTypeBuilderTestCase method invalidEncoding.

@Test
public void invalidEncoding() {
    expected.expect(IllegalArgumentException.class);
    final DataType dataType = DataType.builder().charset("imInvalid").build();
}
Also used : DefaultFunctionDataType(org.mule.runtime.core.internal.metadata.DefaultFunctionDataType) SimpleDataType(org.mule.runtime.core.internal.metadata.SimpleDataType) FunctionDataType(org.mule.runtime.api.metadata.FunctionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) DataType(org.mule.runtime.api.metadata.DataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) Test(org.junit.Test)

Example 33 with DataType

use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.

the class DataTypeBuilderTestCase method buildTypedCollectionFromImplementationClass.

@Test
public void buildTypedCollectionFromImplementationClass() {
    final DataType dataType = DataType.builder().collectionType(SpecificCollection.class).build();
    assertThat(dataType, instanceOf(DefaultCollectionDataType.class));
    assertThat(dataType.getType(), is(equalTo(SpecificCollection.class)));
    assertThat(((DefaultCollectionDataType) dataType).getItemDataType(), is(STRING));
}
Also used : DefaultFunctionDataType(org.mule.runtime.core.internal.metadata.DefaultFunctionDataType) SimpleDataType(org.mule.runtime.core.internal.metadata.SimpleDataType) FunctionDataType(org.mule.runtime.api.metadata.FunctionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) DataType(org.mule.runtime.api.metadata.DataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) Test(org.junit.Test)

Example 34 with DataType

use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.

the class DataTypeBuilderTestCase method cglibInterfaceProxy.

@Test
public void cglibInterfaceProxy() {
    final Message muleMessageProxy = mock(Message.class);
    final DataType dataType = DataType.fromObject(muleMessageProxy);
    assertThat(dataType.getType(), is(equalTo(Message.class)));
}
Also used : Message(org.mule.runtime.api.message.Message) DefaultFunctionDataType(org.mule.runtime.core.internal.metadata.DefaultFunctionDataType) SimpleDataType(org.mule.runtime.core.internal.metadata.SimpleDataType) FunctionDataType(org.mule.runtime.api.metadata.FunctionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) DataType(org.mule.runtime.api.metadata.DataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) Test(org.junit.Test)

Example 35 with DataType

use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.

the class DataTypeBuilderTestCase method buildMap.

@Test
public void buildMap() {
    final DataType dataType = DataType.fromType(HashMap.class);
    assertThat(dataType, instanceOf(DefaultMapDataType.class));
    assertThat(dataType.getType(), is(equalTo(HashMap.class)));
    assertThat(((DefaultMapDataType) dataType).getKeyDataType(), is(OBJECT));
    assertThat(((DefaultMapDataType) dataType).getValueDataType(), is(OBJECT));
}
Also used : DefaultFunctionDataType(org.mule.runtime.core.internal.metadata.DefaultFunctionDataType) SimpleDataType(org.mule.runtime.core.internal.metadata.SimpleDataType) FunctionDataType(org.mule.runtime.api.metadata.FunctionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) DataType(org.mule.runtime.api.metadata.DataType) DefaultCollectionDataType(org.mule.runtime.core.internal.metadata.DefaultCollectionDataType) DefaultMapDataType(org.mule.runtime.core.internal.metadata.DefaultMapDataType) Test(org.junit.Test)

Aggregations

DataType (org.mule.runtime.api.metadata.DataType)102 Test (org.junit.Test)67 SmallTest (org.mule.tck.size.SmallTest)29 DefaultCollectionDataType (org.mule.runtime.core.internal.metadata.DefaultCollectionDataType)24 FunctionDataType (org.mule.runtime.api.metadata.FunctionDataType)20 DefaultFunctionDataType (org.mule.runtime.core.internal.metadata.DefaultFunctionDataType)20 DefaultMapDataType (org.mule.runtime.core.internal.metadata.DefaultMapDataType)20 SimpleDataType (org.mule.runtime.core.internal.metadata.SimpleDataType)20 Message (org.mule.runtime.api.message.Message)18 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)18 TypedValue (org.mule.runtime.api.metadata.TypedValue)12 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)12 CompiledExpression (org.mule.mvel2.compiler.CompiledExpression)10 CollectionDataType (org.mule.runtime.api.metadata.CollectionDataType)10 Transformer (org.mule.runtime.core.api.transformer.Transformer)10 ArrayList (java.util.ArrayList)9 List (java.util.List)9 ParserContext (org.mule.mvel2.ParserContext)7 MapDataType (org.mule.runtime.api.metadata.MapDataType)6 MVELExpressionLanguage (org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguage)6