diff options
Diffstat (limited to 'core/modules/qemu/runvirt-plugin-qemu/src/test/java')
2 files changed, 71 insertions, 4 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java index 9f8f925f..a7929ab0 100644 --- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java +++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java @@ -63,7 +63,7 @@ public class AppTest assertTrue( shortHelpOptionCorrectOutput.contains( App.APP_DESC ) ); // test that no error was logged and output is available - assertEquals( 2026, shortHelpOptionCorrectOutput.length() ); + assertEquals( 2093, shortHelpOptionCorrectOutput.length() ); assertEquals( 0, shortHelpOptionCorrectErrOutput.length() ); } @@ -91,7 +91,7 @@ public class AppTest assertTrue( longHelpOptionCorrectOutput.contains( App.APP_DESC ) ); // test that no error was logged and output is available - assertEquals( 2026, longHelpOptionCorrectOutput.length() ); + assertEquals( 2093, longHelpOptionCorrectOutput.length() ); assertEquals( 0, longHelpOptionCorrectErrOutput.length() ); } @@ -119,7 +119,7 @@ public class AppTest assertTrue( shortHelpOptionIncorrectOutput.contains( App.APP_DESC ) ); // test that error was logged and output is available - assertEquals( 2026, shortHelpOptionIncorrectOutput.length() ); + assertEquals( 2093, shortHelpOptionIncorrectOutput.length() ); assertEquals( 0, shortHelpOptionIncorrectErrOutput.length() ); } @@ -147,7 +147,7 @@ public class AppTest assertTrue( longHelpOptionIncorrectOutput.contains( App.APP_DESC ) ); // test that error was logged and output is available - assertEquals( 2026, longHelpOptionIncorrectOutput.length() ); + assertEquals( 2093, longHelpOptionIncorrectOutput.length() ); assertEquals( 0, longHelpOptionIncorrectErrOutput.length() ); } diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java index ee3e0d1d..972f5e4b 100644 --- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java +++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java @@ -1,6 +1,7 @@ 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; @@ -16,6 +17,8 @@ public class CommandLineArgsTest 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"; @@ -70,6 +73,70 @@ public class CommandLineArgsTest } @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 { |