@Test public void testConvertLoadAlertToLoadAlertResponse() { LoadAlert req = new LoadAlert(); req.setName("loadalert"); req.setDescription("loadalertdesc"); req.setId(10L); ScalingPolicy scalingPolicy = getScalingPolicy(); req.setScalingPolicy(scalingPolicy); when(scalingPolicyResponseConverter.convert(any(ScalingPolicy.class))).thenCallRealMethod(); LoadAlertResponse loadAlertResponse = underTest.convert(req); assertEquals("LoadAlert Name should match", loadAlertResponse.getAlertName(), "loadalert"); assertEquals("LoadAlert Desc should match", loadAlertResponse.getDescription(), "loadalertdesc"); assertEquals("LoadAlert Hostgroup should match", loadAlertResponse.getScalingPolicy().getHostGroup(), "compute"); assertEquals("LoadAlert Adjustment Type should match", loadAlertResponse.getScalingPolicy().getAdjustmentType(), NODE_COUNT); assertEquals("LoadAlert Adjustment should match", loadAlertResponse.getScalingPolicy().getScalingAdjustment(), 10); }
@Override public LoadAlertResponse convert(LoadAlert source) { LoadAlertResponse json = new LoadAlertResponse(); json.setCrn(source.getAlertCrn()); json.setAlertName(source.getName()); json.setDescription(source.getDescription()); if (source.getLoadAlertConfiguration() != null) { json.setLoadAlertConfiguration( loadAlertConfigurationResponseConverter.convert(source.getLoadAlertConfiguration())); } if (source.getScalingPolicy() != null) { json.setScalingPolicy(scalingPolicyResponseConverter.convert(source.getScalingPolicy())); } return json; }
LoadAlertResponseConverter extends AbstractConverter<LoadAlertResponse, LoadAlert> { @Override public LoadAlertResponse convert(LoadAlert source) { LoadAlertResponse json = new LoadAlertResponse(); json.setCrn(source.getAlertCrn()); json.setAlertName(source.getName()); json.setDescription(source.getDescription()); if (source.getLoadAlertConfiguration() != null) { json.setLoadAlertConfiguration( loadAlertConfigurationResponseConverter.convert(source.getLoadAlertConfiguration())); } if (source.getScalingPolicy() != null) { json.setScalingPolicy(scalingPolicyResponseConverter.convert(source.getScalingPolicy())); } return json; } }
LoadAlertResponseConverter extends AbstractConverter<LoadAlertResponse, LoadAlert> { @Override public LoadAlertResponse convert(LoadAlert source) { LoadAlertResponse json = new LoadAlertResponse(); json.setCrn(source.getAlertCrn()); json.setAlertName(source.getName()); json.setDescription(source.getDescription()); if (source.getLoadAlertConfiguration() != null) { json.setLoadAlertConfiguration( loadAlertConfigurationResponseConverter.convert(source.getLoadAlertConfiguration())); } if (source.getScalingPolicy() != null) { json.setScalingPolicy(scalingPolicyResponseConverter.convert(source.getScalingPolicy())); } return json; }  }
LoadAlertResponseConverter extends AbstractConverter<LoadAlertResponse, LoadAlert> { @Override public LoadAlertResponse convert(LoadAlert source) { LoadAlertResponse json = new LoadAlertResponse(); json.setCrn(source.getAlertCrn()); json.setAlertName(source.getName()); json.setDescription(source.getDescription()); if (source.getLoadAlertConfiguration() != null) { json.setLoadAlertConfiguration( loadAlertConfigurationResponseConverter.convert(source.getLoadAlertConfiguration())); } if (source.getScalingPolicy() != null) { json.setScalingPolicy(scalingPolicyResponseConverter.convert(source.getScalingPolicy())); } return json; }  @Override LoadAlertResponse convert(LoadAlert source); }
LoadAlertResponseConverter extends AbstractConverter<LoadAlertResponse, LoadAlert> { @Override public LoadAlertResponse convert(LoadAlert source) { LoadAlertResponse json = new LoadAlertResponse(); json.setCrn(source.getAlertCrn()); json.setAlertName(source.getName()); json.setDescription(source.getDescription()); if (source.getLoadAlertConfiguration() != null) { json.setLoadAlertConfiguration( loadAlertConfigurationResponseConverter.convert(source.getLoadAlertConfiguration())); } if (source.getScalingPolicy() != null) { json.setScalingPolicy(scalingPolicyResponseConverter.convert(source.getScalingPolicy())); } return json; }  @Override LoadAlertResponse convert(LoadAlert source);  }