Search in sources :

Example 1 with DefaultExtensionLoadingContext

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

the class ExtensionDescriptionDocumenterTestCase method loadDocumentationFromFile.

@Test
public void loadDocumentationFromFile() {
    ClassLoader cl = currentThread().getContextClassLoader();
    ExtensionLoadingContext ctx = new DefaultExtensionLoadingContext(cl, getDefault(emptySet()));
    DefaultJavaModelLoaderDelegate loader = new DefaultJavaModelLoaderDelegate(extensionClass, "1.0.0-dev");
    loader.declare(ctx);
    ExtensionDescriptionsEnricher enricher = new ExtensionDescriptionsEnricher();
    enricher.enrich(ctx);
    ExtensionModelFactory factory = new ExtensionModelFactory();
    ExtensionModel extensionModel = factory.create(ctx);
    assertDescribedExtensionModel(extensionModel);
}
Also used : ExtensionDescriptionsEnricher(org.mule.runtime.module.extension.internal.loader.enricher.ExtensionDescriptionsEnricher) DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionLoadingContext(org.mule.runtime.extension.api.loader.ExtensionLoadingContext) DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) DefaultJavaModelLoaderDelegate(org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) ExtensionModelFactory(org.mule.runtime.extension.internal.loader.ExtensionModelFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 2 with DefaultExtensionLoadingContext

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

the class DynamicMetadataDeclarationEnricherTestCase method setUp.

@Before
public void setUp() {
    DefaultJavaModelLoaderDelegate loader = new DefaultJavaModelLoaderDelegate(MetadataExtension.class, getProductVersion());
    ExtensionDeclarer declarer = loader.declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
    new DynamicMetadataDeclarationEnricher().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) Before(org.junit.Before)

Example 3 with DefaultExtensionLoadingContext

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

the class TestConnectionFailuresTestCase method mockedExtension.

private ExtensionModel mockedExtension(final String name, final String config, final String connectionProvider) {
    final ExtensionDeclarer extensionDeclarer = new ExtensionDeclarer();
    extensionDeclarer.named(name).onVersion("4.0.0").fromVendor("MuleSoft testcase").withCategory(Category.COMMUNITY).withConfig(config).withConnectionProvider(connectionProvider).withConnectionManagementType(ConnectionManagementType.NONE);
    return new ExtensionModelFactory().create(new DefaultExtensionLoadingContext(extensionDeclarer, currentThread().getContextClassLoader(), new NullDslResolvingContext()));
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) NullDslResolvingContext(org.mule.runtime.internal.dsl.NullDslResolvingContext) ExtensionModelFactory(org.mule.runtime.extension.internal.loader.ExtensionModelFactory)

Example 4 with DefaultExtensionLoadingContext

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

the class JavaXmlDeclarationEnricherTestCase method enrich.

private XmlDslModel enrich(Class<?> type) {
    extensionDeclarer.withModelProperty(new ImplementingTypeModelProperty(type));
    declarationEnricher.enrich(new DefaultExtensionLoadingContext(extensionDeclarer, type.getClassLoader(), getDefault(emptySet())));
    return extensionDeclarer.getDeclaration().getXmlDslModel();
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ImplementingTypeModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty)

Example 5 with DefaultExtensionLoadingContext

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

the class BooleanParameterDeclarationEnricherTestCase method setUp.

@Before
public void setUp() {
    ExtensionDeclarer declarer = new DefaultJavaModelLoaderDelegate(HeisenbergExtension.class, getProductVersion()).declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
    new BooleanParameterDeclarationEnricher().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