@Test public void generateKeyByParametersTest() { String applicationId = "appID"; String eventId = "eventId"; String deploymentId = "deploymentId"; String vm1 = "vm1"; String vm2 = "vm2"; String unit = "unit"; List<String> vms = new ArrayList<String>(); vms.add(vm1); vms.add(vm2); String key = EnergyModellerQueueController.generateKey(applicationId, eventId, deploymentId, vms, unit); assertEquals(applicationId + eventId + deploymentId + vm1 + vm2 + unit, key); key = EnergyModellerQueueController.generateKey(applicationId, eventId, deploymentId, null, unit); assertEquals(applicationId + 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; }