use of org.ovirt.engine.core.common.console.ConsoleOptions in project ovirt-engine by oVirt.
the class VncConsoleModel method invokeConsole.
private void invokeConsole() {
final GraphicsInfo vncInfo = getEntity().getGraphicsInfos().get(GraphicsType.VNC);
if (vncInfo == null) {
// $NON-NLS-1$
throw new IllegalStateException("Trying to invoke VNC console but VM GraphicsInfo is null.");
}
vncImpl.getOptions().setVmId(getEntity().getId());
ConfigureConsoleOptionsParams parameters = new ConfigureConsoleOptionsParams(vncImpl.getOptions(), true);
parameters.setEngineBaseUrl(FrontendUrlUtils.getRootURL());
parameters.setConsoleClientResourcesUrl(dynamicMessages.consoleClientResourcesUrl());
Frontend.getInstance().runQuery(QueryType.ConfigureConsoleOptions, parameters, new ShowErrorAsyncQuery(returnValue -> {
ConsoleOptions configuredOptions = ((QueryReturnValue) returnValue).getReturnValue();
// overriding global server settings by frontend settings
configuredOptions.setRemapCtrlAltDelete(vncImpl.getOptions().isRemapCtrlAltDelete());
vncImpl.setOptions(configuredOptions);
vncImpl.getOptions().setTitle(getClientTitle());
vncImpl.getOptions().setVmName(getEntity().getName());
vncImpl.invokeClient();
}));
}
use of org.ovirt.engine.core.common.console.ConsoleOptions in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method testFillRemoteViewerUrl.
private void testFillRemoteViewerUrl(String toRepalce, String baseUrl, String resourceUrl, String expected) {
ConsoleOptions options = new ConsoleOptions();
when(getQueryParameters().getOptions()).thenReturn(getValidOptions(GraphicsType.SPICE));
getQuery().fillRemoteViewerUrl(options, toRepalce, baseUrl, resourceUrl);
assertEquals(expected, options.getRemoteViewerNewerVersionUrl());
}
use of org.ovirt.engine.core.common.console.ConsoleOptions in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method shouldFailtWhenNoGraphicsType.
@Test
public void shouldFailtWhenNoGraphicsType() {
when(getQueryParameters().getOptions()).thenReturn(new ConsoleOptions());
assertFalse(getQuery().validateInputs());
}
use of org.ovirt.engine.core.common.console.ConsoleOptions in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method getValidOptions.
private ConsoleOptions getValidOptions(GraphicsType graphicsType) {
ConsoleOptions options = new ConsoleOptions(graphicsType);
options.setVmId(Guid.Empty);
return options;
}
use of org.ovirt.engine.core.common.console.ConsoleOptions in project ovirt-engine by oVirt.
the class SpiceConsoleModel method invokeClient.
public void invokeClient() {
final GraphicsInfo spiceInfo = getEntity().getGraphicsInfos().get(GraphicsType.SPICE);
if (spiceInfo == null) {
// $NON-NLS-1$
throw new IllegalStateException("Trying to invoke SPICE console but VM GraphicsInfo is null.");
}
final ConsoleOptions options = getSpiceImpl().getOptions();
options.setVmId(getEntity().getId());
// configure options
ConfigureConsoleOptionsParams parameters = new ConfigureConsoleOptionsParams(options, true);
parameters.setEngineBaseUrl(FrontendUrlUtils.getRootURL());
parameters.setConsoleClientResourcesUrl(dynamicMessages.consoleClientResourcesUrl());
Frontend.getInstance().runQuery(QueryType.ConfigureConsoleOptions, parameters, new ShowErrorAsyncQuery(returnValue -> {
final ConsoleOptions configuredOptions = returnValue.getReturnValue();
// overriding global server settings by frontend settings
configuredOptions.setRemapCtrlAltDelete(options.isRemapCtrlAltDelete());
configuredOptions.setTitle(getClientTitle());
configuredOptions.setVmName(getEntity().getName());
configuredOptions.setFullScreen(options.isFullScreen());
configuredOptions.setSmartcardEnabledOverridden(options.isSmartcardEnabledOverridden());
if (!configuredOptions.isSpiceProxyEnabled()) {
// override spice proxy from backend
configuredOptions.setSpiceProxy(null);
}
try {
getSpiceImpl().setOptions(configuredOptions);
getSpiceImpl().invokeClient();
} catch (RuntimeException ex) {
// $NON-NLS-1$
getLogger().error("Exception on Spice connect", ex);
}
}));
}
Aggregations