use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method describeTestModule.
@Test
public void describeTestModule() throws Exception {
ExtensionDeclarer declarer = declareExtension();
ExtensionDeclaration extensionDeclaration = declarer.getDeclaration();
assertExtensionProperties(extensionDeclaration, HEISENBERG);
assertTestModuleConfiguration(extensionDeclaration);
assertTestModuleOperations(extensionDeclaration);
assertTestModuleConnectionProviders(extensionDeclaration);
assertTestModuleMessageSource(extensionDeclaration);
assertModelProperties(extensionDeclaration);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method listOfResultsOperationWithoutGenerics.
@Test
public void listOfResultsOperationWithoutGenerics() throws Exception {
ExtensionDeclarer declarer = loaderFor(HeisenbergWithListOfResultOperations.class).declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
OperationDeclaration operation = getOperation(declarer.getDeclaration(), "listOfResultsWithoutGenerics");
MetadataType outputType = operation.getOutput().getType();
assertThat(outputType, is(instanceOf(ArrayType.class)));
assertMessageType(((ArrayType) outputType).getType(), TYPE_BUILDER.anyType().build(), TYPE_BUILDER.anyType().build());
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method flyweight.
@Test
public void flyweight() {
setLoader(loaderFor(VeganExtension.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
final ConfigurationDeclaration appleConfiguration = findDeclarationByName(declaration.getConfigurations(), APPLE);
final ConfigurationDeclaration bananaConfiguration = findDeclarationByName(declaration.getConfigurations(), BANANA);
final String sourceName = PaulMcCartneySource.class.getSimpleName();
SourceDeclaration appleSource = findDeclarationByName(appleConfiguration.getMessageSources(), sourceName);
SourceDeclaration bananaSource = findDeclarationByName(bananaConfiguration.getMessageSources(), sourceName);
assertThat(appleSource, is(sameInstance(bananaSource)));
final String operationName = "spreadTheWord";
OperationDeclaration appleOperation = findDeclarationByName(appleConfiguration.getOperations(), operationName);
OperationDeclaration bananaOperation = findDeclarationByName(bananaConfiguration.getOperations(), operationName);
assertThat(appleOperation, is(sameInstance(bananaOperation)));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method messageOperationWithoutGenerics.
@Test
public void messageOperationWithoutGenerics() throws Exception {
ExtensionDeclarer declarer = loaderFor(HeisenbergWithGenericlessMessageOperation.class).declare(new DefaultExtensionLoadingContext(HeisenbergWithSameOperationsAndConfigs.class.getClassLoader(), getDefault(emptySet())));
OperationDeclaration operation = getOperation(declarer.getDeclaration(), "noGenerics");
assertThat(operation.getOutput().getType(), is(instanceOf(AnyType.class)));
assertThat(operation.getOutputAttributes().getType(), is(instanceOf(AnyType.class)));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method listOfResultsOperation.
@Test
public void listOfResultsOperation() throws Exception {
ExtensionDeclarer declarer = loaderFor(HeisenbergWithListOfResultOperations.class).declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
OperationDeclaration operation = getOperation(declarer.getDeclaration(), "listOfResults");
MetadataType outputType = operation.getOutput().getType();
assertThat(outputType, is(instanceOf(ArrayType.class)));
assertMessageType(((ArrayType) outputType).getType(), TYPE_LOADER.load(Integer.class), TYPE_LOADER.load(IntegerAttributes.class));
assertThat(operation.getOutputAttributes().getType(), is(instanceOf(VoidType.class)));
}
Aggregations