summaryrefslogblamecommitdiffstats
path: root/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java
blob: 77522bd64689ca19a304899dad323f68aea8b2cb (plain) (tree)
1
2
3
4
5
6
7
8
9
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590


                                                            
                                                           



                                                            
                      







                                                                         

                                                                    
 

                                                                     








                                                                                                                                 

                                                                            












































                                                                                                   































































                                                                                                    































































































































































































































































































































































































































































                                                                                                                    

                                                                                                                 

                                       











































                                                                                                                 



                                                                    
                                                                     


             

                                                                                                                  

                                       











































                                                                                                                  



                                                                    
                                                                     
         


















































                                                                                                                              
 
package org.openslx.runvirt.plugin.qemu.cmdln;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.util.List;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.openslx.runvirt.plugin.qemu.cmdln.CommandLineArgs.CmdLnOption;

public class CommandLineArgsTest
{
	// @formatter:off
	public static final String CMDLN_PREFIX_OPTION_SHORT = "-";
	public static final String CMDLN_PREFIX_OPTION_LONG  = "--";

	private static final String CMDLN_TEST_DEBUG_OFF   = "false";
	private static final String CMDLN_TEST_DEBUG_ON    = "true";
	private static final String CMDLN_TEST_NAME        = "test";
	private static final String CMDLN_TEST_FILENAME    = System.getProperty( "user.dir" ) + File.separator + CMDLN_TEST_NAME;
	private static final String CMDLN_TEST_UUID        = "c9570672-cbae-4cbd-801a-881b281b8d79";
	private static final String CMDLN_TEST_OS          = "Windows 10 (x64)";
	private static final int    CMDLN_TEST_NCPUS       = 4;
	private static final String CMDLN_TEST_MEM         = "1024";
	private static final String CMDLN_TEST_PARPORT     = "/dev/parport0";
	private static final String CMDLN_TEST_SERPORT     = "/dev/ttyS0";
	private static final String CMDLN_TEST_MAC         = "02:42:8e:77:1b:e6";
	private static final String CMDLN_TEST_NVGPU_DESC  = "10de:0ff9";
	private static final String CMDLN_TEST_NVGPU_ADDR  = "0000:00:01.0";
	// @formatter:on

	@Test
	@DisplayName( "Test the parsing of wrong command line options" )
	public void testCmdlnOptionsIncorrect()
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + "hello",
				"world argument",
				CMDLN_PREFIX_OPTION_LONG + "info",
				"description"
		};

		CommandLineArgs cmdLn = new CommandLineArgs();

		assertThrows( CommandLineArgsException.class, () -> cmdLn.parseCmdLnArgs( args ) );
	}

	@Test
	@DisplayName( "Test the parsing of the help command line option (short version)" )
	public void testCmdlnOptionHelpShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.HELP.getShortOption()
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertTrue( cmdLn.isHelpAquired() );
	}

	@Test
	@DisplayName( "Test the parsing of the help command line option (long version)" )
	public void testCmdlnOptionHelpLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.HELP.getLongOption()
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertTrue( cmdLn.isHelpAquired() );
	}

	@Test
	@DisplayName( "Test the parsing of the enabled debug command line option (short version)" )
	public void testCmdlnOptionDebugEnabledShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.DEBUG.getShortOption(),
				CMDLN_TEST_DEBUG_ON
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertTrue( cmdLn.isDebugEnabled() );
	}

	@Test
	@DisplayName( "Test the parsing of the enabled debug command line option (long version)" )
	public void testCmdlnOptionDebugEnabledLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.DEBUG.getLongOption(),
				CMDLN_TEST_DEBUG_ON
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertTrue( cmdLn.isDebugEnabled() );
	}

	@Test
	@DisplayName( "Test the parsing of the disabled debug command line option (short version)" )
	public void testCmdlnOptionDebugDisabledShort() throws CommandLineArgsException
	{
		final String[] argsDebugOff = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.DEBUG.getShortOption(),
				CMDLN_TEST_DEBUG_OFF
		};

		final String[] argsDebugMissing = {};

		CommandLineArgs cmdLnDebugOff = new CommandLineArgs( argsDebugOff );
		CommandLineArgs cmdLnDebugMissing = new CommandLineArgs( argsDebugMissing );

		assertFalse( cmdLnDebugOff.isDebugEnabled() );
		assertFalse( cmdLnDebugMissing.isDebugEnabled() );
	}

	@Test
	@DisplayName( "Test the parsing of the disabled debug command line option (long version)" )
	public void testCmdlnOptionDebugDisabledLong() throws CommandLineArgsException
	{
		final String[] argsDebugOff = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.DEBUG.getLongOption(),
				CMDLN_TEST_DEBUG_OFF
		};

		final String[] argsDebugMissing = {};

		CommandLineArgs cmdLnDebugOff = new CommandLineArgs( argsDebugOff );
		CommandLineArgs cmdLnDebugMissing = new CommandLineArgs( argsDebugMissing );

		assertFalse( cmdLnDebugOff.isDebugEnabled() );
		assertFalse( cmdLnDebugMissing.isDebugEnabled() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM configuration input command line option (short version)" )
	public void testCmdlnOptionVmCfgInpShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_CFGINP.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmCfgInpFileName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM configuration input command line option (long version)" )
	public void testCmdlnOptionVmCfgInpLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_CFGINP.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmCfgInpFileName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM configuration output command line option (short version)" )
	public void testCmdlnOptionVmCfgOutShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_CFGOUT.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmCfgOutFileName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM configuration output command line option (long version)" )
	public void testCmdlnOptionVmCfgOutLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_CFGOUT.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmCfgOutFileName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM name command line option (short version)" )
	public void testCmdlnOptionVmNameShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_NAME.getShortOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM name command line option (long version)" )
	public void testCmdlnOptionVmNameLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_NAME.getLongOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM UUID command line option (short version)" )
	public void testCmdlnOptionVmUuidShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_UUID.getShortOption(),
				CMDLN_TEST_UUID
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_UUID, cmdLn.getVmUuid() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM UUID command line option (long version)" )
	public void testCmdlnOptionVmUuidLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_UUID.getLongOption(),
				CMDLN_TEST_UUID
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_UUID, cmdLn.getVmUuid() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM display name command line option (short version)" )
	public void testCmdlnOptionVmDsplNameShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_DSPLNAME.getShortOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmDisplayName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM display name command line option (long version)" )
	public void testCmdlnOptionVmDsplNameLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_DSPLNAME.getLongOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmDisplayName() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM OS command line option (short version)" )
	public void testCmdlnOptionVmOsShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_OS.getShortOption(),
				CMDLN_TEST_OS
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_OS, cmdLn.getVmOperatingSystem() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM OS command line option (long version)" )
	public void testCmdlnOptionVmOsLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_OS.getLongOption(),
				CMDLN_TEST_OS
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_OS, cmdLn.getVmOperatingSystem() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM CPU number command line option (short version)" )
	public void testCmdlnOptionVmNCpusShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_NCPUS.getShortOption(),
				Integer.toString( CMDLN_TEST_NCPUS )
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NCPUS, cmdLn.getVmNumCpus() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM CPU number command line option (long version)" )
	public void testCmdlnOptionVmNCpusLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_NCPUS.getLongOption(),
				Integer.toString( CMDLN_TEST_NCPUS )
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NCPUS, cmdLn.getVmNumCpus() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM memory command line option (short version)" )
	public void testCmdlnOptionVmMemShort() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_MEM.getShortOption(),
				CMDLN_TEST_MEM
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_MEM, cmdLn.getVmMemory() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM memory command line option (long version)" )
	public void testCmdlnOptionVmMemLong() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_MEM.getLongOption(),
				CMDLN_TEST_MEM
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_MEM, cmdLn.getVmMemory() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first HDD disk image command line option (short version)" )
	public void testCmdlnOptionVmHdd0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_HDD0.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameHDD0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first HDD disk image command line option (long version)" )
	public void testCmdlnOptionVmHdd0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_HDD0.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameHDD0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first floppy disk image command line option (short version)" )
	public void testCmdlnOptionVmFloppy0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FLOPPY0.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameFloppy0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first floppy disk image command line option (long version)" )
	public void testCmdlnOptionVmFloppy0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FLOPPY0.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameFloppy0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second floppy disk image command line option (short version)" )
	public void testCmdlnOptionVmFloppy1Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FLOPPY1.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameFloppy1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second floppy disk image command line option (long version)" )
	public void testCmdlnOptionVmFloppy1Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FLOPPY1.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameFloppy1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first CDROM disk image command line option (short version)" )
	public void testCmdlnOptionVmCdrom0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_CDROM0.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameCdrom0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first CDROM disk image command line option (long version)" )
	public void testCmdlnOptionVmCdrom0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_CDROM0.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameCdrom0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second CDROM disk image command line option (short version)" )
	public void testCmdlnOptionVmCdrom1Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_CDROM1.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameCdrom1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second CDROM disk image command line option (long version)" )
	public void testCmdlnOptionVmCdrom1Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_CDROM1.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmDiskFileNameCdrom1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first parallel interface command line option (short version)" )
	public void testCmdlnOptionVmParallel0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_PARALLEL0.getShortOption(),
				CMDLN_TEST_PARPORT
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_PARPORT, cmdLn.getVmDeviceParallel0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first parallel interface command line option (long version)" )
	public void testCmdlnOptionVmParallel0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_PARALLEL0.getLongOption(),
				CMDLN_TEST_PARPORT
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_PARPORT, cmdLn.getVmDeviceParallel0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first serial interface command line option (short version)" )
	public void testCmdlnOptionVmSerial0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_SERIAL0.getShortOption(),
				CMDLN_TEST_SERPORT
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_SERPORT, cmdLn.getVmDeviceSerial0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first serial interface command line option (long version)" )
	public void testCmdlnOptionVmSerial0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_SERIAL0.getLongOption(),
				CMDLN_TEST_SERPORT
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_SERPORT, cmdLn.getVmDeviceSerial0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first network interface MAC command line option (short version)" )
	public void testCmdlnOptionVmMac0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_MAC0.getShortOption(),
				CMDLN_TEST_MAC
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_MAC, cmdLn.getVmMacAddress0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first network interface MAC command line option (long version)" )
	public void testCmdlnOptionVmMac0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_MAC0.getLongOption(),
				CMDLN_TEST_MAC
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_MAC, cmdLn.getVmMacAddress0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first file system source command line option (short version)" )
	public void testCmdlnOptionVmFsSrc0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FSSRC0.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmFsSrc0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first file system source command line option (long version)" )
	public void testCmdlnOptionVmFsSrc0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FSSRC0.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmFsSrc0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first file system target command line option (short version)" )
	public void testCmdlnOptionVmFsTgt0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FSTGT0.getShortOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmFsTgt0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM first file system target command line option (long version)" )
	public void testCmdlnOptionVmFsTgt0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FSTGT0.getLongOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmFsTgt0() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second file system source command line option (short version)" )
	public void testCmdlnOptionVmFsSrc1Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FSSRC1.getShortOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmFsSrc1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second file system source command line option (long version)" )
	public void testCmdlnOptionVmFsSrc1Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FSSRC1.getLongOption(),
				CMDLN_TEST_FILENAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_FILENAME, cmdLn.getVmFsSrc1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second file system target command line option (short version)" )
	public void testCmdlnOptionVmFsTgt1Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_FSTGT1.getShortOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmFsTgt1() );
	}

	@Test
	@DisplayName( "Test the parsing of the VM second file system target command line option (long version)" )
	public void testCmdlnOptionVmFsTgt1Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FSTGT1.getLongOption(),
				CMDLN_TEST_NAME
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		assertEquals( CMDLN_TEST_NAME, cmdLn.getVmFsTgt1() );
	}

	@Test
	@DisplayName( "Test the parsing of NVIDIA PCI IDs command line option for the first GPU passthrough (short version)" )
	public void testCmdlnOptionVmNvGpuIds0Short() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_NVGPUIDS0.getShortOption(),
				CMDLN_TEST_NVGPU_DESC, CMDLN_TEST_NVGPU_ADDR
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		final List<String> nvidiaGpuIds = cmdLn.getVmNvGpuIds0();
		assertEquals( 2, nvidiaGpuIds.size() );
		assertEquals( CMDLN_TEST_NVGPU_DESC, nvidiaGpuIds.get( 0 ) );
		assertEquals( CMDLN_TEST_NVGPU_ADDR, nvidiaGpuIds.get( 1 ) );
	}

	@Test
	@DisplayName( "Test the parsing of NVIDIA PCI IDs command line option for the first GPU passthrough (long version)" )
	public void testCmdlnOptionVmNvGpuIds0Long() throws CommandLineArgsException
	{
		final String[] args = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_NVGPUIDS0.getLongOption(),
				CMDLN_TEST_NVGPU_DESC, CMDLN_TEST_NVGPU_ADDR
		};

		CommandLineArgs cmdLn = new CommandLineArgs( args );

		final List<String> nvidiaGpuIds = cmdLn.getVmNvGpuIds0();
		assertEquals( 2, nvidiaGpuIds.size() );
		assertEquals( CMDLN_TEST_NVGPU_DESC, nvidiaGpuIds.get( 0 ) );
		assertEquals( CMDLN_TEST_NVGPU_ADDR, nvidiaGpuIds.get( 1 ) );
	}

	@Test
	@DisplayName( "Test whether a NVIDIA GPU passthrough is enabled" )
	public void testIsNvidiaGpuPassthroughEnabled() throws CommandLineArgsException
	{
		final String[] args1 = {
				CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_NVGPUIDS0.getLongOption(),
				CMDLN_TEST_NVGPU_DESC, CMDLN_TEST_NVGPU_ADDR
		};
		final String[] args2 = {};

		CommandLineArgs cmdLn1 = new CommandLineArgs( args1 );
		CommandLineArgs cmdLn2 = new CommandLineArgs( args2 );

		assertTrue( cmdLn1.isNvidiaGpuPassthroughEnabled() );
		assertFalse( cmdLn2.isNvidiaGpuPassthroughEnabled() );
	}
}