use of com.sequenceiq.cloudbreak.common.json.JsonToString in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method infrastructureShouldBeStoppableForValidInstanceGroups.
@Test
public void infrastructureShouldBeStoppableForValidInstanceGroups() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "worker"));
InstanceGroup master = createGroup(List.of("ebs"), temporaryStorage, "master");
master.getTemplate().setAttributes(new JsonToString().convertToEntityAttribute("{\"sshLocation\":\"0.0.0.0/0\",\"encrypted\":false}"));
groups.add(master);
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.47.0-bXX"));
Assertions.assertEquals(StopRestrictionReason.NONE, underTest.isInfrastructureStoppable(createStack("AWS", groups)));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.48.0-bXX"));
Assertions.assertEquals(StopRestrictionReason.NONE, underTest.isInfrastructureStoppable(createStack("AWS", groups)));
}
use of com.sequenceiq.cloudbreak.common.json.JsonToString in project cloudbreak by hortonworks.
the class BlueprintToBlueprintV4ResponseConverterTest method testConvertContainsExpectedSingleKeyValuePairInTagsProperty.
@Test
public void testConvertContainsExpectedSingleKeyValuePairInTagsProperty() {
String key = "name";
String name = "greg";
Blueprint source = createSource();
source.setTags(new JsonToString().convertToEntityAttribute(String.format("{\"%s\":\"%s\"}", key, name)));
BlueprintV4Response result = underTest.convert(source);
Assert.assertNotNull(result.getTags());
Assert.assertTrue(result.getTags().containsKey(key));
Assert.assertNotNull(result.getTags().get(key));
Assert.assertEquals(name, result.getTags().get(key));
}
Aggregations