use of com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataWithCCM.
@Test
public void testBuildUserDataWithCCM() throws IOException {
BaseServiceEndpoint serviceEndpoint = new BaseServiceEndpoint(new HostEndpoint("ccm.cloudera.com"));
DefaultServerParameters serverParameters = new DefaultServerParameters(serviceEndpoint, "pub-key", "mina-id");
DefaultInstanceParameters instanceParameters = new DefaultInstanceParameters("tunnel-id", "key-id", "private-key");
DefaultTunnelParameters nginxTunnel = new DefaultTunnelParameters(KnownServiceIdentifier.GATEWAY, 9443);
DefaultTunnelParameters knoxTunnel = new DefaultTunnelParameters(KnownServiceIdentifier.KNOX, 8443);
CcmParameters ccmParameters = new DefaultCcmParameters(serverParameters, instanceParameters, List.of(nginxTunnel, knoxTunnel));
CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmParameters);
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", ccmConnectivityParameters, null);
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-ccm-init.sh");
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-ccm-init.sh");
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
}
use of com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataWithCCMV2.
@Test
public void testBuildUserDataWithCCMV2() throws IOException {
CcmV2Parameters ccmV2Parameters = new DefaultCcmV2Parameters("invertingProxyHost", "invertingProxyCertificate", "agentCrn", "agentKeyId", "agentEncipheredPrivateKey", "agentCertificate");
CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmV2Parameters);
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", ccmConnectivityParameters, null);
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-ccm-init.sh");
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-ccm-v2-init.sh");
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
}
use of com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataAzureWithNoAuthProxy.
@Test
public void testBuildUserDataAzureWithNoAuthProxy() throws IOException {
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-init-noauthproxy.sh");
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-init.sh");
ProxyConfig proxyConfig = ProxyConfig.builder().withServerHost("proxy.host").withServerPort(1234).withNoProxyHosts("noproxy.com").withProtocol("http").build();
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", new CcmConnectivityParameters(), proxyConfig);
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
}
use of com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataWithCCMV2Jumpgate.
@Test
public void testBuildUserDataWithCCMV2Jumpgate() throws IOException {
CcmV2JumpgateParameters ccmV2JumpgateParameters = new DefaultCcmV2JumpgateParameters();
CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmV2JumpgateParameters);
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", ccmConnectivityParameters, null);
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-ccm-init.sh");
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-ccm-v2-jumpgate-init.sh");
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
}
use of com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataAzureWithAuthProxy.
@Test
public void testBuildUserDataAzureWithAuthProxy() throws IOException {
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-init-authproxy.sh");
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-init.sh");
ProxyAuthentication proxyAuthentication = ProxyAuthentication.builder().withUserName("user").withPassword("pwd").build();
ProxyConfig proxyConfig = ProxyConfig.builder().withServerHost("proxy.host").withServerPort(1234).withProxyAuthentication(proxyAuthentication).withNoProxyHosts("noproxy.com").withProtocol("https").build();
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", new CcmConnectivityParameters(), proxyConfig);
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
}
Aggregations