From a79a0959d1ff9409562df3c5a8e0eebdabfa1117 Mon Sep 17 00:00:00 2001 From: elrodro83 Date: Tue, 1 Oct 2024 10:38:42 -0300 Subject: [PATCH 1/2] Remove soap Service --- .../extensions-soap-support/api-changes.json | 20 + modules/extensions-soap-support/pom.xml | 67 - .../src/main/java/module-info.java | 37 - .../SoapExtensionModelLoaderProvider.java | 28 - .../DefaultHttpMessageDispatcherProvider.java | 79 - .../loader/SoapExtensionModelLoader.java | 23 - .../loader/SoapExtensionTypeFactory.java | 33 - .../loader/SoapInvokeOperationDeclarer.java | 216 -- .../loader/SoapModelLoaderDelegate.java | 135 - .../loader/SoapServiceProviderDeclarer.java | 94 - .../property/SoapExtensionModelProperty.java | 38 - .../MessageDispatcherProviderTypeWrapper.java | 41 - .../type/runtime/SoapComponentWrapper.java | 22 - .../runtime/SoapExtensionTypeWrapper.java | 57 - .../runtime/SoapServiceProviderWrapper.java | 55 - .../internal/metadata/BaseInvokeResolver.java | 43 - .../InvokeInputAttachmentsTypeResolver.java | 36 - .../InvokeInputHeadersTypeResolver.java | 42 - .../internal/metadata/InvokeKeysResolver.java | 61 - .../metadata/InvokeOutputTypeResolver.java | 45 - .../metadata/InvokeRequestTypeResolver.java | 42 - .../internal/metadata/WebServiceTypeKey.java | 33 - .../connection/DefaultDispatchingContext.java | 30 - .../connection/ForwardingSoapClient.java | 161 -- ...orwardingSoapClientConnectionProvider.java | 136 -- .../SoapConnectionProviderObjectBuilder.java | 99 - .../operation/SoapOperationExecutor.java | 186 -- .../SoapOperationExecutorFactory.java | 33 - ...tractSoapExtensionDeclarationTestCase.java | 58 - .../soap/internal/loader/ParameterProber.java | 42 - .../SoapExtensionDeclarationTestCase.java | 123 - ...thCustomTransportsDeclarationTestCase.java | 74 - ...gSoapClientConnectionProviderTestCase.java | 91 - .../ForwardingSoapClientTestCase.java | 160 -- .../connection/TestDispatcherProvider.java | 63 - .../runtime/connection/TestSoapClient.java | 67 - modules/extensions-spring-support/pom.xml | 14 - .../ConnectionProviderObjectFactory.java | 18 +- .../MulePluginDescriptorGenerator.java | 26 +- ...faultExtensionSchemaGeneratorTestCase.java | 14 +- .../ExtensionModelJsonGeneratorTestCase.java | 5 +- .../LegacyJsonDeserializationTestCase.java | 30 +- .../ParameterizedExtensionModelTestCase.java | 20 +- .../src/test/resources/models/ram.json | 2173 ----------------- .../src/test/resources/models/soap.json | 3 - .../src/test/resources/schemas/ram.xsd | 155 -- .../src/test/resources/schemas/soap.xsd | 124 - modules/soap-api/api-changes.json | 188 ++ modules/soap-api/pom.xml | 32 - .../soap-api/src/main/java/module-info.java | 20 - .../mule/runtime/soap/api/SoapService.java | 26 - .../mule/runtime/soap/api/SoapVersion.java | 36 - .../runtime/soap/api/client/SoapClient.java | 47 - .../api/client/SoapClientConfiguration.java | 99 - .../SoapClientConfigurationBuilder.java | 176 -- .../soap/api/client/SoapClientFactory.java | 25 - .../metadata/SoapMetadataKeyResolver.java | 27 - .../client/metadata/SoapMetadataResolver.java | 38 - .../metadata/SoapOperationMetadata.java | 32 - .../api/exception/BadRequestException.java | 26 - .../api/exception/BadResponseException.java | 26 - .../api/exception/DispatchingException.java | 26 - .../soap/api/exception/EncodingException.java | 27 - .../api/exception/InvalidWsdlException.java | 27 - .../api/exception/SoapFaultException.java | 87 - .../api/exception/SoapServiceException.java | 19 - .../soap/api/exception/error/SoapErrors.java | 52 - .../error/SoapExceptionEnricher.java | 60 - .../api/message/ImmutableSoapRequest.java | 73 - .../runtime/soap/api/message/SoapMessage.java | 40 - .../runtime/soap/api/message/SoapRequest.java | 35 - .../soap/api/message/SoapRequestBuilder.java | 85 - .../soap/api/message/SoapResponse.java | 22 - .../soap/api/message/WithContentType.java | 22 - .../DefaultHttpMessageDispatcher.java | 105 - .../HttpConfigBasedMessageDispatcher.java | 44 - .../api/transport/HttpResourceLocator.java | 44 - .../NullTransportResourceLocator.java | 30 - .../ReflectiveHttpConfigBasedRequester.java | 126 - .../transport/TransportResourceLocator.java | 38 - .../soap/extension/CalcioServiceProvider.java | 41 - .../soap/extension/FootballSoapExtension.java | 63 - .../soap/extension/LaLigaServiceProvider.java | 51 - .../ram/AbstractScienceTransportProvider.java | 44 - .../DefaultPortalGunDispatcherProvider.java | 20 - .../test/ram/MiniverseDispatcherProvider.java | 17 - .../mule/test/ram/RickAndMortyExtension.java | 55 - .../TestHttpMessageDispatcherProvider.java | 36 - 88 files changed, 256 insertions(+), 6983 deletions(-) delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/loader/SoapExtensionModelLoaderProvider.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/runtime/connection/transport/DefaultHttpMessageDispatcherProvider.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionModelLoader.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionTypeFactory.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapInvokeOperationDeclarer.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapModelLoaderDelegate.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapServiceProviderDeclarer.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/property/SoapExtensionModelProperty.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/MessageDispatcherProviderTypeWrapper.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapComponentWrapper.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapExtensionTypeWrapper.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapServiceProviderWrapper.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/BaseInvokeResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputAttachmentsTypeResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputHeadersTypeResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeKeysResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeOutputTypeResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeRequestTypeResolver.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/WebServiceTypeKey.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/DefaultDispatchingContext.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClient.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProvider.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/SoapConnectionProviderObjectBuilder.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutor.java delete mode 100644 modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutorFactory.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/AbstractSoapExtensionDeclarationTestCase.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/ParameterProber.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionDeclarationTestCase.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionWithCustomTransportsDeclarationTestCase.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProviderTestCase.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientTestCase.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestDispatcherProvider.java delete mode 100644 modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestSoapClient.java delete mode 100644 modules/extensions-spring-support/src/test/resources/models/ram.json delete mode 100644 modules/extensions-spring-support/src/test/resources/models/soap.json delete mode 100644 modules/extensions-spring-support/src/test/resources/schemas/ram.xsd delete mode 100644 modules/extensions-spring-support/src/test/resources/schemas/soap.xsd delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapService.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapVersion.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClient.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfiguration.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfigurationBuilder.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientFactory.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataKeyResolver.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataResolver.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapOperationMetadata.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadRequestException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadResponseException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/DispatchingException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/EncodingException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/InvalidWsdlException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapFaultException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapServiceException.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapErrors.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapExceptionEnricher.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/ImmutableSoapRequest.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapMessage.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequest.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequestBuilder.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapResponse.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/WithContentType.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/DefaultHttpMessageDispatcher.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/HttpConfigBasedMessageDispatcher.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/HttpResourceLocator.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/NullTransportResourceLocator.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/ReflectiveHttpConfigBasedRequester.java delete mode 100644 modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/TransportResourceLocator.java delete mode 100644 tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/CalcioServiceProvider.java delete mode 100644 tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/FootballSoapExtension.java delete mode 100644 tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/LaLigaServiceProvider.java delete mode 100644 tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/AbstractScienceTransportProvider.java delete mode 100644 tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/DefaultPortalGunDispatcherProvider.java delete mode 100644 tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/MiniverseDispatcherProvider.java delete mode 100644 tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/RickAndMortyExtension.java delete mode 100644 tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/TestHttpMessageDispatcherProvider.java diff --git a/modules/extensions-soap-support/api-changes.json b/modules/extensions-soap-support/api-changes.json index cc3e547274b7..59656c30e2d5 100644 --- a/modules/extensions-soap-support/api-changes.json +++ b/modules/extensions-soap-support/api-changes.json @@ -1,4 +1,24 @@ { + "4.9.0": { + "revapi": { + "differences": { + "differences": [ + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.module.extension.soap.api.loader.SoapExtensionModelLoaderProvider", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.module.extension.soap.api.runtime.connection.transport.DefaultHttpMessageDispatcherProvider", + "justification": "W-" + } + ] + } + } + }, "4.5.0": { "revapi": { "ignore": [ diff --git a/modules/extensions-soap-support/pom.xml b/modules/extensions-soap-support/pom.xml index 81aaebacbd43..e814202ec78f 100644 --- a/modules/extensions-soap-support/pom.xml +++ b/modules/extensions-soap-support/pom.xml @@ -25,71 +25,4 @@ ../../formatter.xml - - - - - org.mule.runtime - mule-extensions-soap-api - - - - - org.mule.runtime - mule-service-soap-api - ${project.version} - - - - - org.mule.runtime - mule-module-extensions-support - ${project.version} - - - org.mule.sdk - mule-sdk-api - - - - - org.springframework - spring-core - provided - - - - - org.mule.tests - mule-tests-unit - ${project.version} - test - - - org.mule.tests - mule-tests-allure - ${project.version} - test - - - - org.mule.tests - mule-football-soap-extension - ${project.version} - test - - - org.mule.tests - mule-rick-and-morty-extension - ${project.version} - test - - - org.mule.runtime - mule-module-extensions-support - ${project.version} - test-jar - test - - diff --git a/modules/extensions-soap-support/src/main/java/module-info.java b/modules/extensions-soap-support/src/main/java/module-info.java index aecfcc37c2f2..0cc5a1c3f3d3 100644 --- a/modules/extensions-soap-support/src/main/java/module-info.java +++ b/modules/extensions-soap-support/src/main/java/module-info.java @@ -12,41 +12,4 @@ */ module org.mule.runtime.extensions.soap.support { - requires org.mule.runtime.core; - requires org.mule.runtime.extensions.api; - requires org.mule.runtime.extensions.soap.api; - requires org.mule.runtime.extensions.support; - requires org.mule.runtime.http.api; - requires org.mule.runtime.metadata.model.api; - requires org.mule.runtime.metadata.model.java; - requires org.mule.runtime.metadata.support; - requires org.mule.runtime.soap.api; - requires org.mule.sdk.api; - - exports org.mule.runtime.module.extension.soap.api.loader; - exports org.mule.runtime.module.extension.soap.api.runtime.connection.transport; - - exports org.mule.runtime.module.extension.soap.internal.loader to - org.mule.runtime.extensions.spring.support; - exports org.mule.runtime.module.extension.soap.internal.loader.property to - org.mule.runtime.extensions.spring.support; - exports org.mule.runtime.module.extension.soap.internal.metadata to - org.mule.runtime.extensions.support; - exports org.mule.runtime.module.extension.soap.internal.runtime.connection to - org.mule.runtime.extensions.spring.support; - - requires java.inject; - requires com.google.common; - - opens org.mule.runtime.module.extension.soap.api.runtime.connection.transport to - spring.core; - opens org.mule.runtime.module.extension.soap.internal.metadata to - org.mule.runtime.extensions.support; - opens org.mule.runtime.module.extension.soap.internal.runtime.connection to - spring.core; - opens org.mule.runtime.module.extension.soap.internal.runtime.operation to - spring.core; - - provides org.mule.runtime.extension.api.loader.ExtensionModelLoaderProvider with - org.mule.runtime.module.extension.soap.api.loader.SoapExtensionModelLoaderProvider; } diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/loader/SoapExtensionModelLoaderProvider.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/loader/SoapExtensionModelLoaderProvider.java deleted file mode 100644 index a2f9db4ca216..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/loader/SoapExtensionModelLoaderProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.api.loader; - -import static java.util.Collections.singleton; - -import org.mule.runtime.extension.api.loader.ExtensionModelLoader; -import org.mule.runtime.extension.api.loader.ExtensionModelLoaderProvider; -import org.mule.runtime.module.extension.soap.internal.loader.SoapExtensionModelLoader; - -import java.util.Set; - -/** - * {@link ExtensionModelLoaderProvider} yielding loaders for SOAP based extensions - * - * @since 4.5.0 - */ -public class SoapExtensionModelLoaderProvider implements ExtensionModelLoaderProvider { - - @Override - public Set getExtensionModelLoaders() { - return singleton(new SoapExtensionModelLoader()); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/runtime/connection/transport/DefaultHttpMessageDispatcherProvider.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/runtime/connection/transport/DefaultHttpMessageDispatcherProvider.java deleted file mode 100644 index 8da03f98ea7d..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/api/runtime/connection/transport/DefaultHttpMessageDispatcherProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.api.runtime.connection.transport; - -import static org.mule.runtime.api.connection.ConnectionValidationResult.success; -import static org.mule.runtime.core.api.lifecycle.LifecycleUtils.disposeIfNeeded; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.api.exception.MuleException; -import org.mule.runtime.api.lifecycle.InitialisationException; -import org.mule.runtime.api.lifecycle.Lifecycle; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.http.api.HttpService; -import org.mule.runtime.http.api.client.HttpClient; -import org.mule.runtime.http.api.client.HttpClientConfiguration; -import org.mule.runtime.soap.api.message.dispatcher.DefaultHttpMessageDispatcher; - -import javax.inject.Inject; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Default implementation of {@link MessageDispatcherProvider} sends a soap message over http using a default configuration. - * - * @since 4.0 - */ -public class DefaultHttpMessageDispatcherProvider implements MessageDispatcherProvider, Lifecycle { - - private static final Logger LOGGER = LoggerFactory.getLogger(DefaultHttpMessageDispatcher.class); - - @Inject - private HttpService httpService; - - private HttpClient httpClient; - - @Override - public MessageDispatcher connect() throws ConnectionException { - return new DefaultHttpMessageDispatcher(httpClient); - } - - @Override - public void disconnect(MessageDispatcher connection) { - disposeIfNeeded(connection, LOGGER); - } - - @Override - public ConnectionValidationResult validate(MessageDispatcher connection) { - return success(); - } - - - @Override - public void dispose() { - // Do nothing - } - - @Override - public void initialise() throws InitialisationException { - httpClient = httpService.getClientFactory().create(new HttpClientConfiguration.Builder() - .setName("soap-extension") - .build()); - } - - @Override - public void stop() throws MuleException { - httpClient.stop(); - } - - @Override - public void start() throws MuleException { - httpClient.start(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionModelLoader.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionModelLoader.java deleted file mode 100644 index fecc0db7522d..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionModelLoader.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import org.mule.runtime.module.extension.internal.loader.java.AbstractJavaExtensionModelLoader; - -/** - * Loads a Soap Based extension by introspecting a class which uses the Soap Extensions API annotations - * - * @since 4.0 - */ -public class SoapExtensionModelLoader extends AbstractJavaExtensionModelLoader { - - public static final String SOAP_LOADER_ID = "soap"; - - public SoapExtensionModelLoader() { - super(SOAP_LOADER_ID, SoapModelLoaderDelegate::new); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionTypeFactory.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionTypeFactory.java deleted file mode 100644 index d562b94b4b32..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionTypeFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.extension.api.annotation.Extension; -import org.mule.runtime.module.extension.api.loader.java.type.ExtensionElement; -import org.mule.runtime.module.extension.soap.internal.loader.type.runtime.SoapExtensionTypeWrapper; - -/** - * Method Factory Pattern implementation that creates {@link ExtensionElement} for a Soap Extension from a {@link Class} that uses - * the Soap Extensions API. - * - * @since 4.0 - */ -class SoapExtensionTypeFactory { - - /** - * Creates a {@link ExtensionElement} from a given {@link Class} that will help to introspect an extension. - * - * @param extensionType SOAP A class annotated with {@link Extension} or {@link org.mule.sdk.api.annotation.Extension} - * @param typeLoader a {@link ClassTypeLoader} - * @return an {@link ExtensionElement} wrapping the extension {@link Class} structure - */ - - static SoapExtensionTypeWrapper getSoapExtensionType(Class extensionType, ClassTypeLoader typeLoader) { - return new SoapExtensionTypeWrapper<>(extensionType, typeLoader); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapInvokeOperationDeclarer.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapInvokeOperationDeclarer.java deleted file mode 100644 index 0426f64edc55..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapInvokeOperationDeclarer.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static org.mule.metadata.java.api.JavaTypeLoader.JAVA; -import static org.mule.runtime.api.meta.model.parameter.ParameterRole.CONTENT; -import static org.mule.runtime.api.meta.model.parameter.ParameterRole.PRIMARY_CONTENT; -import static org.mule.runtime.extension.api.annotation.param.Optional.PAYLOAD; -import static org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getField; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.metadata.api.annotation.TypeIdAnnotation; -import org.mule.metadata.api.builder.BaseTypeBuilder; -import org.mule.metadata.api.model.MetadataType; -import org.mule.metadata.api.model.ObjectType; -import org.mule.metadata.api.model.StringType; -import org.mule.metadata.java.api.annotation.ClassInformationAnnotation; -import org.mule.runtime.api.meta.model.ParameterDslConfiguration; -import org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer; -import org.mule.runtime.api.meta.model.display.DisplayModel; -import org.mule.runtime.api.meta.model.display.LayoutModel; -import org.mule.runtime.api.meta.model.error.ErrorModel; -import org.mule.runtime.extension.api.declaration.type.annotation.TypedValueTypeAnnotation; -import org.mule.runtime.extension.api.metadata.ComponentMetadataConfigurerFactory; -import org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty; -import org.mule.runtime.extension.api.soap.SoapAttributes; -import org.mule.runtime.extension.api.soap.SoapOutputPayload; -import org.mule.runtime.module.extension.api.loader.java.property.CompletableComponentExecutorModelProperty; -import org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor; -import org.mule.runtime.module.extension.internal.loader.delegate.StereotypeModelLoaderDelegate; -import org.mule.runtime.module.extension.internal.loader.java.property.ConnectivityModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper; -import org.mule.runtime.module.extension.internal.util.ReflectionCache; -import org.mule.runtime.module.extension.soap.internal.metadata.InvokeInputAttachmentsTypeResolver; -import org.mule.runtime.module.extension.soap.internal.metadata.InvokeInputHeadersTypeResolver; -import org.mule.runtime.module.extension.soap.internal.metadata.InvokeKeysResolver; -import org.mule.runtime.module.extension.soap.internal.metadata.InvokeOutputTypeResolver; -import org.mule.runtime.module.extension.soap.internal.metadata.InvokeRequestTypeResolver; -import org.mule.runtime.module.extension.soap.internal.metadata.WebServiceTypeKey; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient; -import org.mule.runtime.module.extension.soap.internal.runtime.operation.SoapOperationExecutorFactory; - -import java.io.InputStream; -import java.util.Map; -import java.util.Set; - -/** - * Declares the invoke operation for a given Soap Extension {@link ExtensionDeclarer}. - * - * @since 4.0 - */ -public class SoapInvokeOperationDeclarer { - - public static final String MESSAGE_GROUP = "Message"; - private static final String KEYS_GROUP = "Web Service Configuration"; - static final String TRANSPORT = "Transport"; - static final String TRANSPORT_GROUP = TRANSPORT + " Configuration"; - static final String OPERATION_DESCRIPTION = "invokes Web Service operations"; - static final String OPERATION_NAME = "invoke"; - - public static final String SERVICE_PARAM = "service"; - public static final String OPERATION_PARAM = "operation"; - public static final String HEADERS_PARAM = "headers"; - public static final String BODY_PARAM = "body"; - public static final String ATTACHMENTS_PARAM = "attachments"; - public static final String HEADERS_DISPLAY_NAME = "Headers"; - public static final String TRANSPORT_HEADERS_PARAM = "transportHeaders"; - - private static final BaseTypeBuilder TYPE_BUILDER = BaseTypeBuilder.create(JAVA); - - private final StereotypeModelLoaderDelegate stereotypeDelegate; - - public SoapInvokeOperationDeclarer(StereotypeModelLoaderDelegate stereotypeDelegate) { - this.stereotypeDelegate = stereotypeDelegate; - } - - /** - * Declares the invoke operation. - * - * @param configDeclarer the soap config declarer - * @param loader a {@link ClassTypeLoader} to load some parameters types. - * @param soapErrors the {@link ErrorModel}s that this operation can throw. - */ - void declare(ConfigurationDeclarer configDeclarer, ClassTypeLoader loader, Set soapErrors) { - ReflectionCache reflectionCache = new ReflectionCache(); - - OperationDeclarer operation = configDeclarer.withOperation(OPERATION_NAME) - .describedAs(OPERATION_DESCRIPTION) - .requiresConnection(true) - .blocking(true) - .withStereotype(stereotypeDelegate.getDefaultOperationStereotype(OPERATION_NAME)) - .withModelProperty(new CompletableComponentExecutorModelProperty(new SoapOperationExecutorFactory())) - .withModelProperty(new ConnectivityModelProperty(ForwardingSoapClient.class)); - - soapErrors.forEach(operation::withErrorModel); - declareMetadata(operation, loader); - declareOutput(operation, loader); - declareMetadataKeyParameters(operation, loader, reflectionCache); - declareRequestParameters(operation, loader); - } - - private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) { - ComponentMetadataConfigurerFactory.getDefault().create() - .setKeysResolver(new InvokeKeysResolver(), KEYS_GROUP, loader.load(WebServiceTypeKey.class), false) - .addInputResolver(BODY_PARAM, new InvokeRequestTypeResolver()) - .addInputResolver(HEADERS_PARAM, new InvokeInputHeadersTypeResolver()) - .addInputResolver(ATTACHMENTS_PARAM, new InvokeInputAttachmentsTypeResolver()) - .setOutputTypeResolver(new InvokeOutputTypeResolver()) - .setConnected(true) - .configure(operation); - } - - private void declareOutput(OperationDeclarer operation, ClassTypeLoader loader) { - operation.withOutput().ofDynamicType(loader.load(SoapOutputPayload.class)); - operation.withOutputAttributes().ofType(loader.load(SoapAttributes.class)); - } - - /** - * Given the Invoke Operation Declarer declares the parameters for the soap request. - * - * @param operation the invoke operation declarer. - * @param loader a {@link ClassTypeLoader} to load some parameters types. - */ - private void declareRequestParameters(OperationDeclarer operation, ClassTypeLoader loader) { - ParameterGroupDeclarer message = operation.onParameterGroup(MESSAGE_GROUP) - .withDslInlineRepresentation(true) - .withLayout(getLayout(1)); - - MetadataType binaryType = loader.load(InputStream.class); - ObjectType attachments = TYPE_BUILDER.objectType() - .openWith(TYPE_BUILDER.binaryType() - .id(InputStream.class.getName()) - .with(new TypedValueTypeAnnotation())) - .with(new TypeIdAnnotation(Map.class.getName())) - .with(new ClassInformationAnnotation(Map.class)) - .build(); - - message.withOptionalParameter(BODY_PARAM).ofDynamicType(binaryType) - .withRole(PRIMARY_CONTENT) - .defaultingTo(PAYLOAD) - .withLayout(getLayout(3)) - .withDisplayModel(DisplayModel.builder() - .summary("The XML body to include in the SOAP message, with all the required parameters.") - .build()); - - message.withOptionalParameter(HEADERS_PARAM).ofDynamicType(binaryType) - .withRole(CONTENT) - .withLayout(getLayout(4)) - .withDisplayModel(DisplayModel.builder() - .displayName(HEADERS_DISPLAY_NAME) - .summary("The XML headers to include in the SOAP message.") - .build()); - - message.withOptionalParameter(ATTACHMENTS_PARAM).ofDynamicType(attachments) - .withRole(CONTENT) - .withLayout(getLayout(5)) - .withDisplayModel(DisplayModel.builder() - .summary("The attachments to include in the SOAP request.") - .build()); - - operation.onParameterGroup(TRANSPORT_GROUP).withLayout(getLayout(2)) - .withOptionalParameter(TRANSPORT_HEADERS_PARAM) - .ofType(TYPE_BUILDER.objectType() - .openWith(loader.load(String.class)) - .with(new TypeIdAnnotation(Map.class.getName())) - .with(new ClassInformationAnnotation(Map.class)) - .build()) - .withDsl(ParameterDslConfiguration.getDefaultInstance()) - .withLayout(LayoutModel.builder().order(2).tabName(TRANSPORT).build()) - .withDisplayModel(DisplayModel.builder() - .displayName(HEADERS_DISPLAY_NAME) - .summary("The headers to set in the transport configuration.") - .build()); - } - - /** - * Given the Invoke Operation Declarer declares all the parameters that the operation has. - * - * @param operation the invoke operation declarer. - */ - private void declareMetadataKeyParameters(OperationDeclarer operation, ClassTypeLoader loader, - ReflectionCache reflectionCache) { - TypeWrapper keyType = new TypeWrapper(WebServiceTypeKey.class, loader); - ParameterGroupDeclarer group = operation - .onParameterGroup(KEYS_GROUP) - .withModelProperty( - new ParameterGroupModelProperty(new ParameterGroupDescriptor(KEYS_GROUP, keyType))); - - StringType stringType = TYPE_BUILDER.stringType().build(); - group.withRequiredParameter(SERVICE_PARAM) - .withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, SERVICE_PARAM, reflectionCache) - .get())) - .ofType(stringType) - .withModelProperty(new MetadataKeyPartModelProperty(1)) - .withLayout(getLayout(1)); - group.withRequiredParameter(OPERATION_PARAM) - .ofType(stringType) - .withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, OPERATION_PARAM, reflectionCache) - .get())) - .withModelProperty(new MetadataKeyPartModelProperty(2)) - .withLayout(getLayout(2)); - } - - private LayoutModel getLayout(int order) { - return LayoutModel.builder().order(order).build(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapModelLoaderDelegate.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapModelLoaderDelegate.java deleted file mode 100644 index a966293e7afd..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapModelLoaderDelegate.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_DESCRIPTION; -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_NAME; -import static org.mule.runtime.module.extension.internal.loader.parser.java.MuleExtensionAnnotationParser.getExtensionInfo; -import static org.mule.runtime.module.extension.internal.loader.utils.ExtensionNamespaceUtils.getExtensionsNamespace; -import static org.mule.runtime.module.extension.internal.loader.utils.ModelLoaderUtils.getXmlDslModel; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapExtensionTypeFactory.getSoapExtensionType; - -import static java.util.stream.Collectors.toList; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.metadata.api.model.MetadataType; -import org.mule.runtime.api.meta.model.ExtensionModel; -import org.mule.runtime.api.meta.model.XmlDslModel; -import org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer; -import org.mule.runtime.api.meta.model.error.ErrorModel; -import org.mule.runtime.extension.api.declaration.type.DefaultExtensionsTypeLoaderFactory; -import org.mule.runtime.extension.api.loader.ExtensionLoadingContext; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.module.extension.api.loader.java.type.ExtensionElement; -import org.mule.runtime.module.extension.internal.error.ErrorsModelFactory; -import org.mule.runtime.module.extension.internal.loader.delegate.ModelLoaderDelegate; -import org.mule.runtime.module.extension.internal.loader.delegate.StereotypeModelLoaderDelegate; -import org.mule.runtime.module.extension.internal.loader.java.TypeAwareConfigurationFactory; -import org.mule.runtime.module.extension.internal.loader.java.info.ExtensionInfo; -import org.mule.runtime.module.extension.internal.loader.java.property.ConfigurationFactoryModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper; -import org.mule.runtime.module.extension.internal.loader.parser.java.JavaExtensionModelParser; -import org.mule.runtime.module.extension.soap.internal.loader.property.SoapExtensionModelProperty; -import org.mule.runtime.module.extension.soap.internal.loader.type.runtime.MessageDispatcherProviderTypeWrapper; -import org.mule.runtime.module.extension.soap.internal.loader.type.runtime.SoapExtensionTypeWrapper; -import org.mule.runtime.soap.api.exception.error.SoapErrors; - -import java.util.List; -import java.util.Set; - -/** - * Describes a Soap Based {@link ExtensionModel} based on a set of java classes and annotations. - * - * @since 4.0 - */ -public final class SoapModelLoaderDelegate implements ModelLoaderDelegate { - - private final Class extensionType; - private final ExtensionElement extensionElement; - private final String version; - private final ClassTypeLoader typeLoader; - private SoapServiceProviderDeclarer serviceProviderDeclarer; - private SoapInvokeOperationDeclarer operationDeclarer; - private StereotypeModelLoaderDelegate stereotypeDelegate; - - public SoapModelLoaderDelegate(ExtensionElement extensionElement, String version) { - this.extensionType = extensionElement.getDeclaringClass().get(); - this.extensionElement = extensionElement; - this.version = version; - this.typeLoader = new DefaultExtensionsTypeLoaderFactory().createTypeLoader(extensionType.getClassLoader()); - } - - /** - * {@inheritDoc} - */ - @Override - public ExtensionDeclarer declare(ExtensionLoadingContext context) { - JavaExtensionModelParser parser = new JavaExtensionModelParser(extensionElement, context); - ExtensionDeclarer extensionDeclarer = getExtensionDeclarer(context); - XmlDslModel xmlDslModel = getXmlDslModel(extensionElement, version, parser.getXmlDslConfiguration()); - extensionDeclarer.withXmlDsl(xmlDslModel); - stereotypeDelegate = new StereotypeModelLoaderDelegate(context); - stereotypeDelegate.setNamespace(getExtensionsNamespace(xmlDslModel)); - operationDeclarer = new SoapInvokeOperationDeclarer(stereotypeDelegate); - serviceProviderDeclarer = - new SoapServiceProviderDeclarer(extensionDeclarer, parser::getStereotypeLoaderDelegate, stereotypeDelegate, context); - - final SoapExtensionTypeWrapper extension = getSoapExtensionType(this.extensionType, typeLoader); - List customTransportProviders = extension.getDispatcherProviders(); - declareSubtypes(extensionDeclarer, customTransportProviders); - Set soapErrors = getSoapErrors(extensionDeclarer); - soapErrors.forEach(extensionDeclarer::withErrorModel); - ConfigurationDeclarer configDeclarer = getConfigDeclarer(extensionDeclarer, extension, soapErrors); - extension.getSoapServiceProviders() - .forEach(provider -> serviceProviderDeclarer.declare(configDeclarer, provider, !customTransportProviders.isEmpty())); - return extensionDeclarer; - } - - private void declareSubtypes(ExtensionDeclarer extension, List transportProviders) { - if (!transportProviders.isEmpty()) { - List types = transportProviders.stream().map(TypeWrapper::asMetadataType).collect(toList()); - extension.withSubTypes(typeLoader.load(MessageDispatcherProvider.class), types); - } - } - - private ExtensionDeclarer getExtensionDeclarer(ExtensionLoadingContext context) { - ExtensionInfo info = getExtensionInfo(extensionType); - return context.getExtensionDeclarer() - .named(info.getName()) - .onVersion(version) - .fromVendor(info.getVendor()) - .withCategory(info.getCategory()) - .withModelProperty(new SoapExtensionModelProperty()) - .withModelProperty(new ExtensionTypeDescriptorModelProperty(new TypeWrapper(extensionType, typeLoader))) - .withModelProperty(new ImplementingTypeModelProperty(extensionType)); - } - - private ConfigurationDeclarer getConfigDeclarer(ExtensionDeclarer declarer, - SoapExtensionTypeWrapper extension, - Set soapErrors) { - // TODO - MULE-14311 - Make loader work in compile time - Class clazz = extension.getDeclaringClass().get(); - TypeAwareConfigurationFactory configurationFactory = new TypeAwareConfigurationFactory(clazz, clazz.getClassLoader()); - - ConfigurationDeclarer configDeclarer = declarer.withConfig(DEFAULT_CONFIG_NAME) - .describedAs(DEFAULT_CONFIG_DESCRIPTION) - .withStereotype(stereotypeDelegate.getDefaultConfigStereotype(DEFAULT_CONFIG_NAME)) - .withModelProperty(new ConfigurationFactoryModelProperty(configurationFactory)) - .withModelProperty(new ImplementingTypeModelProperty(clazz)); - - operationDeclarer.declare(configDeclarer, typeLoader, soapErrors); - return configDeclarer; - } - - private Set getSoapErrors(ExtensionDeclarer declarer) { - ErrorsModelFactory factory = new ErrorsModelFactory(SoapErrors.class.getEnumConstants(), declarer.getDeclaration().getName()); - return factory.getErrorModels(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapServiceProviderDeclarer.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapServiceProviderDeclarer.java deleted file mode 100644 index dc9a073f76e5..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/SoapServiceProviderDeclarer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED; -import static org.mule.runtime.api.meta.model.connection.ConnectionManagementType.POOLING; -import static org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.registerType; -import static org.mule.runtime.module.extension.internal.loader.parser.java.JavaExtensionModelParserUtils.getParameterGroupParsers; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.TRANSPORT; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.TRANSPORT_GROUP; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.ConnectionProviderDeclarer; -import org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer; -import org.mule.runtime.api.meta.model.display.DisplayModel; -import org.mule.runtime.api.meta.model.display.LayoutModel; -import org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory; -import org.mule.runtime.extension.api.loader.ExtensionLoadingContext; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.module.extension.internal.loader.delegate.ParameterModelsLoaderDelegate; -import org.mule.runtime.module.extension.internal.loader.delegate.StereotypeModelLoaderDelegate; -import org.mule.runtime.module.extension.internal.loader.java.property.ConnectionTypeModelProperty; -import org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty; -import org.mule.runtime.module.extension.internal.loader.parser.java.ParameterDeclarationContext; -import org.mule.runtime.module.extension.soap.internal.loader.type.runtime.SoapServiceProviderWrapper; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient; - -import java.util.function.Supplier; - -/** - * Declares a Connection Provider of {@link ForwardingSoapClient} instances given a {@link SoapServiceProvider}. - * - * @since 4.0 - */ -public class SoapServiceProviderDeclarer { - - public static final String TRANSPORT_PARAM = TRANSPORT.toLowerCase(); - - private final ParameterModelsLoaderDelegate parametersLoader; - private final ClassTypeLoader typeLoader = ExtensionsTypeLoaderFactory.getDefault().createTypeLoader(); - private final StereotypeModelLoaderDelegate stereotypeDelegate; - private final ExtensionLoadingContext loadingContext; - - SoapServiceProviderDeclarer(ExtensionDeclarer extensionDeclarer, - Supplier stereotypeModelLoader, - StereotypeModelLoaderDelegate stereotypeDelegate, - ExtensionLoadingContext loadingContext) { - parametersLoader = new ParameterModelsLoaderDelegate(stereotypeModelLoader, type -> registerType(extensionDeclarer, type)); - this.stereotypeDelegate = stereotypeDelegate; - this.loadingContext = loadingContext; - } - - /** - * Declares a new connection provider for a configuration given a {@link SoapServiceProviderWrapper} declaration. - * - * @param configDeclarer the configuration declarer that will own the provider - * @param provider a {@link SoapServiceProviderWrapper} that describes the {@link SoapServiceProvider} Type. - * @param hasCustomTransports if declares custom transport or not. - */ - public void declare(ConfigurationDeclarer configDeclarer, SoapServiceProviderWrapper provider, boolean hasCustomTransports) { - String description = provider.getDescription(); - - // Declares the Service Provider as a Connection Provider. - final String providerName = provider.getAlias(); - ConnectionProviderDeclarer providerDeclarer = configDeclarer.withConnectionProvider(providerName) - .describedAs(description) - .withModelProperty(new ConnectionTypeModelProperty(ForwardingSoapClient.class)) - // TODO - MULE-14311 - Make loader work in compile time - .withModelProperty(new ImplementingTypeModelProperty(provider.getDeclaringClass().get())) - .withConnectionManagementType(POOLING) - .supportsConnectivityTesting(provider.supportsConnectivityTesting()) - .withStereotype(stereotypeDelegate.getDefaultConnectionProviderStereotype(providerName)); - - ParameterDeclarationContext context = new ParameterDeclarationContext("Service Provider", providerName, loadingContext); - - parametersLoader.declare(providerDeclarer, - getParameterGroupParsers(provider.getParameters(), context), - loadingContext); - if (hasCustomTransports) { - providerDeclarer.onParameterGroup(TRANSPORT_GROUP) - .withRequiredParameter(TRANSPORT_PARAM) - .withDisplayModel(DisplayModel.builder().displayName(TRANSPORT_GROUP).build()) - .ofType(typeLoader.load(MessageDispatcherProvider.class)) - .withLayout(LayoutModel.builder().order(1).tabName(TRANSPORT).build()) - .withExpressionSupport(NOT_SUPPORTED); - } - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/property/SoapExtensionModelProperty.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/property/SoapExtensionModelProperty.java deleted file mode 100644 index 3d0d2a4db6f5..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/property/SoapExtensionModelProperty.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader.property; - -import org.mule.runtime.api.meta.model.ModelProperty; - -/** - * An immutable model property which indicates that the extension is a Soap Based one. - * - * @since 4.0 - */ -public final class SoapExtensionModelProperty implements ModelProperty { - - private static final String NAME = "soapExtensionType"; - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return NAME; - } - - - /** - * {@inheritDoc} - * - * @return {@code false} - */ - @Override - public boolean isPublic() { - return false; - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/MessageDispatcherProviderTypeWrapper.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/MessageDispatcherProviderTypeWrapper.java deleted file mode 100644 index 766a6c235d2d..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/MessageDispatcherProviderTypeWrapper.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader.type.runtime; - -import static org.mule.runtime.extension.api.util.NameUtils.hyphenize; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper; - -/** - * {@link TypeWrapper} implementation for classes that implements the {@link MessageDispatcherProvider} interface. - * - * @since 4.0 - */ -public class MessageDispatcherProviderTypeWrapper extends TypeWrapper { - - private static final String MESSAGE = "-message"; - private static final String PROVIDER = "-provider"; - private static final String DISPATCHER = "-dispatcher"; - - MessageDispatcherProviderTypeWrapper(Class clazz, ClassTypeLoader typeLoader) { - super(clazz, typeLoader); - } - - /** - * @return the name specified by the user ending with {@code message-dispatcher}. - */ - @Override - public String getAlias() { - String hyphenized = hyphenize(super.getAlias()); - return hyphenized.replace(MESSAGE + DISPATCHER + PROVIDER, "") - .replace(DISPATCHER + PROVIDER, "") - .replace(PROVIDER, "") - .concat(MESSAGE + DISPATCHER); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapComponentWrapper.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapComponentWrapper.java deleted file mode 100644 index 250bcd65e69b..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapComponentWrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader.type.runtime; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper; - -/** - * {@link TypeWrapper} Base implementation for classes that are annotated with the SoapTransportProviders annotation. - * - * @since 4.0 - */ -abstract class SoapComponentWrapper extends TypeWrapper { - - SoapComponentWrapper(Class aClass, ClassTypeLoader typeLoader) { - super(aClass, typeLoader); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapExtensionTypeWrapper.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapExtensionTypeWrapper.java deleted file mode 100644 index 18bd17fff861..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapExtensionTypeWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader.type.runtime; - -import static java.util.Collections.emptyList; -import static java.util.stream.Collectors.toList; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.annotation.Soap; -import org.mule.runtime.extension.api.soap.annotation.SoapMessageDispatcherProviders; - -import java.util.List; - -import com.google.common.collect.ImmutableList; - -/** - * {@link SoapComponentWrapper} implementation for the extension annotated class, which is a Soap Extension either because - * implements the {@link SoapServiceProvider} interface or is annotated with the {@link Soap} annotation. - * - * @since 4.0 - */ -public class SoapExtensionTypeWrapper extends SoapComponentWrapper { - - private ClassTypeLoader typeLoader; - - public SoapExtensionTypeWrapper(Class extensionType, ClassTypeLoader typeLoader) { - super(extensionType, typeLoader); - this.typeLoader = typeLoader; - } - - public List getSoapServiceProviders() { - ImmutableList.Builder serviceProviders = ImmutableList.builder(); - if (this.isAssignableTo(SoapServiceProvider.class)) { - serviceProviders - .add(new SoapServiceProviderWrapper((Class) this.getDeclaringClass().get(), typeLoader)); - } - getValueFromAnnotation(Soap.class).ifPresent(soap -> soap.getClassArrayValue(Soap::value).stream() - .forEach(sp -> { - Class type = (Class) sp.getDeclaringClass().get(); - serviceProviders.add(new SoapServiceProviderWrapper(type, typeLoader)); - })); - return serviceProviders.build(); - } - - public List getDispatcherProviders() { - return getValueFromAnnotation(SoapMessageDispatcherProviders.class) - .map(value -> value.getClassArrayValue(SoapMessageDispatcherProviders::value).stream() - .map(type -> new MessageDispatcherProviderTypeWrapper(type.getDeclaringClass().get(), typeLoader)) - .collect(toList())) - .orElse(emptyList()); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapServiceProviderWrapper.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapServiceProviderWrapper.java deleted file mode 100644 index 4cfaaeae7c20..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/loader/type/runtime/SoapServiceProviderWrapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader.type.runtime; - - -import static org.mule.runtime.extension.api.util.NameUtils.hyphenize; -import static org.mule.runtime.module.extension.internal.ExtensionProperties.DEFAULT_CONNECTION_PROVIDER_NAME; - -import org.mule.metadata.api.ClassTypeLoader; -import org.mule.runtime.extension.api.connectivity.NoConnectivityTest; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.module.extension.api.loader.java.type.ParameterizableTypeElement; -import org.mule.runtime.module.extension.api.loader.java.type.Type; - -import java.util.Optional; - -/** - * {@link SoapComponentWrapper} implementation for classes that implements the {@link SoapServiceProvider} interface. - * - * @since 4.0 - */ -public class SoapServiceProviderWrapper extends SoapComponentWrapper implements ParameterizableTypeElement { - - SoapServiceProviderWrapper(Class aClass, ClassTypeLoader typeLoader) { - super(aClass, typeLoader); - } - - /** - * @return a {@link Class} that implements the {@link SoapServiceProvider} interface which this {@link Type} represents. - */ - @Override - public Optional> getDeclaringClass() { - return super.getDeclaringClass(); - } - - @Override - public String getAlias() { - String finalName = hyphenize(super.getAlias()) - .replace("-service-provider", "") - .replace("-connection", "") - .replace("-extension", ""); - return finalName + "-" + DEFAULT_CONNECTION_PROVIDER_NAME; - } - - public boolean supportsConnectivityTesting() { - return super.getDeclaringClass() - .map(clazz -> !NoConnectivityTest.class.isAssignableFrom(clazz) - && !org.mule.sdk.api.connectivity.NoConnectivityTest.class.isAssignableFrom(clazz)) - .orElse(true); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/BaseInvokeResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/BaseInvokeResolver.java deleted file mode 100644 index b68cec7a16c1..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/BaseInvokeResolver.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import static org.mule.runtime.api.metadata.resolving.FailureCode.CONNECTION_FAILURE; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.NamedTypeResolver; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient; -import org.mule.runtime.soap.api.client.SoapClient; - -/** - * Base type resolver for the Soap Connect invoke operation. - * - * @since 4.0 - */ -abstract class BaseInvokeResolver implements NamedTypeResolver { - - /** - * {@inheritDoc} - */ - @Override - public String getCategoryName() { - return "InvokeOperationCategory"; - } - - SoapClient getClient(MetadataContext context, WebServiceTypeKey key) - throws MetadataResolvingException, ConnectionException { - ForwardingSoapClient connection = getConnection(context); - return connection.getSoapClient(key.getService()); - } - - ForwardingSoapClient getConnection(MetadataContext context) - throws MetadataResolvingException, ConnectionException { - return context.getConnection() - .orElseThrow(() -> new MetadataResolvingException("Cannot obtain connection", CONNECTION_FAILURE)); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputAttachmentsTypeResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputAttachmentsTypeResolver.java deleted file mode 100644 index b9406fa15133..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputAttachmentsTypeResolver.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import org.mule.metadata.api.model.MetadataType; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.InputTypeResolver; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.metadata.SoapOperationMetadata; - -/** - * Resolves the metadata for the input attachments for the soap connect invoke operation - * - * @since 4.0 - */ -public final class InvokeInputAttachmentsTypeResolver extends BaseInvokeResolver implements InputTypeResolver { - - @Override - public String getResolverName() { - return "InvokeInputAttachments"; - } - - @Override - public MetadataType getInputMetadata(MetadataContext context, WebServiceTypeKey key) - throws MetadataResolvingException, ConnectionException { - SoapClient client = getClient(context, key); - SoapOperationMetadata metadata = client.getMetadataResolver().getInputMetadata(key.getOperation()); - return metadata.getAttachmentsType(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputHeadersTypeResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputHeadersTypeResolver.java deleted file mode 100644 index cfbb9d0a07c5..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeInputHeadersTypeResolver.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import org.mule.metadata.api.model.MetadataType; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.InputTypeResolver; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.metadata.SoapOperationMetadata; - -/** - * Resolves the metadata for the input headers for the soap connect invoke operation. - * - * @since 4.0 - */ -public final class InvokeInputHeadersTypeResolver extends BaseInvokeResolver implements InputTypeResolver { - - /** - * {@inheritDoc} - */ - @Override - public String getResolverName() { - return "InvokeInputHeaders"; - } - - /** - * {@inheritDoc} - */ - @Override - public MetadataType getInputMetadata(MetadataContext context, WebServiceTypeKey key) - throws MetadataResolvingException, ConnectionException { - SoapClient client = getClient(context, key); - SoapOperationMetadata metadata = client.getMetadataResolver().getInputMetadata(key.getOperation()); - return metadata.getHeadersType(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeKeysResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeKeysResolver.java deleted file mode 100644 index 42bc152d6806..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeKeysResolver.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import static org.mule.runtime.module.extension.api.metadata.MultilevelMetadataKeyBuilder.newKey; - -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataKey; -import org.mule.runtime.api.metadata.MetadataKeyBuilder; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.TypeKeysResolver; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.util.NameUtils; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient; -import org.mule.runtime.soap.api.client.metadata.SoapMetadataResolver; - -import java.util.List; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; - -/** - * Resolves the metadata keys for a given Soap Extension {@link ForwardingSoapClient} connection. - *

- * Retrieves all the services that are available to hit and for each service will retrieve all available Operations that the user - * can execute. - * - * @since 4.0 - */ -public final class InvokeKeysResolver extends BaseInvokeResolver implements TypeKeysResolver { - - /** - * {@inheritDoc} - * - * Resolves multi-level metadata keys with the services available to hit and for each of the services exposes all available - * operations. - */ - @Override - public Set getKeys(MetadataContext context) throws MetadataResolvingException, ConnectionException { - ForwardingSoapClient connection = getConnection(context); - ImmutableSet.Builder keys = ImmutableSet.builder(); - connection.getAllWebServices().forEach(ws -> keys.add(buildServiceKey(connection, ws))); - return keys.build(); - } - - private MetadataKey buildServiceKey(ForwardingSoapClient connection, WebServiceDefinition ws) { - String serviceId = ws.getServiceId(); - SoapMetadataResolver resolver = connection.getSoapClient(serviceId).getMetadataResolver(); - MetadataKeyBuilder key = newKey(serviceId).withDisplayName(ws.getFriendlyName()); - List excludedOperations = ws.getExcludedOperations(); - resolver.getAvailableOperations().stream() - .filter(ope -> !excludedOperations.contains(ope)) - .forEach(ope -> key.withChild(newKey(ope).withDisplayName(NameUtils.titleize(ope)))); - return key.build(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeOutputTypeResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeOutputTypeResolver.java deleted file mode 100644 index bf995a0b3b2f..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeOutputTypeResolver.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import static org.mule.runtime.extension.api.soap.metadata.SoapOutputTypeBuilder.buildOutputType; - -import org.mule.metadata.api.model.MetadataType; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.OutputTypeResolver; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.metadata.SoapOperationMetadata; - -/** - * Resolves the output metadata for the soap connect invoke operation - * - * @since 4.0 - */ -public final class InvokeOutputTypeResolver extends BaseInvokeResolver implements OutputTypeResolver { - - /** - * {@inheritDoc} - */ - @Override - public String getResolverName() { - return "InvokeOutput"; - } - - /** - * {@inheritDoc} - */ - @Override - public MetadataType getOutputType(MetadataContext context, WebServiceTypeKey key) - throws MetadataResolvingException, ConnectionException { - SoapClient client = getClient(context, key); - SoapOperationMetadata metadata = client.getMetadataResolver().getOutputMetadata(key.getOperation()); - return buildOutputType(metadata.getBodyType(), metadata.getHeadersType(), metadata.getAttachmentsType(), - context.getTypeBuilder()); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeRequestTypeResolver.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeRequestTypeResolver.java deleted file mode 100644 index 89e1e77cd1b7..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/InvokeRequestTypeResolver.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -import org.mule.metadata.api.model.MetadataType; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.MetadataContext; -import org.mule.runtime.api.metadata.MetadataResolvingException; -import org.mule.runtime.api.metadata.resolving.InputTypeResolver; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.metadata.SoapOperationMetadata; - -/** - * Resolves the input metadata for the request body for the soap connect invoke operation - * - * @since 4.0 - */ -public final class InvokeRequestTypeResolver extends BaseInvokeResolver implements InputTypeResolver { - - /** - * {@inheritDoc} - */ - @Override - public String getResolverName() { - return "InvokeRequest"; - } - - /** - * {@inheritDoc} - */ - @Override - public MetadataType getInputMetadata(MetadataContext context, WebServiceTypeKey key) - throws MetadataResolvingException, ConnectionException { - SoapClient client = getClient(context, key); - SoapOperationMetadata metadata = client.getMetadataResolver().getInputMetadata(key.getOperation()); - return metadata.getBodyType(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/WebServiceTypeKey.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/WebServiceTypeKey.java deleted file mode 100644 index fadcae203428..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/metadata/WebServiceTypeKey.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.metadata; - -/** - * Represents a multilevel metadata key that describes a soap operation giving a web service. - * - * @since 1.0 - */ -public final class WebServiceTypeKey { - - /** - * The service that contains the operation - */ - private String service; - - /** - * The operation to be executed - */ - private String operation; - - public String getService() { - return service; - } - - public String getOperation() { - return operation; - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/DefaultDispatchingContext.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/DefaultDispatchingContext.java deleted file mode 100644 index 7e55793b675c..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/DefaultDispatchingContext.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.soap.DispatchingContext; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; - -/** - * Default {@link DispatchingContext} implementation - * - * @since 4.1 - */ -public class DefaultDispatchingContext implements DispatchingContext { - - private final ExtensionsClient client; - - DefaultDispatchingContext(ExtensionsClient client) { - this.client = client; - } - - @Override - public ExtensionsClient getExtensionsClient() { - return client; - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClient.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClient.java deleted file mode 100644 index 29c7fea2438f..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClient.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static com.google.common.collect.ImmutableList.copyOf; -import static java.util.Collections.emptyMap; -import static java.util.concurrent.TimeUnit.MINUTES; -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import static org.mule.runtime.soap.api.client.SoapClientConfiguration.builder; - -import org.mule.runtime.api.exception.MuleRuntimeException; -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.soap.ContextAwareMessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.soap.api.SoapService; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.SoapClientConfigurationBuilder; -import org.mule.runtime.soap.api.client.SoapClientFactory; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.cache.RemovalListener; -import com.google.common.cache.RemovalNotification; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.ExecutionException; -import java.util.function.Supplier; - -/** - * This client is just a manager of {@link SoapClient} instances, since a single {@link SoapServiceProvider} can connect with - * multiple services. - *

- * This client will create {@link SoapClient} instances lazily and only when required, this way we avoid instantiating all - * multiple clients for each different {@link ForwardingSoapClient} that is created, optimising resources. - * - * @since 4.0 - */ -public class ForwardingSoapClient { - - private final LoadingCache clientsCache; - private final MessageDispatcherProvider dispatcherProvider; - private final SoapServiceProvider serviceProvider; - private final List webServiceDefinitions; - - ForwardingSoapClient(SoapService service, - SoapServiceProvider serviceProvider, - MessageDispatcherProvider dispatcher) { - this.serviceProvider = serviceProvider; - this.webServiceDefinitions = serviceProvider.getWebServiceDefinitions(); - this.dispatcherProvider = dispatcher; - this.clientsCache = CacheBuilder.newBuilder() - .expireAfterAccess(1, MINUTES) - .removalListener(new ForwardingClientRemovalListener()) - .build(new SoapClientCacheLoader(service)); - } - - public Map getCustomHeaders(String id, String operation) { - Map customHeaders = serviceProvider.getCustomHeaders(getWebServiceDefinitionById(id), operation); - return customHeaders != null ? customHeaders : emptyMap(); - } - - /** - * Returns a {@link SoapClient} instance connected to the {@link WebServiceDefinition} of the specified {@code id}. - * - * @param id the id of the {@link WebServiceDefinition}. - * @return a {@link SoapClient} instance - */ - public SoapClient getSoapClient(String id) { - try { - return clientsCache.get(getWebServiceDefinitionById(id)); - } catch (ExecutionException e) { - throw new MuleRuntimeException(createStaticMessage("Error while retrieving soap client id [" + id + "]"), e); - } - } - - private WebServiceDefinition getWebServiceDefinitionById(String id) { - return webServiceDefinitions.stream().filter(ws -> ws.getServiceId().equals(id)).findAny() - .orElseThrow(() -> new IllegalArgumentException("Could not find a web service definition with id=[" + id + "]")); - } - - public List getAllWebServices() { - return copyOf(webServiceDefinitions); - } - - /** - * Disconnects all the {@link SoapClient} instances created by this manager. - */ - public void disconnect() { - clientsCache.invalidateAll(); - } - - public Optional getExtensionsClientDispatcher(Supplier clientSupplier) { - return (dispatcherProvider instanceof ContextAwareMessageDispatcherProvider) - ? Optional.ofNullable(((ContextAwareMessageDispatcherProvider) dispatcherProvider) - .connect(new DefaultDispatchingContext(clientSupplier.get()))) - : Optional.empty(); - } - - /** - * {@link CacheLoader} implementation to load lazily {@link SoapClient}s. - */ - private class SoapClientCacheLoader extends CacheLoader { - - private final SoapService service; - - private SoapClientCacheLoader(SoapService service) { - this.service = service; - } - - @Override - public SoapClient load(WebServiceDefinition definition) throws Exception { - SoapClientFactory clientFactory = service.getClientFactory(); - SoapClientConfigurationBuilder configurationBuilder = builder() - .withService(definition.getService()) - .withPort(definition.getPort()) - .withWsdlLocation(definition.getWsdlUrl().toString()); - - if (definition.getAddress() != null) { - configurationBuilder.withAddress(definition.getAddress().toString()); - } - - if (!(dispatcherProvider instanceof ContextAwareMessageDispatcherProvider)) { - configurationBuilder.withDispatcher(dispatcherProvider.connect()); - } - - serviceProvider.getSecurities().forEach(configurationBuilder::withSecurity); - SoapClient soapClient = clientFactory.create(configurationBuilder.build()); - soapClient.start(); - return soapClient; - } - } - - - /** - * {@link RemovalListener} implementation stop {@link SoapClient}s. - */ - private class ForwardingClientRemovalListener implements RemovalListener { - - @Override - public void onRemoval(RemovalNotification notification) { - SoapClient client = notification.getValue(); - try { - if (client != null) { - client.stop(); - } - } catch (Exception e) { - throw new MuleRuntimeException(createStaticMessage("A problem occurred while disconnecting client: '%s'", client), e); - } - } - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProvider.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProvider.java deleted file mode 100644 index 658dfe33851f..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProvider.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static java.util.Arrays.asList; -import static org.mule.runtime.api.connection.ConnectionValidationResult.failure; -import static org.mule.runtime.api.connection.ConnectionValidationResult.success; -import static org.mule.runtime.core.api.lifecycle.LifecycleUtils.*; - -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.connection.ConnectionProvider; -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.api.exception.MuleException; -import org.mule.runtime.api.lifecycle.InitialisationException; -import org.mule.runtime.api.lifecycle.Lifecycle; -import org.mule.runtime.core.api.MuleContext; -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.soap.ContextAwareMessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProviderConfigurationException; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.http.api.HttpService; -import org.mule.runtime.soap.api.SoapService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import java.util.List; - -/** - * {@link ConnectionProvider} implementation that handles {@link ForwardingSoapClient} connections, which are created from a - * {@link List} of {@link WebServiceDefinition}s. Each {@link WebServiceDefinition} describe one service with which instances - * created by this provider will be capable to connect to. - *

- * This Provider centralize the logic and polling mechanism to provision and release connection for each of the clients that - * required to be created, while remaining abstracted from the concerns of actually manage those connections. - * - * @since 4.0 - */ -public class ForwardingSoapClientConnectionProvider implements ConnectionProvider, Lifecycle { - - private static final Logger LOGGER = LoggerFactory.getLogger(ForwardingSoapClientConnectionProvider.class); - - private MuleContext muleContext; - - @Inject - private SoapService soapService; - - @Inject - private HttpService httpService; - - @Inject - private ExtensionsClient client; - - /** - * The {@link SoapServiceProvider} that knows which services will this connection connect to. - */ - private final SoapServiceProvider serviceProvider; - - /** - * The {@link MessageDispatcherProvider} used to get {@link MessageDispatcher} instances. - */ - private final MessageDispatcherProvider transportProvider; - - ForwardingSoapClientConnectionProvider(SoapServiceProvider serviceProvider, - MessageDispatcherProvider transportProvider, - MuleContext muleContext) { - this.serviceProvider = serviceProvider; - this.transportProvider = (MessageDispatcherProvider) transportProvider; - this.muleContext = muleContext; - } - - /** - * @return a new {@link ForwardingSoapClient} instance. - * @throws ConnectionException in any error case. - */ - @Override - public ForwardingSoapClient connect() throws ConnectionException { - return new ForwardingSoapClient(soapService, serviceProvider, transportProvider); - } - - /** - * Disconnects a {@link ForwardingSoapClient} connection, by shutting down each one of the services that the provided instance - * manages. - * - * @param connection a {@link ForwardingSoapClient} instance to disconnect, - */ - @Override - public void disconnect(ForwardingSoapClient connection) { - connection.disconnect(); - } - - @Override - public ConnectionValidationResult validate(ForwardingSoapClient connection) { - try { - serviceProvider.validateConfiguration(); - MessageDispatcher messageDispatcher; - if (transportProvider instanceof ContextAwareMessageDispatcherProvider) { - messageDispatcher = ((ContextAwareMessageDispatcherProvider) transportProvider) - .connect(new DefaultDispatchingContext(client)); - } else { - messageDispatcher = transportProvider.connect(); - } - ConnectionValidationResult result = transportProvider.validate(messageDispatcher, serviceProvider); - transportProvider.disconnect(messageDispatcher); - return result; - } catch (Exception e) { - return failure(e.getMessage(), e); - } - } - - @Override - public void initialise() throws InitialisationException { - initialiseIfNeeded(asList(transportProvider, serviceProvider), true, muleContext); - } - - @Override - public void dispose() { - disposeIfNeeded(asList(transportProvider, serviceProvider), LOGGER); - } - - @Override - public void stop() throws MuleException { - stopIfNeeded(asList(transportProvider, serviceProvider)); - } - - @Override - public void start() throws MuleException { - startIfNeeded(asList(transportProvider, serviceProvider)); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/SoapConnectionProviderObjectBuilder.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/SoapConnectionProviderObjectBuilder.java deleted file mode 100644 index a72d1988e17a..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/SoapConnectionProviderObjectBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static java.lang.String.format; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapServiceProviderDeclarer.TRANSPORT_PARAM; - -import org.mule.runtime.api.config.PoolingProfile; -import org.mule.runtime.api.connection.ConnectionProvider; -import org.mule.runtime.api.exception.MuleException; -import org.mule.runtime.api.meta.model.ExtensionModel; -import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel; -import org.mule.runtime.api.util.Pair; -import org.mule.runtime.core.api.MuleContext; -import org.mule.runtime.core.api.el.ExpressionManager; -import org.mule.runtime.core.api.retry.ReconnectionConfig; -import org.mule.runtime.core.internal.connection.ErrorTypeHandlerConnectionProviderWrapper; -import org.mule.runtime.core.internal.connection.ReconnectableConnectionProviderWrapper; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.module.extension.api.runtime.resolver.ResolverSet; -import org.mule.runtime.module.extension.api.runtime.resolver.ResolverSetResult; -import org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty; -import org.mule.runtime.module.extension.internal.runtime.config.BaseConnectionProviderObjectBuilder; -import org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultResolverSetBasedObjectBuilder; -import org.mule.runtime.module.extension.soap.api.runtime.connection.transport.DefaultHttpMessageDispatcherProvider; -import org.mule.runtime.soap.api.client.SoapClient; - -/** - * Implementation of {@link BaseConnectionProviderObjectBuilder} which produces instances of - * {@link ForwardingSoapClientConnectionProvider}. - * - * @since 4.0 - */ -public final class SoapConnectionProviderObjectBuilder extends BaseConnectionProviderObjectBuilder { - - private final DefaultResolverSetBasedObjectBuilder objectBuilder; - - public SoapConnectionProviderObjectBuilder(ConnectionProviderModel providerModel, - ResolverSet resolverSet, - PoolingProfile poolingProfile, - ReconnectionConfig reconnectionConfig, - ExtensionModel extensionModel, - ExpressionManager expressionManager, - MuleContext muleContext) { - super(providerModel, getServiceProviderType(providerModel), resolverSet, poolingProfile, - reconnectionConfig, extensionModel, expressionManager, muleContext); - objectBuilder = new DefaultResolverSetBasedObjectBuilder<>(getServiceProviderType(providerModel), resolverSet, - expressionManager, muleContext); - } - - /** - * Build a new {@link ForwardingSoapClientConnectionProvider} based on a {@link SoapServiceProvider} instance. - * - * @param result the {@link ResolverSetResult} with the values for the {@link SoapServiceProvider} instance. - * @return a wrapped {@link ForwardingSoapClientConnectionProvider} with error handling and polling mechanisms. - * @throws MuleException - */ - @Override - public Pair, ResolverSetResult> build(ResolverSetResult result) throws MuleException { - SoapServiceProvider serviceProvider = objectBuilder.build(result); - MessageDispatcherProvider transport = getCustomTransport(result); - ConnectionProvider provider = - new ForwardingSoapClientConnectionProvider(serviceProvider, transport, muleContext); - provider = new ReconnectableConnectionProviderWrapper<>(provider, reconnectionConfig); - provider = new ErrorTypeHandlerConnectionProviderWrapper<>(provider, extensionModel, reconnectionConfig, - muleContext.getErrorTypeRepository()); - return new Pair(provider, result); - } - - private MessageDispatcherProvider getCustomTransport(ResolverSetResult resultSet) { - MessageDispatcherProvider customTransport = (MessageDispatcherProvider) resultSet.get(TRANSPORT_PARAM); - return customTransport != null ? customTransport : new DefaultHttpMessageDispatcherProvider(); - } - - /** - * @return a {@link SoapServiceProvider} implementation {@link Class} for a given {@link ConnectionProviderModel}. - */ - private static Class getServiceProviderType(ConnectionProviderModel model) { - return model.getModelProperty(ImplementingTypeModelProperty.class) - .map(prop -> (Class) prop.getType()) - .orElseThrow(() -> new IllegalStateException(format("No %s was defined in connection provider [%s]", - ImplementingTypeModelProperty.class.getSimpleName(), - model.getName()))); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDynamic() { - return resolverSet.isDynamic(); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutor.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutor.java deleted file mode 100644 index ff7378ab7ced..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutor.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.operation; - -import static org.mule.runtime.api.metadata.DataType.INPUT_STREAM; -import static org.mule.runtime.api.metadata.DataType.XML_STRING; -import static org.mule.runtime.core.api.rx.Exceptions.wrapFatal; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.ATTACHMENTS_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.BODY_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.HEADERS_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.MESSAGE_GROUP; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.OPERATION_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.SERVICE_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.TRANSPORT_HEADERS_PARAM; - -import org.mule.runtime.api.el.BindingContext; -import org.mule.runtime.api.el.CompiledExpression; -import org.mule.runtime.api.el.ExpressionLanguageSession; -import org.mule.runtime.api.el.MuleExpressionLanguage; -import org.mule.runtime.api.lifecycle.Initialisable; -import org.mule.runtime.api.meta.model.operation.OperationModel; -import org.mule.runtime.api.metadata.DataType; -import org.mule.runtime.api.metadata.TypedValue; -import org.mule.runtime.api.transformation.TransformationService; -import org.mule.runtime.core.api.transformer.MessageTransformerException; -import org.mule.runtime.core.api.transformer.TransformerException; -import org.mule.runtime.core.api.util.IOUtils; -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.runtime.operation.CompletableComponentExecutor; -import org.mule.runtime.extension.api.runtime.operation.ExecutionContext; -import org.mule.runtime.extension.api.soap.SoapAttachment; -import org.mule.runtime.module.extension.api.runtime.privileged.ExecutionContextAdapter; -import org.mule.runtime.module.extension.internal.runtime.client.EventedExtensionsClientDecorator; -import org.mule.runtime.module.extension.internal.runtime.resolver.ConnectionArgumentResolver; -import org.mule.runtime.module.extension.internal.runtime.resolver.StreamingHelperArgumentResolver; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.exception.error.SoapExceptionEnricher; -import org.mule.runtime.soap.api.message.SoapRequest; -import org.mule.runtime.soap.api.message.SoapRequestBuilder; -import org.mule.runtime.soap.api.message.SoapResponse; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import javax.inject.Inject; - -/** - * {@link CompletableComponentExecutor} implementation that executes SOAP operations using a provided {@link SoapClient}. - * - * @since 4.0 - */ -public final class SoapOperationExecutor implements CompletableComponentExecutor, Initialisable { - - @Inject - private MuleExpressionLanguage expressionExecutor; - - @Inject - private TransformationService transformationService; - - @Inject - private ExtensionsClient extensionsClient; - - private final ConnectionArgumentResolver connectionResolver = new ConnectionArgumentResolver(); - private final StreamingHelperArgumentResolver streamingHelperArgumentResolver = new StreamingHelperArgumentResolver(); - private final SoapExceptionEnricher soapExceptionEnricher = new SoapExceptionEnricher(); - private CompiledExpression headersExpression; - - /** - * {@inheritDoc} - */ - @Override - public void execute(ExecutionContext context, ExecutorCallback callback) { - try { - String serviceId = context.getParameter(SERVICE_PARAM); - ForwardingSoapClient connection = (ForwardingSoapClient) connectionResolver.resolve(context); - Map customHeaders = connection.getCustomHeaders(serviceId, getOperation(context)); - SoapRequest request = getRequest(context, customHeaders); - SoapClient soapClient = connection.getSoapClient(serviceId); - SoapResponse response = connection - .getExtensionsClientDispatcher(() -> new EventedExtensionsClientDecorator(extensionsClient, - ((ExecutionContextAdapter) context) - .getEvent())) - .map(d -> soapClient.consume(request, d)) - .orElseGet(() -> soapClient.consume(request)); - - callback.complete((response.getAsResult(streamingHelperArgumentResolver.resolve(context)))); - } catch (MessageTransformerException | TransformerException e) { - callback.error(e); - } catch (Exception e) { - callback.error(soapExceptionEnricher.enrich(e)); - } catch (Throwable t) { - callback.error(wrapFatal(t)); - } - } - - public void initialise() { - headersExpression = expressionExecutor.compile( - "%dw 2.0 \n" - + "output application/java \n" - + "---\n" - + "payload.headers mapObject (value, key) -> {\n" - + " '$key' : write((key): value, \"application/xml\")\n" - + "}", - BindingContext.builder() - .addBinding("payload", new TypedValue<>("", XML_STRING)).build()); - } - - /** - * Builds a Soap Request with the execution context to be sent using the {@link SoapClient}. - */ - private SoapRequest getRequest(ExecutionContext context, Map fixedHeaders) - throws MessageTransformerException, TransformerException { - SoapRequestBuilder builder = SoapRequest.builder().operation(getOperation(context)); - builder.soapHeaders(fixedHeaders); - - Optional optionalMessageGroup = getParam(context, MESSAGE_GROUP); - if (optionalMessageGroup.isPresent()) { - Map message = (Map) optionalMessageGroup.get(); - InputStream body = (InputStream) message.get(BODY_PARAM); - if (body != null) { - builder.content(body); - } - - InputStream headers = (InputStream) message.get(HEADERS_PARAM); - if (headers != null) { - builder.soapHeaders((Map) evaluateHeaders(headers)); - } - - Map> attachments = (Map>) message.get(ATTACHMENTS_PARAM); - if (attachments != null) { - toSoapAttachments(attachments).forEach(builder::attachment); - } - } - - getParam(context, TRANSPORT_HEADERS_PARAM) - .ifPresent(th -> builder.transportHeaders((Map) th)); - return builder.build(); - } - - private String getOperation(ExecutionContext context) { - return (String) getParam(context, OPERATION_PARAM) - .orElseThrow( - () -> new IllegalStateException("Execution Context does not have the required operation parameter")); - } - - private Optional getParam(ExecutionContext context, String param) { - return context.hasParameter(param) ? Optional.ofNullable(context.getParameter(param)) : Optional.empty(); - } - - private Object evaluateHeaders(InputStream headers) { - String hs = IOUtils.toString(headers); - BindingContext context = BindingContext.builder().addBinding("payload", new TypedValue<>(hs, XML_STRING)).build(); - try (ExpressionLanguageSession session = expressionExecutor.openSession(context)) { - return session.evaluate(headersExpression).getValue(); - } - } - - private Map toSoapAttachments(Map> attachments) - throws MessageTransformerException, TransformerException { - Map soapAttachmentMap = new HashMap<>(); - - for (Map.Entry> attachment : attachments.entrySet()) { - SoapAttachment soapAttachment = - new SoapAttachment(toInputStream(attachment.getValue()), attachment.getValue().getDataType().getMediaType()); - soapAttachmentMap.put(attachment.getKey(), soapAttachment); - } - - return soapAttachmentMap; - } - - private InputStream toInputStream(TypedValue typedValue) throws MessageTransformerException, TransformerException { - - Object value = typedValue.getValue(); - if (value instanceof InputStream) { - return (InputStream) value; - } - return (InputStream) transformationService.transform(value, DataType.fromObject(value), INPUT_STREAM); - } -} diff --git a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutorFactory.java b/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutorFactory.java deleted file mode 100644 index 6d51e185e7a2..000000000000 --- a/modules/extensions-soap-support/src/main/java/org/mule/runtime/module/extension/soap/internal/runtime/operation/SoapOperationExecutorFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.operation; - -import org.mule.runtime.api.meta.model.operation.OperationModel; -import org.mule.runtime.extension.api.runtime.operation.CompletableComponentExecutor; -import org.mule.runtime.extension.api.runtime.operation.CompletableComponentExecutorFactory; - -import java.util.Map; - -/** - * {@link CompletableComponentExecutorFactory} that creates instances of {@link SoapOperationExecutor}. - */ -public final class SoapOperationExecutorFactory implements CompletableComponentExecutorFactory { - - /** - * Creates a new executor for soap operations. - * - * @param operationModel the model of the operation to be executed - * @param parameters parameters for initializing the executor - * @return a new {@link SoapOperationExecutor} - */ - - @Override - public CompletableComponentExecutor createExecutor(OperationModel operationModel, - Map parameters) { - return new SoapOperationExecutor(); - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/AbstractSoapExtensionDeclarationTestCase.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/AbstractSoapExtensionDeclarationTestCase.java deleted file mode 100644 index e1b288192b03..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/AbstractSoapExtensionDeclarationTestCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static java.util.Arrays.stream; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel; -import org.mule.runtime.api.meta.model.parameter.ParameterModel; -import org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty; - -import java.util.List; -import java.util.Optional; - -public class AbstractSoapExtensionDeclarationTestCase { - - SoapExtensionModelLoader loader = new SoapExtensionModelLoader(); - - void assertConnectionProvider(ConnectionProviderModel provider, - String name, - String description, - boolean supportsConnectivityTesting, - ParameterProber... probers) { - List parameterModels = provider.getAllParameterModels(); - assertThat(provider.getName(), is(name)); - assertThat(provider.getDescription(), is(description)); - - Long parameterCount = parameterModels.stream() - .filter(p -> !p.getModelProperty(InfrastructureParameterModelProperty.class).isPresent()) - .count(); - - assertThat(parameterCount.intValue(), is(probers.length)); - assertParameters(parameterModels, probers); - assertThat(provider.supportsConnectivityTesting(), is(supportsConnectivityTesting)); - } - - void assertParameters(List parameterModels, ParameterProber... probers) { - if (!parameterModels.isEmpty()) { - stream(probers).forEach(prober -> { - String name = prober.getName(); - Optional parameter = parameterModels.stream().filter(p -> name.equals(p.getName())).findAny(); - assertParameter(parameter.orElseThrow(() -> new RuntimeException("parameter [" + name + "] not found")), prober); - }); - } - } - - void assertParameter(ParameterModel param, ParameterProber prober) { - assertThat(param.getName(), is(prober.getName())); - assertThat(param.getType(), instanceOf(prober.getType())); - assertThat(param.getDefaultValue(), is(prober.getDefaultValue())); - assertThat(param.isRequired(), is(prober.isRequired())); - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/ParameterProber.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/ParameterProber.java deleted file mode 100644 index 1abe81ce97b5..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/ParameterProber.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -class ParameterProber { - - private final String name; - private final String defaultValue; - private final Class type; - private final boolean required; - - ParameterProber(String name, String defaultValue, Class type, boolean required) { - this.name = name; - this.defaultValue = defaultValue; - this.type = type; - this.required = required; - } - - ParameterProber(String name, Class type) { - this(name, null, type, true); - } - - public String getName() { - return name; - } - - public boolean isRequired() { - return required; - } - - public String getDefaultValue() { - return defaultValue; - } - - public Class getType() { - return type; - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionDeclarationTestCase.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionDeclarationTestCase.java deleted file mode 100644 index 8150f3ce24df..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionDeclarationTestCase.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static java.util.Collections.emptySet; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Stream.of; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isOneOf; -import static org.mule.runtime.api.dsl.DslResolvingContext.getDefault; -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_DESCRIPTION; -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_NAME; -import static org.mule.runtime.extension.api.annotation.param.Optional.PAYLOAD; -import static org.mule.runtime.extension.api.error.MuleErrors.ANY; -import static org.mule.runtime.manifest.api.MuleManifest.getMuleManifest; -import static org.mule.runtime.module.extension.internal.loader.java.AbstractJavaExtensionModelLoader.TYPE_PROPERTY_NAME; -import static org.mule.runtime.module.extension.internal.loader.java.AbstractJavaExtensionModelLoader.VERSION; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.ATTACHMENTS_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.BODY_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.HEADERS_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.OPERATION_DESCRIPTION; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.OPERATION_NAME; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.OPERATION_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.SERVICE_PARAM; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.TRANSPORT_HEADERS_PARAM; -import static org.mule.test.soap.extension.CalcioServiceProvider.CALCIO_DESC; -import static org.mule.test.soap.extension.CalcioServiceProvider.CALCIO_ID; - -import org.mule.metadata.api.model.BinaryType; -import org.mule.metadata.api.model.ObjectType; -import org.mule.metadata.api.model.StringType; -import org.mule.runtime.api.meta.model.ExtensionModel; -import org.mule.runtime.api.meta.model.config.ConfigurationModel; -import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel; -import org.mule.runtime.api.meta.model.error.ErrorModel; -import org.mule.runtime.api.meta.model.operation.OperationModel; -import org.mule.runtime.module.extension.internal.error.ModuleErrors; -import org.mule.runtime.soap.api.exception.error.SoapErrors; -import org.mule.test.soap.extension.FootballSoapExtension; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -public class SoapExtensionDeclarationTestCase extends AbstractSoapExtensionDeclarationTestCase { - - @Test - public void assertSoapExtensionModel() { - Map params = new HashMap<>(); - params.put(TYPE_PROPERTY_NAME, FootballSoapExtension.class.getName()); - params.put(VERSION, getMuleManifest().getProductVersion()); - // TODO MULE-14517: This workaround should be replaced for a better and more complete mechanism - params.put("COMPILATION_MODE", true); - ExtensionModel model = - loader.loadExtensionModel(FootballSoapExtension.class.getClassLoader(), getDefault(emptySet()), params); - - assertErrorModels(model.getErrorModels()); - - assertThat(model.getConfigurationModels(), hasSize(1)); - ConfigurationModel configuration = model.getConfigurationModels().get(0); - assertThat(configuration.getName(), is(DEFAULT_CONFIG_NAME)); - assertThat(configuration.getDescription(), is(DEFAULT_CONFIG_DESCRIPTION)); - - assertThat(configuration.getOperationModels(), hasSize(1)); - assertOperation(configuration.getOperationModels().get(0)); - - List providers = configuration.getConnectionProviders(); - assertThat(providers, hasSize(3)); - - assertConnectionProvider(providers.get(0), "base-connection", "", false, - new ParameterProber("laLigaAddress", null, StringType.class, true), - new ParameterProber("leaguesAddress", "http://some-url.com", StringType.class, false)); - - assertConnectionProvider(providers.get(1), CALCIO_ID + "-connection", CALCIO_DESC, false); - - assertConnectionProvider(providers.get(2), "la-liga-connection", "", true, - new ParameterProber("firstDivision", StringType.class), - new ParameterProber("secondDivision", StringType.class), - new ParameterProber("wsdlLocation", StringType.class)); - } - - private void assertErrorModels(Set errors) { - assertThat(errors, hasSize(12)); - ImmutableList errorNames = ImmutableList.builder() - .addAll(of(SoapErrors.values()).map(Object::toString).collect(toList())) - .addAll(of(ModuleErrors.values()).map(Object::toString).collect(toList())) - .add(ANY.name()) - .build(); - errors.forEach(e -> assertThat(e.getType(), isOneOf(errorNames.toArray()))); - } - - private void assertOperation(OperationModel operation) { - assertThat(operation.getOutput().getType(), is(instanceOf(ObjectType.class))); - assertThat(operation.getOutputAttributes().getType(), is(instanceOf(ObjectType.class))); - assertErrorModels(operation.getErrorModels()); - assertThat(operation.getName(), is(OPERATION_NAME)); - assertThat(operation.getDescription(), is(OPERATION_DESCRIPTION)); - ParameterProber[] probers = new ParameterProber[] { - new ParameterProber(OPERATION_PARAM, StringType.class), - new ParameterProber(SERVICE_PARAM, StringType.class), - new ParameterProber(BODY_PARAM, PAYLOAD, BinaryType.class, false), - new ParameterProber(HEADERS_PARAM, null, BinaryType.class, false), - new ParameterProber(TRANSPORT_HEADERS_PARAM, null, ObjectType.class, false), - new ParameterProber(ATTACHMENTS_PARAM, null, ObjectType.class, false), - }; - // the `5` is added because the sdk adds the config-ref, target, targetValue, errorMappings, and retryPolicy parameters - // automatically - assertThat(operation.getAllParameterModels(), hasSize(probers.length + 5)); - assertParameters(operation.getAllParameterModels(), probers); - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionWithCustomTransportsDeclarationTestCase.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionWithCustomTransportsDeclarationTestCase.java deleted file mode 100644 index 9195f45f1997..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/loader/SoapExtensionWithCustomTransportsDeclarationTestCase.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.loader; - -import static java.util.Collections.emptySet; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isOneOf; -import static org.mule.runtime.api.dsl.DslResolvingContext.getDefault; -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_DESCRIPTION; -import static org.mule.runtime.extension.api.annotation.Extension.DEFAULT_CONFIG_NAME; -import static org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getId; -import static org.mule.runtime.manifest.api.MuleManifest.getMuleManifest; -import static org.mule.runtime.module.extension.internal.loader.java.DefaultJavaExtensionModelLoader.TYPE_PROPERTY_NAME; -import static org.mule.runtime.module.extension.internal.loader.java.DefaultJavaExtensionModelLoader.VERSION; -import org.mule.metadata.api.model.ObjectType; -import org.mule.metadata.api.model.StringType; -import org.mule.runtime.api.meta.model.ExtensionModel; -import org.mule.runtime.api.meta.model.SubTypesModel; -import org.mule.runtime.api.meta.model.config.ConfigurationModel; -import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.test.ram.DefaultPortalGunDispatcherProvider; -import org.mule.test.ram.MiniverseDispatcherProvider; -import org.mule.test.ram.RickAndMortyExtension; -import org.mule.test.ram.TestHttpMessageDispatcherProvider; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; - -public class SoapExtensionWithCustomTransportsDeclarationTestCase extends AbstractSoapExtensionDeclarationTestCase { - - @Test - public void assertSoapExtensionModel() { - Map params = new HashMap<>(); - params.put(TYPE_PROPERTY_NAME, RickAndMortyExtension.class.getName()); - params.put(VERSION, getMuleManifest().getProductVersion()); - // TODO MULE-14517: This workaround should be replaced for a better and more complete mechanism - params.put("COMPILATION_MODE", true); - ExtensionModel model = - loader.loadExtensionModel(RickAndMortyExtension.class.getClassLoader(), getDefault(emptySet()), params); - - assertThat(model.getConfigurationModels(), hasSize(1)); - ConfigurationModel configuration = model.getConfigurationModels().get(0); - assertThat(configuration.getName(), is(DEFAULT_CONFIG_NAME)); - assertThat(configuration.getDescription(), is(DEFAULT_CONFIG_DESCRIPTION)); - assertThat(configuration.getOperationModels(), hasSize(1)); - assertSubtypes(model); - List providers = configuration.getConnectionProviders(); - assertThat(providers, hasSize(1)); - assertConnectionProvider(providers.get(0), "rick-and-morty-connection", "", true, - new ParameterProber("wsdlUrl", StringType.class), - new ParameterProber("port", StringType.class), - new ParameterProber("service", StringType.class), - new ParameterProber("transport", ObjectType.class)); - } - - private void assertSubtypes(ExtensionModel model) { - SubTypesModel subtypes = model.getSubTypes().iterator().next(); - assertThat(getId(subtypes.getBaseType()).get(), is(MessageDispatcherProvider.class.getName())); - subtypes.getSubTypes() - .forEach(subtype -> assertThat(getId(subtype).get(), isOneOf(TestHttpMessageDispatcherProvider.class.getName(), - DefaultPortalGunDispatcherProvider.class.getName(), - MiniverseDispatcherProvider.class.getName()))); - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProviderTestCase.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProviderTestCase.java deleted file mode 100644 index c1b266cd8662..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientConnectionProviderTestCase.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static java.util.Arrays.asList; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.api.lifecycle.InitialisationException; -import org.mule.runtime.api.message.ErrorType; -import org.mule.runtime.core.api.Injector; -import org.mule.runtime.core.api.MuleContext; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProviderConfigurationException; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -public class ForwardingSoapClientConnectionProviderTestCase { - - private static final String ERROR_NAME = "AN_ERROR"; - private static final String ERROR_NS = "NS"; - private static final String ERROR_MESSAGE = "ERROR MESSAGE"; - private static final Exception EXCEPTION = new RuntimeException(ERROR_MESSAGE); - private static final ErrorType ERROR_TYPE = mock(ErrorType.class); - - public ExpectedException expectedException = ExpectedException.none(); - - private MessageDispatcherProvider dispatcherProvider = mock(MessageDispatcherProvider.class); - private MuleContext ctx = mock(MuleContext.class); - - @Before - public void setup() { - when(ERROR_TYPE.getNamespace()).thenReturn(ERROR_NS); - when(ERROR_TYPE.getIdentifier()).thenReturn(ERROR_NAME); - } - - @Test - public void invalidProvider() throws Exception { - ConnectionValidationResult result = - new ForwardingSoapClientConnectionProvider(new ValidableServiceProvider(false), dispatcherProvider, ctx).validate(null); - assertThat(result.isValid(), is(false)); - assertThat(result.getException(), instanceOf(SoapServiceProviderConfigurationException.class)); - assertThat(result.getMessage(), is(ERROR_MESSAGE)); - } - - private class ValidableServiceProvider implements SoapServiceProvider { - - private final boolean valid; - - ValidableServiceProvider(boolean valid) { - this.valid = valid; - } - - @Override - public List getWebServiceDefinitions() { - try { - return asList(WebServiceDefinition.builder() - .withId("dos") - .withFriendlyName("Another Service Name") - .withWsdlUrl(new URL("http://localhost.com/dos")) - .withService("Service") - .withPort("Port2").build()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - @Override - public void validateConfiguration() { - if (!valid) { - throw new SoapServiceProviderConfigurationException(ERROR_MESSAGE, EXCEPTION); - } - } - } -} - diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientTestCase.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientTestCase.java deleted file mode 100644 index 1bdf8ac1d760..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/ForwardingSoapClientTestCase.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static java.util.Arrays.asList; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.sameInstance; -import static org.hamcrest.core.Is.is; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.exception.MuleException; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.soap.api.SoapService; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.SoapClientConfiguration; -import org.mule.runtime.soap.api.client.SoapClientFactory; -import org.mule.runtime.soap.api.message.SoapRequest; -import org.mule.runtime.soap.api.message.SoapResponse; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.io.IOUtils; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class ForwardingSoapClientTestCase { - - private static final String HEADER_VALUE_MASK = "service=%s, operation%s"; - private static final String HEADER_NAME = "aHeader"; - private static final String NULL_HEADERS_OPE = "nullHeaders"; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private SoapService service; - private ForwardingSoapClient client; - private MessageDispatcherProvider dispatcherProvider = new TestDispatcherProvider(); - - @Before - public void setup() throws ConnectionException { - service = mock(SoapService.class); - when(service.getClientFactory()).thenReturn(new TestClientFactory()); - client = new ForwardingSoapClient(service, new TestServiceProvider(), dispatcherProvider); - } - - @Test - public void loadClient() throws Exception { - SoapClient sc = client.getSoapClient("uno"); - SoapResponse response = sc.consume(SoapRequest.empty("no-op")); - assertThat(IOUtils.toString(response.getContent()), is("Content")); - } - - @Test - public void invalidService() throws MuleException { - expectedException.expectMessage("Could not find a web service definition with id=[invalid]"); - expectedException.expect(IllegalArgumentException.class); - client.getSoapClient("invalid"); - } - - @Test - public void disconnect() throws Exception { - TestSoapClient sc1 = (TestSoapClient) client.getSoapClient("uno"); - TestSoapClient sc2 = (TestSoapClient) client.getSoapClient("dos"); - client.disconnect(); - assertThat(sc1.isDisconnected(), is(true)); - assertThat(sc2.isDisconnected(), is(true)); - } - - @Test - public void differentDispatcherInstances() { - TestSoapClient sc1 = (TestSoapClient) client.getSoapClient("uno"); - TestSoapClient sc2 = (TestSoapClient) client.getSoapClient("dos"); - assertThat(sc1.getDispatcher(), is(not(sameInstance(sc2.getDispatcher())))); - } - - @Test - public void connectAndDisconnectDispatcher() throws ConnectionException { - MessageDispatcherProvider spyProvider = spy(dispatcherProvider); - client = new ForwardingSoapClient(service, new TestServiceProvider(), spyProvider); - TestSoapClient sc1 = (TestSoapClient) client.getSoapClient("uno"); - TestSoapClient sc2 = (TestSoapClient) client.getSoapClient("dos"); - verify(spyProvider, times(2)).connect(); - assertThat(((TestDispatcherProvider.TestMessageDispatcher) sc1.getDispatcher()).isDisconnected(), is(true)); - assertThat(((TestDispatcherProvider.TestMessageDispatcher) sc2.getDispatcher()).isDisconnected(), is(true)); - } - - @Test - public void customHeadersAreResolvedCorrectly() { - String someOperationName = "someOperation"; - Map headers = client.getCustomHeaders("uno", someOperationName); - assertThat(headers.size(), is(1)); - Map.Entry header = headers.entrySet().iterator().next(); - assertThat(header.getKey(), is(HEADER_NAME)); - assertThat(header.getValue(), is(getHeaderValue("uno", someOperationName))); - } - - @Test - public void customHeadersAreNeverNull() { - Map headers = client.getCustomHeaders("uno", NULL_HEADERS_OPE); - assertThat(headers.size(), is(0)); - } - - private class TestServiceProvider implements SoapServiceProvider { - - @Override - public List getWebServiceDefinitions() { - try { - return asList( - WebServiceDefinition.builder().withId("uno").withFriendlyName("Service Name") - .withWsdlUrl(new URL("http://localhost.com/uno")).withService("Service").withPort("Port1").build(), - WebServiceDefinition.builder().withId("dos").withFriendlyName("Another Service Name") - .withWsdlUrl(new URL("http://localhost.com/dos")).withService("Service").withPort("Port2").build()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - @Override - public Map getCustomHeaders(WebServiceDefinition definition, String operation) { - if (operation.equals(NULL_HEADERS_OPE)) { - return null; - } - Map headers = new HashMap<>(); - headers.put(HEADER_NAME, getHeaderValue(definition.getServiceId(), operation)); - return headers; - } - - } - - public class TestClientFactory implements SoapClientFactory { - - @Override - public SoapClient create(SoapClientConfiguration configuration) throws ConnectionException { - return new TestSoapClient(configuration); - } - } - - private String getHeaderValue(String id, String ope) { - return String.format(HEADER_VALUE_MASK, id, ope); - } -} - diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestDispatcherProvider.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestDispatcherProvider.java deleted file mode 100644 index f8db6ac62c97..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestDispatcherProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static java.util.Collections.singletonMap; -import static org.mule.runtime.api.connection.ConnectionValidationResult.success; - -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.api.lifecycle.Disposable; -import org.mule.runtime.api.lifecycle.Initialisable; -import org.mule.runtime.api.lifecycle.InitialisationException; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.message.DispatchingRequest; -import org.mule.runtime.extension.api.soap.message.DispatchingResponse; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import java.io.ByteArrayInputStream; - -public class TestDispatcherProvider implements MessageDispatcherProvider { - - @Override - public MessageDispatcher connect() throws ConnectionException { - return new TestMessageDispatcher(); - } - - @Override - public void disconnect(MessageDispatcher connection) { - - } - - @Override - public ConnectionValidationResult validate(MessageDispatcher connection) { - return success(); - } - - public class TestMessageDispatcher implements MessageDispatcher, Initialisable, Disposable { - - private boolean disconnected = true; - - @Override - public DispatchingResponse dispatch(DispatchingRequest request) { - return new DispatchingResponse(new ByteArrayInputStream("".getBytes()), singletonMap("Content-Type", "text/xml")); - } - - @Override - public void dispose() { - disconnected = true; - } - - @Override - public void initialise() throws InitialisationException { - disconnected = false; - } - - public boolean isDisconnected() { - return disconnected; - } - } -} diff --git a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestSoapClient.java b/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestSoapClient.java deleted file mode 100644 index 9b42a93b6c81..000000000000 --- a/modules/extensions-soap-support/src/test/java/org/mule/runtime/module/extension/soap/internal/runtime/connection/TestSoapClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.soap.internal.runtime.connection; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import org.mule.runtime.api.exception.MuleException; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.SoapClientConfiguration; -import org.mule.runtime.soap.api.client.metadata.SoapMetadataResolver; -import org.mule.runtime.soap.api.message.SoapRequest; -import org.mule.runtime.soap.api.message.SoapResponse; - -import java.io.ByteArrayInputStream; - -public class TestSoapClient implements SoapClient { - - private final MessageDispatcher dispatcher; - private boolean disconnected = false; - - public TestSoapClient(SoapClientConfiguration configuration) { - this.dispatcher = configuration.getDispatcher(); - } - - @Override - public void stop() throws MuleException { - disconnected = true; - } - - @Override - public void start() throws MuleException { - - } - - public SoapResponse consume(SoapRequest request) { - return consume(request, null); - } - - @Override - public SoapResponse consume(SoapRequest request, MessageDispatcher dispatcher) { - SoapResponse response = mock(SoapResponse.class); - when(response.getContent()).thenReturn(new ByteArrayInputStream("Content".getBytes())); - return response; - } - - @Override - public SoapMetadataResolver getMetadataResolver() { - return null; - } - - public MessageDispatcher getDispatcher() { - return dispatcher; - } - - public boolean isDisconnected() { - return disconnected; - } - - public void setDisconnected(boolean disconnected) { - this.disconnected = disconnected; - } -} diff --git a/modules/extensions-spring-support/pom.xml b/modules/extensions-spring-support/pom.xml index 51038abfa8d5..8e8379d3f803 100644 --- a/modules/extensions-spring-support/pom.xml +++ b/modules/extensions-spring-support/pom.xml @@ -339,13 +339,6 @@ mule-plugin test - - org.mule.tests - mule-football-soap-extension - ${project.version} - mule-plugin - test - org.mule.tests mule-semantic-terms-extension @@ -370,13 +363,6 @@ - - org.mule.tests - mule-rick-and-morty-extension - ${project.version} - mule-plugin - test - org.mule.tests classloading-extension diff --git a/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/config/dsl/connection/ConnectionProviderObjectFactory.java b/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/config/dsl/connection/ConnectionProviderObjectFactory.java index b78f196bc43e..519fd50649f4 100644 --- a/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/config/dsl/connection/ConnectionProviderObjectFactory.java +++ b/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/config/dsl/connection/ConnectionProviderObjectFactory.java @@ -34,8 +34,6 @@ import org.mule.runtime.module.extension.internal.runtime.connectivity.oauth.ocs.PlatformManagedOAuthConnectionProviderObjectBuilder; import org.mule.runtime.module.extension.internal.runtime.connectivity.oauth.ocs.PlatformManagedOAuthHandler; import org.mule.runtime.module.extension.internal.runtime.resolver.ConnectionProviderResolver; -import org.mule.runtime.module.extension.soap.internal.loader.property.SoapExtensionModelProperty; -import org.mule.runtime.module.extension.soap.internal.runtime.connection.SoapConnectionProviderObjectBuilder; import java.util.concurrent.Callable; @@ -80,17 +78,11 @@ public ConnectionProviderObjectFactory(ConnectionProviderModel providerModel, @Override public ConnectionProviderResolver doGetObject() { // TODO: W-11365218 - Callable callable = () -> getParametersResolver().getParametersAsResolverSet(providerModel, muleContext); - ResolverSet resolverSet = withContextClassLoader(getClassLoader(extensionModel), callable); + final Callable callable = () -> getParametersResolver().getParametersAsResolverSet(providerModel, muleContext); + final ResolverSet resolverSet = withContextClassLoader(getClassLoader(extensionModel), callable); BaseConnectionProviderObjectBuilder builder; - if (extensionModel.getModelProperty(SoapExtensionModelProperty.class).isPresent()) { - builder = new SoapConnectionProviderObjectBuilder(providerModel, resolverSet, poolingProfile, - reconnectionConfig, - extensionModel, - expressionManager, - muleContext); - } else if (providerModel.getModelProperty(OAuthModelProperty.class).isPresent()) { + if (providerModel.getModelProperty(OAuthModelProperty.class).isPresent()) { builder = resolveOAuthBuilder(resolverSet); } else { builder = new DefaultConnectionProviderObjectBuilder(providerModel, resolverSet, poolingProfile, @@ -104,11 +96,11 @@ public ConnectionProviderResolver doGetObject() { } private BaseConnectionProviderObjectBuilder resolveOAuthBuilder(ResolverSet resolverSet) { - OAuthGrantType grantType = providerModel.getModelProperty(OAuthModelProperty.class) + final OAuthGrantType grantType = providerModel.getModelProperty(OAuthModelProperty.class) .map(OAuthModelProperty::getGrantTypes) .get().get(0); - Reference builder = new Reference<>(); + final Reference builder = new Reference<>(); grantType.accept(new OAuthGrantTypeVisitor() { diff --git a/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/resources/MulePluginDescriptorGenerator.java b/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/resources/MulePluginDescriptorGenerator.java index f4b39a2b1b2e..683626d11274 100644 --- a/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/resources/MulePluginDescriptorGenerator.java +++ b/modules/extensions-spring-support/src/main/java/org/mule/runtime/module/extension/internal/resources/MulePluginDescriptorGenerator.java @@ -6,21 +6,21 @@ */ package org.mule.runtime.module.extension.internal.resources; -import static java.util.Collections.emptyMap; -import static java.util.Optional.empty; -import static java.util.Optional.of; import static org.mule.runtime.api.deployment.meta.Product.MULE; import static org.mule.runtime.api.deployment.meta.Product.MULE_EE; import static org.mule.runtime.api.meta.Category.COMMUNITY; -import static org.mule.runtime.deployment.model.api.artifact.ArtifactDescriptorConstants.EXPORTED_PACKAGES; -import static org.mule.runtime.deployment.model.api.artifact.ArtifactDescriptorConstants.EXPORTED_RESOURCES; -import static org.mule.runtime.deployment.model.api.artifact.ArtifactDescriptorConstants.MULE_LOADER_ID; -import static org.mule.runtime.deployment.model.api.artifact.ArtifactDescriptorConstants.PRIVILEGED_ARTIFACTS_IDS; -import static org.mule.runtime.deployment.model.api.artifact.ArtifactDescriptorConstants.PRIVILEGED_EXPORTED_PACKAGES; import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor.MULE_ARTIFACT_JSON_DESCRIPTOR; +import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptorConstants.EXPORTED_PACKAGES; +import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptorConstants.EXPORTED_RESOURCES; +import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptorConstants.MULE_LOADER_ID; +import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptorConstants.PRIVILEGED_ARTIFACTS_IDS; +import static org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptorConstants.PRIVILEGED_EXPORTED_PACKAGES; +import static org.mule.runtime.module.extension.internal.loader.java.AbstractJavaExtensionModelLoader.TYPE_PROPERTY_NAME; import static org.mule.runtime.module.extension.internal.loader.java.DefaultJavaExtensionModelLoader.JAVA_LOADER_ID; -import static org.mule.runtime.module.extension.internal.loader.java.DefaultJavaExtensionModelLoader.TYPE_PROPERTY_NAME; -import static org.mule.runtime.module.extension.soap.internal.loader.SoapExtensionModelLoader.SOAP_LOADER_ID; + +import static java.util.Collections.emptyMap; +import static java.util.Optional.empty; +import static java.util.Optional.of; import org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptor; import org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder; @@ -35,7 +35,6 @@ import org.mule.runtime.module.extension.internal.resources.manifest.DefaultClassPackageFinder; import org.mule.runtime.module.extension.internal.resources.manifest.ExportedPackagesCollector; import org.mule.runtime.module.extension.internal.resources.manifest.ProcessingEnvironmentClassPackageFinder; -import org.mule.runtime.module.extension.soap.internal.loader.property.SoapExtensionModelProperty; import java.util.Optional; @@ -63,7 +62,7 @@ public Optional generateResource(ExtensionModel extensionMode return empty(); } - DefaultClassPackageFinder defaultClassPackageFinder = new DefaultClassPackageFinder(); + final DefaultClassPackageFinder defaultClassPackageFinder = new DefaultClassPackageFinder(); if (processingEnvironment != null) { defaultClassPackageFinder.addAdditionalPackageFinder(new ProcessingEnvironmentClassPackageFinder(processingEnvironment)); } @@ -104,8 +103,7 @@ public Optional generateResource(ExtensionModel extensionMode } private String getLoaderId(ExtensionModel extensionModel) { - Optional soapModelProperty = extensionModel.getModelProperty(SoapExtensionModelProperty.class); - return soapModelProperty.isPresent() ? SOAP_LOADER_ID : JAVA_LOADER_ID; + return JAVA_LOADER_ID; } @Override diff --git a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/capability/xml/DefaultExtensionSchemaGeneratorTestCase.java b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/capability/xml/DefaultExtensionSchemaGeneratorTestCase.java index 6f33058aa823..3e102756810b 100644 --- a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/capability/xml/DefaultExtensionSchemaGeneratorTestCase.java +++ b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/capability/xml/DefaultExtensionSchemaGeneratorTestCase.java @@ -6,14 +6,16 @@ */ package org.mule.runtime.module.extension.internal.capability.xml; -import static com.google.common.collect.ImmutableSet.copyOf; -import static java.lang.Boolean.getBoolean; -import static java.util.Arrays.asList; -import static java.util.Optional.ofNullable; import static org.mule.runtime.api.util.MuleSystemProperties.SYSTEM_PROPERTY_PREFIX; import static org.mule.test.module.extension.internal.FileGenerationParameterizedExtensionModelTestCase.ResourceExtensionUnitTest.newUnitTest; import static org.mule.test.module.extension.internal.util.ExtensionsTestUtils.compareXML; +import static java.lang.Boolean.getBoolean; +import static java.util.Arrays.asList; +import static java.util.Optional.ofNullable; + +import static com.google.common.collect.ImmutableSet.copyOf; + import org.mule.extension.test.extension.reconnection.ReconnectionExtension; import org.mule.runtime.api.dsl.DslResolvingContext; import org.mule.runtime.api.meta.model.ExtensionModel; @@ -36,9 +38,7 @@ import org.mule.test.nonimplicit.config.extension.extension.api.NonImplicitConfigExtension; import org.mule.test.oauth.TestOAuthExtension; import org.mule.test.petstore.extension.PetStoreConnector; -import org.mule.test.ram.RickAndMortyExtension; import org.mule.test.semantic.extension.SemanticTermsExtension; -import org.mule.test.soap.extension.FootballSoapExtension; import org.mule.test.substitutiongroup.extension.SubstitutionGroupExtension; import org.mule.test.subtypes.extension.SubTypesMappingConnector; import org.mule.test.transactional.TransactionalExtension; @@ -82,8 +82,6 @@ public static Collection data() { newUnitTest(JAVA_LOADER, TransactionalExtension.class, "tx-ext.xsd"), newUnitTest(JAVA_LOADER, SubTypesMappingConnector.class, "subtypes.xsd"), newUnitTest(JAVA_LOADER, MarvelExtension.class, "marvel.xsd"), - newUnitTest(SOAP_LOADER, FootballSoapExtension.class, "soap.xsd"), - newUnitTest(SOAP_LOADER, RickAndMortyExtension.class, "ram.xsd"), newUnitTest(JAVA_LOADER, TypedValueExtension.class, "typed-value.xsd"), newUnitTest(JAVA_LOADER, TestOAuthExtension.class, "test-oauth.xsd"), newUnitTest(JAVA_LOADER, WeaveFunctionExtension.class, "test-fn.xsd"), diff --git a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/ExtensionModelJsonGeneratorTestCase.java b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/ExtensionModelJsonGeneratorTestCase.java index f60d578fe78b..7ef832a1a392 100644 --- a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/ExtensionModelJsonGeneratorTestCase.java +++ b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/ExtensionModelJsonGeneratorTestCase.java @@ -31,7 +31,6 @@ import org.mule.test.nonimplicit.config.extension.extension.api.NonImplicitConfigExtension; import org.mule.test.oauth.TestOAuthExtension; import org.mule.test.petstore.extension.PetStoreConnector; -import org.mule.test.ram.RickAndMortyExtension; import org.mule.test.semantic.extension.SemanticTermsExtension; import org.mule.test.substitutiongroup.extension.SubstitutionGroupExtension; import org.mule.test.subtypes.extension.SubTypesMappingConnector; @@ -78,8 +77,6 @@ public static Collection data() { createArtifactCoordinate("mule-subtypes-extension")), newUnitTest(JAVA_LOADER, MarvelExtension.class, "marvel.json", createArtifactCoordinate("mule-marvel-extension")), - newUnitTest(SOAP_LOADER, RickAndMortyExtension.class, "ram.json", - createArtifactCoordinate("mule-rick-and-morty-extension")), newUnitTest(JAVA_LOADER, TypedValueExtension.class, "typed-value.json", createArtifactCoordinate("mule-typed-value-extension")), newUnitTest(JAVA_LOADER, TestOAuthExtension.class, "test-oauth.json", @@ -130,7 +127,7 @@ protected void assertEquals(String expectedContent, String actualContent) throws @Test public void load() { - ExtensionModel result = generator.deserialize(expectedContent); + final ExtensionModel result = generator.deserialize(expectedContent); assertThat(result, is(extensionUnderTest)); } } diff --git a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/LegacyJsonDeserializationTestCase.java b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/LegacyJsonDeserializationTestCase.java index 9d2a3397c7a4..d2c3a9aa1b24 100644 --- a/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/LegacyJsonDeserializationTestCase.java +++ b/modules/extensions-spring-support/src/test/java/org/mule/runtime/module/extension/internal/resources/LegacyJsonDeserializationTestCase.java @@ -6,21 +6,14 @@ */ package org.mule.runtime.module.extension.internal.resources; -import static java.util.Arrays.asList; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.MatcherAssert.assertThat; - import static org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED; import static org.mule.runtime.core.api.util.IOUtils.getResourceAsString; -import java.io.IOException; -import java.util.Collection; +import static java.util.Arrays.asList; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; import org.mule.runtime.api.meta.model.ComponentModel; import org.mule.runtime.api.meta.model.ComposableModel; @@ -49,6 +42,14 @@ import org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty; import org.mule.tck.size.SmallTest; +import java.io.IOException; +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + @SmallTest @RunWith(Parameterized.class) public class LegacyJsonDeserializationTestCase { @@ -69,7 +70,6 @@ public static Collection data() { {"tx-ext.json"}, {"subtypes.json"}, {"marvel.json"}, - {"ram.json"}, {"typed-value.json"}, {"test-oauth.json"}, {"test-oauth-ocs.json"}, @@ -94,7 +94,7 @@ protected String getExpectedFilesDir() { @Test public void load() { - ExtensionModel result = generator.deserialize(fileContent); + final ExtensionModel result = generator.deserialize(fileContent); assertLegacyExtensionModelCollections(result); } @@ -160,7 +160,7 @@ protected void onParameter(ParameterizedModel owner, ParameterGroupModel groupMo assertNotNull(model.getAllowedStereotypes()); assertNotNull(model.getSemanticTerms()); assertFieldValueProviderModels(model); - model.getValueProviderModel().ifPresent(valueProviderModel -> valueProviderModel.getParameters()); + model.getValueProviderModel().ifPresent(ValueProviderModel::getParameters); model.getModelProperty(MetadataKeyPartModelProperty.class) .ifPresent(LegacyJsonDeserializationTestCase.this::assertMetadataKeyPartModelPropertyHasCorrectDefault); } @@ -203,7 +203,7 @@ private void assertSourceCallbackModel(SourceCallbackModel sourceCallbackModel) private void assertFieldValueProviderModels(ParameterModel model) { assertNotNull(model.getFieldValueProviderModels()); - model.getFieldValueProviderModels().forEach(fieldValueProviderModel -> assertValueProviderModel(fieldValueProviderModel)); + model.getFieldValueProviderModels().forEach(this::assertValueProviderModel); } private void assertValueProviderModel(ValueProviderModel model) { diff --git a/modules/extensions-spring-support/src/test/java/org/mule/test/module/extension/internal/ParameterizedExtensionModelTestCase.java b/modules/extensions-spring-support/src/test/java/org/mule/test/module/extension/internal/ParameterizedExtensionModelTestCase.java index 9919e721bf24..c62017186be3 100644 --- a/modules/extensions-spring-support/src/test/java/org/mule/test/module/extension/internal/ParameterizedExtensionModelTestCase.java +++ b/modules/extensions-spring-support/src/test/java/org/mule/test/module/extension/internal/ParameterizedExtensionModelTestCase.java @@ -24,7 +24,6 @@ import org.mule.runtime.extension.api.loader.ExtensionModelLoader; import org.mule.runtime.extension.api.loader.ExtensionModelLoadingRequest; import org.mule.runtime.module.extension.internal.loader.java.DefaultJavaExtensionModelLoader; -import org.mule.runtime.module.extension.soap.internal.loader.SoapExtensionModelLoader; import org.mule.tck.junit4.AbstractMuleTestCase; import org.mule.tck.size.SmallTest; @@ -47,7 +46,6 @@ public abstract class ParameterizedExtensionModelTestCase extends AbstractMuleTe protected static Map EXTENSION_MODELS = new HashMap<>(); protected static final ExtensionModelLoader JAVA_LOADER = new DefaultJavaExtensionModelLoader(); - protected static final ExtensionModelLoader SOAP_LOADER = new SoapExtensionModelLoader(); @Parameterized.Parameter public ExtensionModel extensionUnderTest; @@ -58,9 +56,9 @@ public static void cleanUp() { } protected static Collection createExtensionModels(List extensions) { - TriFunction, ExtensionModelLoader, ArtifactCoordinates, ExtensionModel> createExtensionModel = + final TriFunction, ExtensionModelLoader, ArtifactCoordinates, ExtensionModel> createExtensionModel = (extension, loader, artifactCoordinates) -> { - ExtensionModel model = loadExtension(extension, loader, artifactCoordinates); + final ExtensionModel model = loadExtension(extension, loader, artifactCoordinates); if (EXTENSION_MODELS.put(model.getName(), model) != null) { throw new IllegalArgumentException(format("Extension names must be unique. Name [%s] for extension [%s] was already used", @@ -76,11 +74,11 @@ protected static Collection createExtensionModels(List clazz, ExtensionModelLoader loader, ArtifactCoordinates coordinates) { - Map params = of(TYPE_PROPERTY_NAME, clazz.getName(), - VERSION, getMuleManifest().getProductVersion(), - // TODO MULE-14517: This workaround should be replaced for a better and more complete - // mechanism - COMPILATION_MODE, true); + final Map params = of(TYPE_PROPERTY_NAME, clazz.getName(), + VERSION, getMuleManifest().getProductVersion(), + // TODO MULE-14517: This workaround should be replaced for a better and more complete + // mechanism + COMPILATION_MODE, true); // TODO MULE-11797: as this utils is consumed from // org.mule.runtime.module.extension.internal.capability.xml.schema.AbstractXmlResourceFactory.generateResource(org.mule.runtime.api.meta.model.ExtensionModel), @@ -98,7 +96,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE classBytes = toByteArray(this.getClass().getResourceAsStream("/" + name.replaceAll("\\.", "/") + ".class")); return this.defineClass(null, classBytes, 0, classBytes.length); - } catch (Exception e) { + } catch (final Exception e) { return super.loadClass(name); } } else { @@ -107,7 +105,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE } }; - ExtensionModelLoadingRequest.Builder builder = builder(pluginClassLoader, dslResolvingContext) + final ExtensionModelLoadingRequest.Builder builder = builder(pluginClassLoader, dslResolvingContext) .setResolveMinMuleVersion(true) .addParameters(params); if (coordinates != null) { diff --git a/modules/extensions-spring-support/src/test/resources/models/ram.json b/modules/extensions-spring-support/src/test/resources/models/ram.json deleted file mode 100644 index ee3d77701eec..000000000000 --- a/modules/extensions-spring-support/src/test/resources/models/ram.json +++ /dev/null @@ -1,2173 +0,0 @@ -{ - "name": "RAM", - "description": "", - "version": "@mule.runtime.version@", - "vendor": "Mulesoft", - "supportedJavaVersions": [ - "1.8", - "11" - ], - "category": "COMMUNITY", - "xmlDsl": { - "prefix": "ram", - "namespace": "http://www.mulesoft.org/schema/mule/ram", - "schemaLocation": "http://www.mulesoft.org/schema/mule/ram/current/mule-ram.xsd", - "schemaVersion": "@mule.runtime.version@", - "xsdFileName": "mule-ram.xsd" - }, - "resources": [], - "subTypes": [ - { - "baseType": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.soap.MessageDispatcherProvider", - "classInformation": { - "classname": "org.mule.runtime.extension.api.soap.MessageDispatcherProvider", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [ - "org.mule.runtime.api.connection.ConnectionProvider" - ], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "MessageDispatcherProvider" - } - }, - "fields": [] - }, - "subTypes": [ - { - "format": "java", - "type": "@ref:org.mule.test.ram.MiniverseDispatcherProvider" - }, - { - "format": "java", - "type": "@ref:org.mule.test.ram.DefaultPortalGunDispatcherProvider" - }, - { - "format": "java", - "type": "@ref:org.mule.test.ram.TestHttpMessageDispatcherProvider" - } - ] - } - ], - "privilegedPackages": [], - "privilegedArtifacts": [], - "externalLibraries": [], - "importedTypes": [], - "configurations": [ - { - "stereotype": { - "type": "CONFIG", - "namespace": "RAM", - "parent": { - "type": "MODULE_CONFIG", - "namespace": "MULE" - } - }, - "parameterGroupModels": [ - { - "parameters": [ - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": true, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "name", - "description": "The identifier of this element used to reference it in other components", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.runtime.ExpirationPolicy", - "classInformation": { - "classname": "org.mule.runtime.extension.api.runtime.ExpirationPolicy", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "infrastructureType": {}, - "description": { - "value": "Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. The runtime will actually purge the instances when it sees it fit." - }, - "typeDsl": { - "allowInlineDefinition": true, - "allowTopLevelDefinition": false - } - }, - "fields": [ - { - "key": { - "name": "maxIdleTime" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "5" - } - }, - "annotations": { - "description": { - "value": "A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it\u0027s considered eligible for expiration" - }, - "expressionSupport": { - "value": "NOT_SUPPORTED" - } - } - }, - { - "key": { - "name": "timeUnit" - }, - "model": { - "type": "String", - "annotations": { - "enum": { - "type": "[Ljava.lang.String;", - "values": [ - "NANOSECONDS", - "MICROSECONDS", - "MILLISECONDS", - "SECONDS", - "MINUTES", - "HOURS", - "DAYS" - ] - }, - "default": "MINUTES" - } - }, - "annotations": { - "description": { - "value": "A time unit that qualifies the maxIdleTime attribute" - }, - "expressionSupport": { - "value": "NOT_SUPPORTED" - } - } - } - ] - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "expirationPolicy", - "description": "Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. The runtime will actually purge the instances when it sees it fit.", - "modelProperties": { - "org.mule.runtime.extension.api.property.QNameModelProperty": { - "value": { - "namespaceURI": "http://www.mulesoft.org/schema/mule/core", - "localPart": "expiration-policy", - "prefix": "mule" - } - }, - "org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty": { - "sequence": 4 - } - } - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1 - }, - "showInDsl": false, - "name": "General", - "description": "", - "modelProperties": {} - } - ], - "externalLibraryModels": [], - "operations": [ - { - "blocking": true, - "executionType": "BLOCKING", - "output": { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.soap.SoapOutputPayload", - "classInformation": { - "classname": "org.mule.runtime.extension.api.soap.SoapOutputPayload", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "SoapOutputPayload" - } - }, - "fields": [ - { - "key": { - "name": "attachments" - }, - "model": { - "type": "Object", - "annotations": { - "classInformation": { - "classname": "java.util.Map", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [ - "java.lang.String", - "org.mule.runtime.api.metadata.TypedValue" - ], - "isMap": true - } - }, - "open": { - "type": "Binary", - "annotations": { - "classInformation": { - "classname": "java.io.InputStream", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - } - } - }, - "fields": [] - }, - "annotations": { - "visibility": "READ_ONLY" - } - }, - { - "key": { - "name": "body" - }, - "model": { - "type": "Binary", - "annotations": { - "classInformation": { - "classname": "java.io.InputStream", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - } - } - }, - "annotations": { - "visibility": "READ_ONLY" - } - }, - { - "key": { - "name": "headers" - }, - "model": { - "type": "Object", - "annotations": { - "classInformation": { - "classname": "java.util.Map", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [ - "java.lang.String", - "org.mule.runtime.api.metadata.TypedValue" - ], - "isMap": true - } - }, - "open": { - "type": "String" - }, - "fields": [] - }, - "annotations": { - "visibility": "READ_ONLY" - } - } - ] - }, - "hasDynamicType": true, - "description": "", - "modelProperties": {} - }, - "outputAttributes": { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.soap.SoapAttributes", - "classInformation": { - "classname": "org.mule.runtime.extension.api.soap.SoapAttributes", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "SoapAttributes" - } - }, - "fields": [ - { - "key": { - "name": "protocolHeaders" - }, - "model": { - "type": "Object", - "annotations": { - "classInformation": { - "classname": "java.util.Map", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [ - "java.lang.String", - "java.lang.String" - ], - "isMap": true - } - }, - "open": { - "type": "String" - }, - "fields": [] - }, - "annotations": { - "visibility": "READ_ONLY" - } - } - ] - }, - "hasDynamicType": false, - "description": "", - "modelProperties": {} - }, - "transactional": false, - "requiresConnection": true, - "supportsStreaming": false, - "notifications": [], - "nestedComponents": [], - "errors": [ - "MULE:ANY", - "MULE:CONNECTIVITY", - "MULE:RETRY_EXHAUSTED", - "RAM:BAD_REQUEST", - "RAM:BAD_RESPONSE", - "RAM:CANNOT_DISPATCH", - "RAM:CONNECTIVITY", - "RAM:ENCODING", - "RAM:INVALID_WSDL", - "RAM:RETRY_EXHAUSTED", - "RAM:SOAP_FAULT", - "RAM:TIMEOUT" - ], - "semanticTerms": [], - "visibility": "PUBLIC", - "stereotype": { - "type": "INVOKE", - "namespace": "RAM", - "parent": { - "type": "PROCESSOR", - "namespace": "RAM", - "parent": { - "type": "PROCESSOR", - "namespace": "MULE" - } - } - }, - "parameterGroupModels": [ - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.runtime.config.ConfigurationProvider", - "classInformation": { - "classname": "org.mule.runtime.extension.api.runtime.config.ConfigurationProvider", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - } - }, - "fields": [] - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": true, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 10 - }, - "allowedStereotypeModels": [ - { - "type": "CONFIG", - "namespace": "RAM", - "parent": { - "type": "MODULE_CONFIG", - "namespace": "MULE" - } - } - ], - "semanticTerms": [], - "name": "config-ref", - "description": "The name of the configuration to be used to execute this component", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 0 - }, - "showInDsl": false, - "name": "General", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "service", - "description": "", - "modelProperties": { - "org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty": { - "order": 1, - "providedByKeyResolver": true, - "expressionSupport": "NOT_SUPPORTED" - } - } - }, - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "operation", - "description": "", - "modelProperties": { - "org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty": { - "order": 2, - "providedByKeyResolver": true, - "expressionSupport": "NOT_SUPPORTED" - } - } - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 3 - }, - "showInDsl": false, - "name": "Web Service Configuration", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Binary", - "annotations": { - "classInformation": { - "classname": "java.io.InputStream", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - } - } - }, - "hasDynamicType": true, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "defaultValue": "#[payload]", - "role": "PRIMARY_CONTENT", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 3 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "body", - "displayModel": { - "summary": "The XML body to include in the SOAP message, with all the required parameters." - }, - "description": "", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "Binary", - "annotations": { - "classInformation": { - "classname": "java.io.InputStream", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - } - } - }, - "hasDynamicType": true, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "CONTENT", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 4 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "headers", - "displayModel": { - "displayName": "Headers", - "summary": "The XML headers to include in the SOAP message." - }, - "description": "", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "java.util.Map", - "classInformation": { - "classname": "java.util.Map", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": true - } - }, - "open": { - "type": "Binary", - "annotations": { - "typeId": "java.io.InputStream" - } - }, - "fields": [] - }, - "hasDynamicType": true, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "CONTENT", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 5 - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "attachments", - "displayModel": { - "summary": "The attachments to include in the SOAP request." - }, - "description": "", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1 - }, - "showInDsl": true, - "name": "Message", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "java.util.Map", - "classInformation": { - "classname": "java.util.Map", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": true - } - }, - "open": { - "type": "String" - }, - "fields": [] - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": true, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2, - "tabName": "Transport" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "transportHeaders", - "displayModel": { - "displayName": "Headers", - "summary": "The headers to set in the transport configuration." - }, - "description": "", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2 - }, - "showInDsl": false, - "name": "Transport Configuration", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 6, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "target", - "displayModel": { - "displayName": "Target Variable" - }, - "description": "The name of a variable on which the operation\u0027s output will be placed", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "REQUIRED", - "defaultValue": "#[payload]", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 7, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "targetValue", - "displayModel": { - "displayName": "Target Value" - }, - "description": "An expression that will be evaluated against the operation\u0027s output and the outcome of that expression will be stored in the target variable", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 4 - }, - "showInDsl": false, - "name": "Output", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Array", - "annotations": { - "infrastructureType": {}, - "description": { - "value": "Determines that an error thrown by this operation should be mapped to another" - }, - "typeDsl": { - "allowInlineDefinition": true, - "allowTopLevelDefinition": false - } - }, - "item": { - "type": "Object", - "annotations": { - "typeId": "errorMapping", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "source" - }, - "model": { - "format": { - "id": "text", - "label": "Text", - "validMimeTypes": [ - "text/plain" - ] - }, - "type": "String", - "annotations": { - "typeId": "errorTypeMatcher", - "enum": { - "type": "[Ljava.lang.String;", - "values": [ - "ANY", - "REDELIVERY_EXHAUSTED", - "TRANSFORMATION", - "EXPRESSION", - "SECURITY", - "CLIENT_SECURITY", - "SERVER_SECURITY", - "ROUTING", - "CONNECTIVITY", - "RETRY_EXHAUSTED", - "TIMEOUT" - ] - } - } - } - }, - { - "key": { - "name": "target", - "required": "true" - }, - "model": { - "format": { - "id": "text", - "label": "Text", - "validMimeTypes": [ - "text/plain" - ] - }, - "type": "String", - "annotations": { - "typeId": "errorTypeDefinition" - } - } - } - ] - } - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 8, - "tabName": "Error Mapping" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "errorMappings", - "description": "Set of error mappings", - "modelProperties": { - "org.mule.runtime.extension.api.property.QNameModelProperty": { - "value": { - "namespaceURI": "http://www.mulesoft.org/schema/mule/core", - "localPart": "error-mappings", - "prefix": "mule" - } - }, - "sinceMuleVersion": { - "version": "4.4.0" - }, - "org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty": { - "sequence": 12 - } - } - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 5 - }, - "showInDsl": false, - "name": "Error Mappings", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Union", - "annotations": { - "typeId": "ReconnectionStrategy", - "infrastructureType": {} - }, - "of": [ - { - "type": "Object", - "annotations": { - "typeId": "reconnect", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "frequency" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "2000" - } - }, - "annotations": { - "description": { - "value": "How often (in ms) to reconnect" - } - } - }, - { - "key": { - "name": "blocking" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "true" - } - }, - "annotations": { - "description": { - "value": "If false, the reconnection strategy will run in a separate, non-blocking thread" - } - } - }, - { - "key": { - "name": "count" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "2" - } - }, - "annotations": { - "description": { - "value": "How many reconnection attempts to make" - } - } - } - ] - }, - { - "type": "Object", - "annotations": { - "typeId": "reconnect-forever", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "frequency" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "2000" - } - }, - "annotations": { - "description": { - "value": "How often (in ms) to reconnect" - } - } - }, - { - "key": { - "name": "blocking" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "true" - } - }, - "annotations": { - "description": { - "value": "If false, the reconnection strategy will run in a separate, non-blocking thread" - } - } - } - ] - } - ] - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 9, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "reconnectionStrategy", - "description": "A retry strategy in case of connectivity errors", - "modelProperties": { - "org.mule.runtime.extension.api.property.QNameModelProperty": { - "value": { - "namespaceURI": "http://www.mulesoft.org/schema/mule/core", - "localPart": "abstract-reconnection-strategy", - "prefix": "mule" - } - }, - "org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty": { - "sequence": 3 - } - } - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 6 - }, - "showInDsl": false, - "name": "Connection", - "description": "", - "modelProperties": {} - } - ], - "name": "invoke", - "description": "invokes Web Service operations", - "modelProperties": { - "metadataKeyId": { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.module.extension.soap.internal.metadata.WebServiceTypeKey", - "classInformation": { - "classname": "org.mule.runtime.module.extension.soap.internal.metadata.WebServiceTypeKey", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": true, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "WebServiceTypeKey" - } - }, - "fields": [ - { - "key": { - "name": "operation" - }, - "model": { - "type": "String" - }, - "annotations": { - "visibility": "READ_ONLY" - } - }, - { - "key": { - "name": "service" - }, - "model": { - "type": "String" - }, - "annotations": { - "visibility": "READ_ONLY" - } - } - ] - }, - "parameterName": "Web Service Configuration", - "categoryName": "InvokeOperationCategory" - }, - "typeResolversInformation": { - "category": "InvokeOperationCategory", - "outputResolver": { - "resolverName": "InvokeOutput", - "requiresConnection": true, - "requiresConfiguration": true - }, - "keysResolver": { - "resolverName": "keys", - "requiresConnection": true, - "requiresConfiguration": true - }, - "partialTypeKeyResolver": false, - "inputResolvers": { - "headers": { - "resolverName": "InvokeInputHeaders", - "requiresConnection": true, - "requiresConfiguration": true - }, - "attachments": { - "resolverName": "InvokeInputAttachments", - "requiresConnection": true, - "requiresConfiguration": true - }, - "body": { - "resolverName": "InvokeRequest", - "requiresConnection": true, - "requiresConfiguration": true - } - } - } - }, - "kind": "operation" - } - ], - "connectionProviders": [ - { - "connectionManagementType": "POOLING", - "externalLibraryModels": [], - "supportsConnectivityTesting": true, - "semanticTerms": [], - "stereotype": { - "type": "RICK-AND-MORTY-CONNECTION", - "namespace": "RAM", - "parent": { - "type": "CONNECTION", - "namespace": "MULE" - } - }, - "parameterGroupModels": [ - { - "parameters": [ - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2 - }, - "allowedStereotypeModels": [], - "semanticTerms": [ - "core.urlTemplate" - ], - "name": "wsdlUrl", - "description": "", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 3 - }, - "allowedStereotypeModels": [], - "semanticTerms": [ - "apiContract.endpoint" - ], - "name": "service", - "description": "", - "modelProperties": {} - }, - { - "type": { - "format": "java", - "type": "String" - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": false, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 4 - }, - "allowedStereotypeModels": [], - "semanticTerms": [ - "connectivity.port" - ], - "name": "port", - "description": "", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1 - }, - "showInDsl": false, - "name": "General", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.extension.api.soap.MessageDispatcherProvider", - "classInformation": { - "classname": "org.mule.runtime.extension.api.soap.MessageDispatcherProvider", - "hasDefaultConstructor": false, - "isInterface": true, - "isInstantiable": false, - "isAbstract": true, - "isFinal": false, - "implementedInterfaces": [ - "org.mule.runtime.api.connection.ConnectionProvider" - ], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "MessageDispatcherProvider" - } - }, - "fields": [] - }, - "hasDynamicType": false, - "required": true, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": true, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 1, - "tabName": "Transport" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "transport", - "displayModel": { - "displayName": "Transport Configuration" - }, - "description": "", - "modelProperties": {} - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 2 - }, - "showInDsl": false, - "name": "Transport Configuration", - "description": "", - "modelProperties": {} - }, - { - "parameters": [ - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "Reconnection", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "failsDeployment" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "false" - } - }, - "annotations": { - "description": { - "value": "When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment will fail if the test doesn\u0027t pass after exhausting the associated reconnection strategy" - } - } - }, - { - "key": { - "name": "reconnectionStrategy" - }, - "model": { - "type": "Union", - "annotations": { - "typeId": "ReconnectionStrategy", - "infrastructureType": {} - }, - "of": [ - { - "type": "Object", - "annotations": { - "typeId": "reconnect", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "frequency" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "2000" - } - }, - "annotations": { - "description": { - "value": "How often (in ms) to reconnect" - } - } - }, - { - "key": { - "name": "blocking" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "true" - } - }, - "annotations": { - "description": { - "value": "If false, the reconnection strategy will run in a separate, non-blocking thread" - } - } - }, - { - "key": { - "name": "count" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "2" - } - }, - "annotations": { - "description": { - "value": "How many reconnection attempts to make" - } - } - } - ] - }, - { - "type": "Object", - "annotations": { - "typeId": "reconnect-forever", - "infrastructureType": {} - }, - "fields": [ - { - "key": { - "name": "frequency" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "2000" - } - }, - "annotations": { - "description": { - "value": "How often (in ms) to reconnect" - } - } - }, - { - "key": { - "name": "blocking" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "true" - } - }, - "annotations": { - "description": { - "value": "If false, the reconnection strategy will run in a separate, non-blocking thread" - } - } - } - ] - } - ] - }, - "annotations": { - "description": { - "value": "The reconnection strategy to use" - } - } - } - ] - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 5, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "reconnection", - "description": "When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment will fail if the test doesn\u0027t pass after exhausting the associated reconnection strategy", - "modelProperties": { - "org.mule.runtime.extension.api.property.QNameModelProperty": { - "value": { - "namespaceURI": "http://www.mulesoft.org/schema/mule/core", - "localPart": "reconnection", - "prefix": "mule" - } - }, - "org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty": { - "sequence": 3 - } - } - }, - { - "type": { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.runtime.api.config.PoolingProfile", - "description": { - "value": "A pooling profile is used to configure the pooling behaviour of Mule components. Each component can have its own pooling profile." - }, - "infrastructureType": {}, - "typeAlias": { - "value": "pooling-profile" - } - }, - "fields": [ - { - "key": { - "name": "maxActive" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "5" - } - }, - "annotations": { - "description": { - "value": "Controls the maximum number of Mule components that can be borrowed from a session at one time. When set to a negative value, there is no limit to the number of components that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted." - } - } - }, - { - "key": { - "name": "maxIdle" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "5" - } - }, - "annotations": { - "description": { - "value": "Controls the maximum number of Mule components that can sit idle in the pool at any time. When set to a negative value, there is no limit to the number of Mule components that may be idle at one time." - } - } - }, - { - "key": { - "name": "maxWait" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "classInformation": { - "classname": "java.lang.Long", - "hasDefaultConstructor": false, - "isInterface": false, - "isInstantiable": false, - "isAbstract": false, - "isFinal": true, - "implementedInterfaces": [], - "parent": "java.lang.Number", - "genericTypes": [], - "isMap": false - }, - "default": "4000" - } - }, - "annotations": { - "description": { - "value": "Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the exhaustedAction is set to WHEN_EXHAUSTED_WAIT." - } - } - }, - { - "key": { - "name": "minEvictionMillis" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "1800000" - } - }, - "annotations": { - "description": { - "value": "Determines the minimum amount of time an object may sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone." - } - } - }, - { - "key": { - "name": "evictionCheckIntervalMillis" - }, - "model": { - "type": "Number", - "annotations": { - "int": {}, - "default": "-1" - } - }, - "annotations": { - "description": { - "value": "Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed." - } - } - }, - { - "key": { - "name": "exhaustedAction" - }, - "model": { - "type": "String", - "annotations": { - "enum": { - "type": "[Ljava.lang.String;", - "values": [ - "WHEN_EXHAUSTED_GROW", - "WHEN_EXHAUSTED_WAIT", - "WHEN_EXHAUSTED_FAIL" - ] - }, - "default": "WHEN_EXHAUSTED_GROW" - } - }, - "annotations": { - "description": { - "value": "Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are: \"WHEN_EXHAUSTED_FAIL\", which will throw a NoSuchElementException, \"WHEN_EXHAUSTED_WAIT\", which will block by invoking Object.wait(long) until a new or idle object is available, or WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for at most that many milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely." - } - } - }, - { - "key": { - "name": "initialisationPolicy" - }, - "model": { - "type": "String", - "annotations": { - "enum": { - "type": "[Ljava.lang.String;", - "values": [ - "INITIALISE_NONE", - "INITIALISE_ONE", - "INITIALISE_ALL" - ] - }, - "default": "INITIALISE_ONE" - } - }, - "annotations": { - "description": { - "value": "Determines how components in a pool should be initialized. The possible values are: INITIALISE_NONE (will not load any components into the pool on startup), INITIALISE_ONE (will load one initial component into the pool on startup), or INITIALISE_ALL (will load all components in the pool on startup)" - } - } - }, - { - "key": { - "name": "disabled" - }, - "model": { - "type": "Boolean", - "annotations": { - "default": "false" - } - }, - "annotations": { - "description": { - "value": "Whether pooling should be disabled" - } - } - } - ] - }, - "hasDynamicType": false, - "required": false, - "isConfigOverride": false, - "isComponentId": false, - "fieldValueProviderModels": [], - "expressionSupport": "NOT_SUPPORTED", - "role": "BEHAVIOUR", - "dslConfiguration": { - "allowsInlineDefinition": true, - "allowsReferences": false, - "allowTopLevelDefinition": false - }, - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 6, - "tabName": "Advanced" - }, - "allowedStereotypeModels": [], - "semanticTerms": [], - "name": "poolingProfile", - "description": "Characteristics of the connection pool", - "modelProperties": { - "org.mule.runtime.extension.api.property.QNameModelProperty": { - "value": { - "namespaceURI": "http://www.mulesoft.org/schema/mule/core", - "localPart": "pooling-profile", - "prefix": "mule" - } - }, - "org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty": { - "sequence": 5 - } - } - } - ], - "exclusiveParametersModels": [], - "layoutModel": { - "password": false, - "text": false, - "query": false, - "order": 3 - }, - "showInDsl": false, - "name": "Connection", - "description": "", - "modelProperties": {} - } - ], - "name": "rick-and-morty-connection", - "description": "", - "modelProperties": { - "requiredForMetadata": { - "requiredParameters": [ - "wsdlUrl", - "service", - "port", - "transport" - ] - } - } - } - ], - "messageSources": [], - "name": "config", - "description": "Default configuration", - "modelProperties": { - "requiredForMetadata": { - "requiredParameters": [ - "name" - ] - } - } - } - ], - "operations": [], - "functions": [], - "constructs": [], - "connectionProviders": [], - "messageSources": [], - "artifactCoordinates": { - "artifact id": "mule-rick-and-morty-extension", - "group id": "org.mule.tests", - "version": "1.2.3" - }, - "notifications": [], - "errors": [ - { - "error": "MULE:ANY", - "handleable": true - }, - { - "error": "MULE:CONNECTIVITY", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "MULE:RETRY_EXHAUSTED", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:BAD_REQUEST", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:BAD_RESPONSE", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:CANNOT_DISPATCH", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:CONNECTIVITY", - "parent": "MULE:CONNECTIVITY", - "handleable": true - }, - { - "error": "RAM:ENCODING", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:INVALID_WSDL", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:RETRY_EXHAUSTED", - "parent": "MULE:RETRY_EXHAUSTED", - "handleable": true - }, - { - "error": "RAM:SOAP_FAULT", - "parent": "MULE:ANY", - "handleable": true - }, - { - "error": "RAM:TIMEOUT", - "parent": "MULE:ANY", - "handleable": true - } - ], - "modelProperties": {}, - "types": [ - { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.test.ram.DefaultPortalGunDispatcherProvider", - "classInformation": { - "classname": "org.mule.test.ram.DefaultPortalGunDispatcherProvider", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": true, - "isAbstract": false, - "isFinal": false, - "implementedInterfaces": [], - "parent": "org.mule.test.ram.AbstractScienceTransportProvider", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "DefaultPortalGunDispatcherProvider" - } - }, - "fields": [ - { - "key": { - "name": "responseMessage", - "required": "true" - }, - "model": { - "type": "String" - }, - "annotations": { - "expressionSupport": { - "value": "SUPPORTED" - } - } - } - ] - }, - { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.test.ram.MiniverseDispatcherProvider", - "classInformation": { - "classname": "org.mule.test.ram.MiniverseDispatcherProvider", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": true, - "isAbstract": false, - "isFinal": false, - "implementedInterfaces": [], - "parent": "org.mule.test.ram.AbstractScienceTransportProvider", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "MiniverseDispatcherProvider" - } - }, - "fields": [] - }, - { - "format": "java", - "type": "Object", - "annotations": { - "typeId": "org.mule.test.ram.TestHttpMessageDispatcherProvider", - "classInformation": { - "classname": "org.mule.test.ram.TestHttpMessageDispatcherProvider", - "hasDefaultConstructor": true, - "isInterface": false, - "isInstantiable": true, - "isAbstract": false, - "isFinal": false, - "implementedInterfaces": [ - "org.mule.runtime.extension.api.soap.MessageDispatcherProvider" - ], - "parent": "", - "genericTypes": [], - "isMap": false - }, - "typeAlias": { - "value": "TestHttpMessageDispatcherProvider" - } - }, - "fields": [] - } - ] -} \ No newline at end of file diff --git a/modules/extensions-spring-support/src/test/resources/models/soap.json b/modules/extensions-spring-support/src/test/resources/models/soap.json deleted file mode 100644 index 0db3279e44b0..000000000000 --- a/modules/extensions-spring-support/src/test/resources/models/soap.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/modules/extensions-spring-support/src/test/resources/schemas/ram.xsd b/modules/extensions-spring-support/src/test/resources/schemas/ram.xsd deleted file mode 100644 index 2675e2936560..000000000000 --- a/modules/extensions-spring-support/src/test/resources/schemas/ram.xsd +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default configuration - - - - - - - - The identifier of this element used to reference it in other components - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - invokes Web Service operations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The name of the configuration to be used to execute this component - - - - - - - - The name of a variable on which the operation's output will be placed - - - - - An expression that will be evaluated against the operation's output and the outcome of that expression will be stored in the target variable - - - - - - \ No newline at end of file diff --git a/modules/extensions-spring-support/src/test/resources/schemas/soap.xsd b/modules/extensions-spring-support/src/test/resources/schemas/soap.xsd deleted file mode 100644 index b29354a928a0..000000000000 --- a/modules/extensions-spring-support/src/test/resources/schemas/soap.xsd +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - Default configuration - - - - - - - - The identifier of this element used to reference it in other components - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - invokes Web Service operations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The name of the configuration to be used to execute this component - - - - - - - - The name of a variable on which the operation's output will be placed - - - - - An expression that will be evaluated against the operation's output and the outcome of that expression will be stored in the target variable - - - - - - \ No newline at end of file diff --git a/modules/soap-api/api-changes.json b/modules/soap-api/api-changes.json index 1ab08772f760..540f68fa48b4 100644 --- a/modules/soap-api/api-changes.json +++ b/modules/soap-api/api-changes.json @@ -1,4 +1,192 @@ { + "4.9.0": { + "revapi": { + "differences": { + "differences": [ + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.SoapService", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "enum org.mule.runtime.soap.api.SoapVersion", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.client.SoapClient", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.client.SoapClientConfiguration", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.client.SoapClientConfigurationBuilder", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.client.SoapClientFactory", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.client.metadata.SoapMetadataKeyResolver", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.client.metadata.SoapMetadataResolver", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.client.metadata.SoapOperationMetadata", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.BadRequestException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.BadResponseException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.DispatchingException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.EncodingException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.InvalidWsdlException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.SoapFaultException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.SoapServiceException", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "enum org.mule.runtime.soap.api.exception.error.SoapErrors", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.exception.error.SoapExceptionEnricher", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.message.ImmutableSoapRequest", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.message.SoapMessage", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.message.SoapRequest", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.message.SoapRequestBuilder", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.message.SoapResponse", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.message.WithContentType", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.message.dispatcher.DefaultHttpMessageDispatcher", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.message.dispatcher.HttpConfigBasedMessageDispatcher", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.transport.HttpResourceLocator", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.transport.NullTransportResourceLocator", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "class org.mule.runtime.soap.api.transport.ReflectiveHttpConfigBasedRequester", + "justification": "W-" + }, + { + "ignore": true, + "code": "java.class.removed", + "old": "interface org.mule.runtime.soap.api.transport.TransportResourceLocator", + "justification": "W-" + } + ] + } + } + }, "4.1.1": { "revapi": { "ignore": [ diff --git a/modules/soap-api/pom.xml b/modules/soap-api/pom.xml index 35ec5689df91..7d46bcce07fd 100644 --- a/modules/soap-api/pom.xml +++ b/modules/soap-api/pom.xml @@ -21,36 +21,4 @@ ../../formatter.xml - - - org.mule.runtime - mule-api - provided - - - com.google.guava - guava - - - jakarta.xml.soap - jakarta.xml.soap-api - - - org.mule.runtime - mule-extensions-soap-api - provided - - - org.mule.runtime - mule-core - ${project.version} - provided - - - org.mule.runtime - mule-service-http-api - ${project.version} - - - diff --git a/modules/soap-api/src/main/java/module-info.java b/modules/soap-api/src/main/java/module-info.java index d0f1f44538f6..f4c3b3ec08f9 100644 --- a/modules/soap-api/src/main/java/module-info.java +++ b/modules/soap-api/src/main/java/module-info.java @@ -12,24 +12,4 @@ */ module org.mule.runtime.soap.api { - requires transitive org.mule.runtime.api; - requires org.mule.runtime.metadata.model.api; - requires org.mule.runtime.extensions.api; - requires org.mule.runtime.extensions.soap.api; - requires org.mule.runtime.http.api; - - requires java.xml.soap; - - requires com.google.common; - requires org.apache.commons.io; - - exports org.mule.runtime.soap.api; - exports org.mule.runtime.soap.api.client; - exports org.mule.runtime.soap.api.client.metadata; - exports org.mule.runtime.soap.api.exception; - exports org.mule.runtime.soap.api.exception.error; - exports org.mule.runtime.soap.api.message; - exports org.mule.runtime.soap.api.message.dispatcher; - exports org.mule.runtime.soap.api.transport; - } diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapService.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapService.java deleted file mode 100644 index 52982185d933..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api; - -import org.mule.runtime.api.service.Service; -import org.mule.runtime.soap.api.client.SoapClient; -import org.mule.runtime.soap.api.client.SoapClientFactory; -import org.mule.api.annotation.NoImplement; - -/** - * Contract for a service that provides a Soap client factory. - * - * @since 4.0 - */ -@NoImplement -public interface SoapService extends Service { - - /** - * @return a {@link SoapClientFactory} instance capable of creating {@link SoapClient} instances. - */ - SoapClientFactory getClientFactory(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapVersion.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapVersion.java deleted file mode 100644 index 5f789f95913d..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/SoapVersion.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api; - -import static javax.xml.soap.SOAPConstants.SOAP_1_1_PROTOCOL; -import static javax.xml.soap.SOAPConstants.SOAP_1_2_PROTOCOL; - -/** - * All the available SOAP versions with it's version code and protocol name. - * - * @since 4.0 - */ -public enum SoapVersion { - - SOAP11("1.1", SOAP_1_1_PROTOCOL), SOAP12("1.2", SOAP_1_2_PROTOCOL); - - private final String version; - private final String protocol; - - SoapVersion(String version, String protocol) { - this.version = version; - this.protocol = protocol; - } - - public String getVersion() { - return version; - } - - public String getProtocol() { - return protocol; - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClient.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClient.java deleted file mode 100644 index ddb2d3b60269..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client; - -import org.mule.runtime.api.lifecycle.Startable; -import org.mule.runtime.api.lifecycle.Stoppable; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.soap.api.client.metadata.SoapMetadataResolver; -import org.mule.runtime.soap.api.message.SoapRequest; -import org.mule.runtime.soap.api.message.SoapResponse; - -/** - * Contract for clients that consumes SOAP Web Services, and returns the response. - * - * @since 4.0 - */ -public interface SoapClient extends Startable, Stoppable { - - /** - * Sends a {@link SoapRequest} blocking the current thread until a response is available or the request times out. - * - * @param request a {@link SoapRequest} instance. - * @param dispatcher a {@link MessageDispatcher} that will be used to dispatch the {@link SoapRequest} - * @return a {@link SoapResponse} instance with the XML content and Headers if any. - */ - default SoapResponse consume(SoapRequest request, MessageDispatcher dispatcher) { - return consume(request); - } - - /** - * Sends a {@link SoapRequest} blocking the current thread until a response is available or the request times out. - * - * @param request a {@link SoapRequest} instance. - * @return a {@link SoapResponse} instance with the XML content and Headers if any. - */ - SoapResponse consume(SoapRequest request); - - /** - * @return a {@link SoapMetadataResolver} that can resolve the INPUT and OUTPUT metadata for the different Web Service - * Operations. - */ - SoapMetadataResolver getMetadataResolver(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfiguration.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfiguration.java deleted file mode 100644 index df70c2f0214f..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfiguration.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client; - -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.extension.api.soap.security.SecurityStrategy; -import org.mule.runtime.soap.api.SoapVersion; -import org.mule.runtime.soap.api.transport.TransportResourceLocator; - -import java.util.List; - -/** - * Represents a Soap Client Configuration with all the required attributes for stablishing a connection with the Web Service. - * - * @since 4.0 - */ -public final class SoapClientConfiguration { - - private final String wsdlLocation; - private final String address; - private final String service; - private final String port; - private final SoapVersion version; - private final boolean mtomEnabled; - private final List securities; - private final MessageDispatcher dispatcher; - private final TransportResourceLocator locator; - private final String encoding; - - SoapClientConfiguration(String wsdlLocation, - String address, - String service, - String port, - SoapVersion version, - boolean mtomEnabled, - List securities, - MessageDispatcher dispatcher, - TransportResourceLocator locator, - String encoding) { - this.wsdlLocation = wsdlLocation; - this.address = address; - this.service = service; - this.port = port; - this.version = version; - this.mtomEnabled = mtomEnabled; - this.securities = securities; - this.dispatcher = dispatcher; - this.locator = locator; - this.encoding = encoding; - } - - public static SoapClientConfigurationBuilder builder() { - return new SoapClientConfigurationBuilder(); - } - - public String getWsdlLocation() { - return wsdlLocation; - } - - public String getAddress() { - return address; - } - - public String getService() { - return service; - } - - public String getPort() { - return port; - } - - public SoapVersion getVersion() { - return version; - } - - public boolean isMtomEnabled() { - return mtomEnabled; - } - - public List getSecurities() { - return securities; - } - - public MessageDispatcher getDispatcher() { - return dispatcher; - } - - public String getEncoding() { - return encoding == null ? "UTF-8" : encoding; - } - - public TransportResourceLocator getLocator() { - return locator; - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfigurationBuilder.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfigurationBuilder.java deleted file mode 100644 index 6dad91baa7f4..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientConfigurationBuilder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client; - -import static org.mule.runtime.api.util.Preconditions.checkNotNull; -import static org.mule.runtime.soap.api.SoapVersion.SOAP11; - -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.extension.api.soap.security.DecryptSecurityStrategy; -import org.mule.runtime.extension.api.soap.security.EncryptSecurityStrategy; -import org.mule.runtime.extension.api.soap.security.SecurityStrategy; -import org.mule.runtime.extension.api.soap.security.SignSecurityStrategy; -import org.mule.runtime.extension.api.soap.security.TimestampSecurityStrategy; -import org.mule.runtime.extension.api.soap.security.UsernameTokenSecurityStrategy; -import org.mule.runtime.extension.api.soap.security.VerifySignatureSecurityStrategy; -import org.mule.runtime.soap.api.SoapVersion; -import org.mule.runtime.soap.api.message.SoapMessage; -import org.mule.runtime.soap.api.message.dispatcher.DefaultHttpMessageDispatcher; -import org.mule.runtime.soap.api.transport.NullTransportResourceLocator; -import org.mule.runtime.soap.api.transport.TransportResourceLocator; - -import java.util.ArrayList; -import java.util.List; - -/** - * Builder pattern implementation that creates {@link SoapClientConfiguration} instances. - * - * @since 4.0 - */ -public class SoapClientConfigurationBuilder { - - private String wsdlLocation; - private String address; - private String service; - private String port; - private SoapVersion version = SOAP11; - private boolean mtomEnabled; - private List securities = new ArrayList<>(); - private MessageDispatcher dispatcher; - private String encoding; - private TransportResourceLocator locator = new NullTransportResourceLocator(); - - SoapClientConfigurationBuilder() {} - - /** - * Sets the location of the WSDL that describes the SOAP web service. This can be an URL to an external resource (e.g - * http://somewsdl.com/hit?wsdl), just a reference to a local file or an application resource name. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withWsdlLocation(String wsdlLocation) { - this.wsdlLocation = wsdlLocation; - return this; - } - - /** - * Sets the address of the Web Service, if none specified it will be fetched from the wsdl file, if possible. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withAddress(String address) { - this.address = address; - return this; - } - - /** - * Sets the service of the WSDL we want to perform operations from. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withService(String service) { - this.service = service; - return this; - } - - /** - * Sets the port of the service that describes the set of operations that can be performed. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withPort(String port) { - this.port = port; - return this; - } - - /** - * Sets the encoding of the messages send and retrieved by the . - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withEncoding(String encoding) { - this.encoding = encoding; - return this; - } - - /** - * Sets the {@link SoapVersion} of the Web Service. defaults to SOAP 1.1 - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withVersion(SoapVersion version) { - this.version = version; - return this; - } - - /** - * Specifies that the Web Service is MTOM enabled. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder enableMtom(boolean mtomEnabled) { - this.mtomEnabled = mtomEnabled; - return this; - } - - /** - * Sets a new {@link SecurityStrategy} to connect with a Secured Soap Web Service. - *

- * One of: {@link DecryptSecurityStrategy}, {@link EncryptSecurityStrategy}, {@link SignSecurityStrategy}, - * {@link TimestampSecurityStrategy}, {@link UsernameTokenSecurityStrategy} or {@link VerifySignatureSecurityStrategy}. - *

- * Multiple {@link SecurityStrategy Security Strategies} can be configured. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withSecurity(SecurityStrategy security) { - this.securities.add(security); - return this; - } - - /** - * Sets a list of {@link SecurityStrategy SecurityStrategies} to connect with a Secured Soap Web Service. - * - * @return this builder. - */ - public SoapClientConfigurationBuilder withSecurities(List security) { - this.securities.addAll(security); - return this; - } - - /** - * Sets a custom {@link MessageDispatcher} that enables the send and retrieve of {@link SoapMessage}s using a custom underlying - * transport. - * - * @return this builder - */ - public SoapClientConfigurationBuilder withDispatcher(MessageDispatcher dispatcher) { - this.dispatcher = dispatcher; - return this; - } - - /** - * Sets a {@link TransportResourceLocator} instance to fetch the wsdl resources. - * - * @return this builder - */ - public SoapClientConfigurationBuilder withResourceLocator(TransportResourceLocator locator) { - this.locator = locator; - return this; - } - - /** - * @return a new {@link SoapClientConfiguration} instance with the attributes specified. - */ - public SoapClientConfiguration build() { - checkNotNull(wsdlLocation, "WSDL location cannot be null"); - checkNotNull(service, "Service cannot be null"); - checkNotNull(port, "Port cannot be null"); - return new SoapClientConfiguration(wsdlLocation, address, service, port, version, mtomEnabled, securities, - dispatcher, locator, encoding); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientFactory.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientFactory.java deleted file mode 100644 index b8f05100f6df..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/SoapClientFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client; - -import org.mule.runtime.api.connection.ConnectionException; - -/** - * A Contract for Factory Objects that creates {@link SoapClient instances} - * - * @since 4.0 - */ -public interface SoapClientFactory { - - /** - * Creates a new SoapClient instance. - * - * @param configuration the {@link SoapClientConfiguration} specifying the desired client configuration. - * @return a newly built {@link SoapClient} based on the {@code configuration}. - */ - SoapClient create(SoapClientConfiguration configuration) throws ConnectionException; -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataKeyResolver.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataKeyResolver.java deleted file mode 100644 index f551406e431d..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataKeyResolver.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client.metadata; - -import java.util.Set; - -import org.mule.runtime.api.metadata.MetadataKey; -import org.mule.runtime.api.metadata.MetadataResolvingException; - -/** - * An object that is in charge of resolving {@link SoapOperationMetadata} for different operations. - * - * @since 4.0 - */ -public interface SoapMetadataKeyResolver { - - /** - * @param operation the name of the operation that the metadata is going to fetched for - * @return a new {@link SoapOperationMetadata} with the INPUT body type, headers type and attachments type. - * @throws MetadataResolvingException in any error case. - */ - Set getMetadataKeys() throws MetadataResolvingException; -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataResolver.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataResolver.java deleted file mode 100644 index f51d9417d0f3..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapMetadataResolver.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client.metadata; - -import org.mule.runtime.api.metadata.MetadataResolvingException; - -import java.util.Set; - -/** - * An object that is in charge of resolving {@link SoapOperationMetadata} for different operations. - * - * @since 4.0 - */ -public interface SoapMetadataResolver { - - /** - * @param operation the name of the operation that the metadata is going to fetched for - * @return a new {@link SoapOperationMetadata} with the INPUT body type, headers type and attachments type. - * @throws MetadataResolvingException in any error case. - */ - SoapOperationMetadata getInputMetadata(String operation) throws MetadataResolvingException; - - /** - * @param operation the name of the operation that the metadata is going to fetched for - * @return a new {@link SoapOperationMetadata} with the OUTPUT body type, headers type and attachments type. - * @throws MetadataResolvingException in any error case. - */ - SoapOperationMetadata getOutputMetadata(String operation) throws MetadataResolvingException; - - /** - * @return a {@link Set} with the available operations names for the specified service. - */ - Set getAvailableOperations(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapOperationMetadata.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapOperationMetadata.java deleted file mode 100644 index 251782344eed..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/client/metadata/SoapOperationMetadata.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.client.metadata; - -import org.mule.metadata.api.model.MetadataType; - -/** - * Represents the metadata of a SOAP Operation, carries a body type, a headers type and an attachments type. - * - * @since 4.0 - */ -public interface SoapOperationMetadata { - - /** - * @return the {@link MetadataType} of the body. - */ - MetadataType getBodyType(); - - /** - * @return the {@link MetadataType} of the headers. - */ - MetadataType getHeadersType(); - - /** - * @return the {@link MetadataType} of the attachments. - */ - MetadataType getAttachmentsType(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadRequestException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadRequestException.java deleted file mode 100644 index b7e6a62b2dce..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadRequestException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -/** - * {@link Exception} implementation that aims to be thrown when an error occur while parsing or processing the SOAP request. - * - * @since 4.0 - */ -public final class BadRequestException extends MuleRuntimeException { - - public BadRequestException(String message) { - super(createStaticMessage(message)); - } - - public BadRequestException(String message, Throwable cause) { - super(createStaticMessage(message), cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadResponseException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadResponseException.java deleted file mode 100644 index f204f5c59798..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/BadResponseException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -/** - * {@link Exception} implementation that aims to be thrown when an error occur while parsing or processing the SOAP response. - * - * @since 4.0 - */ -public final class BadResponseException extends MuleRuntimeException { - - public BadResponseException(String message) { - super(createStaticMessage(message)); - } - - public BadResponseException(String message, Throwable cause) { - super(createStaticMessage(message), cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/DispatchingException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/DispatchingException.java deleted file mode 100644 index 7dd3f66e45cf..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/DispatchingException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -/** - * {@link Exception} implementation that aims to be thrown when an error occur while parsing or processing the SOAP request. - * - * @since 4.0 - */ -public final class DispatchingException extends MuleRuntimeException { - - public DispatchingException(String message) { - super(createStaticMessage(message)); - } - - public DispatchingException(String message, Throwable cause) { - super(createStaticMessage(message), cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/EncodingException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/EncodingException.java deleted file mode 100644 index b71489db778d..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/EncodingException.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -/** - * {@link Exception} implementation that aims to be thrown when a problem occur while encoding or decoding the content of a part - * of a SOAP message. - * - * @since 4.0 - */ -public final class EncodingException extends MuleRuntimeException { - - public EncodingException(String message) { - super(createStaticMessage(message)); - } - - public EncodingException(String message, Throwable cause) { - super(createStaticMessage(message), cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/InvalidWsdlException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/InvalidWsdlException.java deleted file mode 100644 index c9b32920b02c..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/InvalidWsdlException.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -/** - * {@link Exception} implementation that aims to be thrown when an inconsistent WSDL state is found or a provided one cannot be - * parsed. - * - * @since 4.0 - */ -public final class InvalidWsdlException extends MuleRuntimeException { - - public InvalidWsdlException(String message) { - super(createStaticMessage(message)); - } - - public InvalidWsdlException(String message, Throwable cause) { - super(createStaticMessage(message), cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapFaultException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapFaultException.java deleted file mode 100644 index 6373e7b296a9..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapFaultException.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -import static java.util.Optional.ofNullable; -import static org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage; -import org.mule.runtime.api.exception.MuleRuntimeException; - -import java.util.Optional; - -import javax.xml.namespace.QName; - -/** - * A simple POJO that represents a SOAP Fault that occurs during invocation processing. - * - * @since 4.0 - */ -public final class SoapFaultException extends MuleRuntimeException { - - private final QName faultCode; - private final QName subCode; - private final String detail; - private final String reason; - private final String node; - private final String role; - - public SoapFaultException(QName faultCode, QName subCode, String detail, String reason, String node, String role, - Throwable parent) { - super(createStaticMessage(reason), parent); - this.faultCode = faultCode; - this.subCode = subCode; - this.reason = reason; - this.node = node; - this.role = role; - this.detail = detail; - } - - public SoapFaultException(QName faultCode, String detail, Throwable parent) { - this(faultCode, null, detail, "", null, null, parent); - } - - /** - * @return a code used to indicate a class of errors. - */ - public QName getFaultCode() { - return faultCode; - } - - /** - * @return the cause (reason) of the fault. - */ - public String getReason() { - return reason; - } - - /** - * @return an Optional Subcode element if you need to break down the {@link this#getFaultCode()} into subcodes. - */ - public Optional getSubCode() { - return ofNullable(subCode); - } - - /** - * @return an element that carries application-specific error messages. It can contain child elements called detail entries. - */ - public String getDetail() { - return detail; - } - - /** - * @return an URI identifying the node in which the Fault occurred. - */ - public Optional getNode() { - return ofNullable(node); - } - - /** - * @return the role of the node in which the fault occurred. - */ - public Optional getRole() { - return ofNullable(role); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapServiceException.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapServiceException.java deleted file mode 100644 index 5218e6f501eb..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/SoapServiceException.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception; - -/** - * Base {@link RuntimeException} type for the Web Service Consumer. - * - * @since 4.0 - */ -public final class SoapServiceException extends RuntimeException { - - public SoapServiceException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapErrors.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapErrors.java deleted file mode 100644 index 178a9cdca0ca..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapErrors.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception.error; - -import org.mule.runtime.extension.api.error.ErrorTypeDefinition; - -/** - * Enum that defines all the Mule Error Types that can be thrown by the modules that use the soap service. - * - * @since 4.0 - */ -public enum SoapErrors implements ErrorTypeDefinition { - - /** - * Error thrown when an invalid WSDL is found or inconsistent WSDL state occurred. - */ - INVALID_WSDL, - - /** - * Error thrown when an encoding related problem occurs when parsing the request or response XML. - */ - ENCODING, - - /** - * Error thrown when the generated request is invalid, mostly because inconsistent provided parameters. - */ - BAD_REQUEST, - - /** - * Error thrown when the resulting response is invalid. - */ - BAD_RESPONSE, - - /** - * a problem occurred while sending the request. - */ - CANNOT_DISPATCH, - - /** - * Error thrown when the outgoing request took longer than the server prepared to wait. - */ - TIMEOUT, - - /** - * Error thrown when a SOAP Fault occurred. - */ - SOAP_FAULT -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapExceptionEnricher.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapExceptionEnricher.java deleted file mode 100644 index 1bcb282c88a3..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/exception/error/SoapExceptionEnricher.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.exception.error; - -import static org.mule.runtime.soap.api.exception.error.SoapErrors.BAD_REQUEST; -import static org.mule.runtime.soap.api.exception.error.SoapErrors.BAD_RESPONSE; -import static org.mule.runtime.soap.api.exception.error.SoapErrors.CANNOT_DISPATCH; -import static org.mule.runtime.soap.api.exception.error.SoapErrors.ENCODING; -import static org.mule.runtime.soap.api.exception.error.SoapErrors.INVALID_WSDL; -import static org.mule.runtime.soap.api.exception.error.SoapErrors.SOAP_FAULT; - -import org.mule.runtime.extension.api.exception.ModuleException; -import org.mule.runtime.soap.api.exception.BadRequestException; -import org.mule.runtime.soap.api.exception.BadResponseException; -import org.mule.runtime.soap.api.exception.DispatchingException; -import org.mule.runtime.soap.api.exception.EncodingException; -import org.mule.runtime.soap.api.exception.InvalidWsdlException; -import org.mule.runtime.soap.api.exception.SoapFaultException; - -/** - * A util class that knows how to wrap an exception throwed by the Soap Service into a {@link ModuleException}. - *

- * This class is internal, and it's not supposed to be used by others. - * - * @since 4.0 - */ -public final class SoapExceptionEnricher { - - /** - * Wraps an exception in a {@link ModuleException} specifying an error type. - * - * @param e the exception to be wrapped in a {@link ModuleException} - * @return a new {@link ModuleException} with the corresponding error type. - */ - public Exception enrich(Exception e) { - if (e instanceof SoapFaultException) { - return new ModuleException(SOAP_FAULT, e); - } - if (e instanceof InvalidWsdlException) { - return new ModuleException(INVALID_WSDL, e); - } - if (e instanceof BadResponseException) { - return new ModuleException(BAD_RESPONSE, e); - } - if (e instanceof BadRequestException) { - return new ModuleException(BAD_REQUEST, e); - } - if (e instanceof DispatchingException) { - return new ModuleException(CANNOT_DISPATCH, e); - } - if (e instanceof EncodingException) { - return new ModuleException(ENCODING, e); - } - return new Exception("Unexpected error while consuming web service: " + e.getMessage(), e); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/ImmutableSoapRequest.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/ImmutableSoapRequest.java deleted file mode 100644 index b3d066d1e322..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/ImmutableSoapRequest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -import static java.util.Collections.unmodifiableMap; -import org.mule.runtime.api.metadata.MediaType; -import org.mule.runtime.extension.api.soap.SoapAttachment; - -import java.io.InputStream; -import java.util.Map; - -/** - * Immutable implementation of a {@link SoapRequest}. - * - * @since 4.0 - */ -public final class ImmutableSoapRequest implements SoapRequest { - - private final InputStream content; - private final Map soapHeaders; - private final Map attachments; - private final Map transportHeaders; - private final MediaType contentType; - private final String operation; - - ImmutableSoapRequest(InputStream content, - Map soapHeaders, - Map transportHeaders, - Map attachments, - MediaType contentType, - String operation) { - this.content = content; - this.soapHeaders = unmodifiableMap(soapHeaders); - this.transportHeaders = unmodifiableMap(transportHeaders); - this.attachments = unmodifiableMap(attachments); - this.contentType = contentType; - this.operation = operation; - } - - @Override - public InputStream getContent() { - return content; - } - - @Override - public Map getSoapHeaders() { - return soapHeaders; - } - - @Override - public Map getTransportHeaders() { - return transportHeaders; - } - - @Override - public Map getAttachments() { - return attachments; - } - - @Override - public MediaType getContentType() { - return contentType; - } - - @Override - public String getOperation() { - return operation; - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapMessage.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapMessage.java deleted file mode 100644 index 59e7ae827229..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapMessage.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -import org.mule.runtime.extension.api.soap.SoapAttachment; - -import java.io.InputStream; -import java.util.Map; - -/** - * Represents a Soap Message carrying a content, attachments and a set of headers. - * - * @since 4.0 - */ -public interface SoapMessage extends WithContentType { - - /** - * @return the content of the message. - */ - InputStream getContent(); - - /** - * @return a set of Soap Headers. - */ - Map getSoapHeaders(); - - /** - * @return a set of Transport Specific Headers. - */ - Map getTransportHeaders(); - - /** - * @return a set of attachments. - */ - Map getAttachments(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequest.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequest.java deleted file mode 100644 index f81385a9da5f..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -/** - * Represents a request that aims to be sent to a Soap Web Service. - * - * @since 4.0 - */ -public interface SoapRequest extends SoapMessage { - - /** - * @return The name of the operation that is requested. - */ - String getOperation(); - - /** - * @return a {@link SoapRequestBuilder} instance to create a new {@link SoapRequest}. - */ - static SoapRequestBuilder builder() { - return new SoapRequestBuilder(); - } - - /** - * @param operation the operation that is going to be executed. - * @return an empty Soap Request with no content for the requested operation. - */ - static SoapRequest empty(String operation) { - return builder().operation(operation).build(); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequestBuilder.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequestBuilder.java deleted file mode 100644 index 0253b3e91d12..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapRequestBuilder.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -import static org.mule.runtime.api.metadata.MediaType.APPLICATION_XML; -import static org.mule.runtime.api.util.Preconditions.checkNotNull; -import org.mule.runtime.api.metadata.MediaType; -import org.mule.runtime.extension.api.soap.SoapAttachment; - -import com.google.common.collect.ImmutableMap; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Map; - -public class SoapRequestBuilder { - - private InputStream content; - private ImmutableMap.Builder soapHeaders = ImmutableMap.builder(); - private ImmutableMap.Builder transportHeaders = ImmutableMap.builder(); - private ImmutableMap.Builder attachments = ImmutableMap.builder(); - private MediaType contentType = APPLICATION_XML; - private String operation; - - SoapRequestBuilder() {} - - public SoapRequestBuilder content(InputStream content) { - this.content = content; - return this; - } - - public SoapRequestBuilder content(String content) { - this.content = new ByteArrayInputStream(content.getBytes()); - return this; - } - - public SoapRequestBuilder soapHeaders(Map soapHeaders) { - this.soapHeaders.putAll(soapHeaders); - return this; - } - - public SoapRequestBuilder transportHeader(String key, String value) { - this.transportHeaders.put(key, value); - return this; - } - - public SoapRequestBuilder transportHeaders(Map headers) { - this.transportHeaders.putAll(headers); - return this; - } - - public SoapRequestBuilder attachment(String name, SoapAttachment attachment) { - this.attachments.put(name, attachment); - return this; - } - - public SoapRequestBuilder attachments(Map attachments) { - this.attachments.putAll(attachments); - return this; - } - - public SoapRequestBuilder contentType(MediaType contentType) { - this.contentType = contentType; - return this; - } - - public SoapRequestBuilder operation(String operation) { - this.operation = operation; - return this; - } - - public ImmutableSoapRequest build() { - checkNotNull(operation, "Missing executing operation"); - return new ImmutableSoapRequest(content, - soapHeaders.build(), - transportHeaders.build(), - attachments.build(), - contentType, - operation); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapResponse.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapResponse.java deleted file mode 100644 index 0ce1ae07daf4..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/SoapResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -import org.mule.runtime.extension.api.runtime.operation.Result; -import org.mule.runtime.extension.api.runtime.streaming.StreamingHelper; -import org.mule.runtime.extension.api.soap.SoapAttributes; -import org.mule.runtime.extension.api.soap.SoapOutputPayload; - -/** - * Represents a response retrieved by a Soap Web Service. - * - * @since 4.0 - */ -public interface SoapResponse extends SoapMessage { - - Result getAsResult(StreamingHelper helper); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/WithContentType.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/WithContentType.java deleted file mode 100644 index f16a70de67c7..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/WithContentType.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message; - -import org.mule.runtime.api.metadata.MediaType; - -/** - * Contract for Objects that carries a content-type. - * - * @since 4.0 - */ -public interface WithContentType { - - /** - * @return the content type of the attachment content. - */ - MediaType getContentType(); -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/DefaultHttpMessageDispatcher.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/DefaultHttpMessageDispatcher.java deleted file mode 100644 index 133640049db9..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/DefaultHttpMessageDispatcher.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message.dispatcher; - - -import static org.mule.runtime.http.api.HttpConstants.Method.POST; - -import static java.util.function.Function.identity; -import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toMap; - -import org.mule.runtime.api.util.MultiMap; -import org.mule.runtime.extension.api.soap.message.DispatchingRequest; -import org.mule.runtime.extension.api.soap.message.DispatchingResponse; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.http.api.client.HttpClient; -import org.mule.runtime.http.api.domain.entity.InputStreamHttpEntity; -import org.mule.runtime.http.api.domain.message.request.HttpRequest; -import org.mule.runtime.http.api.domain.message.response.HttpResponse; -import org.mule.runtime.soap.api.exception.DispatchingException; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.concurrent.TimeoutException; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Default {@link MessageDispatcher} implementation that aims to dispatch messages through HTTP with a prebuilt default - * configuration. - * - * @since 4.0 - */ -public final class DefaultHttpMessageDispatcher implements MessageDispatcher { - - private static final Logger LOGGER = LoggerFactory.getLogger(DefaultHttpMessageDispatcher.class.getName()); - private static final int DEFAULT_TIMEOUT_MILLIS = 5000; - - private final HttpClient client; - - public DefaultHttpMessageDispatcher(HttpClient client) { - this.client = client; - } - - /** - * {@inheritDoc} - *

- * Dispatches a Soap message through http adding the SoapAction header, if required, and the content-type. - */ - @Override - public DispatchingResponse dispatch(DispatchingRequest context) { - InputStream content = logIfNeeded("Soap Request to [" + context.getAddress() + "]", context.getContent()); - HttpRequest request = HttpRequest.builder() - .uri(context.getAddress()) - .method(POST) - .entity(new InputStreamHttpEntity(content)) - .headers(new MultiMap<>(context.getHeaders())) - .build(); - try { - HttpResponse response = client.send(request, DEFAULT_TIMEOUT_MILLIS, false, null); - return new DispatchingResponse(logIfNeeded("Soap Response", response.getEntity().getContent()), toHeadersMap(response)); - } catch (IOException e) { - throw new DispatchingException("An error occurred while sending the SOAP request", e); - } catch (TimeoutException e) { - throw new DispatchingException("The SOAP request timed out", e); - } - } - - /** - * Logs the content if it's log enabled, returns the same content. - */ - private InputStream logIfNeeded(String title, InputStream content) { - if (LOGGER.isDebugEnabled()) { - String c; - try { - c = IOUtils.toString(content); - } catch (IOException iox) { - throw new RuntimeException(iox); - } - LOGGER.debug("Logging " + title); - LOGGER.debug("-----------------------------------"); - LOGGER.debug(c); - LOGGER.debug("-----------------------------------"); - return new ByteArrayInputStream(c.getBytes()); - } - return content; - } - - /** - * Collects all the headers returned by the http call. - */ - private Map toHeadersMap(HttpResponse response) { - return response.getHeaderNames().stream() - .collect(toMap(identity(), name -> response.getHeaderValues(name).stream().collect(joining(" ")))); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/HttpConfigBasedMessageDispatcher.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/HttpConfigBasedMessageDispatcher.java deleted file mode 100644 index a19a59545bad..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/message/dispatcher/HttpConfigBasedMessageDispatcher.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.message.dispatcher; - -import org.mule.runtime.api.util.Pair; -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.soap.message.DispatchingRequest; -import org.mule.runtime.extension.api.soap.message.DispatchingResponse; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import org.mule.runtime.soap.api.transport.ReflectiveHttpConfigBasedRequester; -import java.io.InputStream; -import java.util.Map; - -/** - * A {@link MessageDispatcher} that dispatches the SOAP request via HTTP using an HTTP connector provided configuration. - *

- * As the this lives in mule and it cannot depend on the HTTP extension, reflection is used to access the returned headers. - * - * @since 4.0 - */ -public final class HttpConfigBasedMessageDispatcher implements MessageDispatcher { - - private final ReflectiveHttpConfigBasedRequester requester; - - public HttpConfigBasedMessageDispatcher(String configName, ExtensionsClient client) { - this.requester = new ReflectiveHttpConfigBasedRequester(configName, client); - } - - /** - * {@inheritDoc} - *

- * Dispatches the message using the {@link ExtensionsClient} executing the {@code request} operation of the HTTP extension. - *

- */ - @Override - public DispatchingResponse dispatch(DispatchingRequest req) { - Pair> result = requester.post(req.getAddress(), req.getHeaders(), req.getContent()); - return new DispatchingResponse(result.getFirst(), result.getSecond()); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/HttpResourceLocator.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/HttpResourceLocator.java deleted file mode 100644 index 57da562c9299..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/HttpResourceLocator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.transport; - -import static java.util.Collections.emptyMap; - -import org.mule.runtime.extension.api.client.ExtensionsClient; -import java.io.InputStream; - -/** - * Retrieve remote documents over HTTP using an Http Connector configuration. - * - * @since 4.0 - */ -public final class HttpResourceLocator implements TransportResourceLocator { - - private final ReflectiveHttpConfigBasedRequester requester; - - public HttpResourceLocator(String configName, ExtensionsClient client) { - this.requester = new ReflectiveHttpConfigBasedRequester(configName, client); - } - - /** - * {@inheritDoc} - *

- * handles `http` and `https` uris. - */ - @Override - public boolean handles(String url) { - return url.startsWith("http"); - } - - /** - * Retrieves the document's content over http. - */ - @Override - public InputStream getResource(String url) { - return requester.get(url, emptyMap()).getFirst(); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/NullTransportResourceLocator.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/NullTransportResourceLocator.java deleted file mode 100644 index 81ad0a95d85f..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/NullTransportResourceLocator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -/** - * - */ -package org.mule.runtime.soap.api.transport; - -import java.io.InputStream; - -/** - * Null implementation of {@link TransportResourceLocator}. It does not handle any resource. - * - * @since 4.0 - */ -public final class NullTransportResourceLocator implements TransportResourceLocator { - - @Override - public boolean handles(String url) { - return false; - } - - @Override - public InputStream getResource(String url) { - throw new UnsupportedOperationException("Null implementation does not support this operation"); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/ReflectiveHttpConfigBasedRequester.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/ReflectiveHttpConfigBasedRequester.java deleted file mode 100644 index 52ac50013e92..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/ReflectiveHttpConfigBasedRequester.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.transport; - -import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toMap; -import static org.mule.runtime.api.metadata.DataType.INPUT_STREAM; -import static org.mule.runtime.extension.api.client.DefaultOperationParameters.builder; -import static org.mule.runtime.http.api.HttpConstants.Method.GET; -import static org.mule.runtime.http.api.HttpConstants.Method.POST; - -import org.mule.runtime.api.metadata.TypedValue; -import org.mule.runtime.api.streaming.bytes.CursorStreamProvider; -import org.mule.runtime.api.util.MultiMap; -import org.mule.runtime.api.util.Pair; -import org.mule.runtime.extension.api.client.DefaultOperationParametersBuilder; -import org.mule.runtime.extension.api.client.ExtensionsClient; -import org.mule.runtime.extension.api.runtime.operation.Result; -import org.mule.runtime.soap.api.exception.DispatchingException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -/** - * Performs HTTP requests using an Http Connector configuration. - *

- * As the this lives in mule and it cannot depend on the HTTP extension, reflection is used to access the returned headers. - * - * @since 4.0 - */ -public final class ReflectiveHttpConfigBasedRequester { - - private final String configName; - private final ExtensionsClient client; - - public ReflectiveHttpConfigBasedRequester(String configName, ExtensionsClient client) { - this.configName = configName; - this.client = client; - } - - /** - * Performs a GET request to the URL passed as parameter with a set of headers. - * - * @param url the URL to be requested - * @param headers a set of headers that are going to be bounded to the request - * @return a {@link Pair} in which the first element is the response and the second is a set of response headers. - */ - public Pair> get(String url, Map headers) { - return request(GET.toString(), url, headers, null); - } - - /** - * Performs a PORT request to the URL passed as parameter with a set of headers and a body content. - * - * @param url the URL to be requested - * @param headers a set of headers that are going to be bounded to the request - * @param body the content body bounded to the request. - * @return a {@link Pair} in which the first element is the response and the second is a set of response headers. - */ - public Pair> post(String url, Map headers, InputStream body) { - return request(POST.toString(), url, headers, body); - } - - private Pair> request(String method, - String url, - Map headers, - InputStream body) { - try { - Result result = client.execute("HTTP", "request", parameterizer -> { - parameterizer.withConfigRef(configName); - parameterizer.withParameter("method", method); - parameterizer.withParameter("url", url); - parameterizer.withParameter("headers", new MultiMap<>(headers)); - // TODO(MULE-13066): REMOVE THIS LINE WHEN DONE! - parameterizer.withParameter("targetValue", "#[payload]"); - - if (body != null) { - parameterizer.withParameter("body", new TypedValue<>(body, INPUT_STREAM)); - } - }).get(); - Map httpHeaders = getHttpHeaders(result); - InputStream content = getContent(result); - return new Pair<>(content, httpHeaders); - } catch (Exception e) { - throw new DispatchingException("Could not dispatch soap message using the [" + configName + "] HTTP configuration", e); - } - } - - /** - * Reflectively introspects the result to find the HTTP Headers. - * - * @param result the {@link Result} returned by the http request operation - */ - private Map getHttpHeaders(Result result) { - try { - Optional httpAttributes = result.getAttributes(); - if (!httpAttributes.isPresent()) { - throw new IllegalStateException("No Http Attributes found on the response, cannot get response headers."); - } - Object headers = httpAttributes.get().getClass().getMethod("getHeaders").invoke(httpAttributes.get()); - Map> map = (Map>) headers.getClass().getMethod("toListValuesMap").invoke(headers); - return map.entrySet().stream().collect(toMap(e -> e.getKey(), e -> e.getValue().stream().collect(joining(" ")))); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - throw new IllegalStateException("Something went wrong when introspecting the http response attributes.", e); - } - } - - /** - * Retrieves the content as an input stream validating it. - */ - private InputStream getContent(Result result) { - Object output = result.getOutput(); - if (output instanceof CursorStreamProvider) { - return ((CursorStreamProvider) output).openCursor(); - } else if (output instanceof InputStream) { - return (InputStream) output; - } - throw new IllegalStateException("Content was expected to be an stream but got a [" + output.getClass().getName() + "]"); - } -} diff --git a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/TransportResourceLocator.java b/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/TransportResourceLocator.java deleted file mode 100644 index 6a54e61136cb..000000000000 --- a/modules/soap-api/src/main/java/org/mule/runtime/soap/api/transport/TransportResourceLocator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.soap.api.transport; - -import org.mule.runtime.soap.api.SoapService; -import java.io.InputStream; - -/** - * This interface acts as an additional layer of indirection between a the WSDL fetching and the WSDL parsing by the - * {@link SoapService}. - *

- * It enables the retrieval of WSDL and XSD documents that are protected somehow. - * - * @since 4.0 - */ -public interface TransportResourceLocator { - - /** - * Given the external document url this method checks if the document can be retrieved by this {@link TransportResourceLocator} - * or not. - * - * @param url the document's url - * @return whether it can retrieve the document file or not. - */ - boolean handles(String url); - - /** - * Retrieves a document's content. - * - * @param url the document's url - * @return an {@link InputStream} representing the document's content. - */ - InputStream getResource(String url); -} diff --git a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/CalcioServiceProvider.java b/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/CalcioServiceProvider.java deleted file mode 100644 index 0581eccecf1b..000000000000 --- a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/CalcioServiceProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.soap.extension; - -import static java.util.Collections.singletonList; -import static org.mule.test.soap.extension.CalcioServiceProvider.CALCIO_DESC; -import static org.mule.test.soap.extension.CalcioServiceProvider.CALCIO_ID; -import org.mule.runtime.extension.api.annotation.Alias; -import org.mule.runtime.extension.api.connectivity.NoConnectivityTest; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; - -import java.util.List; - -@Alias(value = CALCIO_ID, description = CALCIO_DESC) -public class CalcioServiceProvider implements SoapServiceProvider, NoConnectivityTest { - - public static final String CALCIO_ID = "higuain-gp"; - public static final String CALCIO_DESC = "This a nice description about the league where higuain is a star *"; - public static final String CALCIO_FRIENDLY_NAME = "Calcio"; - public static final String CALCIO_URL = "http://www.higuain-no-mereces-nada.com/nada"; - - @Override - public List getWebServiceDefinitions() { - return singletonList(getFirstDivisionService()); - } - - private WebServiceDefinition getFirstDivisionService() { - return WebServiceDefinition.builder() - .withService(CALCIO_ID) - .withFriendlyName(CALCIO_FRIENDLY_NAME) - .withWsdlUrl(CALCIO_URL) - .withService("ServiceA") - .withPort("PortA") - .build(); - } -} diff --git a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/FootballSoapExtension.java b/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/FootballSoapExtension.java deleted file mode 100644 index 49763be2df99..000000000000 --- a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/FootballSoapExtension.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.soap.extension; - -import static org.mule.sdk.api.meta.JavaVersion.JAVA_11; -import static org.mule.sdk.api.meta.JavaVersion.JAVA_17; -import static org.mule.sdk.api.meta.JavaVersion.JAVA_8; - -import static java.util.Collections.emptyList; - -import org.mule.runtime.extension.api.annotation.Alias; -import org.mule.runtime.extension.api.annotation.Extension; -import org.mule.runtime.extension.api.annotation.param.Optional; -import org.mule.runtime.extension.api.annotation.param.Parameter; -import org.mule.runtime.extension.api.connectivity.NoConnectivityTest; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.soap.annotation.Soap; -import org.mule.sdk.api.annotation.JavaVersionSupport; - -import java.util.Arrays; -import java.util.List; - -@Alias("base") -@Soap({LaLigaServiceProvider.class, CalcioServiceProvider.class}) -@Extension(name = "soap") -@JavaVersionSupport({JAVA_8, JAVA_11, JAVA_17}) -public class FootballSoapExtension implements SoapServiceProvider, NoConnectivityTest { - - public static final String LEAGUES_ID = "leagues"; - public static final String LEAGUES_FRIENDLY_NAME = "Football Leagues"; - public static final String LEAGUES_SERVICE = "LeaguesService"; - public static final String LEAGUES_PORT = "LeaguesPort"; - public static final String TEST_SERVICE_URL = "http://some-url.com"; - - @Parameter - @Optional(defaultValue = TEST_SERVICE_URL) - private String leaguesAddress; - - @Parameter - private String laLigaAddress; - - @Override - public List getWebServiceDefinitions() { - return Arrays.asList(getLeaguesService(), getLaLigaService()); - } - - private WebServiceDefinition getLaLigaService() { - return new LaLigaServiceProvider(laLigaAddress).getFirstDivisionService(); - } - - private WebServiceDefinition getLeaguesService() { - return WebServiceDefinition.builder().withId(LEAGUES_ID).withFriendlyName(LEAGUES_FRIENDLY_NAME) - .withWsdlUrl(leaguesAddress + "?wsdl").withAddress(leaguesAddress) - .withService(LEAGUES_SERVICE).withPort(LEAGUES_PORT).withExcludedOperations(emptyList()) - .build(); - } - -} diff --git a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/LaLigaServiceProvider.java b/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/LaLigaServiceProvider.java deleted file mode 100644 index 3dcd17a4308e..000000000000 --- a/tests/test-extensions/mule-soap-extension/src/main/java/org/mule/test/soap/extension/LaLigaServiceProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.soap.extension; - -import org.mule.runtime.extension.api.annotation.param.Parameter; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.sdk.api.annotation.semantics.connectivity.Url; - -import java.util.List; - -import com.google.common.collect.ImmutableList; - -public class LaLigaServiceProvider implements SoapServiceProvider { - - public static final String LA_LIGA = "La Liga"; - public static final String LA_LIGA_SERVICE_A = "LaLigaServiceA"; - public static final String LA_LIGA_PORT_A = "LaLigaPortA"; - - @Parameter - private String firstDivision; - - @Parameter - private String secondDivision; - - @Parameter - @Url - private String wsdlLocation; - - public LaLigaServiceProvider() {} - - LaLigaServiceProvider(String wsdlLocation) { - this.wsdlLocation = wsdlLocation; - this.firstDivision = "FIRST_DIV"; - } - - @Override - public List getWebServiceDefinitions() { - return ImmutableList.builder().add(getFirstDivisionService()).build(); - } - - WebServiceDefinition getFirstDivisionService() { - return WebServiceDefinition.builder().withId("A").withFriendlyName(firstDivision).withWsdlUrl(wsdlLocation) - .withService(LA_LIGA_SERVICE_A).withPort(LA_LIGA_PORT_A).build(); - } - -} diff --git a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/AbstractScienceTransportProvider.java b/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/AbstractScienceTransportProvider.java deleted file mode 100644 index 064a34aa9241..000000000000 --- a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/AbstractScienceTransportProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.ram; - -import static java.util.Collections.singletonMap; - -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.core.api.util.IOUtils; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.message.DispatchingResponse; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; -import java.io.ByteArrayInputStream; -import java.net.URL; - -public abstract class AbstractScienceTransportProvider implements MessageDispatcherProvider { - - @Override - public MessageDispatcher connect() throws ConnectionException { - return request -> { - try { - URL resource = Thread.currentThread().getContextClassLoader().getResource("test-http-response.xml"); - String response = String.format(IOUtils.toString(resource.openStream()), getResponseWord()); - return new DispatchingResponse(new ByteArrayInputStream(response.getBytes()), singletonMap("Content-Type", "text/xml")); - } catch (Exception e) { - throw new RuntimeException("Something went wrong when getting fake test response", e); - } - }; - } - - protected abstract String getResponseWord(); - - @Override - public void disconnect(MessageDispatcher connection) {} - - @Override - public ConnectionValidationResult validate(MessageDispatcher connection) { - return ConnectionValidationResult.success(); - } -} diff --git a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/DefaultPortalGunDispatcherProvider.java b/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/DefaultPortalGunDispatcherProvider.java deleted file mode 100644 index de8746b1c2aa..000000000000 --- a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/DefaultPortalGunDispatcherProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.ram; - -import org.mule.runtime.extension.api.annotation.param.Parameter; - -public class DefaultPortalGunDispatcherProvider extends AbstractScienceTransportProvider { - - @Parameter - private String responseMessage; - - @Override - protected String getResponseWord() { - return responseMessage; - } -} diff --git a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/MiniverseDispatcherProvider.java b/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/MiniverseDispatcherProvider.java deleted file mode 100644 index 51a4b3dfa1ad..000000000000 --- a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/MiniverseDispatcherProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.ram; - -import static org.mule.test.ram.RickAndMortyExtension.RICKS_PHRASE; - -public class MiniverseDispatcherProvider extends AbstractScienceTransportProvider { - - @Override - protected String getResponseWord() { - return RICKS_PHRASE; - } -} diff --git a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/RickAndMortyExtension.java b/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/RickAndMortyExtension.java deleted file mode 100644 index 969f4b895376..000000000000 --- a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/RickAndMortyExtension.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.ram; - -import static org.mule.runtime.extension.api.soap.WebServiceDefinition.builder; -import static org.mule.sdk.api.meta.JavaVersion.JAVA_11; -import static org.mule.sdk.api.meta.JavaVersion.JAVA_17; -import static org.mule.sdk.api.meta.JavaVersion.JAVA_8; - -import static java.util.Collections.singletonList; - -import org.mule.runtime.extension.api.annotation.Extension; -import org.mule.runtime.extension.api.annotation.param.Parameter; -import org.mule.runtime.extension.api.soap.SoapServiceProvider; -import org.mule.runtime.extension.api.soap.WebServiceDefinition; -import org.mule.runtime.extension.api.soap.annotation.SoapMessageDispatcherProviders; -import org.mule.sdk.api.annotation.JavaVersionSupport; -import org.mule.sdk.api.annotation.dsl.xml.Xml; -import org.mule.sdk.api.annotation.semantics.connectivity.Endpoint; -import org.mule.sdk.api.annotation.semantics.connectivity.Port; -import org.mule.sdk.api.annotation.semantics.connectivity.Url; - -import java.util.List; - -@Extension(name = "RAM") -@JavaVersionSupport({JAVA_8, JAVA_11, JAVA_17}) -@Xml(prefix = "ram") -@SoapMessageDispatcherProviders({MiniverseDispatcherProvider.class, - DefaultPortalGunDispatcherProvider.class, - TestHttpMessageDispatcherProvider.class}) -public class RickAndMortyExtension implements SoapServiceProvider { - - public static final String RICKS_PHRASE = "WUBBA LUBBA DUB DUB"; - - @Parameter - @Url - private String wsdlUrl; - - @Parameter - @Endpoint - private String service; - - @Parameter - @Port - private String port; - - @Override - public List getWebServiceDefinitions() { - return singletonList(builder().withId("ram").withWsdlUrl(wsdlUrl).withPort(port).withService(service).build()); - } -} diff --git a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/TestHttpMessageDispatcherProvider.java b/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/TestHttpMessageDispatcherProvider.java deleted file mode 100644 index 7f81c708d00d..000000000000 --- a/tests/test-extensions/rick-and-morty-extension/src/main/java/org/mule/test/ram/TestHttpMessageDispatcherProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.test.ram; - -import static java.util.Collections.emptyMap; -import static org.mule.runtime.api.connection.ConnectionValidationResult.success; - -import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.connection.ConnectionValidationResult; -import org.mule.runtime.extension.api.soap.MessageDispatcherProvider; -import org.mule.runtime.extension.api.soap.message.DispatchingResponse; -import org.mule.runtime.extension.api.soap.message.MessageDispatcher; - -import java.io.ByteArrayInputStream; - -public class TestHttpMessageDispatcherProvider implements MessageDispatcherProvider { - - @Override - public MessageDispatcher connect() throws ConnectionException { - return request -> new DispatchingResponse(new ByteArrayInputStream(new byte[0]), emptyMap()); - } - - @Override - public void disconnect(MessageDispatcher connection) { - - } - - @Override - public ConnectionValidationResult validate(MessageDispatcher connection) { - return success(); - } -} From 39bb4c4ce710be95fe60e79e995580fe65e83118 Mon Sep 17 00:00:00 2001 From: elrodro83 Date: Wed, 2 Oct 2024 10:08:58 -0300 Subject: [PATCH 2/2] more --- modules/all-modules/pom.xml | 10 ---------- modules/extensions-spring-support/pom.xml | 5 ----- .../src/main/java/module-info.java | 1 - tests/runner/pom.xml | 6 ------ tests/test-extensions/pom.xml | 5 ----- 5 files changed, 27 deletions(-) diff --git a/modules/all-modules/pom.xml b/modules/all-modules/pom.xml index 4e2bcc656688..57cc9232a28b 100644 --- a/modules/all-modules/pom.xml +++ b/modules/all-modules/pom.xml @@ -44,11 +44,6 @@ mule-module-extensions-support ${project.version} - - org.mule.runtime - mule-module-extensions-soap-support - ${project.version} - org.mule.runtime mule-module-extensions-spring-support @@ -114,11 +109,6 @@ mule-service-oauth-api ${project.version} - - org.mule.runtime - mule-service-soap-api - ${project.version} - org.mule.runtime.boot diff --git a/modules/extensions-spring-support/pom.xml b/modules/extensions-spring-support/pom.xml index 8e8379d3f803..e9a0ed4a7a64 100644 --- a/modules/extensions-spring-support/pom.xml +++ b/modules/extensions-spring-support/pom.xml @@ -101,11 +101,6 @@ mule-module-extensions-support ${project.version} - - org.mule.runtime - mule-module-extensions-soap-support - ${project.version} - org.mule.runtime mule-core diff --git a/modules/extensions-spring-support/src/main/java/module-info.java b/modules/extensions-spring-support/src/main/java/module-info.java index c6d2eab1c935..9ef4c5240906 100644 --- a/modules/extensions-spring-support/src/main/java/module-info.java +++ b/modules/extensions-spring-support/src/main/java/module-info.java @@ -23,7 +23,6 @@ requires org.mule.runtime.extension.model; requires org.mule.runtime.core; requires org.mule.runtime.extensions.support; - requires org.mule.runtime.extensions.soap.support; requires org.mule.runtime.artifact; requires org.mule.runtime.artifact.activation; requires org.mule.runtime.deployment.model; diff --git a/tests/runner/pom.xml b/tests/runner/pom.xml index 1b57df8f95b2..e63fc85fc43c 100644 --- a/tests/runner/pom.xml +++ b/tests/runner/pom.xml @@ -83,12 +83,6 @@ ${project.version} provided - - org.mule.runtime - mule-module-extensions-soap-support - ${project.version} - provided - org.mule.runtime mule-module-service diff --git a/tests/test-extensions/pom.xml b/tests/test-extensions/pom.xml index c1daee7486b8..5bacb26e2357 100644 --- a/tests/test-extensions/pom.xml +++ b/tests/test-extensions/pom.xml @@ -88,11 +88,6 @@ mule-extensions-api provided - - org.mule.runtime - mule-extensions-soap-api - provided - org.mule.runtime mule-api