use of com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep in project mule-migration-assistant by mulesoft.
the class MuleElementsMigrationTestCase method execute.
@Test
public void execute() throws Exception {
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
steps.forEach(step -> migrate((AbstractApplicationModelMigrationStep) step));
String xmlString = outputter.outputString(doc);
assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
use of com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep in project mule-migration-assistant by mulesoft.
the class MuleElementsMigrationTestCase method setUp.
@Before
public void setUp() throws Exception {
ApplicationModel.ApplicationModelBuilder amb = new ApplicationModel.ApplicationModelBuilder();
amb.withProjectType(ProjectType.MULE_THREE_POLICY);
amb.withProjectBasePath(POLICY_APPLICATION_MODEL_PATH);
appModel = amb.build();
doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
MuleElementsMigrationTask muleElementsMigrationTask = new MuleElementsMigrationTask();
muleElementsMigrationTask.setApplicationModel(appModel);
steps = muleElementsMigrationTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
BasicStructureMigrationTask basicStructureTask = new BasicStructureMigrationTask();
List<MigrationStep> basicStructureSteps = basicStructureTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
steps.addAll(basicStructureSteps);
}
use of com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep in project mule-migration-assistant by mulesoft.
the class ThreatProtectionPolicyMigrationTestCase method execute.
@Test
public void execute() throws Exception {
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
steps.forEach(step -> migrate((AbstractApplicationModelMigrationStep) step));
String xmlString = outputter.outputString(doc);
assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
use of com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep in project mule-migration-assistant by mulesoft.
the class ThreatProtectionPolicyMigrationTestCase method setUp.
@Before
public void setUp() throws Exception {
ApplicationModel.ApplicationModelBuilder amb = new ApplicationModel.ApplicationModelBuilder();
amb.withProjectType(ProjectType.MULE_THREE_POLICY);
amb.withProjectBasePath(POLICY_APPLICATION_MODEL_PATH);
amb.withPom(pomPath);
appModel = amb.build();
doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
ThreatProtectionMigrationTask task = new ThreatProtectionMigrationTask();
task.setApplicationModel(appModel);
steps = task.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
MuleElementsMigrationTask muleElementsMigrationTask = new MuleElementsMigrationTask();
muleElementsMigrationTask.setApplicationModel(appModel);
List<MigrationStep> policyUtilsMigrationSteps = muleElementsMigrationTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
steps.addAll(policyUtilsMigrationSteps);
BasicStructureMigrationTask basicStructureTask = new BasicStructureMigrationTask();
basicStructureTask.setApplicationModel(appModel);
List<MigrationStep> basicStructureSteps = basicStructureTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
steps.addAll(basicStructureSteps);
}
use of com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep 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");
}
}
Aggregations