File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
api/src/main/java/org/apache/cloudstack/api/response Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ public class ConsoleSessionResponse extends BaseResponse {
7070 @ Param (description = "ID of the instance." )
7171 private String instanceId ;
7272
73+ @ SerializedName (ApiConstants .INSTANCE_NAME )
74+ @ Param (description = "Name of the instance." )
75+ private String instanceName ;
76+
7377 @ SerializedName (ApiConstants .HOST_ID )
7478 @ Param (description = "ID of the host." )
7579 private String hostId ;
@@ -134,6 +138,10 @@ public void setInstanceId(String instanceId) {
134138 this .instanceId = instanceId ;
135139 }
136140
141+ public void setInstanceName (String instanceName ) {
142+ this .instanceName = instanceName ;
143+ }
144+
137145 public void setHostId (String hostId ) {
138146 this .hostId = hostId ;
139147 }
@@ -198,6 +206,10 @@ public String getInstanceId() {
198206 return instanceId ;
199207 }
200208
209+ public String getInstanceName () {
210+ return instanceName ;
211+ }
212+
201213 public String getHostId () {
202214 return hostId ;
203215 }
Original file line number Diff line number Diff line change @@ -5610,6 +5610,7 @@ private void populateInstanceFieldsOnConsoleSessionResponse(ConsoleSession conso
56105610 VMInstanceVO instance = ApiDBUtils .findVMInstanceById (consoleSession .getInstanceId ());
56115611 if (instance != null ) {
56125612 consoleSessionResponse .setInstanceId (instance .getUuid ());
5613+ consoleSessionResponse .setInstanceName (instance .getInstanceName ());
56135614 }
56145615 }
56155616
Original file line number Diff line number Diff line change @@ -670,6 +670,7 @@ private ConsoleSessionResponse getExpectedConsoleSessionResponseForTests(boolean
670670 expected .setHostName ("host" );
671671 expected .setHostId ("hostUuid" );
672672 expected .setInstanceId ("vmUuid" );
673+ expected .setInstanceName ("vmName" );
673674 }
674675
675676 return expected ;
@@ -735,6 +736,7 @@ public void createConsoleSessionResponseTestShouldReturnFullResponse() {
735736
736737 apiDBUtilsStaticMock .when (() -> ApiDBUtils .findVMInstanceById (2L )).thenReturn (vmInstanceVOMock );
737738 Mockito .when (vmInstanceVOMock .getUuid ()).thenReturn (expected .getInstanceId ());
739+ Mockito .when (vmInstanceVOMock .getInstanceName ()).thenReturn (expected .getInstanceName ());
738740
739741 ConsoleSessionResponse response = apiResponseHelper .createConsoleSessionResponse (consoleSessionMock , ResponseObject .ResponseView .Full );
740742
@@ -754,6 +756,7 @@ public void createConsoleSessionResponseTestShouldReturnFullResponse() {
754756 Assert .assertEquals (expected .getHostId (), response .getHostId ());
755757 Assert .assertEquals (expected .getHostName (), response .getHostName ());
756758 Assert .assertEquals (expected .getInstanceId (), response .getInstanceId ());
759+ Assert .assertEquals (expected .getInstanceName (), response .getInstanceName ());
757760 }
758761 }
759762}
You can’t perform that action at this time.
0 commit comments