Package org.codice.ddf.itests.common
Class KarafConsole
java.lang.Object
org.apache.karaf.itests.KarafTestSupport
org.codice.ddf.itests.common.KarafConsole
public class KarafConsole
extends org.apache.karaf.itests.KarafTestSupport
Class that provides access to the Karaf Console.
Note: This class is needed to expose the protected methods provided by KarafTestSupport. Since we already extend from our own base class, out test classes cannot
extend from this one to access its protected methods.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.karaf.itests.KarafTestSupport
org.apache.karaf.itests.KarafTestSupport.Retry -
Field Summary
Fields inherited from class org.apache.karaf.itests.KarafTestSupport
baseTestWatcher, bundleContext, configurationAdmin, featureService, MAX_HTTP_PORT, MAX_RMI_REG_PORT, MAX_RMI_SERVER_PORT, MAX_SSH_PORT, MIN_HTTP_PORT, MIN_RMI_REG_PORT, MIN_RMI_SERVER_PORT, MIN_SSH_PORT, retry, sessionFactory -
Constructor Summary
ConstructorsConstructorDescriptionKarafConsole(org.osgi.framework.BundleContext bundleContext, org.apache.karaf.features.FeaturesService featuresService, org.apache.karaf.shell.api.console.SessionFactory sessionFactory) Karaf console constructor. -
Method Summary
Modifier and TypeMethodDescriptionrunCommand(String command) Runs a shell command and returns output as a String.runCommand(String command, long timeout) Runs a shell command and returns output as a String.runCommand(String command, long timeout, Principal... principals) Runs a shell command and returns output as a String.runCommand(String command, Principal... principals) Runs a shell command and returns output as a String.Methods inherited from class org.apache.karaf.itests.KarafTestSupport
addFeaturesRepository, assertBundleInstalled, assertBundleNotInstalled, assertContains, assertContainsNot, assertFeatureInstalled, assertFeatureInstalled, assertFeatureNotInstalled, assertFeatureNotInstalled, assertFeaturesInstalled, assertServiceAvailable, assertServiceAvailable, assertServiceAvailable, assertServiceAvailable, close, config, executeAlias, executeAlias, executeCommand, executeCommand, findBundleByName, getAvailablePort, getConfigFile, getHttpPort, getJMXConnector, getJMXConnector, getJmxServiceUrl, getKarafDistribution, getOsgiService, getOsgiService, getOsgiService, getOsgiService, getOsgiService, getSshPort, installAndAssertFeature, installAssertAndUninstallFeature, installAssertAndUninstallFeatures, installBundle, probeConfiguration, uninstallNewFeatures, waitBundleState, waitForService
-
Constructor Details
-
KarafConsole
public KarafConsole(org.osgi.framework.BundleContext bundleContext, org.apache.karaf.features.FeaturesService featuresService, org.apache.karaf.shell.api.console.SessionFactory sessionFactory) Karaf console constructor.- Parameters:
bundleContext- bundle context to use when using the console. Cannot benull.
-
-
Method Details
-
runCommand
Runs a shell command and returns output as a String. Commands have a default timeout of 10 seconds.- Parameters:
command- command to execute. Cannot benull.timeout- command timeout in millisecondsprincipals- principals (e.g. RolePrincipal objects) to run the command under (optional)- Returns:
- command output. Can be empty but not
null.
-
runCommand
Runs a shell command and returns output as a String. Commands have a default timeout of 10 seconds.- Parameters:
command- command to execute. Cannot benull.principals- principals (e.g. RolePrincipal objects) to run the command under (optional)- Returns:
- command output. Can be empty but not
null.
-
runCommand
Runs a shell command and returns output as a String. Commands have a default timeout of 10 seconds. Uses the DEFAULT_ROLES to execute the command as an administrator.- Parameters:
command- command to execute. Cannot benull.- Returns:
- command output. Can be empty but not
null.
-
runCommand
Runs a shell command and returns output as a String. The command will timeout after the supplied timeout (in milliseconds). Uses the DEFAULT_ROLES to execute the command as an administrator.- Parameters:
command- command to execute. Cannot benull.timeout- command timeout in milliseconds.- Returns:
- command output. Can be empty but not
null.
-