Repository: stratos
Updated Branches:
  refs/heads/master 81ae4dc8a -> e45f31f1b


Update object converted according to load threshold update


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e45f31f1
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e45f31f1
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e45f31f1

Branch: refs/heads/master
Commit: e45f31f1b0a7737c10a9235577c7af1fd7de43fb
Parents: dbe463c
Author: Lahiru Sandaruwan <[email protected]>
Authored: Mon Dec 22 17:22:28 2014 +0530
Committer: Lahiru Sandaruwan <[email protected]>
Committed: Mon Dec 22 17:28:38 2014 +0530

----------------------------------------------------------------------
 .../util/converter/ObjectConverter.java         | 33 +++++++-------------
 1 file changed, 11 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/e45f31f1/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index 9bc5114..0272559 100644
--- 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -341,30 +341,19 @@ public class ObjectConverter {
             if (autoscalePolicyBean.getLoadThresholds().getLoadAverage() != 
null) {
 
                 //set load average information
-                
org.apache.stratos.autoscaler.stub.autoscale.policy.LoadAverageThresholds 
loadAverage = new
-                        
org.apache.stratos.autoscaler.stub.autoscale.policy.LoadAverageThresholds();
-                
loadAverage.setUpperLimit(autoscalePolicyBean.getLoadThresholds().getLoadAverage().getThreshold());
-                //set load average
-                loadThresholds.setLoadAverage(loadAverage);
+                loadThresholds.setMemoryConsumptionThreshold(
+                        
autoscalePolicyBean.getLoadThresholds().getLoadAverage().getThreshold());
             }
             if (autoscalePolicyBean.getLoadThresholds().getRequestsInFlight() 
!= null) {
 
-                
org.apache.stratos.autoscaler.stub.autoscale.policy.RequestsInFlightThresholds 
requestsInFlight = new
-                        
org.apache.stratos.autoscaler.stub.autoscale.policy.RequestsInFlightThresholds();
                 //set request in flight information
-                
requestsInFlight.setUpperLimit(autoscalePolicyBean.getLoadThresholds().getRequestsInFlight().getThreshold());
-                //set request in flight
-                loadThresholds.setRequestsInFlight(requestsInFlight);
+                loadThresholds.setRequestsInFlightThreshold(
+                        
autoscalePolicyBean.getLoadThresholds().getRequestsInFlight().getThreshold());
             }
             if (autoscalePolicyBean.getLoadThresholds().getMemoryConsumption() 
!= null) {
 
-                
org.apache.stratos.autoscaler.stub.autoscale.policy.MemoryConsumptionThresholds 
memoryConsumption = new
-                        
org.apache.stratos.autoscaler.stub.autoscale.policy.MemoryConsumptionThresholds();
-
                 //set memory consumption information
-                
memoryConsumption.setUpperLimit(autoscalePolicyBean.getLoadThresholds().getMemoryConsumption().getThreshold());
-                //set memory consumption
-                loadThresholds.setMemoryConsumption(memoryConsumption);
+                
loadThresholds.setMemoryConsumptionThreshold(autoscalePolicyBean.getLoadThresholds().getMemoryConsumption().getThreshold());
             }
 
             autoscalePolicy.setLoadThresholds(loadThresholds);
@@ -863,19 +852,19 @@ public class ObjectConverter {
                                                                                
      loadThresholds) {
 
         LoadThresholds loadThresholdBean = new LoadThresholds();
-        if (loadThresholds.getLoadAverage() != null) {
+        if (loadThresholds.getLoadAverageThreshold() != 0) {
             LoadAverageThresholds loadAverage = new LoadAverageThresholds();
-            
loadAverage.setThreshold(loadThresholds.getLoadAverage().getUpperLimit());
+            loadAverage.setThreshold(loadThresholds.getLoadAverageThreshold());
             loadThresholdBean.setLoadAverage(loadAverage);
         }
-        if (loadThresholds.getMemoryConsumption() != null) {
+        if (loadThresholds.getMemoryConsumptionThreshold() != 0) {
             MemoryConsumptionThresholds memoryConsumption = new 
MemoryConsumptionThresholds();
-            
memoryConsumption.setThreshold(loadThresholds.getMemoryConsumption().getUpperLimit());
+            
memoryConsumption.setThreshold(loadThresholds.getMemoryConsumptionThreshold());
             loadThresholdBean.setMemoryConsumption(memoryConsumption);
         }
-        if (loadThresholds.getRequestsInFlight() != null) {
+        if (loadThresholds.getRequestsInFlightThreshold() != 0) {
             RequestsInFlightThresholds requestsInFlight = new 
RequestsInFlightThresholds();
-            
requestsInFlight.setThreshold(loadThresholds.getRequestsInFlight().getUpperLimit());
+            
requestsInFlight.setThreshold(loadThresholds.getRequestsInFlightThreshold());
             loadThresholdBean.setRequestsInFlight(requestsInFlight);
         }
 

Reply via email to