Search in sources :

Example 6 with DefaultExtensionLoadingContext

use of org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext 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());
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) MetadataType(org.mule.metadata.api.model.MetadataType) ExtensionsTestUtils.toMetadataType(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 7 with DefaultExtensionLoadingContext

use of org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext 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)));
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 8 with DefaultExtensionLoadingContext

use of org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext 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)));
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) MetadataType(org.mule.metadata.api.model.MetadataType) ExtensionsTestUtils.toMetadataType(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType) IntegerAttributes(org.mule.test.heisenberg.extension.model.types.IntegerAttributes) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 9 with DefaultExtensionLoadingContext

use of org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext in project mule by mulesoft.

the class DisplayDeclarationEnricherTestCase method setUp.

@Before
public void setUp() {
    String version = getProductVersion();
    ClassLoader cl = getClass().getClassLoader();
    DefaultExtensionLoadingContext loadingCtx = new DefaultExtensionLoadingContext(cl, DSL_CTX);
    DefaultJavaModelLoaderDelegate heisenbergLoader = new DefaultJavaModelLoaderDelegate(HeisenbergExtension.class, version);
    DefaultJavaModelLoaderDelegate marvelLoader = new DefaultJavaModelLoaderDelegate(MarvelExtension.class, version);
    heisenbergDeclarer = heisenbergLoader.declare(loadingCtx);
    marvelDeclarer = marvelLoader.declare(loadingCtx);
    DisplayDeclarationEnricher enricher = new DisplayDeclarationEnricher();
    enricher.enrich(new DefaultExtensionLoadingContext(heisenbergDeclarer, cl, DSL_CTX));
    enricher.enrich(new DefaultExtensionLoadingContext(marvelDeclarer, cl, DSL_CTX));
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) DefaultJavaModelLoaderDelegate(org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate) Before(org.junit.Before)

Example 10 with DefaultExtensionLoadingContext

use of org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext in project mule by mulesoft.

the class JavaConfigurationDeclarationEnricherTestCase method setUp.

@Before
public void setUp() {
    ExtensionDeclarer declarer = new DefaultJavaModelLoaderDelegate(HeisenbergExtension.class, getProductVersion()).declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
    new JavaConfigurationDeclarationEnricher().enrich(new DefaultExtensionLoadingContext(declarer, this.getClass().getClassLoader(), getDefault(emptySet())));
    declaration = declarer.getDeclaration();
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) DefaultJavaModelLoaderDelegate(org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate) HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Before(org.junit.Before)

Aggregations

DefaultExtensionLoadingContext (org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext)11 ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)8 DefaultJavaModelLoaderDelegate (org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate)6 Before (org.junit.Before)5 Test (org.junit.Test)4 SmallTest (org.mule.tck.size.SmallTest)4 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)3 HeisenbergExtension (org.mule.test.heisenberg.extension.HeisenbergExtension)3 MetadataType (org.mule.metadata.api.model.MetadataType)2 ExtensionModelFactory (org.mule.runtime.extension.internal.loader.ExtensionModelFactory)2 ExtensionsTestUtils.toMetadataType (org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType)2 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)1 ExtensionLoadingContext (org.mule.runtime.extension.api.loader.ExtensionLoadingContext)1 TargetParameterDeclarationEnricher (org.mule.runtime.extension.internal.loader.enricher.TargetParameterDeclarationEnricher)1 NullDslResolvingContext (org.mule.runtime.internal.dsl.NullDslResolvingContext)1 ExtensionDescriptionsEnricher (org.mule.runtime.module.extension.internal.loader.enricher.ExtensionDescriptionsEnricher)1 ImplementingTypeModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty)1 IntegerAttributes (org.mule.test.heisenberg.extension.model.types.IntegerAttributes)1