### Question:
AbstractContinuumProjectBuilder implements ContinuumProjectBuilder, Initializable { protected File createMetadataFile( File importRoot, URL metadata, String username, String password, ContinuumProjectBuildingResult result ) throws IOException, URISyntaxException, HttpException { DefaultHttpClient httpClient = new DefaultHttpClient( cm, params ); String url = metadata.toExternalForm(); if ( metadata.getProtocol().startsWith( "http" ) ) { url = hidePasswordInUrl( url ); } log.info( "Downloading " + url ); InputStream is = null; try { if ( metadata.getProtocol().startsWith( "http" ) ) { URI uri = metadata.toURI(); HttpGet httpGet = new HttpGet( uri ); httpClient.getCredentialsProvider().clear(); if ( username != null && password != null ) { httpClient.getCredentialsProvider().setCredentials( new AuthScope( uri.getHost(), uri.getPort() ), new UsernamePasswordCredentials( username, password ) ); } HttpResponse httpResponse = httpClient.execute( httpGet ); if ( httpResponse.getStatusLine().getStatusCode() != 200 ) { log.debug( "Initial attempt did not return a 200 status code. Trying pre-emptive authentication.." ); HttpHost targetHost = new HttpHost( uri.getHost(), uri.getPort(), uri.getScheme() ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( targetHost, basicAuth ); BasicHttpContext localcontext = new BasicHttpContext(); localcontext.setAttribute( ClientContext.AUTH_CACHE, authCache ); httpResponse = httpClient.execute( targetHost, httpGet, localcontext ); } int res = httpResponse.getStatusLine().getStatusCode(); switch ( res ) { case 200: break; case 401: log.error( "Error adding project: Unauthorized " + url ); result.addError( ContinuumProjectBuildingResult.ERROR_UNAUTHORIZED ); return null; default: log.warn( "skip non handled http return code " + res ); } is = IOUtils.toInputStream( EntityUtils.toString( httpResponse.getEntity(), EntityUtils.getContentCharSet( httpResponse.getEntity() ) ) ); } else { is = metadata.openStream(); } String path = metadata.getPath(), baseDirectory, fileName; int lastIndex = path.lastIndexOf( "/" ); if ( lastIndex >= 0 ) { baseDirectory = path.substring( 0, lastIndex ); int colonIndex = baseDirectory.indexOf( ":" ); if ( colonIndex >= 0 ) { baseDirectory = baseDirectory.substring( colonIndex + 1 ); } fileName = path.substring( lastIndex + 1 ); } else { baseDirectory = ""; fileName = path; } baseDirectory = baseDirectory.replaceAll( "[*]", "" ); File uploadDirectory = new File( importRoot, baseDirectory ); uploadDirectory.mkdirs(); File file = new File( uploadDirectory, fileName ); fsManager.writeFile( file, is ); return file; } finally { if ( is != null ) { is.close(); } } }  void initialize();  }### Answer:
@Test @Ignore( "requires a password protected resource under https" ) public void testCreateMetadataFileURLStringString() throws Exception { URL url = new URL( "https: String username = "myusername"; String password = "mypassword"; builder.createMetadataFile( importRoot, url, username, password, new ContinuumProjectBuildingResult() ); }