@Test public void testForRepository() { final RepositorySystemSession session = newSession(); final RemoteRepository[] repos = { null }; Authentication auth = new Authentication() { public void fill( AuthenticationContext context, String key, Map<String, String> data ) { fail( "AuthenticationDigest should not call fill()" ); } public void digest( AuthenticationDigest digest ) { assertNotNull( digest ); assertSame( session, digest.getSession() ); assertNotNull( digest.getRepository() ); assertNull( digest.getProxy() ); assertNull( "digest() should only be called once", repos[0] ); repos[0] = digest.getRepository(); digest.update( (byte[]) null ); digest.update( (char[]) null ); digest.update( (String[]) null ); digest.update( null, null ); } }; RemoteRepository repo = newRepo( auth, newProxy( null ) ); String digest = AuthenticationDigest.forRepository( session, repo ); assertSame( repo, repos[0] ); assertNotNull( digest ); assertTrue( digest.length() > 0 ); }
public static String forRepository( RepositorySystemSession session, RemoteRepository repository ) { String digest = ""; Authentication auth = repository.getAuthentication(); if ( auth != null ) { AuthenticationDigest authDigest = new AuthenticationDigest( session, repository, null ); auth.digest( authDigest ); digest = authDigest.digest(); } return digest; }
AuthenticationDigest { public static String forRepository( RepositorySystemSession session, RemoteRepository repository ) { String digest = ""; Authentication auth = repository.getAuthentication(); if ( auth != null ) { AuthenticationDigest authDigest = new AuthenticationDigest( session, repository, null ); auth.digest( authDigest ); digest = authDigest.digest(); } return digest; } }
AuthenticationDigest { public static String forRepository( RepositorySystemSession session, RemoteRepository repository ) { String digest = ""; Authentication auth = repository.getAuthentication(); if ( auth != null ) { AuthenticationDigest authDigest = new AuthenticationDigest( session, repository, null ); auth.digest( authDigest ); digest = authDigest.digest(); } return digest; } private  AuthenticationDigest( RepositorySystemSession session, RemoteRepository repository, Proxy proxy ); }
AuthenticationDigest { public static String forRepository( RepositorySystemSession session, RemoteRepository repository ) { String digest = ""; Authentication auth = repository.getAuthentication(); if ( auth != null ) { AuthenticationDigest authDigest = new AuthenticationDigest( session, repository, null ); auth.digest( authDigest ); digest = authDigest.digest(); } return digest; } private  AuthenticationDigest( RepositorySystemSession session, RemoteRepository repository, Proxy proxy ); static String forRepository( RepositorySystemSession session, RemoteRepository repository ); static String forProxy( RepositorySystemSession session, RemoteRepository repository ); RepositorySystemSession getSession(); RemoteRepository getRepository(); Proxy getProxy(); void update( String... strings ); void update( char... chars ); void update( byte... bytes ); }
AuthenticationDigest { public static String forRepository( RepositorySystemSession session, RemoteRepository repository ) { String digest = ""; Authentication auth = repository.getAuthentication(); if ( auth != null ) { AuthenticationDigest authDigest = new AuthenticationDigest( session, repository, null ); auth.digest( authDigest ); digest = authDigest.digest(); } return digest; } private  AuthenticationDigest( RepositorySystemSession session, RemoteRepository repository, Proxy proxy ); static String forRepository( RepositorySystemSession session, RemoteRepository repository ); static String forProxy( RepositorySystemSession session, RemoteRepository repository ); RepositorySystemSession getSession(); RemoteRepository getRepository(); Proxy getProxy(); void update( String... strings ); void update( char... chars ); void update( byte... bytes );  }