use of com.mulesoft.tools.migration.project.model.pom.Dependency in project mule-migration-assistant by mulesoft.
the class AbstractJmsEndpoint method addActiveMqConnection.
private static Element addActiveMqConnection(final Element m4JmsConfig, final Element m3Connector, ApplicationModel appModel) {
Dependency activeMqClient = new DependencyBuilder().withGroupId("org.apache.activemq").withArtifactId("activemq-client").withVersion("${activeMq.version}").build();
addSharedLibs(appModel.getPomModel().get(), activeMqClient);
Element amqConnection = new Element("active-mq-connection", JMS_NAMESPACE);
m4JmsConfig.addContent(amqConnection);
boolean addFactory = false;
Element factoryConfiguration = new Element("factory-configuration", JMS_NAMESPACE);
if (m3Connector.getAttribute("brokerURL") != null) {
factoryConfiguration.setAttribute("brokerUrl", m3Connector.getAttributeValue("brokerURL"));
addFactory = true;
}
if (m3Connector.getAttributeValue("maxRedelivery") != null) {
factoryConfiguration.setAttribute("maxRedelivery", m3Connector.getAttributeValue("maxRedelivery"));
addFactory = true;
}
if (addFactory) {
amqConnection.addContent(factoryConfiguration);
}
return amqConnection;
}
use of com.mulesoft.tools.migration.project.model.pom.Dependency in project mule-migration-assistant by mulesoft.
the class ClientIdEnforcementPomContributionMigrationStepTestCase method pomContributionTest.
@Test
public void pomContributionTest() {
PomModel pm = new PomModel();
ClientIdEnforcementPomContributionMigrationStep step = new ClientIdEnforcementPomContributionMigrationStep();
step.execute(pm, mock(MigrationReport.class));
assertThat(pm.getDependencies().size(), is(1));
Dependency clientIdEnforcementDependency = pm.getDependencies().get(0);
assertThat(clientIdEnforcementDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(clientIdEnforcementDependency.getArtifactId(), is(MULE_CLIENT_ID_ENFORCEMENT_EXTENSION_ARTIFACT_ID));
assertThat(clientIdEnforcementDependency.getVersion(), is(notNullValue()));
assertThat(clientIdEnforcementDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
use of com.mulesoft.tools.migration.project.model.pom.Dependency in project mule-migration-assistant by mulesoft.
the class MelToDwExpressionMigrator method translateSingleExpression.
public String translateSingleExpression(String unwrappedExpression, boolean dataWeaveBodyOnly, Element element, boolean enricher) {
logger.debug(" --->> Evaluating MEL expression at element {} -> {}", element != null ? element.getName() : "null", unwrappedExpression);
String migratedExpression;
MigrationResult result;
try {
result = Migrator.migrate(unwrappedExpression);
migratedExpression = result.getGeneratedCode();
} catch (Exception e) {
return compatibilityResolver.resolve(unwrappedExpression, element, report, model, this, enricher);
}
if (result.metadata().children().exists(a -> a instanceof NonMigratable)) {
List<NonMigratable> metadata = (List<NonMigratable>) (List<?>) JavaConverters.seqAsJavaList(result.metadata().children()).stream().filter(a -> a instanceof NonMigratable).collect(toList());
metadata.forEach(a -> report.report(a.reason(), element, element));
return new DefaultMelCompatibilityResolver().resolve(unwrappedExpression, element, report, model, this, enricher);
}
if (migratedExpression.contains("message.inboundAttachments")) {
report.report("message.expressionsAttachments", element, element);
}
if (result.metadata().children().exists(a -> a instanceof JavaModuleRequired)) {
Dependency javaModuleDependency = new Dependency.DependencyBuilder().withGroupId("org.mule.module").withArtifactId("mule-java-module").withVersion(targetVersion("mule-java-module")).withClassifier("mule-plugin").build();
model.getPomModel().ifPresent(m -> m.addDependency(javaModuleDependency));
}
migratedExpression = resolveServerContext(migratedExpression);
migratedExpression = resolveIdentifiers(migratedExpression);
if (dataWeaveBodyOnly) {
migratedExpression = migratedExpression.replaceFirst("%dw 2\\.0\n---", "").trim();
}
report.melExpressionSuccess(unwrappedExpression);
return escapeUnderscores(migratedExpression);
}
use of com.mulesoft.tools.migration.project.model.pom.Dependency in project mule-migration-assistant by mulesoft.
the class FixedTimeAlgorithmMigrationStepTestCase method rateLimitPomContributionTest.
@Test
public void rateLimitPomContributionTest() throws Exception {
FixedTimeFrameAlgorithmMigrationStep step = new FixedTimeFrameAlgorithmMigrationStep();
step.setApplicationModel(appModel);
Element element = createPolicy(1, FIXED_TIME_FRAME_ALGORITHM_TAG_NAME, false);
step.execute(element, reportMock);
PomModel pm = appModel.getPomModel().get();
assertThat(pm.getDependencies().size(), is(2));
Dependency policyTransformExtensionDependency = pm.getDependencies().get(1);
assertThat(policyTransformExtensionDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(policyTransformExtensionDependency.getArtifactId(), is(MULE_THROTTLING_EXTENSION_ARTIFACT_ID));
assertThat(policyTransformExtensionDependency.getVersion(), is(notNullValue()));
assertThat(policyTransformExtensionDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
use of com.mulesoft.tools.migration.project.model.pom.Dependency in project mule-migration-assistant by mulesoft.
the class RamlValidatorPomContributionMigrationStepTestCase method pomContributionTestWithPreviousDependency.
@Test
public void pomContributionTestWithPreviousDependency() {
PomModel pm = new PomModel();
pm.addDependency(getRamlDependency());
RamlValidatorPomContributionMigrationStep step = new RamlValidatorPomContributionMigrationStep();
step.execute(pm, mock(MigrationReport.class));
assertThat(pm.getDependencies().size(), is(1));
Dependency httpPolicyTransformExtension = pm.getDependencies().get(0);
assertThat(httpPolicyTransformExtension.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(httpPolicyTransformExtension.getArtifactId(), is(MULE_REST_VALIDATOR_EXTENSION));
assertThat(httpPolicyTransformExtension.getVersion(), is(notNullValue()));
assertThat(httpPolicyTransformExtension.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Aggregations