@Test public void generateKeyWithObjectTest() { EnergyModellerMessage emMessage = new EnergyModellerMessage(); emMessage.setApplicationid("appID"); emMessage.setEventid("eventId"); emMessage.setDeploymentid("deploymentId"); emMessage.setUnit("unit"); emMessage.setProvider("provider"); emMessage.setValue("0.0"); emMessage.setGenerattiontimestamp("generation"); emMessage.setReferredtimestamp("referal"); String vm1 = "vm1"; String vm2 = "vm2"; List<String> vms = new ArrayList<String>(); vms.add(vm1); vms.add(vm2); emMessage.setVms(vms); String key = EnergyModellerQueueController.generateKey(emMessage); assertEquals("appID" + "eventId" + "deploymentId" + "vm1" + "vm2" + "unit", key); emMessage.setVms(null); key = EnergyModellerQueueController.generateKey(emMessage); assertEquals("appID" + "eventId" + "deploymentId" + "unit", key); }
public static String generateKey(EnergyModellerMessage emMessage) { if(emMessage != null) { return generateKey(emMessage.getApplicationid(), emMessage.getEventid(), emMessage.getDeploymentid(), emMessage.getVms(), emMessage.getUnit()); } else { return null; } }
EnergyModellerQueueController implements InitializingBean { public static String generateKey(EnergyModellerMessage emMessage) { if(emMessage != null) { return generateKey(emMessage.getApplicationid(), emMessage.getEventid(), emMessage.getDeploymentid(), emMessage.getVms(), emMessage.getUnit()); } else { return null; } } }
EnergyModellerQueueController implements InitializingBean { public static String generateKey(EnergyModellerMessage emMessage) { if(emMessage != null) { return generateKey(emMessage.getApplicationid(), emMessage.getEventid(), emMessage.getDeploymentid(), emMessage.getVms(), emMessage.getUnit()); } else { return null; } } EnergyModellerQueueController(); }
EnergyModellerQueueController implements InitializingBean { public static String generateKey(EnergyModellerMessage emMessage) { if(emMessage != null) { return generateKey(emMessage.getApplicationid(), emMessage.getEventid(), emMessage.getDeploymentid(), emMessage.getVms(), emMessage.getUnit()); } else { return null; } } EnergyModellerQueueController(); @Override void afterPropertiesSet(); void addMessage(EnergyModellerMessage emMessage, String type); EnergyModellerMessage getMeasurementMessage(String key); EnergyModellerMessage getPredictionMessage(String key); static Map<K, V> createLRUMap(final int maxEntries); static String generateKey(EnergyModellerMessage emMessage); static String generateKey(String applicationId, String eventId, String deploymentId, List<String> vmsId, String unit); }
EnergyModellerQueueController implements InitializingBean { public static String generateKey(EnergyModellerMessage emMessage) { if(emMessage != null) { return generateKey(emMessage.getApplicationid(), emMessage.getEventid(), emMessage.getDeploymentid(), emMessage.getVms(), emMessage.getUnit()); } else { return null; } } EnergyModellerQueueController(); @Override void afterPropertiesSet(); void addMessage(EnergyModellerMessage emMessage, String type); EnergyModellerMessage getMeasurementMessage(String key); EnergyModellerMessage getPredictionMessage(String key); static Map<K, V> createLRUMap(final int maxEntries); static String generateKey(EnergyModellerMessage emMessage); static String generateKey(String applicationId, String eventId, String deploymentId, List<String> vmsId, String unit); static final String WATT; static final String WATTHOUR; static final String COUNT; static final String SEC; static final String APP_DURATION; static final String APP_COUNT; static final String MEASUREMENTS; static final String PREDICTIONS; }