use of org.mule.runtime.internal.dsl.NullDslResolvingContext 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()));
}
use of org.mule.runtime.internal.dsl.NullDslResolvingContext in project mule by mulesoft.
the class ExtensionsTestInfrastructureDiscoverer method generateDslResources.
public List<GeneratedResource> generateDslResources(File generatedResourcesDirectory, ExtensionModel forExtensionModel) {
DslResolvingContext context;
if (extensionManager.getExtensions().stream().anyMatch(e -> !e.getImportedTypes().isEmpty())) {
HashSet<ExtensionModel> models = new HashSet<>(extensionManager.getExtensions());
models.add(MuleExtensionModelProvider.getExtensionModel());
context = DslResolvingContext.getDefault(models);
} else {
context = new NullDslResolvingContext();
}
ExtensionsTestDslResourcesGenerator dslResourceGenerator = new ExtensionsTestDslResourcesGenerator(getDslResourceFactories(), generatedResourcesDirectory, context);
extensionManager.getExtensions().stream().filter(runtimeExtensionModel -> forExtensionModel != null ? runtimeExtensionModel.equals(forExtensionModel) : true).forEach(dslResourceGenerator::generateFor);
return dslResourceGenerator.dumpAll();
}
use of org.mule.runtime.internal.dsl.NullDslResolvingContext in project mule by mulesoft.
the class AbstractXmlResourceFactory method generateResource.
@Override
public Optional<GeneratedResource> generateResource(ExtensionModel extensionModel) {
Set<ImportedTypeModel> importedTypes = extensionModel.getImportedTypes();
DslResolvingContext dslContext = importedTypes.isEmpty() ? new NullDslResolvingContext() : new ClasspathBasedDslContext(extensionModel.getModelProperty(ImplementingTypeModelProperty.class).map(mp -> mp.getType().getClassLoader()).orElse(Thread.currentThread().getContextClassLoader()));
return generateResource(extensionModel, dslContext);
}
Aggregations