use of com.mulesoft.tools.migration.project.model.pom.Repository in project mule-migration-assistant by mulesoft.
the class PolicyDeployPropertiesPomContributionMigrationStep method addRepository.
private void addRepository(PomModel pomModel) {
Repository repository = new Repository.RepositoryBuilder().withId(EXCHANGE_SERVER_ID).build();
repository.setName(EXCHANGE_SERVER_NAME);
repository.setUrl(EXCHANGE_SERVER_URL);
repository.setSnapshotsEnabled(true);
pomModel.addRepository(repository);
}
use of com.mulesoft.tools.migration.project.model.pom.Repository in project mule-migration-assistant by mulesoft.
the class PolicyDeployPropertiesPomContributionMigrationStep method addPluginRepository.
private void addPluginRepository(PomModel pomModel) {
Repository pluginRepository = new Repository.RepositoryBuilder().withId(PLUGIN_REPOSITORY_ID).build();
pluginRepository.setName(PLUGIN_REPOSITORY_NAME);
pluginRepository.setUrl(PLUGIN_REPOSITORY_URL);
pomModel.addPluginRepository(pluginRepository);
}
use of com.mulesoft.tools.migration.project.model.pom.Repository in project mule-migration-assistant by mulesoft.
the class UpdateRepositories method execute.
@Override
public void execute(PomModel pomModel, MigrationReport report) {
for (Repository repository : pomModel.getRepositories()) {
if (repository.getUrl().startsWith("http://repository.mulesoft.org")) {
repository.setUrl(repository.getUrl().replace("http://repository.mulesoft.org", "https://repository.mulesoft.org"));
}
}
final Repository exchangeRepo = new Repository.RepositoryBuilder().withId("anypoint-exchange").build();
exchangeRepo.setName("Anypoint Exchange");
exchangeRepo.setUrl("https://maven.anypoint.mulesoft.com/api/v1/maven");
exchangeRepo.setLayout("default");
pomModel.addRepository(exchangeRepo);
for (Repository repository : pomModel.getPluginRepositories()) {
if (repository.getUrl().startsWith("http://repository.mulesoft.org")) {
repository.setUrl(repository.getUrl().replace("http://repository.mulesoft.org", "https://repository.mulesoft.org"));
}
}
}
use of com.mulesoft.tools.migration.project.model.pom.Repository in project mule-migration-assistant by mulesoft.
the class ThrottlingWithFileRenameMigrationTestCase method assertPomDeployProperties.
private void assertPomDeployProperties(PomModel pomModel) {
assertThat(pomModel.getGroupId(), is(GROUP_ID_VALUE));
Properties pomProperties = pomModel.getProperties();
assertNotNull(pomProperties);
assertThat(pomProperties.size(), is(5));
assertThat(pomProperties.getProperty(EXCHANGE_URL_KEY), is(EXCHANGE_URL_VALUE));
assertThat(pomProperties.getProperty(MULE_MAVEN_PLUGIN_VERSION_KEY), is(notNullValue()));
List<Repository> repositoryList = pomModel.getRepositories();
assertThat(repositoryList.size(), is(1));
Repository repository = repositoryList.get(0);
assertThat(repository.getId(), is(EXCHANGE_SERVER_ID));
assertThat(repository.getName(), is(EXCHANGE_SERVER_NAME));
assertThat(repository.getUrl(), is(EXCHANGE_SERVER_URL));
assertThat(repository.areSnapshotsEnabled(), is(true));
DeploymentRepository deploymentRepository = pomModel.getMavenModelCopy().getDistributionManagement().getRepository();
assertNotNull(deploymentRepository);
assertThat(deploymentRepository.getId(), is(EXCHANGE_SERVER_ID));
assertThat(deploymentRepository.getName(), is(DISTRIBUTION_MANAGEMENT_REPOSITORY_NAME));
assertThat(deploymentRepository.getUrl(), is(EXCHANGE_SERVER_URL));
assertThat(deploymentRepository.getLayout(), is(DISTRIBUTION_MANAGEMENT_LAYOUT));
List<Plugin> pluginList = pomModel.getPlugins();
assertThat(pluginList.size(), is(2));
Plugin muleMavenPlugin = pluginList.get(0);
assertThat(muleMavenPlugin.getGroupId(), is(MULE_MAVEN_PLUGIN_GROUP_ID));
assertThat(muleMavenPlugin.getArtifactId(), is(MULE_MAVEN_PLUGIN_ARTIFACT_ID));
assertThat(muleMavenPlugin.getVersion(), is(MULE_MAVEN_PLUGIN_VERSION));
assertThat(muleMavenPlugin.getExtensions(), is(MULE_MAVEN_PLUGIN_EXTENSIONS));
Plugin mavenDeployPlugin = pluginList.get(1);
assertThat(mavenDeployPlugin.getGroupId(), is(MAVEN_DEPLOY_PLUGIN_GROUP_ID));
assertThat(mavenDeployPlugin.getArtifactId(), is(MAVEN_DEPLOY_PLUGIN_ARTIFACT_ID));
List<PluginExecution> pluginExecutionList = mavenDeployPlugin.getExecutions();
assertThat(pluginExecutionList.size(), is(1));
PluginExecution pluginExecution = pluginExecutionList.get(0);
assertThat(pluginExecution.getId(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_ID));
assertThat(pluginExecution.getPhase(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_PHASE));
assertThat(pluginExecution.getGoals().get(0), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GOAL));
Xpp3Dom configuration = pluginExecution.getConfiguration();
assertThat(configuration.getChild(REPOSITORY_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_REPOSITORY_ID));
assertThat(configuration.getChild(URL_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_URL));
assertThat(configuration.getChild(FILE_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_FILE));
assertThat(configuration.getChild(GENERATE_POM_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GENERATE_POM));
assertThat(configuration.getChild(GROUP_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GROUP_ID));
assertThat(configuration.getChild(ARTIFACT_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_ARTIFACT_ID));
assertThat(configuration.getChild(VERSION_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_VERSION));
assertThat(configuration.getChild(PACKAGING_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_PACKAGING));
assertThat(configuration.getChild(CLASSIFIER_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_CLASSIFIER));
List<Repository> pluginRepositoriesList = pomModel.getPluginRepositories();
assertThat(pluginRepositoriesList.size(), is(1));
Repository pluginRepository = pluginRepositoriesList.get(0);
assertThat(pluginRepository.getId(), is(MULE_PLUGIN_CLASSIFIER));
assertThat(pluginRepository.getName(), is(PLUGIN_REPOSITORY_NAME));
assertThat(pluginRepository.getUrl(), is(PLUGIN_REPOSITORY_URL));
}
use of com.mulesoft.tools.migration.project.model.pom.Repository in project mule-migration-assistant by mulesoft.
the class PolicyDeployPropertiesPomContributionMigrationStepTestCase method pomDeployPropertiesTest.
@Test
public void pomDeployPropertiesTest() {
PomModel pomModel = new PomModel();
PolicyDeployPropertiesPomContributionMigrationStep step = new PolicyDeployPropertiesPomContributionMigrationStep();
step.execute(pomModel, mock(MigrationReport.class));
assertThat(pomModel.getGroupId(), is(GROUP_ID_VALUE));
Properties pomProperties = pomModel.getProperties();
assertNotNull(pomProperties);
assertThat(pomProperties.size(), is(2));
assertThat(pomProperties.getProperty(EXCHANGE_URL_KEY), is(EXCHANGE_URL_VALUE));
assertThat(pomProperties.getProperty(MULE_MAVEN_PLUGIN_VERSION_KEY), is(notNullValue()));
List<Repository> repositoryList = pomModel.getRepositories();
assertThat(repositoryList.size(), is(1));
Repository repository = repositoryList.get(0);
assertThat(repository.getId(), is(EXCHANGE_SERVER_ID));
assertThat(repository.getName(), is(EXCHANGE_SERVER_NAME));
assertThat(repository.getUrl(), is(EXCHANGE_SERVER_URL));
assertThat(repository.areSnapshotsEnabled(), is(true));
DeploymentRepository deploymentRepository = pomModel.getMavenModelCopy().getDistributionManagement().getRepository();
assertNotNull(deploymentRepository);
assertThat(deploymentRepository.getId(), is(EXCHANGE_SERVER_ID));
assertThat(deploymentRepository.getName(), is(DISTRIBUTION_MANAGEMENT_REPOSITORY_NAME));
assertThat(deploymentRepository.getUrl(), is(EXCHANGE_SERVER_URL));
assertThat(deploymentRepository.getLayout(), is(DISTRIBUTION_MANAGEMENT_LAYOUT));
List<Plugin> pluginList = pomModel.getPlugins();
assertThat(pluginList.size(), is(2));
Plugin muleMavenPlugin = pluginList.get(0);
assertThat(muleMavenPlugin.getGroupId(), is(MULE_MAVEN_PLUGIN_GROUP_ID));
assertThat(muleMavenPlugin.getArtifactId(), is(MULE_MAVEN_PLUGIN_ARTIFACT_ID));
assertThat(muleMavenPlugin.getVersion(), is(MULE_MAVEN_PLUGIN_VERSION));
assertThat(muleMavenPlugin.getExtensions(), is(MULE_MAVEN_PLUGIN_EXTENSIONS));
Plugin mavenDeployPlugin = pluginList.get(1);
assertThat(mavenDeployPlugin.getGroupId(), is(MAVEN_DEPLOY_PLUGIN_GROUP_ID));
assertThat(mavenDeployPlugin.getArtifactId(), is(MAVEN_DEPLOY_PLUGIN_ARTIFACT_ID));
List<PluginExecution> pluginExecutionList = mavenDeployPlugin.getExecutions();
assertThat(pluginExecutionList.size(), is(1));
PluginExecution pluginExecution = pluginExecutionList.get(0);
assertThat(pluginExecution.getId(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_ID));
assertThat(pluginExecution.getPhase(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_PHASE));
assertThat(pluginExecution.getGoals().get(0), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GOAL));
Xpp3Dom configuration = pluginExecution.getConfiguration();
assertThat(configuration.getChild(REPOSITORY_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_REPOSITORY_ID));
assertThat(configuration.getChild(URL_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_URL));
assertThat(configuration.getChild(FILE_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_FILE));
assertThat(configuration.getChild(GENERATE_POM_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GENERATE_POM));
assertThat(configuration.getChild(GROUP_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_GROUP_ID));
assertThat(configuration.getChild(ARTIFACT_ID_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_ARTIFACT_ID));
assertThat(configuration.getChild(VERSION_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_VERSION));
assertThat(configuration.getChild(PACKAGING_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_PACKAGING));
assertThat(configuration.getChild(CLASSIFIER_KEY).getValue(), is(MAVEN_DEPLOY_PLUGIN_EXECUTION_CLASSIFIER));
List<Repository> pluginRepositoriesList = pomModel.getPluginRepositories();
assertThat(pluginRepositoriesList.size(), is(1));
Repository pluginRepository = pluginRepositoriesList.get(0);
assertThat(pluginRepository.getId(), is(MULE_PLUGIN_CLASSIFIER));
assertThat(pluginRepository.getName(), is(PLUGIN_REPOSITORY_NAME));
assertThat(pluginRepository.getUrl(), is(PLUGIN_REPOSITORY_URL));
}
Aggregations