use of com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask 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;
}
use of com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask 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);
}
}
}
}
Aggregations