public class ContainerUtil
extends java.lang.Object
The constructors only store parameters. You must call loginToManager() explicitly
before using the other methods. * Make sure to call logoutFromManager() when done.
Some methods use JUnit asserts from Assert which means that runtime exceptions such as
AssertionFailedError may be thrown.
TODO: Merge with similar class in ACS/LGPL/CommonSoftware/containerTests/contLogTest (which builds before this, but does not get installed).
| Modifier and Type | Class and Description |
|---|---|
static class |
ContainerUtil.ContainerLogLevelSpec
Complete logging spec for a container.
|
| Modifier and Type | Field and Description |
|---|---|
protected AcsManagerProxy |
adminProxy |
protected ContainerServices |
containerServices |
protected boolean |
loggedInToManager |
protected AcsLogger |
logger |
protected ManagerAdminClient |
managerAdminClient |
protected org.omg.CORBA.ORB |
orb |
| Constructor and Description |
|---|
ContainerUtil(ContainerServices cs)
Constructor for use as stand-alone application.
|
ContainerUtil(ContainerServices cs,
AcsManagerProxy managerProxy)
Constructor for use in a ComponentClientTestCase.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<ContainerInfo> |
getAllContainerInfos() |
ContainerDaemonOperations |
getContainerDaemon(java.lang.String host) |
LoggingConfigurableOperations |
getContainerLoggingIF(java.lang.String containerName)
Gets a reference to the LoggingConfigurableOperations interface of a container with a given name.
|
protected void |
init(ContainerServices cs,
AcsManagerProxy adminProxy)
Common to both constructors.
|
boolean |
isContainerLoggedIn(java.lang.String containerName)
Asks the manager if the specified container is logged in.
|
void |
loginToManager() |
void |
logoutFromManager() |
java.lang.String |
resolveContainerName(java.lang.String componentName)
Gets the name of the container running (or configured to run) the component of the given name.
|
void |
setContainerLogLevels(java.lang.String containerName,
ContainerUtil.ContainerLogLevelSpec spec)
Dynamically configures container log levels, using
getContainerLoggingIF(String). |
void |
startContainer(java.lang.String host,
ContainerImplLangType containerType,
java.lang.String containerName,
java.lang.String flags,
boolean waitContainerReady)
Starts (possibly remote) containers using container daemons.
|
void |
stopContainer(java.lang.String host,
java.lang.String containerName) |
protected ContainerServices containerServices
protected AcsLogger logger
protected AcsManagerProxy adminProxy
protected boolean loggedInToManager
protected org.omg.CORBA.ORB orb
protected ManagerAdminClient managerAdminClient
public ContainerUtil(ContainerServices cs)
cs - managerLoc - public ContainerUtil(ContainerServices cs, AcsManagerProxy managerProxy)
Allows access to the manager as an administrator client, on top of the existing manager connection
from managerProxy;
cs - managerProxy - As inherited from ComponentClientTestCaseManagerAdminClientprotected void init(ContainerServices cs, AcsManagerProxy adminProxy)
cs - adminProxy - public void loginToManager()
throws AcsJContainerEx
AcsJContainerExpublic void logoutFromManager()
public java.util.List<ContainerInfo> getAllContainerInfos()
throws NoPermissionEx,
AcsJContainerEx
NoPermissionExAcsJContainerExpublic boolean isContainerLoggedIn(java.lang.String containerName)
throws AcsJContainerEx,
NoPermissionEx
containerName - AcsJContainerExNoPermissionExpublic LoggingConfigurableOperations getContainerLoggingIF(java.lang.String containerName)
throws AcsJContainerEx,
NoPermissionEx
Note that only in test code like here we are allowed to talk directly with the manager. For operational code, the ContainerServices methods must be used and extended if necessary.
containerName - AcsJContainerExNoPermissionExpublic void setContainerLogLevels(java.lang.String containerName,
ContainerUtil.ContainerLogLevelSpec spec)
throws AcsJContainerEx,
NoPermissionEx
getContainerLoggingIF(String).containerName - defaultConfig - namedLoggerConfigs - AcsJContainerExNoPermissionExpublic java.lang.String resolveContainerName(java.lang.String componentName)
throws AcsJContainerEx,
NoPermissionEx
AcsJContainerExNoPermissionExpublic ContainerDaemonOperations getContainerDaemon(java.lang.String host)
host - public void startContainer(java.lang.String host,
ContainerImplLangType containerType,
java.lang.String containerName,
java.lang.String flags,
boolean waitContainerReady)
throws AcsJBadParameterEx,
AcsJFailedToStartContainerEx
Note that outside of performance tests it is required to start containers either through the OMC or by the manager in case of CDB-configured autostart containers. Here we do it from application code in order to run flexible tests that don't require a CDB setup.
Similar code from module acscommandcenter (Executor#remoteDaemonForContainers) does not seem to implement synchronization on the container becoming available.
host - Name of container host. Can be null for localhost.containerType - containerName - flags - waitContainerReady - If true, waits for the container to be ready, as indicated by a callback from the manager (requires prior login to the manager).FailedToStartContainerExBadParameterExAcsJBadParameterExAcsJFailedToStartContainerExpublic void stopContainer(java.lang.String host,
java.lang.String containerName)
throws BadParameterEx,
FailedToStopContainerEx
host - Name of container host. Can be null for localhost.containerName - BadParameterExFailedToStopContainerEx