use of org.mule.runtime.api.meta.model.ExtensionModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method validatorStereotype.
@Test
public void validatorStereotype() {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
OperationModel operation = extensionModel.getOperationModel("validateMoney").get();
StereotypeModel stereotypeModel = operation.getStereotype();
assertThat(stereotypeModel.isAssignableTo(PROCESSOR), is(true));
assertThat(stereotypeModel.isAssignableTo(VALIDATOR), is(true));
assertThat(stereotypeModel.getType(), is(VALIDATOR_DEFINITION.getName()));
assertThat(stereotypeModel.getNamespace(), is(HEISENBERG.toUpperCase()));
assertThat(stereotypeModel.getParent().get(), is(VALIDATOR));
}
use of org.mule.runtime.api.meta.model.ExtensionModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method testeableConnectionProvider.
@Test
public void testeableConnectionProvider() throws Exception {
ExtensionModel extensionModel = createExtension(VeganExtension.class);
ConnectionProviderModel connectionProviderModel = extensionModel.getConfigurationModel(BANANA).map(c -> c.getConnectionProviders().get(0)).get();
assertThat(connectionProviderModel.supportsConnectivityTesting(), is(true));
}
use of org.mule.runtime.api.meta.model.ExtensionModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method objectStoreParameters.
@Test
public void objectStoreParameters() {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
OperationModel operationModel = extensionModel.getOperationModel("storeMoney").get();
ParameterModel parameter = operationModel.getAllParameterModels().stream().filter(p -> "objectStore".equals(p.getName())).findFirst().get();
StereotypeModel stereotype = parameter.getAllowedStereotypes().stream().filter(s -> s.getType().equals(OBJECT_STORE.getType())).findFirst().get();
assertThat(stereotype.getNamespace(), equalTo(OBJECT_STORE.getNamespace()));
Optional<ImportedTypeModel> typeImport = extensionModel.getImportedTypes().stream().filter(i -> getTypeId(i.getImportedType()).map(id -> ObjectStore.class.getName().equals(id)).orElse(false)).findFirst();
assertThat(typeImport.isPresent(), is(true));
}
use of org.mule.runtime.api.meta.model.ExtensionModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method streamingHintOnSource.
@Test
public void streamingHintOnSource() throws Exception {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
SourceModel sourceModel = extensionModel.getConfigurationModels().get(0).getSourceModel("ListenPayments").get();
ParameterModel streamingParameter = sourceModel.getAllParameterModels().stream().filter(p -> p.getName().equals(STREAMING_STRATEGY_PARAMETER_NAME)).findFirst().get();
assertStreamingStrategy(streamingParameter);
}
use of org.mule.runtime.api.meta.model.ExtensionModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method defaultStereotype.
@Test
public void defaultStereotype() {
ExtensionModel extensionModel = createExtension(VeganExtension.class);
OperationModel operation = extensionModel.getConfigurationModel(APPLE).get().getOperationModel("eatApple").get();
StereotypeModel stereotypeModel = operation.getStereotype();
assertThat(stereotypeModel.isAssignableTo(PROCESSOR), is(true));
assertThat(stereotypeModel.getType(), is(PROCESSOR_DEFINITION.getName()));
assertThat(stereotypeModel.getNamespace(), is("MULE"));
assertThat(stereotypeModel.getParent().isPresent(), is(false));
}
Aggregations