use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class TargetParameterDeclarationEnricherTestCase method verifyTargetValueParameterOnOperation.
@Test
public void verifyTargetValueParameterOnOperation() {
OperationDeclaration operationDeclaration = getNamedObject(declaration.getOperations(), "transform");
ParameterDeclaration parameterDeclaration = getNamedObject(operationDeclaration.getAllParameters(), "targetValue");
assertThat(parameterDeclaration.getName(), is("targetValue"));
assertThat(parameterDeclaration.getExpressionSupport(), is(REQUIRED));
assertThat(parameterDeclaration.getType(), instanceOf(StringType.class));
assertThat(parameterDeclaration.isRequired(), is(false));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class TargetParameterDeclarationEnricherTestCase method verifyTargetParameterOnOperation.
@Test
public void verifyTargetParameterOnOperation() {
OperationDeclaration operationDeclaration = getNamedObject(declaration.getOperations(), "transform");
ParameterDeclaration parameterDeclaration = getNamedObject(operationDeclaration.getAllParameters(), "target");
assertThat(parameterDeclaration.getName(), is("target"));
assertThat(parameterDeclaration.getExpressionSupport(), is(NOT_SUPPORTED));
assertThat(parameterDeclaration.getType(), instanceOf(StringType.class));
assertThat(parameterDeclaration.isRequired(), is(false));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertTestModuleConfiguration.
private void assertTestModuleConfiguration(ExtensionDeclaration extensionDeclaration) throws Exception {
assertThat(extensionDeclaration.getConfigurations(), hasSize(1));
ConfigurationDeclaration conf = extensionDeclaration.getConfigurations().get(0);
assertThat(conf.getName(), equalTo(DEFAULT_CONFIG_NAME));
List<ParameterDeclaration> parameters = conf.getAllParameters();
assertThat(parameters, hasSize(31));
assertParameter(parameters, "myName", "", STRING_TYPE, false, SUPPORTED, HEISENBERG);
assertParameter(parameters, "age", "", toMetadataType(Integer.class), false, SUPPORTED, AGE);
assertParameter(parameters, "enemies", "", listOfString(), true, SUPPORTED, null);
assertParameter(parameters, "money", "", toMetadataType(BigDecimal.class), true, SUPPORTED, null);
assertParameter(parameters, "cancer", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "cancer", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "dateOfBirth", "", toMetadataType(Date.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfDeath", "", toMetadataType(Calendar.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfConception", "", toMetadataType(LocalDateTime.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfGraduation", "", toMetadataType(Calendar.class), false, NOT_SUPPORTED, null);
assertParameter(parameters, "recipe", "", TYPE_BUILDER.objectType().openWith(TYPE_BUILDER.numberType().integer().with(new ClassInformationAnnotation(Long.class))).with(new ClassInformationAnnotation(Map.class, asList(String.class, Long.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "ricinPacks", "", arrayOf(Set.class, objectTypeBuilder(Ricin.class)), false, SUPPORTED, null);
assertParameter(parameters, "nextDoor", "", toMetadataType(KnockeableDoor.class), false, SUPPORTED, null);
assertParameter(parameters, "candidateDoors", "", TYPE_BUILDER.objectType().openWith((objectTypeBuilder(KnockeableDoor.class)).build()).with(new ClassInformationAnnotation(Map.class, asList(String.class, KnockeableDoor.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "initialHealth", "", toMetadataType(HealthStatus.class), false, SUPPORTED, "CANCER");
assertParameter(parameters, "finalHealth", "", toMetadataType(HealthStatus.class), true, SUPPORTED, null);
assertParameter(parameters, "labAddress", "", STRING_TYPE, false, REQUIRED, null);
assertParameter(parameters, "firstEndevour", "", STRING_TYPE, false, NOT_SUPPORTED, null);
assertParameter(parameters, "weapon", "", toMetadataType(Weapon.class), false, SUPPORTED, null);
assertParameter(parameters, "wildCardWeapons", "", arrayOf(List.class, objectTypeBuilder(Weapon.class)), false, SUPPORTED, null);
assertParameter(parameters, "wildCards", "", arrayOf(List.class, objectTypeBuilder(Object.class)), false, SUPPORTED, null);
assertParameter(parameters, "worksAtDEA", "", toMetadataType(boolean.class), false, SUPPORTED, valueOf(TRUE));
assertParameter(parameters, "lovesMinerals", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "monthlyIncomes", "", arrayOf(List.class, longTypeBuilder()), true, SUPPORTED, null);
assertParameter(parameters, "labeledRicin", "", TYPE_BUILDER.objectType().openWith(objectTypeBuilder(Ricin.class)).with(new ClassInformationAnnotation(Map.class, asList(String.class, Ricin.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "deathsBySeasons", "", TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, List.class))).openWith(TYPE_BUILDER.arrayType().of(TYPE_BUILDER.stringType())).build(), false, SUPPORTED, null);
assertParameter(parameters, "weaponValueMap", "", TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, Weapon.class))).openWith(WEAPON_TYPE).build(), false, SUPPORTED, null);
assertParameter(parameters, "healthProgressions", "", TYPE_BUILDER.arrayType().of(TYPE_LOADER.load(HealthStatus.class)).build(), false, SUPPORTED, null);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertHeisenbergSource.
private void assertHeisenbergSource(SourceDeclaration source, String sourceName, Class<? extends Source> type) {
assertThat(source.getName(), is(sourceName));
List<ParameterDeclaration> parameters = source.getAllParameters();
assertThat(parameters, hasSize(31));
assertParameter(parameters, SOURCE_PARAMETER, "", INT_TYPE, true, NOT_SUPPORTED, null);
assertParameter(parameters, SOURCE_CALLBACK_PARAMETER, "", toMetadataType(Long.class), false, SUPPORTED, "#[payload]");
assertParameter(parameters, SOURCE_REPEATED_CALLBACK_PARAMETER, "", STRING_TYPE, false, SUPPORTED, null);
assertParameter(parameters, "methylamine", "", toMetadataType(Methylamine.class), false, SUPPORTED, null);
ImplementingTypeModelProperty typeModelProperty = source.getModelProperty(ImplementingTypeModelProperty.class).get();
assertThat(typeModelProperty.getType(), equalTo(type));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class BooleanParameterDeclarationEnricherTestCase method verifyConfigurationModelPropertyOnOperation.
@Test
public void verifyConfigurationModelPropertyOnOperation() {
ParameterDeclaration booleanDeclaration = getNamedObject(declaration.getConfigurations().get(0).getAllParameters(), "lovesMinerals");
assertThat(booleanDeclaration.isRequired(), is(FALSE));
assertThat(booleanDeclaration.getDefaultValue(), is(valueOf(FALSE)));
booleanDeclaration = getNamedObject(declaration.getConfigurations().get(0).getAllParameters(), "worksAtDEA");
assertThat(booleanDeclaration.isRequired(), is(FALSE));
assertThat(booleanDeclaration.getDefaultValue(), is(valueOf(TRUE)));
}
Aggregations