Search in sources :

Example 16 with CcmConnectivityParameters

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));
}
Also used : DefaultCcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters) CcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters) CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) BaseServiceEndpoint(com.sequenceiq.cloudbreak.ccm.endpoint.BaseServiceEndpoint) DefaultInstanceParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultInstanceParameters) HostEndpoint(com.sequenceiq.cloudbreak.ccm.endpoint.HostEndpoint) DefaultServerParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultServerParameters) DefaultTunnelParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultTunnelParameters) Test(org.junit.Test)

Example 17 with CcmConnectivityParameters

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));
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) DefaultCcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters) CcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2Parameters) DefaultCcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters) Test(org.junit.Test)

Example 18 with CcmConnectivityParameters

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));
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) ProxyConfig(com.sequenceiq.cloudbreak.dto.ProxyConfig) Test(org.junit.Test)

Example 19 with CcmConnectivityParameters

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));
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) CcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2JumpgateParameters) Test(org.junit.Test)

Example 20 with CcmConnectivityParameters

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));
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) ProxyAuthentication(com.sequenceiq.cloudbreak.dto.ProxyAuthentication) ProxyConfig(com.sequenceiq.cloudbreak.dto.ProxyConfig) Test(org.junit.Test)

Aggregations

CcmConnectivityParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters)28 Test (org.junit.jupiter.api.Test)12 InstanceGroupType (com.sequenceiq.common.api.type.InstanceGroupType)7 PlatformParameters (com.sequenceiq.cloudbreak.cloud.PlatformParameters)6 Stack (com.sequenceiq.freeipa.entity.Stack)6 Test (org.junit.Test)6 DefaultCcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters)5 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)5 ProxyConfig (com.sequenceiq.cloudbreak.dto.ProxyConfig)5 CcmParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters)4 CcmV2Parameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2Parameters)4 DefaultCcmParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters)4 DefaultCcmV2Parameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters)4 ScriptParams (com.sequenceiq.cloudbreak.cloud.model.ScriptParams)4 DisplayName (org.junit.jupiter.api.DisplayName)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 CcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2JumpgateParameters)3 Optional (java.util.Optional)3 DefaultInstanceParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultInstanceParameters)2 DefaultServerParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultServerParameters)2