Search in sources :

Example 6 with RemoteRepository

use of org.mule.maven.client.api.model.RemoteRepository in project mule by mulesoft.

the class MavenConfigTestCase method loadSettings.

@Description("Loads the global and user settings from system properties")
@Test
public void loadSettings() throws Exception {
    File userSettings = temporaryFolder.newFile();
    File globalSettings = temporaryFolder.newFile();
    Map<String, String> properties = new HashMap<>();
    properties.put("muleRuntimeConfig.maven.userSettingsLocation", userSettings.getAbsolutePath());
    properties.put("muleRuntimeConfig.maven.globalSettingsLocation", globalSettings.getAbsolutePath());
    testWithSystemProperties(properties, () -> {
        GlobalConfigLoader.reset();
        MavenConfiguration mavenConfig = getMavenConfig();
        List<RemoteRepository> mavenRemoteRepositories = mavenConfig.getMavenRemoteRepositories();
        assertThat(mavenRemoteRepositories, hasSize(1));
        assertThat(mavenRemoteRepositories.get(0).getId(), is("mavenCentral"));
        assertThat(mavenConfig.getGlobalSettingsLocation().isPresent(), is(true));
        assertThat(mavenConfig.getGlobalSettingsLocation().get(), is(globalSettings));
        assertThat(mavenConfig.getUserSettingsLocation().isPresent(), is(true));
        assertThat(mavenConfig.getUserSettingsLocation().get(), is(userSettings));
    });
}
Also used : MavenConfiguration(org.mule.maven.client.api.model.MavenConfiguration) HashMap(java.util.HashMap) RemoteRepository(org.mule.maven.client.api.model.RemoteRepository) File(java.io.File) Description(io.qameta.allure.Description) Test(org.junit.Test)

Aggregations

Description (io.qameta.allure.Description)6 Test (org.junit.Test)6 MavenConfiguration (org.mule.maven.client.api.model.MavenConfiguration)6 RemoteRepository (org.mule.maven.client.api.model.RemoteRepository)6 URL (java.net.URL)5 HashMap (java.util.HashMap)3 File (java.io.File)1