@Test public void testAddCredentials() throws IOException, ClassNotFoundException { String testUser = "test_username"; slaveServer.setUsername( testUser ); String testPassword = "test_password"; slaveServer.setPassword( testPassword ); String host = "somehost"; slaveServer.setHostname( host ); int port = 1000; slaveServer.setPort( "" + port ); HttpClientContext auth = slaveServer.getAuthContext(); Credentials cred = auth.getCredentialsProvider().getCredentials( new AuthScope( host, port ) ); assertEquals( testUser, cred.getUserPrincipal().getName() ); assertEquals( testPassword, cred.getPassword() ); String user2 = "user2"; slaveServer.setUsername( user2 ); slaveServer.setPassword( "pass2" ); auth = slaveServer.getAuthContext(); cred = auth.getCredentialsProvider().getCredentials( new AuthScope( host, port ) ); assertEquals( user2, cred.getUserPrincipal().getName() ); }
private void addCredentials( HttpClientContext context ) { String userName; String password; String host; int port; String proxyHost; lock.readLock().lock(); try { host = environmentSubstitute( hostname ); port = Const.toInt( environmentSubstitute( this.port ), 80 ); userName = environmentSubstitute( username ); password = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( this.password ) ); proxyHost = environmentSubstitute( proxyHostname ); } finally { lock.readLock().unlock(); } CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( userName, password ); if ( !Utils.isEmpty( proxyHost ) && host.equals( "localhost" ) ) { host = "127.0.0.1"; } provider.setCredentials( new AuthScope( host, port ), credentials ); context.setCredentialsProvider( provider ); HttpHost target = new HttpHost( host, port, "http" ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( target, basicAuth ); context.setAuthCache( authCache ); }
SlaveServer extends ChangedFlag implements Cloneable, SharedObjectInterface, VariableSpace,
  RepositoryElementInterface, XMLInterface { private void addCredentials( HttpClientContext context ) { String userName; String password; String host; int port; String proxyHost; lock.readLock().lock(); try { host = environmentSubstitute( hostname ); port = Const.toInt( environmentSubstitute( this.port ), 80 ); userName = environmentSubstitute( username ); password = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( this.password ) ); proxyHost = environmentSubstitute( proxyHostname ); } finally { lock.readLock().unlock(); } CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( userName, password ); if ( !Utils.isEmpty( proxyHost ) && host.equals( "localhost" ) ) { host = "127.0.0.1"; } provider.setCredentials( new AuthScope( host, port ), credentials ); context.setCredentialsProvider( provider ); HttpHost target = new HttpHost( host, port, "http" ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( target, basicAuth ); context.setAuthCache( authCache ); } }
SlaveServer extends ChangedFlag implements Cloneable, SharedObjectInterface, VariableSpace,
  RepositoryElementInterface, XMLInterface { private void addCredentials( HttpClientContext context ) { String userName; String password; String host; int port; String proxyHost; lock.readLock().lock(); try { host = environmentSubstitute( hostname ); port = Const.toInt( environmentSubstitute( this.port ), 80 ); userName = environmentSubstitute( username ); password = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( this.password ) ); proxyHost = environmentSubstitute( proxyHostname ); } finally { lock.readLock().unlock(); } CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( userName, password ); if ( !Utils.isEmpty( proxyHost ) && host.equals( "localhost" ) ) { host = "127.0.0.1"; } provider.setCredentials( new AuthScope( host, port ), credentials ); context.setCredentialsProvider( provider ); HttpHost target = new HttpHost( host, port, "http" ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( target, basicAuth ); context.setAuthCache( authCache ); } SlaveServer();  SlaveServer( String name, String hostname, String port, String username, String password );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master, boolean ssl );  SlaveServer( Node slaveNode ); }
SlaveServer extends ChangedFlag implements Cloneable, SharedObjectInterface, VariableSpace,
  RepositoryElementInterface, XMLInterface { private void addCredentials( HttpClientContext context ) { String userName; String password; String host; int port; String proxyHost; lock.readLock().lock(); try { host = environmentSubstitute( hostname ); port = Const.toInt( environmentSubstitute( this.port ), 80 ); userName = environmentSubstitute( username ); password = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( this.password ) ); proxyHost = environmentSubstitute( proxyHostname ); } finally { lock.readLock().unlock(); } CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( userName, password ); if ( !Utils.isEmpty( proxyHost ) && host.equals( "localhost" ) ) { host = "127.0.0.1"; } provider.setCredentials( new AuthScope( host, port ), credentials ); context.setCredentialsProvider( provider ); HttpHost target = new HttpHost( host, port, "http" ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( target, basicAuth ); context.setAuthCache( authCache ); } SlaveServer();  SlaveServer( String name, String hostname, String port, String username, String password );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master, boolean ssl );  SlaveServer( Node slaveNode ); static int getBackoffIncrements(); LogChannelInterface getLogChannel(); String getXML(); Object clone(); void replaceMeta( SlaveServer slaveServer ); String toString(); String getServerAndPort(); boolean equals( Object obj ); int hashCode(); String getHostname(); void setHostname( String urlString ); String getPassword(); void setPassword( String password ); String getUsername(); void setUsername( String username ); String getWebAppName(); void setWebAppName( String webAppName ); String getNonProxyHosts(); void setNonProxyHosts( String nonProxyHosts ); String getProxyHostname(); void setProxyHostname( String proxyHostname ); String getProxyPort(); void setProxyPort( String proxyPort ); String getPropertiesMasterName(); boolean isOverrideExistingProperties(); String getPort(); void setPort( String port ); String getPortSpecification(); String constructUrl( String serviceAndArguments ); String sendXML( String xml, String service ); String sendExport( String filename, String type, String load ); boolean isMaster(); void setMaster( boolean master ); String execService( String service, boolean retry ); static long getDelay( int trial ); String execService( String service ); String execService( String service, Map<String, String> headerValues ); SlaveServerStatus getStatus(); List<SlaveServerDetection> getSlaveServerDetections(); SlaveServerTransStatus getTransStatus( String transName, String carteObjectId, int startLogLineNr ); SlaveServerTransStatus getTransStatus( String transName, String carteObjectId, int startLogLineNr,
                                                boolean sendResultXmlWithStatus ); SlaveServerJobStatus getJobStatus( String jobName, String carteObjectId, int startLogLineNr ); WebResult stopTransformation( String transName, String carteObjectId ); WebResult pauseResumeTransformation( String transName, String carteObjectId ); WebResult removeTransformation( String transName, String carteObjectId ); WebResult removeJob( String jobName, String carteObjectId ); WebResult stopJob( String transName, String carteObjectId ); WebResult startTransformation( String transName, String carteObjectId ); WebResult startJob( String jobName, String carteObjectId ); WebResult cleanupTransformation( String transName, String carteObjectId ); WebResult deAllocateServerSockets( String transName, String clusteredRunId ); Properties getKettleProperties(); static SlaveServer findSlaveServer( List<SlaveServer> slaveServers, String name ); static SlaveServer findSlaveServer( List<SlaveServer> slaveServers, ObjectId id ); static String[] getSlaveServerNames( List<SlaveServer> slaveServers ); int allocateServerSocket( String runId, int portRangeStart, String hostname,
                                   String transformationName, String sourceSlaveName,
                                   String sourceStepName, String sourceStepCopy,
                                   String targetSlaveName, String targetStepName, String targetStepCopy ); String getName(); void setName( String name ); boolean isShared(); void setShared( boolean shared ); void copyVariablesFrom( VariableSpace space ); String environmentSubstitute( String aString ); String[] environmentSubstitute( String[] aString ); String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); VariableSpace getParentVariableSpace(); void setParentVariableSpace( VariableSpace parent ); String getVariable( String variableName, String defaultValue ); String getVariable( String variableName ); boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); void initializeVariablesFrom( VariableSpace parent ); String[] listVariables(); void setVariable( String variableName, String variableValue ); void shareVariablesWith( VariableSpace space ); void injectVariables( Map<String, String> prop ); ObjectId getObjectId(); void setObjectId( ObjectId id ); RepositoryDirectoryInterface getRepositoryDirectory(); void setRepositoryDirectory( RepositoryDirectoryInterface repositoryDirectory ); RepositoryObjectType getRepositoryElementType(); ObjectRevision getObjectRevision(); void setObjectRevision( ObjectRevision objectRevision ); String getDescription(); void setDescription( String description ); String verifyAndModifySlaveServerName( List<SlaveServer> slaveServers, String oldname ); String sniffStep( String transName, String stepName, String copyNr, int lines, String type ); long getNextSlaveSequenceValue( String slaveSequenceName, long incrementValue ); SlaveServer getClient(); Date getChangedDate(); void setSslMode( boolean sslMode ); boolean isSslMode(); SslConfiguration getSslConfig(); }
SlaveServer extends ChangedFlag implements Cloneable, SharedObjectInterface, VariableSpace,
  RepositoryElementInterface, XMLInterface { private void addCredentials( HttpClientContext context ) { String userName; String password; String host; int port; String proxyHost; lock.readLock().lock(); try { host = environmentSubstitute( hostname ); port = Const.toInt( environmentSubstitute( this.port ), 80 ); userName = environmentSubstitute( username ); password = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( this.password ) ); proxyHost = environmentSubstitute( proxyHostname ); } finally { lock.readLock().unlock(); } CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( userName, password ); if ( !Utils.isEmpty( proxyHost ) && host.equals( "localhost" ) ) { host = "127.0.0.1"; } provider.setCredentials( new AuthScope( host, port ), credentials ); context.setCredentialsProvider( provider ); HttpHost target = new HttpHost( host, port, "http" ); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); authCache.put( target, basicAuth ); context.setAuthCache( authCache ); } SlaveServer();  SlaveServer( String name, String hostname, String port, String username, String password );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master );  SlaveServer( String name, String hostname, String port, String username, String password,
                      String proxyHostname, String proxyPort, String nonProxyHosts, boolean master, boolean ssl );  SlaveServer( Node slaveNode ); static int getBackoffIncrements(); LogChannelInterface getLogChannel(); String getXML(); Object clone(); void replaceMeta( SlaveServer slaveServer ); String toString(); String getServerAndPort(); boolean equals( Object obj ); int hashCode(); String getHostname(); void setHostname( String urlString ); String getPassword(); void setPassword( String password ); String getUsername(); void setUsername( String username ); String getWebAppName(); void setWebAppName( String webAppName ); String getNonProxyHosts(); void setNonProxyHosts( String nonProxyHosts ); String getProxyHostname(); void setProxyHostname( String proxyHostname ); String getProxyPort(); void setProxyPort( String proxyPort ); String getPropertiesMasterName(); boolean isOverrideExistingProperties(); String getPort(); void setPort( String port ); String getPortSpecification(); String constructUrl( String serviceAndArguments ); String sendXML( String xml, String service ); String sendExport( String filename, String type, String load ); boolean isMaster(); void setMaster( boolean master ); String execService( String service, boolean retry ); static long getDelay( int trial ); String execService( String service ); String execService( String service, Map<String, String> headerValues ); SlaveServerStatus getStatus(); List<SlaveServerDetection> getSlaveServerDetections(); SlaveServerTransStatus getTransStatus( String transName, String carteObjectId, int startLogLineNr ); SlaveServerTransStatus getTransStatus( String transName, String carteObjectId, int startLogLineNr,
                                                boolean sendResultXmlWithStatus ); SlaveServerJobStatus getJobStatus( String jobName, String carteObjectId, int startLogLineNr ); WebResult stopTransformation( String transName, String carteObjectId ); WebResult pauseResumeTransformation( String transName, String carteObjectId ); WebResult removeTransformation( String transName, String carteObjectId ); WebResult removeJob( String jobName, String carteObjectId ); WebResult stopJob( String transName, String carteObjectId ); WebResult startTransformation( String transName, String carteObjectId ); WebResult startJob( String jobName, String carteObjectId ); WebResult cleanupTransformation( String transName, String carteObjectId ); WebResult deAllocateServerSockets( String transName, String clusteredRunId ); Properties getKettleProperties(); static SlaveServer findSlaveServer( List<SlaveServer> slaveServers, String name ); static SlaveServer findSlaveServer( List<SlaveServer> slaveServers, ObjectId id ); static String[] getSlaveServerNames( List<SlaveServer> slaveServers ); int allocateServerSocket( String runId, int portRangeStart, String hostname,
                                   String transformationName, String sourceSlaveName,
                                   String sourceStepName, String sourceStepCopy,
                                   String targetSlaveName, String targetStepName, String targetStepCopy ); String getName(); void setName( String name ); boolean isShared(); void setShared( boolean shared ); void copyVariablesFrom( VariableSpace space ); String environmentSubstitute( String aString ); String[] environmentSubstitute( String[] aString ); String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); VariableSpace getParentVariableSpace(); void setParentVariableSpace( VariableSpace parent ); String getVariable( String variableName, String defaultValue ); String getVariable( String variableName ); boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); void initializeVariablesFrom( VariableSpace parent ); String[] listVariables(); void setVariable( String variableName, String variableValue ); void shareVariablesWith( VariableSpace space ); void injectVariables( Map<String, String> prop ); ObjectId getObjectId(); void setObjectId( ObjectId id ); RepositoryDirectoryInterface getRepositoryDirectory(); void setRepositoryDirectory( RepositoryDirectoryInterface repositoryDirectory ); RepositoryObjectType getRepositoryElementType(); ObjectRevision getObjectRevision(); void setObjectRevision( ObjectRevision objectRevision ); String getDescription(); void setDescription( String description ); String verifyAndModifySlaveServerName( List<SlaveServer> slaveServers, String oldname ); String sniffStep( String transName, String stepName, String copyNr, int lines, String type ); long getNextSlaveSequenceValue( String slaveSequenceName, long incrementValue ); SlaveServer getClient(); Date getChangedDate(); void setSslMode( boolean sslMode ); boolean isSslMode(); SslConfiguration getSslConfig(); static final String STRING_SLAVESERVER; static final String XML_TAG; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final String SSL_MODE_TAG; static final int KETTLE_CARTE_RETRIES; static final int KETTLE_CARTE_RETRY_BACKOFF_INCREMENTS; }