Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
change
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
  • Loading branch information
shwstppr committed Sep 25, 2025
commit 1e911a912371ad6e1542d0516deea99b3d8f934f
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public String getName() {
protected Map<String, Object> loadAccessDetails(Map<String, Map<String, String>> externalDetails,
VirtualMachineTO virtualMachineTO) {
Map<String, Object> modifiedDetails = new HashMap<>();
if (MapUtils.isNotEmpty(externalDetails) && externalDetails.containsKey(ApiConstants.CALLER)) {
modifiedDetails.put(ApiConstants.CALLER, externalDetails.get(ApiConstants.CALLER));
externalDetails.remove(ApiConstants.CALLER);
}
if (MapUtils.isNotEmpty(externalDetails)) {
modifiedDetails.put(ApiConstants.EXTERNAL_DETAILS, externalDetails);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VmDetailConstants;
import com.cloud.vm.dao.UserVmDao;

@RunWith(MockitoJUnitRunner.class)
Expand Down Expand Up @@ -205,6 +206,20 @@ public void testLoadAccessDetailsWithNullExternalDetails() {
assertEquals("test-vm", result.get(ApiConstants.VIRTUAL_MACHINE_NAME));
}

@Test
public void testLoadAccessDetails_WithCaller() {
Map<String, Map<String, String>> externalDetails = new HashMap<>();
externalDetails.put(ApiConstants.EXTENSION, Map.of("key1", "value1"));
externalDetails.put(ApiConstants.CALLER, Map.of("key2", "value2"));
Map<String, Object> result = provisioner.loadAccessDetails(externalDetails, null);

assertNotNull(result);
assertNotNull(result.get(ApiConstants.EXTERNAL_DETAILS));
assertNotNull(((Map<String, String>) result.get(ApiConstants.EXTERNAL_DETAILS)).get(ApiConstants.EXTENSION));
assertNotNull(result.get(ApiConstants.CALLER));
assertNull(result.get(VmDetailConstants.CLOUDSTACK_VM_DETAILS));
}

@Test
public void testGetExtensionCheckedPathValidFile() {
String result = provisioner.getExtensionCheckedPath("test-extension", "test-extension.sh");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public void getConsoleConnectionDetailsForExternalVmSetsDetailsWhenAnswerIsValid

Mockito.when(answer.getResult()).thenReturn(true);
Mockito.when(answer.getUrl()).thenReturn(url);
Mockito.when(answer.getProtocol()).thenReturn("direct");
Mockito.when(answer.getProtocol()).thenReturn(ConsoleConnectionDetails.Mode.Direct.name());
Mockito.when(managementServer.getExternalVmConsole(vm, host)).thenReturn(answer);

ConsoleConnectionDetails result = consoleAccessManager.getConsoleConnectionDetailsForExternalVm(details, vm, host);
Expand Down
Loading