DefaultRemoteRepositoryManager implements RemoteRepositoryManager, Service { public RepositoryPolicy getPolicy( RepositorySystemSession session, RemoteRepository repository, boolean releases, boolean snapshots ) { RepositoryPolicy policy; if ( releases && snapshots ) { policy = merge( session, repository.getPolicy( false ), repository.getPolicy( true ) ); } else { policy = repository.getPolicy( snapshots ); } if ( !StringUtils.isEmpty( session.getChecksumPolicy() ) ) { policy = policy.setChecksumPolicy( session.getChecksumPolicy() ); } if ( !StringUtils.isEmpty( session.getUpdatePolicy() ) ) { policy = policy.setUpdatePolicy( session.getUpdatePolicy() ); } return policy; } DefaultRemoteRepositoryManager();  DefaultRemoteRepositoryManager( Logger logger, UpdateCheckManager updateCheckManager,
                                           List<RepositoryConnectorFactory> connectorFactories ); void initService( ServiceLocator locator ); DefaultRemoteRepositoryManager setLogger( Logger logger ); DefaultRemoteRepositoryManager setUpdateCheckManager( UpdateCheckManager updateCheckManager ); DefaultRemoteRepositoryManager addRepositoryConnectorFactory( RepositoryConnectorFactory factory ); DefaultRemoteRepositoryManager setRepositoryConnectorFactories( List<RepositoryConnectorFactory> factories ); List<RemoteRepository> aggregateRepositories( RepositorySystemSession session,
                                                         List<RemoteRepository> dominantRepositories,
                                                         List<RemoteRepository> recessiveRepositories,
                                                         boolean recessiveIsRaw ); RepositoryPolicy getPolicy( RepositorySystemSession session, RemoteRepository repository, boolean releases,
                                       boolean snapshots ); RepositoryConnector getRepositoryConnector( RepositorySystemSession session, RemoteRepository repository );  }
@Test public void testGetPolicy() { RepositoryPolicy snapshotPolicy = new RepositoryPolicy( true, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_IGNORE ); RepositoryPolicy releasePolicy = new RepositoryPolicy( true, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_FAIL ); RemoteRepository repo = new RemoteRepository( "id", "type", "http: repo.setPolicy( true, snapshotPolicy ); repo.setPolicy( false, releasePolicy ); RepositoryPolicy effectivePolicy = manager.getPolicy( session, repo, true, true ); assertEquals( true, effectivePolicy.isEnabled() ); assertEquals( RepositoryPolicy.CHECKSUM_POLICY_IGNORE, effectivePolicy.getChecksumPolicy() ); assertEquals( RepositoryPolicy.UPDATE_POLICY_ALWAYS, effectivePolicy.getUpdatePolicy() ); }