use of org.apache.nifi.remote.protocol.http.HttpProxy in project nifi by apache.
the class SiteToSiteCliMainTest method testParseProxy.
@Test
public void testParseProxy() throws ParseException {
String expectedHost = "testHost";
int expectedPort = 292;
String expectedUser = "testUser";
String expectedPassword = "badPassword";
expectedHttpProxy = new HttpProxy(expectedHost, expectedPort, expectedUser, expectedPassword);
parseAndCheckExpected(new String[] { "--" + SiteToSiteCliMain.PROXY_HOST_OPTION, expectedHost, "--" + SiteToSiteCliMain.PROXY_PORT_OPTION, Integer.toString(expectedPort), "--" + SiteToSiteCliMain.PROXY_USERNAME_OPTION, expectedUser, "--" + SiteToSiteCliMain.PROXY_PASSWORD_OPTION, expectedPassword });
}
use of org.apache.nifi.remote.protocol.http.HttpProxy in project nifi by apache.
the class SiteToSiteCliMainTest method parseAndCheckExpected.
private void parseAndCheckExpected(String[] args) throws ParseException {
SiteToSiteCliMain.CliParse cliParse = SiteToSiteCliMain.parseCli(new Options(), args);
SiteToSiteClient.Builder builder = cliParse.getBuilder();
assertEquals(expectedUrl, builder.getUrl());
assertEquals(expectedSiteToSiteTransportProtocol, builder.getTransportProtocol());
assertEquals(expectedPortName, builder.getPortName());
assertEquals(expectedPortIdentifier, builder.getPortIdentifier());
assertEquals(expectedTimeoutNs, builder.getTimeout(TimeUnit.NANOSECONDS));
assertEquals(expectedPenalizationNs, builder.getPenalizationPeriod(TimeUnit.NANOSECONDS));
assertEquals(expectedKeystoreFilename, builder.getKeystoreFilename());
assertEquals(expectedKeystorePass, builder.getKeystorePass());
assertEquals(expectedKeystoreType, builder.getKeystoreType());
assertEquals(expectedTruststoreFilename, builder.getTruststoreFilename());
assertEquals(expectedTruststorePass, builder.getTruststorePass());
assertEquals(expectedTruststoreType, builder.getTruststoreType());
assertEquals(expectedCompression, builder.isUseCompression());
assertEquals(expectedPeerPersistenceFile, builder.getPeerPersistenceFile());
if (expectedHttpProxy == null) {
assertNull(builder.getHttpProxy());
} else {
HttpProxy httpProxy = builder.getHttpProxy();
assertNotNull(httpProxy);
assertEquals(expectedHttpProxy.getHttpHost(), httpProxy.getHttpHost());
assertEquals(expectedHttpProxy.getUsername(), httpProxy.getUsername());
assertEquals(expectedHttpProxy.getPassword(), httpProxy.getPassword());
}
SiteToSiteClientConfig siteToSiteClientConfig = builder.buildConfig();
assertEquals(expectedBatchCount, siteToSiteClientConfig.getPreferredBatchCount());
assertEquals(expectedBatchDuration, siteToSiteClientConfig.getPreferredBatchDuration(TimeUnit.NANOSECONDS));
assertEquals(expectedBatchSize, siteToSiteClientConfig.getPreferredBatchSize());
assertEquals(expectedTransferDirection, cliParse.getTransferDirection());
}
Aggregations