@Test public void convertEnergySampleListTest() { List<EventSample> nullEventSamples = null; List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = EnergyModellerConverter.convertList(nullEventSamples); assertEquals(null, newEventSamples); EventSample eventSample1 = new EventSample(); eventSample1.setCvalue(1.0); eventSample1.setEvalue(2.0); eventSample1.setPvalue(3.0); eventSample1.setTimestampBeging(1l); eventSample1.setTimestampEnd(2l); eventSample1.setVmid("vmid"); eventSample1.setAppid("appid"); EventSample eventSample2 = new EventSample(); eventSample2.setCvalue(4.0); eventSample2.setEvalue(5.0); eventSample2.setPvalue(6.0); eventSample2.setTimestampBeging(3l); eventSample2.setTimestampEnd(4l); eventSample2.setVmid("vmid2"); eventSample2.setAppid("appid2"); List<EventSample> eventSamples = new ArrayList<EventSample>(); eventSamples.add(eventSample1); eventSamples.add(eventSample2); newEventSamples = EnergyModellerConverter.convertList(eventSamples); assertEquals(2, newEventSamples.size()); assertEquals(1.0, newEventSamples.get(0).getCvalue(), 0.00001); assertEquals(2.0, newEventSamples.get(0).getEvalue(), 0.00001); assertEquals(3.0, newEventSamples.get(0).getPvalue(), 0.00001); assertEquals(1l, newEventSamples.get(0).getTimestampBeging()); assertEquals(2l, newEventSamples.get(0).getTimestampEnd()); assertEquals("vmid", newEventSamples.get(0).getVmid()); assertEquals("appid", newEventSamples.get(0).getAppid()); assertEquals(4.0, newEventSamples.get(1).getCvalue(), 0.00001); assertEquals(5.0, newEventSamples.get(1).getEvalue(), 0.00001); assertEquals(6.0, newEventSamples.get(1).getPvalue(), 0.00001); assertEquals(3l, newEventSamples.get(1).getTimestampBeging()); assertEquals(4l, newEventSamples.get(1).getTimestampEnd()); assertEquals("vmid2", newEventSamples.get(1).getVmid()); assertEquals("appid2", newEventSamples.get(1).getAppid()); }
public static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples) { if(eventSamples == null) { return null; } List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = new ArrayList<eu.ascetic.paas.applicationmanager.model.EventSample>(); for(EventSample eventSample : eventSamples) { eu.ascetic.paas.applicationmanager.model.EventSample newEventSample = convert(eventSample); newEventSamples.add(newEventSample); } return newEventSamples; }
EnergyModellerConverter { public static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples) { if(eventSamples == null) { return null; } List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = new ArrayList<eu.ascetic.paas.applicationmanager.model.EventSample>(); for(EventSample eventSample : eventSamples) { eu.ascetic.paas.applicationmanager.model.EventSample newEventSample = convert(eventSample); newEventSamples.add(newEventSample); } return newEventSamples; } }
EnergyModellerConverter { public static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples) { if(eventSamples == null) { return null; } List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = new ArrayList<eu.ascetic.paas.applicationmanager.model.EventSample>(); for(EventSample eventSample : eventSamples) { eu.ascetic.paas.applicationmanager.model.EventSample newEventSample = convert(eventSample); newEventSamples.add(newEventSample); } return newEventSamples; }  }
EnergyModellerConverter { public static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples) { if(eventSamples == null) { return null; } List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = new ArrayList<eu.ascetic.paas.applicationmanager.model.EventSample>(); for(EventSample eventSample : eventSamples) { eu.ascetic.paas.applicationmanager.model.EventSample newEventSample = convert(eventSample); newEventSamples.add(newEventSample); } return newEventSamples; }  static eu.ascetic.paas.applicationmanager.model.EventSample convert(EventSample eventSample); static eu.ascetic.paas.applicationmanager.model.ApplicationSample convert(ApplicationSample applicationSample); static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples); static List<eu.ascetic.paas.applicationmanager.model.ApplicationSample> convertSampleList(List<ApplicationSample> applicationSamples); }
EnergyModellerConverter { public static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples) { if(eventSamples == null) { return null; } List<eu.ascetic.paas.applicationmanager.model.EventSample> newEventSamples = new ArrayList<eu.ascetic.paas.applicationmanager.model.EventSample>(); for(EventSample eventSample : eventSamples) { eu.ascetic.paas.applicationmanager.model.EventSample newEventSample = convert(eventSample); newEventSamples.add(newEventSample); } return newEventSamples; }  static eu.ascetic.paas.applicationmanager.model.EventSample convert(EventSample eventSample); static eu.ascetic.paas.applicationmanager.model.ApplicationSample convert(ApplicationSample applicationSample); static List<eu.ascetic.paas.applicationmanager.model.EventSample> convertList(List<EventSample> eventSamples); static List<eu.ascetic.paas.applicationmanager.model.ApplicationSample> convertSampleList(List<ApplicationSample> applicationSamples);  }