use of com.sequenceiq.common.api.type.InstanceGroupType in project cloudbreak by hortonworks.
the class JsonTest method testMembers.
@Test
public void testMembers() throws JsonProcessingException {
Map<InstanceGroupType, String> userData = new EnumMap<>(InstanceGroupType.class);
userData.put(InstanceGroupType.CORE, "CORE");
Image image = new Image("cb-centos66-amb200-2015-05-25", userData, "redhat6", "redhat6", "", "default", "default-id", new HashMap<>());
Json json = new Json(image);
Assert.assertEquals("{\"imageName\":\"cb-centos66-amb200-2015-05-25\",\"userdata\":{\"CORE\":\"CORE\"},\"os\":\"redhat6\",\"osType\":\"redhat6\"," + "\"imageCatalogUrl\":\"\",\"imageCatalogName\":\"default\",\"imageId\":\"default-id\",\"packageVersions\":{}}", json.getValue());
}
use of com.sequenceiq.common.api.type.InstanceGroupType in project cloudbreak by hortonworks.
the class JsonTest method testMultipleSerialisation.
// The reason for this to check whether serialisetion-deserialisation-serialisation results the same json
@Test
public void testMultipleSerialisation() throws IOException {
Map<InstanceGroupType, String> userData = new EnumMap<>(InstanceGroupType.class);
userData.put(InstanceGroupType.CORE, "CORE");
Image image = new Image("cb-centos66-amb200-2015-05-25", userData, "redhat6", "redhat6", "", "default", "default-id", new HashMap<>());
Json json = new Json(image);
String expected = json.getValue();
Image covertedAgain = json.get(Image.class);
json = new Json(covertedAgain);
Assert.assertEquals(expected, json.getValue());
}
use of com.sequenceiq.common.api.type.InstanceGroupType in project cloudbreak by hortonworks.
the class StackDecoratorTest method createInstanceGroups.
private Set<InstanceGroup> createInstanceGroups(InstanceGroupType... types) {
Set<InstanceGroup> groups = new LinkedHashSet<>(types.length);
int i = 0;
for (InstanceGroupType type : types) {
InstanceGroup group = mock(InstanceGroup.class);
when(group.getInstanceGroupType()).thenReturn(type);
when(group.getGroupName()).thenReturn("name" + i);
when(group.getNodeCount()).thenReturn(2);
groups.add(group);
}
return groups;
}
use of com.sequenceiq.common.api.type.InstanceGroupType in project cloudbreak by hortonworks.
the class UserDataBuilderTest method testBuildUserDataAzure.
@Test
public void testBuildUserDataAzure() throws IOException {
String expectedGwScript = FileReaderUtils.readFileFromClasspath("azure-gateway-init.sh");
String expectedCoreScript = FileReaderUtils.readFileFromClasspath("azure-core-init.sh");
Map<InstanceGroupType, String> userdata = underTest.buildUserData(Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", getPlatformParameters(), "pass", "cert", new CcmConnectivityParameters(), null);
Assert.assertEquals(expectedGwScript, userdata.get(InstanceGroupType.GATEWAY));
Assert.assertEquals(expectedCoreScript, userdata.get(InstanceGroupType.CORE));
}
use of com.sequenceiq.common.api.type.InstanceGroupType in project cloudbreak by hortonworks.
the class SecurityAccessManifesterTest method overrideSecurityAccessWhenOneCidrRangeProvidedThenShouldUpdateTheCidrRange.
@Test
void overrideSecurityAccessWhenOneCidrRangeProvidedThenShouldUpdateTheCidrRange() {
InstanceGroupType gateway = GATEWAY;
List<InstanceGroupV4Request> instanceGroups = getInstanceGroups();
String theWholeWorld = "0.0.0.0/0";
securityAccessManifester.overrideSecurityAccess(gateway, instanceGroups, null, theWholeWorld);
assertEquals(1, instanceGroups.get(0).getSecurityGroup().getSecurityRules().size());
assertEquals(List.of(theWholeWorld), collectSubnets(instanceGroups));
}
Aggregations