Search in sources :

Example 1 with SimpleLocalRepositoryManagerFactory

use of org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory in project spring-boot by spring-projects.

the class SettingsXmlRepositorySystemSessionAutoConfigurationTests method propertyInterpolation.

@Test
public void propertyInterpolation() throws SettingsBuildingException {
    final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
    given(this.repositorySystem.newLocalRepositoryManager(eq(session), any(LocalRepository.class))).willAnswer(new Answer<LocalRepositoryManager>() {

        @Override
        public LocalRepositoryManager answer(InvocationOnMock invocation) throws Throwable {
            LocalRepository localRepository = invocation.getArgument(1);
            return new SimpleLocalRepositoryManagerFactory().newInstance(session, localRepository);
        }
    });
    SystemProperties.doWithSystemProperties(new Runnable() {

        @Override
        public void run() {
            new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session, SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem);
        }
    }, "user.home:src/test/resources/maven-settings/property-interpolation", "foo:bar");
    assertThat(session.getLocalRepository().getBasedir().getAbsolutePath()).endsWith(File.separatorChar + "bar" + File.separatorChar + "repository");
}
Also used : DefaultRepositorySystemSession(org.eclipse.aether.DefaultRepositorySystemSession) InvocationOnMock(org.mockito.invocation.InvocationOnMock) LocalRepositoryManager(org.eclipse.aether.repository.LocalRepositoryManager) LocalRepository(org.eclipse.aether.repository.LocalRepository) SimpleLocalRepositoryManagerFactory(org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory) Test(org.junit.Test)

Aggregations

DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)1 SimpleLocalRepositoryManagerFactory (org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory)1 LocalRepository (org.eclipse.aether.repository.LocalRepository)1 LocalRepositoryManager (org.eclipse.aether.repository.LocalRepositoryManager)1 Test (org.junit.Test)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1