Skip to content

Commit eb872b9

Browse files
committed
address Wei's reviews
1 parent bdce6c0 commit eb872b9

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

api/src/main/java/com/cloud/network/as/AutoScaleService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import java.util.List;
2020

21-
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterForAutoScaleConditionCmd;
21+
import org.apache.cloudstack.api.command.admin.autoscale.CreateAutoScaleCounterCmd;
2222
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleConditionCmd;
2323
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
2424
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
@@ -27,7 +27,7 @@
2727
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
2828
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
2929
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionsCmd;
30-
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionCountersCmd;
30+
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleCountersCmd;
3131
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
3232
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
3333
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
@@ -68,13 +68,13 @@ public interface AutoScaleService {
6868

6969
List<? extends AutoScaleVmGroup> listAutoScaleVmGroups(ListAutoScaleVmGroupsCmd listAutoScaleVmGroupsCmd);
7070

71-
Counter createCounter(CreateCounterForAutoScaleConditionCmd cmd);
71+
Counter createCounter(CreateAutoScaleCounterCmd cmd);
7272

7373
Counter getCounter(long counterId);
7474

7575
boolean deleteCounter(long counterId) throws ResourceInUseException;
7676

77-
List<? extends Counter> listCounters(ListAutoScaleConditionCountersCmd cmd);
77+
List<? extends Counter> listCounters(ListAutoScaleCountersCmd cmd);
7878

7979
Condition createCondition(CreateAutoScaleConditionCmd cmd);
8080

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
@APICommand(name = "createCounter", description = "Adds metric counter for VM auto scaling", responseObject = CounterResponse.class,
3636
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
37-
public class CreateCounterForAutoScaleConditionCmd extends BaseAsyncCreateCmd {
37+
public class CreateAutoScaleCounterCmd extends BaseAsyncCreateCmd {
3838
private static final String s_name = "counterresponse";
3939

4040
// ///////////////////////////////////////////////////
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
@APICommand(name = "deleteCounter", description = "Deletes a counter for VM auto scaling", responseObject = SuccessResponse.class,
3636
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
37-
public class DeleteAutoScaleConditionCounterCmd extends BaseAsyncCmd {
37+
public class DeleteAutoScaleCounterCmd extends BaseAsyncCmd {
3838

3939
// ///////////////////////////////////////////////////
4040
// ////////////// API parameters /////////////////////
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
@APICommand(name = "listCounters", description = "List the counters for VM auto scaling", responseObject = CounterResponse.class,
3535
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
36-
public class ListAutoScaleConditionCountersCmd extends BaseListCmd {
36+
public class ListAutoScaleCountersCmd extends BaseListCmd {
3737
private static final String s_name = "counterresponse";
3838

3939
// ///////////////////////////////////////////////////

server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
5151
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
5252
import org.apache.cloudstack.api.ServerApiException;
53-
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterForAutoScaleConditionCmd;
53+
import org.apache.cloudstack.api.command.admin.autoscale.CreateAutoScaleCounterCmd;
5454
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleConditionCmd;
5555
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
5656
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
@@ -59,7 +59,7 @@
5959
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
6060
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
6161
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionsCmd;
62-
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionCountersCmd;
62+
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleCountersCmd;
6363
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
6464
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
6565
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
@@ -1454,7 +1454,7 @@ public AutoScaleVmGroup disableAutoScaleVmGroup(Long id) {
14541454
@Override
14551455
@ActionEvent(eventType = EventTypes.EVENT_COUNTER_CREATE, eventDescription = "Counter", create = true)
14561456
@DB
1457-
public Counter createCounter(CreateCounterForAutoScaleConditionCmd cmd) {
1457+
public Counter createCounter(CreateAutoScaleCounterCmd cmd) {
14581458
String source = cmd.getSource().toUpperCase();
14591459
String name = cmd.getName();
14601460
String value = cmd.getValue();
@@ -1527,7 +1527,7 @@ public Condition createCondition(CreateAutoScaleConditionCmd cmd) {
15271527
}
15281528

15291529
@Override
1530-
public List<? extends Counter> listCounters(ListAutoScaleConditionCountersCmd cmd) {
1530+
public List<? extends Counter> listCounters(ListAutoScaleCountersCmd cmd) {
15311531
String name = cmd.getName();
15321532
Long id = cmd.getId();
15331533
String source = cmd.getSource();

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
6565
import org.apache.cloudstack.api.command.admin.affinitygroup.UpdateVMAffinityGroupCmdByAdmin;
6666
import org.apache.cloudstack.api.command.admin.alert.GenerateAlertCmd;
67-
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterForAutoScaleConditionCmd;
68-
import org.apache.cloudstack.api.command.admin.autoscale.DeleteAutoScaleConditionCounterCmd;
67+
import org.apache.cloudstack.api.command.admin.autoscale.CreateAutoScaleCounterCmd;
68+
import org.apache.cloudstack.api.command.admin.autoscale.DeleteAutoScaleCounterCmd;
6969
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
7070
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
7171
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
@@ -371,7 +371,7 @@
371371
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
372372
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
373373
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionsCmd;
374-
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionCountersCmd;
374+
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleCountersCmd;
375375
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
376376
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
377377
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
@@ -3698,8 +3698,8 @@ public List<Class<?>> getCommands() {
36983698
cmdList.add(EnableAccountCmd.class);
36993699
cmdList.add(LockAccountCmd.class);
37003700
cmdList.add(UpdateAccountCmd.class);
3701-
cmdList.add(CreateCounterForAutoScaleConditionCmd.class);
3702-
cmdList.add(DeleteAutoScaleConditionCounterCmd.class);
3701+
cmdList.add(CreateAutoScaleCounterCmd.class);
3702+
cmdList.add(DeleteAutoScaleCounterCmd.class);
37033703
cmdList.add(AddClusterCmd.class);
37043704
cmdList.add(DeleteClusterCmd.class);
37053705
cmdList.add(ListClustersCmd.class);
@@ -3870,7 +3870,7 @@ public List<Class<?>> getCommands() {
38703870
cmdList.add(ListAutoScaleVmGroupsCmd.class);
38713871
cmdList.add(ListAutoScaleVmProfilesCmd.class);
38723872
cmdList.add(ListAutoScaleConditionsCmd.class);
3873-
cmdList.add(ListAutoScaleConditionCountersCmd.class);
3873+
cmdList.add(ListAutoScaleCountersCmd.class);
38743874
cmdList.add(UpdateAutoScalePolicyCmd.class);
38753875
cmdList.add(UpdateAutoScaleVmGroupCmd.class);
38763876
cmdList.add(UpdateAutoScaleVmProfileCmd.class);

server/src/test/java/com/cloud/network/as/AutoScaleManagerImplTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
import org.apache.cloudstack.annotation.dao.AnnotationDao;
5050
import org.apache.cloudstack.api.ApiConstants;
5151
import org.apache.cloudstack.api.BaseCmd;
52-
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterForAutoScaleConditionCmd;
52+
import org.apache.cloudstack.api.command.admin.autoscale.CreateAutoScaleCounterCmd;
5353
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleConditionCmd;
5454
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
5555
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
5656
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd;
57-
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleConditionCountersCmd;
57+
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleCountersCmd;
5858
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
5959
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
6060
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleConditionCmd;
@@ -429,7 +429,7 @@ public void tearDown() {
429429

430430
@Test
431431
public void testCreateCounterCmd() throws IllegalArgumentException {
432-
CreateCounterForAutoScaleConditionCmd cmd = new CreateCounterForAutoScaleConditionCmd();
432+
CreateAutoScaleCounterCmd cmd = new CreateAutoScaleCounterCmd();
433433
ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName);
434434
ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider);
435435
ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, counterSource.toString());
@@ -443,7 +443,7 @@ public void testCreateCounterCmd() throws IllegalArgumentException {
443443

444444
@Test(expected = InvalidParameterValueException.class)
445445
public void testCreateCounterCmdWithInvalidSource() throws IllegalArgumentException {
446-
CreateCounterForAutoScaleConditionCmd cmd = new CreateCounterForAutoScaleConditionCmd();
446+
CreateAutoScaleCounterCmd cmd = new CreateAutoScaleCounterCmd();
447447
ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName);
448448
ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider);
449449
ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, INVALID);
@@ -456,7 +456,7 @@ public void testCreateCounterCmdWithInvalidSource() throws IllegalArgumentExcept
456456

457457
@Test(expected = InvalidParameterValueException.class)
458458
public void testCreateCounterCmdWithInvalidProvider() throws IllegalArgumentException {
459-
CreateCounterForAutoScaleConditionCmd cmd = new CreateCounterForAutoScaleConditionCmd();
459+
CreateAutoScaleCounterCmd cmd = new CreateAutoScaleCounterCmd();
460460
ReflectionTestUtils.setField(cmd, ApiConstants.NAME, counterName);
461461
ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, INVALID);
462462
ReflectionTestUtils.setField(cmd, ApiConstants.SOURCE, counterSource.toString());
@@ -472,7 +472,7 @@ public void testListCounters() {
472472
List<CounterVO> countersMock = Arrays.asList(counterMock);
473473
when(counterDao.listCounters(any(), any(), any(), any(), any(), any())).thenReturn(countersMock);
474474

475-
ListAutoScaleConditionCountersCmd cmd = new ListAutoScaleConditionCountersCmd();
475+
ListAutoScaleCountersCmd cmd = new ListAutoScaleCountersCmd();
476476
ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, counterProvider);
477477

478478
List<? extends Counter> counters = autoScaleManagerImplSpy.listCounters(cmd);
@@ -481,7 +481,7 @@ public void testListCounters() {
481481

482482
@Test(expected = InvalidParameterValueException.class)
483483
public void testListCountersWithInvalidProvider() {
484-
ListAutoScaleConditionCountersCmd cmd = new ListAutoScaleConditionCountersCmd();
484+
ListAutoScaleCountersCmd cmd = new ListAutoScaleCountersCmd();
485485
ReflectionTestUtils.setField(cmd, ApiConstants.PROVIDER, INVALID);
486486

487487
List<? extends Counter> counters = autoScaleManagerImplSpy.listCounters(cmd);

0 commit comments

Comments
 (0)