use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.
the class SecurityRuleService method getDefaultSecurityRules.
public SecurityRulesV4Response getDefaultSecurityRules() {
SecurityRulesV4Response ret = new SecurityRulesV4Response();
Set<String> defaultGatewayCidrs = defaultGatewayCidr.stream().filter(StringUtils::isNotBlank).collect(Collectors.toSet());
if (!defaultGatewayCidrs.isEmpty()) {
defaultGatewayCidr.forEach(cloudbreakCidr -> addCidrAndPort(ret, cloudbreakCidr));
}
return ret;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.
the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsDisabledAndHttpsPortIsSet.
@Test
public void getDefaultSecurityRulesWhenKnoxIsDisabledAndHttpsPortIsSet() {
SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
Assert.assertEquals(1, defaultSecurityRules.getCore().size());
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.
the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsEnabledAndKnoxPortIsSet.
@Test
public void getDefaultSecurityRulesWhenKnoxIsEnabledAndKnoxPortIsSet() {
SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
Assert.assertEquals(1, defaultSecurityRules.getCore().size());
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.
the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsEnabled.
@Test
public void getDefaultSecurityRulesWhenKnoxIsEnabled() {
SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
Assert.assertEquals(1, defaultSecurityRules.getCore().size());
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
Aggregations