use of org.mule.metadata.java.api.annotation.ClassInformationAnnotation in project mule by mulesoft.
the class DynamicMetadataDeclarationEnricherTestCase method declareStaticAndDynamicTypesInSource.
@Test
public void declareStaticAndDynamicTypesInSource() {
List<SourceDeclaration> messageSources = declaration.getConfigurations().get(0).getMessageSources();
SourceDeclaration sourceDynamicAttributes = getDeclaration(messageSources, "MetadataSource");
assertOutputType(sourceDynamicAttributes.getOutput(), TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, Object.class))).openWith(TYPE_LOADER.load(Object.class)).build(), true);
assertOutputType(sourceDynamicAttributes.getOutputAttributes(), toMetadataType(StringAttributes.class), false);
assertParameterType(getDeclaration(sourceDynamicAttributes.getAllParameters(), "type"), toMetadataType(String.class));
messageSources = declaration.getMessageSources();
SourceDeclaration sourceStaticAttributes = getDeclaration(messageSources, "MetadataSourceWithMultilevel");
assertOutputType(sourceStaticAttributes.getOutput(), TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, Object.class))).openWith(TYPE_LOADER.load(Object.class)).build(), true);
assertOutputType(sourceStaticAttributes.getOutputAttributes(), toMetadataType(StringAttributes.class), false);
List<ParameterDeclaration> locationKey = sourceStaticAttributes.getAllParameters();
assertParameterType(getDeclaration(locationKey, "continent"), toMetadataType(String.class));
assertParameterType(getDeclaration(locationKey, "country"), toMetadataType(String.class));
assertParameterType(getDeclaration(locationKey, "city"), toMetadataType(String.class));
}
Aggregations