Search in sources :

Example 1 with HttpsOutboundEndpoint

use of com.mulesoft.tools.migration.library.mule.steps.http.HttpsOutboundEndpoint in project mule-migration-assistant by mulesoft.

the class OutboundEndpoint method execute.

@Override
public void execute(Element object, MigrationReport report) throws RuntimeException {
    object.getChildren("property", CORE_NAMESPACE).forEach(p -> {
        object.setAttribute(p.getAttributeValue("key"), p.getAttributeValue("value"));
    });
    object.removeChildren("property", CORE_NAMESPACE);
    if (object.getAttribute("address") != null) {
        String address = object.getAttributeValue("address");
        AbstractApplicationModelMigrationStep migrator = null;
        // TODO MMT-132 make available migrators discoverable
        if (address.startsWith("file://")) {
            migrator = new FileOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(FILE_NS_PREFIX, FILE_NS_URI));
        } else if (address.startsWith("ftp://")) {
            migrator = new FtpEeOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(FTP_NS_PREFIX, FTP_NS_URI));
        } else if (address.startsWith("sftp://")) {
            migrator = new SftpOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(SFTP_NS_PREFIX, SFTP_NS_URI));
        } else if (address.startsWith("http://")) {
            migrator = new HttpOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(HTTP_NS_PREFIX, HTTP_NS_URI));
        } else if (address.startsWith("https://")) {
            migrator = new HttpsOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace("https", "http://www.mulesoft.org/schema/mule/https"));
        } else if (address.startsWith("smtp://")) {
            migrator = new SmtpOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace("smtp", "http://www.mulesoft.org/schema/mule/smtp"));
        } else if (address.startsWith("smtps://")) {
            migrator = new SmtpsOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace("smtps", "http://www.mulesoft.org/schema/mule/smtps"));
        } else if (address.startsWith("jms://")) {
            migrator = new JmsOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(JMS_NS_PREFIX, JMS_NS_URI));
        } else if (address.startsWith("vm://")) {
            migrator = new VmOutboundEndpoint();
            object.setNamespace(Namespace.getNamespace(VM_NS_PREFIX, VM_NS_URI));
        }
        if (migrator != null) {
            migrator.setApplicationModel(getApplicationModel());
            if (migrator instanceof ExpressionMigratorAware) {
                ((ExpressionMigratorAware) migrator).setExpressionMigrator(getExpressionMigrator());
            }
            migrator.execute(object, report);
        }
        object.removeAttribute("address");
    }
    if (object.getAttribute("exchange-pattern") != null) {
        object.removeAttribute("exchange-pattern");
    }
}
Also used : SmtpOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.email.SmtpOutboundEndpoint) SmtpsOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.email.SmtpsOutboundEndpoint) JmsOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.jms.JmsOutboundEndpoint) FtpEeOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.ftp.FtpEeOutboundEndpoint) HttpOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.http.HttpOutboundEndpoint) ExpressionMigratorAware(com.mulesoft.tools.migration.step.ExpressionMigratorAware) SftpOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.sftp.SftpOutboundEndpoint) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) HttpsOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.http.HttpsOutboundEndpoint) FileOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.file.FileOutboundEndpoint) VmOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.vm.VmOutboundEndpoint)

Example 2 with HttpsOutboundEndpoint

use of com.mulesoft.tools.migration.library.mule.steps.http.HttpsOutboundEndpoint in project mule-migration-assistant by mulesoft.

the class WebServiceConsumerTest method setUp.

@Before
public void setUp() throws Exception {
    doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    doc.getRootElement().addNamespaceDeclaration(Namespace.getNamespace("wsc", "http://www.mulesoft.org/schema/mule/wsc"));
    appModel = mockApplicationModel(doc, temp);
    httpOutbound = new HttpOutboundEndpoint();
    httpOutbound.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    httpOutbound.setApplicationModel(appModel);
    httpsOutbound = new HttpsOutboundEndpoint();
    httpsOutbound.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    httpsOutbound.setApplicationModel(appModel);
    httpRequesterConfig = new HttpConnectorRequestConfig();
    httpRequesterConfig.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    httpRequester = new HttpConnectorRequester();
    httpRequester.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    httpRequester.setApplicationModel(appModel);
    httpHeaders = new HttpConnectorHeaders();
    httpHeaders.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    wsConsumerConfig = new WsConsumerConfig();
    wsConsumerConfig.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    wsConsumerConfig.setApplicationModel(appModel);
    wsConsumer = new WsConsumer();
    wsConsumer.setApplicationModel(appModel);
    httpConfig = new HttpConfig();
    httpConfig.setApplicationModel(appModel);
}
Also used : HttpOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.http.HttpOutboundEndpoint) MelToDwExpressionMigrator(com.mulesoft.tools.migration.library.tools.MelToDwExpressionMigrator) HttpConnectorRequestConfig(com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorRequestConfig) HttpsOutboundEndpoint(com.mulesoft.tools.migration.library.mule.steps.http.HttpsOutboundEndpoint) HttpConnectorRequester(com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorRequester) HttpConfig(com.mulesoft.tools.migration.library.mule.steps.http.HttpConfig) HttpConnectorHeaders(com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorHeaders) Before(org.junit.Before)

Aggregations

HttpOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.http.HttpOutboundEndpoint)2 HttpsOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.http.HttpsOutboundEndpoint)2 SmtpOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.email.SmtpOutboundEndpoint)1 SmtpsOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.email.SmtpsOutboundEndpoint)1 FileOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.file.FileOutboundEndpoint)1 FtpEeOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.ftp.FtpEeOutboundEndpoint)1 HttpConfig (com.mulesoft.tools.migration.library.mule.steps.http.HttpConfig)1 HttpConnectorHeaders (com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorHeaders)1 HttpConnectorRequestConfig (com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorRequestConfig)1 HttpConnectorRequester (com.mulesoft.tools.migration.library.mule.steps.http.HttpConnectorRequester)1 JmsOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.jms.JmsOutboundEndpoint)1 SftpOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.sftp.SftpOutboundEndpoint)1 VmOutboundEndpoint (com.mulesoft.tools.migration.library.mule.steps.vm.VmOutboundEndpoint)1 MelToDwExpressionMigrator (com.mulesoft.tools.migration.library.tools.MelToDwExpressionMigrator)1 AbstractApplicationModelMigrationStep (com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep)1 ExpressionMigratorAware (com.mulesoft.tools.migration.step.ExpressionMigratorAware)1 Before (org.junit.Before)1