use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class DefaultJavaModelLoaderDelegate method declare.
/**
* {@inheritDoc}
*/
@Override
public ExtensionDeclarer declare(ExtensionLoadingContext context) {
ExtensionDeclarer declarer = context.getExtensionDeclarer().named(extensionElement.getName()).onVersion(version).fromVendor(extensionElement.getVendor()).withCategory(extensionElement.getCategory()).withModelProperty(new ExtensionTypeDescriptorModelProperty(extensionElement));
// TODO MULE-14517: This workaround should be replaced for a better and more complete mechanism
context.getParameter("COMPILATION_MODE").ifPresent(m -> declarer.withModelProperty(new CompileTimeModelProperty()));
extensionElement.getDeclaringClass().ifPresent(extensionClass -> declarer.withModelProperty(new ImplementingTypeModelProperty(extensionClass)));
processLicenseRequirements(declarer);
parseExternalLibs(extensionElement, declarer);
addExceptionEnricher(extensionElement, declarer);
configLoaderDelegate.declareConfigurations(declarer, extensionElement);
connectionProviderModelLoaderDelegate.declareConnectionProviders(declarer, extensionElement);
if (!isEmpty(extensionElement.getConfigurations())) {
operationLoaderDelegate.declareOperations(declarer, declarer, null, extensionElement.getOperations(), false);
functionModelLoaderDelegate.declareFunctions(declarer, declarer, null, extensionElement.getFunctions());
extensionElement.getSources().forEach(source -> sourceModelLoaderDelegate.declareMessageSource(declarer, declarer, source, false));
}
return declarer;
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method minMuleVersionDefaultValueIsDescribedCorrectly.
@Test
public void minMuleVersionDefaultValueIsDescribedCorrectly() {
setLoader(loaderFor(PetStoreConnector.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method categoryIsDescribedCorrectly.
@Test
public void categoryIsDescribedCorrectly() {
setLoader(loaderFor(HeisenbergExtension.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
assertThat(declaration.getCategory(), is(SELECT));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method flowListeningOperationWithoutAttributes.
@Test
public void flowListeningOperationWithoutAttributes() {
setLoader(loaderFor(VeganExtension.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
OperationDeclaration operation = getOperation(getConfiguration(declaration, BANANA), "getLunch");
assertThat(operation, is(notNullValue()));
assertOutputType(operation.getOutput(), toMetadataType(Fruit.class), false);
assertOutputType(operation.getOutputAttributes(), TYPE_BUILDER.voidType().build(), false);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method minMuleVersionIsDescribedCorrectly.
@Test
public void minMuleVersionIsDescribedCorrectly() {
setLoader(loaderFor(HeisenbergExtension.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
}
Aggregations