Search in sources :

Example 1 with HTTPMigrationTask

use of com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask in project mule-migration-assistant by mulesoft.

the class MigrationTaskLocator method getCoreMigrationTasks.

public List<AbstractMigrationTask> getCoreMigrationTasks() {
    List<AbstractMigrationTask> coreMigrationTasks = new ArrayList<>();
    coreMigrationTasks.add(new SecurePropertiesMigrationTask());
    coreMigrationTasks.add(new SecurityCrc32MigrationTask());
    coreMigrationTasks.add(new SecurityFiltersMigrationTask());
    coreMigrationTasks.add(new PropertiesMigrationTask());
    coreMigrationTasks.add(new MuleCoreComponentsMigrationTask());
    coreMigrationTasks.add(new SplitterAggregatorTask());
    coreMigrationTasks.add(new BatchMigrationTask());
    coreMigrationTasks.add(new ValidationMigrationTask());
    coreMigrationTasks.add(new RequestReplyMigrationTask());
    coreMigrationTasks.add(new QuartzMigrationTask());
    coreMigrationTasks.add(new HTTPMigrationTask());
    coreMigrationTasks.add(new EmailMigrationTask());
    coreMigrationTasks.add(new SocketsMigrationTask());
    coreMigrationTasks.add(new WscMigrationTask());
    coreMigrationTasks.add(new DbMigrationTask());
    coreMigrationTasks.add(new ObjectStoreMigrationTask());
    coreMigrationTasks.add(new FileMigrationTask());
    coreMigrationTasks.add(new FtpMigrationTask());
    coreMigrationTasks.add(new SftpMigrationTask());
    coreMigrationTasks.add(new EndpointsMigrationTask());
    coreMigrationTasks.add(new JmsDomainMigrationTask());
    coreMigrationTasks.add(new JmsMigrationTask());
    coreMigrationTasks.add(new AmqpMigrationTask());
    coreMigrationTasks.add(new VmDomainMigrationTask());
    coreMigrationTasks.add(new VMMigrationTask());
    coreMigrationTasks.add(new CompressionMigrationTask());
    coreMigrationTasks.add(new ScriptingMigrationTask());
    coreMigrationTasks.add(new JsonMigrationTask());
    coreMigrationTasks.add(new SecurityOAuth2ProviderMigrationTask());
    coreMigrationTasks.add(new SalesforceMigrationTask());
    coreMigrationTasks.add(new DomainAppMigrationTask());
    coreMigrationTasks.add(new MuleDeprecatedCoreComponentsMigrationTask());
    coreMigrationTasks.add(new MunitMigrationTask());
    coreMigrationTasks.add(new TransformersMigrationTask());
    coreMigrationTasks.add(new ExpressionTransformerMigrationTask());
    coreMigrationTasks.add(new ApikitMigrationTask());
    coreMigrationTasks.add(new SoapkitMigrationTask());
    return coreMigrationTasks;
}
Also used : SoapkitMigrationTask(com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask) DbMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask) EndpointsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask) ScriptingMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ScriptingMigrationTask) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) FtpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FtpMigrationTask) ValidationMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ValidationMigrationTask) SocketsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SocketsMigrationTask) VmDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VmDomainMigrationTask) ApikitMigrationTask(com.mulesoft.tools.migration.library.apikit.tasks.ApikitMigrationTask) VMMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VMMigrationTask) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) JsonMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JsonMigrationTask) JmsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask) SecurityOAuth2ProviderMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityOAuth2ProviderMigrationTask) JmsDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask) SecurePropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurePropertiesMigrationTask) CompressionMigrationTask(com.mulesoft.tools.migration.library.mule.steps.compression.CompressionMigrationTask) SecurityFiltersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityFiltersMigrationTask) DomainAppMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) WscMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.WscMigrationTask) ObjectStoreMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ObjectStoreMigrationTask) SplitterAggregatorTask(com.mulesoft.tools.migration.library.mule.tasks.SplitterAggregatorTask) RequestReplyMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.RequestReplyMigrationTask) AmqpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.AmqpMigrationTask) EmailMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EmailMigrationTask) SftpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SftpMigrationTask) FileMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FileMigrationTask) MuleDeprecatedCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleDeprecatedCoreComponentsMigrationTask) SalesforceMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SalesforceMigrationTask) BatchMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.BatchMigrationTask) ExpressionTransformerMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ExpressionTransformerMigrationTask) SecurityCrc32MigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityCrc32MigrationTask) TransformersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.TransformersMigrationTask) HTTPMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask) MuleCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask) PropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.PropertiesMigrationTask) SecurePropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurePropertiesMigrationTask) QuartzMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.QuartzMigrationTask)

Example 2 with HTTPMigrationTask

use of com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask in project mule-migration-assistant by mulesoft.

the class DomainTest method setUp.

@Before
public void setUp() throws Exception {
    originalDomainDoc = getDocument(this.getClass().getClassLoader().getResource(domainConfigPath.toString()).toURI().getPath());
    domainDoc = getDocument(this.getClass().getClassLoader().getResource(domainConfigPath.toString()).toURI().getPath());
    appDoc = getDocument(this.getClass().getClassLoader().getResource(appConfigPath.toString()).toURI().getPath());
    MelToDwExpressionMigrator expressionMigrator = new MelToDwExpressionMigrator(report.getReport(), mock(ApplicationModel.class));
    domainModel = mock(ApplicationModel.class);
    when(domainModel.getNodes(any(String.class))).thenAnswer(invocation -> getElementsFromDocument(domainDoc, (String) invocation.getArguments()[0], "domain"));
    when(domainModel.getNode(any(String.class))).thenAnswer(invocation -> getElementsFromDocument(domainDoc, (String) invocation.getArguments()[0], "domain").iterator().next());
    when(domainModel.getNodeOptional(any(String.class))).thenAnswer(invocation -> {
        List<Element> elementsFromDocument = getElementsFromDocument(domainDoc, (String) invocation.getArguments()[0], "domain");
        if (elementsFromDocument.isEmpty()) {
            return empty();
        } else {
            return of(elementsFromDocument.iterator().next());
        }
    });
    when(domainModel.getProjectBasePath()).thenReturn(temp.newFolder().toPath());
    when(domainModel.getPomModel()).thenReturn(of(mock(PomModel.class)));
    final Map<Path, Document> domainModelDocs = new HashMap<>();
    domainModelDocs.put(domainConfigPath, domainDoc);
    when(domainModel.getApplicationDocuments()).thenReturn(domainModelDocs);
    doAnswer(invocation -> {
        String prefix = invocation.getArgument(0);
        String uri = invocation.getArgument(1);
        String schemaLocation = invocation.getArgument(2);
        Namespace namespace = Namespace.getNamespace(prefix, uri);
        addNameSpace(namespace, schemaLocation, domainDoc);
        return null;
    }).when(domainModel).addNameSpace(anyString(), anyString(), anyString());
    appModel = mock(ApplicationModel.class);
    when(appModel.getNodes(any(String.class))).thenAnswer(invocation -> getElementsFromDocuments((String) invocation.getArguments()[0]));
    when(appModel.getNode(any(String.class))).thenAnswer(invocation -> getElementsFromDocuments((String) invocation.getArguments()[0]).iterator().next());
    when(appModel.getNodeOptional(any(String.class))).thenAnswer(invocation -> {
        List<Element> elementsFromDocument = getElementsFromDocuments((String) invocation.getArguments()[0]);
        if (elementsFromDocument.isEmpty()) {
            return empty();
        } else {
            return of(elementsFromDocument.iterator().next());
        }
    });
    when(appModel.getProjectBasePath()).thenReturn(temp.newFolder().toPath());
    when(appModel.getPomModel()).thenReturn(of(mock(PomModel.class)));
    final Map<Path, Document> appDomainModelDocs = new HashMap<>();
    appDomainModelDocs.put(domainConfigPath, originalDomainDoc);
    when(appModel.getDomainDocuments()).thenReturn(appDomainModelDocs);
    doAnswer(invocation -> {
        String prefix = invocation.getArgument(0);
        String uri = invocation.getArgument(1);
        String schemaLocation = invocation.getArgument(2);
        Namespace namespace = Namespace.getNamespace(prefix, uri);
        addNameSpace(namespace, schemaLocation, originalDomainDoc);
        addNameSpace(namespace, schemaLocation, appDoc);
        return null;
    }).when(appModel).addNameSpace(anyString(), anyString(), anyString());
    List<AbstractMigrationTask> coreMigrationTasks = new ArrayList<>();
    coreMigrationTasks.add(new MuleCoreComponentsMigrationTask());
    coreMigrationTasks.add(new HTTPMigrationTask());
    coreMigrationTasks.add(new DbMigrationTask());
    coreMigrationTasks.add(new EndpointsMigrationTask());
    coreMigrationTasks.add(new JmsDomainMigrationTask());
    coreMigrationTasks.add(new JmsMigrationTask());
    coreMigrationTasks.add(new DomainAppMigrationTask());
    coreMigrationTasks.add(new SpringMigrationTask());
    coreMigrationTasks.add(new HTTPCleanupTask());
    coreMigrationTasks.add(new MigrationCleanTask());
    coreMigrationTasks.add(new PostprocessGeneral());
    coreMigrationTasks.add(new PostprocessMuleApplication());
    appSteps = new ArrayList<>();
    domainSteps = new ArrayList<>();
    for (AbstractMigrationTask task : coreMigrationTasks) {
        if (task.getApplicableProjectTypes().contains(MULE_FOUR_DOMAIN)) {
            for (MigrationStep step : task.getSteps()) {
                if (step instanceof ExpressionMigratorAware) {
                    ((ExpressionMigratorAware) step).setExpressionMigrator(expressionMigrator);
                }
                if (step instanceof ApplicationModelContribution) {
                    ((ApplicationModelContribution) step).setApplicationModel(domainModel);
                }
                domainSteps.add(step);
            }
        }
        if (task.getApplicableProjectTypes().contains(MULE_FOUR_APPLICATION)) {
            for (MigrationStep step : task.getSteps()) {
                if (step instanceof ExpressionMigratorAware) {
                    ((ExpressionMigratorAware) step).setExpressionMigrator(expressionMigrator);
                }
                if (step instanceof ApplicationModelContribution) {
                    ((ApplicationModelContribution) step).setApplicationModel(appModel);
                }
                appSteps.add(step);
            }
        }
    }
}
Also used : DbMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask) EndpointsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask) HashMap(java.util.HashMap) Element(org.jdom2.Element) ArrayList(java.util.ArrayList) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) SpringMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SpringMigrationTask) MigrationCleanTask(com.mulesoft.tools.migration.library.mule.tasks.MigrationCleanTask) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Document(org.jdom2.Document) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) ExpressionMigratorAware(com.mulesoft.tools.migration.step.ExpressionMigratorAware) ApplicationModelContribution(com.mulesoft.tools.migration.step.category.ApplicationModelContribution) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) JmsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask) JmsDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask) Path(java.nio.file.Path) PostprocessGeneral(com.mulesoft.tools.migration.library.mule.tasks.PostprocessGeneral) PostprocessMuleApplication(com.mulesoft.tools.migration.library.mule.tasks.PostprocessMuleApplication) DomainAppMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) HTTPCleanupTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPCleanupTask) Namespace(org.jdom2.Namespace) MelToDwExpressionMigrator(com.mulesoft.tools.migration.library.tools.MelToDwExpressionMigrator) HTTPMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask) MuleCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask) Before(org.junit.Before)

Aggregations

DbMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask)2 DomainAppMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask)2 EndpointsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask)2 HTTPMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask)2 JmsDomainMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask)2 JmsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask)2 MuleCoreComponentsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask)2 AbstractMigrationTask (com.mulesoft.tools.migration.task.AbstractMigrationTask)2 ArrayList (java.util.ArrayList)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 DocumentHelper.getDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getDocument)1 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument)1 ApikitMigrationTask (com.mulesoft.tools.migration.library.apikit.tasks.ApikitMigrationTask)1 CompressionMigrationTask (com.mulesoft.tools.migration.library.mule.steps.compression.CompressionMigrationTask)1 AmqpMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.AmqpMigrationTask)1 BatchMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.BatchMigrationTask)1 EmailMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.EmailMigrationTask)1 ExpressionTransformerMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.ExpressionTransformerMigrationTask)1 FileMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.FileMigrationTask)1 FtpMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.FtpMigrationTask)1