archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
/**
     * [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
     */
[MRM-582] Remote Repositories with empty  and  fields shouldn't be created in configuration.
[ MRM - 582 ] Remote Repositories with empty and fields shouldn ' t be created in configuration .
@Test
    public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword()
        throws Exception
    {
        ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
        Configuration configuration = archivaConfiguration.getConfiguration();
        assertConfiguration( configuration, 2, 2, 2 );
        assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() );
        RemoteRepositoryConfiguration repository =
            configuration.getRemoteRepositoriesAsMap().get( "maven2-repository.dev.java.net" );
        assertEquals( "remote repository.url", "https://maven2-repository.dev.java.net/nonav/repository",
                      repository.getUrl() );
        assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName() );
        assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId() );
        assertEquals( "remote repository.layout", "default", repository.getLayout() );
        assertNull( "remote repository.username == null", repository.getUsername() );
        assertNull( "remote repository.password == null", repository.getPassword() );
    }
@ Test public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword ( ) throws Exception { ArchivaConfiguration archivaConfiguration = lookup ( ArchivaConfiguration . class , "test-configuration" ) ; Configuration configuration = archivaConfiguration . getConfiguration ( ) ; assertConfiguration ( configuration , 2 , 2 , 2 ) ; assertEquals ( "check remote repositories" , 2 , configuration . getRemoteRepositories ( ) . size ( ) ) ; RemoteRepositoryConfiguration repository = configuration . getRemoteRepositoriesAsMap ( ) . get ( "maven2-repository.dev.java.net" ) ; assertEquals ( "remote repository.url" , "https://maven2-repository.dev.java.net/nonav/repository" , repository . getUrl ( ) ) ; assertEquals ( "remote repository.name" , "Java.net Repository for Maven 2" , repository . getName ( ) ) ; assertEquals ( "remote repository.id" , "maven2-repository.dev.java.net" , repository . getId ( ) ) ; assertEquals ( "remote repository.layout" , "default" , repository . getLayout ( ) ) ; assertNull ( "remote repository.username == null" , repository . getUsername ( ) ) ; assertNull ( "remote repository.password == null" , repository . getPassword ( ) ) ; }
[MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
[ MRM - 582 ] Remote Repositories with empty <username > and <password > fields shouldn ' t be created in configuration .