Public Member Functions | |
ComponentClientTestCase (String name) throws Exception | |
Protected Member Functions | |
void | runTest () throws Throwable |
void | setUp () throws Exception |
void | connectToManager () throws Exception |
String | getFullName () |
ContainerServices | getContainerServices () |
void | tearDown () throws Exception |
void | initRemoteLogging () |
LogReceiver | getLogReceiver () throws AcsJContainerServicesEx |
Protected Attributes | |
AcsCorba | acsCorba |
AcsManagerProxy | m_acsManagerProxy |
AcsLogger | m_logger |
String | m_managerLoc |
Base class for writing JUnit test clients for ACS components. Takes care of the communication with the ACS manager (local or provided in property ACS.manager
).
Provides the ContainerServices.
alma.acs.component.client.ComponentClientTestCase.ComponentClientTestCase | ( | String | name | ) | throws Exception |
Subclasses must call this ctor.
name | the name used for the test case, and to talk with the ACS manager |
Exception |
void alma.acs.component.client.ComponentClientTestCase.connectToManager | ( | ) | throws Exception [protected] |
Connects to the ACS Manager using AcsManagerProxy.
Exception |
References alma.acs.component.client.ComponentClientTestCase.acsCorba, alma.acs.component.client.ComponentClientTestCase.getFullName(), alma.acs.container.corba.AcsCorba.getORB(), alma.acs.container.AcsManagerProxy.loginToManager(), alma.acs.container.AcsManagerProxy.logoutFromManager(), alma.acs.component.client.ComponentClientTestCase.m_acsManagerProxy, alma.acs.component.client.ComponentClientTestCase.m_logger, and alma.acs.component.client.ComponentClientTestCase.m_managerLoc.
Referenced by alma.acs.component.client.ComponentClientTestCase.setUp().
ContainerServices alma.acs.component.client.ComponentClientTestCase.getContainerServices | ( | ) | [protected] |
Gives access to the ContainerServices interface. This class plays the part of the role of the Java container that has to do with providing explicit services to the component, or test case respectively.
Referenced by alma.acsexmpl.clients.XmlComponentClientTest.setUp(), alma.demo.client.XmlComponentClient.setUp(), alma.demo.client.LampAccessClient.setUp(), alma.acsexmpl.clients.ErrorComponentTest.setUp(), alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest.setUp(), alma.acsexmpl.clients.XmlComponentClientTest.tearDown(), alma.acsexmpl.clients.ErrorComponentTest.tearDown(), alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest.tearDown(), alma.acsexmpl.clients.XmlComponentClientTest.testOffshootJ(), alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest.testOffshootJ(), alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest.testOffshootJFromComponentJ(), alma.acsexmpl.clients.XmlComponentClientTest.testOffshootJFromXmlComponentJ(), and alma.demo.client.XmlComponentClient.testReleaseComponent().
String alma.acs.component.client.ComponentClientTestCase.getFullName | ( | ) | [protected] |
LogReceiver alma.acs.component.client.ComponentClientTestCase.getLogReceiver | ( | ) | throws AcsJContainerServicesEx [protected] |
Gets a LogReceiver which can be used to verify log messages from both local and remote processes. The returned LogReceiver
is already initialized. If initialization fails, an exception is thrown.
To receive logs from the log service, use either LogReceiver#getLogQueue() or LogReceiver#startCaptureLogs(java.io.PrintWriter).
AcsJContainerServicesEx | if the LogReceiver fails to initialize within 20 seconds. |
References alma.acs.component.client.ComponentClientTestCase.acsCorba, alma.acs.container.AcsManagerProxy.getManager(), alma.acs.container.corba.AcsCorba.getORB(), alma.acs.logging.engine.LogReceiver.initialize(), and alma.acs.component.client.ComponentClientTestCase.m_acsManagerProxy.
void alma.acs.component.client.ComponentClientTestCase.initRemoteLogging | ( | ) | [protected] |
Sets up the test client logger(s) to send log records to the remote log service. Only one attempt to connect to the remote logger is made. If it fails, remote logging will be disabled.
Override this method to prevent remote logging.
References alma.acs.component.client.ComponentClientTestCase.acsCorba, alma.acs.container.AcsManagerProxy.getManager(), alma.acs.container.AcsManagerProxy.getManagerHandle(), alma.acs.container.corba.AcsCorba.getORB(), alma.acs.component.client.ComponentClientTestCase.m_acsManagerProxy, and alma.acs.component.client.ComponentClientTestCase.m_logger.
Referenced by alma.acs.component.client.ComponentClientTestCase.setUp().
void alma.acs.component.client.ComponentClientTestCase.runTest | ( | ) | throws Throwable [protected] |
Executes a single test method. Stray exceptions are logged using the test logger, so that they show in system logs.
References alma.acs.component.client.ComponentClientTestCase.getFullName(), alma.acs.logging.AcsLogger.log(), and alma.acs.component.client.ComponentClientTestCase.m_logger.
void alma.acs.component.client.ComponentClientTestCase.setUp | ( | ) | throws Exception [protected] |
Starts CORBA in the client process and connects to the manager and logger.
Subclasses that override this method must call super.setUp()
, likely before any other code in that method.
Reimplemented in alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest, alma.acsexmpl.clients.ErrorComponentTest, alma.acsexmpl.clients.XmlComponentClientTest, alma.demo.client.LampAccessClient, and alma.demo.client.XmlComponentClient.
References alma.acs.component.client.ComponentClientTestCase.acsCorba, alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.container.corba.AcsCorba.doneCorba(), alma.acs.component.client.ComponentClientTestCase.getFullName(), alma.acs.container.AcsManagerProxy.getManagerHandle(), alma.acs.container.corba.AcsCorba.initCorbaForClient(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), alma.acs.logging.AcsLogger.log(), alma.acs.component.client.ComponentClientTestCase.m_acsManagerProxy, alma.acs.component.client.ComponentClientTestCase.m_logger, alma.acs.component.client.ManagerClient.setContainerServices(), and alma.acs.container.corba.AcsCorba.shutdownORB().
void alma.acs.component.client.ComponentClientTestCase.tearDown | ( | ) | throws Exception [protected] |
Releases all previously obtained components (using manager), logs out from the manager, and terminates the CORBA ORB.
Subclasses that override this method must call super.tearDown()
, likely after any other code in that method.
Reimplemented in alma.acsexmpl.clients.ComponentWithXmlOffshootClientTest, alma.acsexmpl.clients.ErrorComponentTest, and alma.acsexmpl.clients.XmlComponentClientTest.
References alma.acs.component.client.ComponentClientTestCase.acsCorba, alma.acs.container.CleaningDaemonThreadFactory.cleanUp(), alma.acs.container.ContainerServicesImpl.cleanUp(), alma.acs.container.corba.AcsCorba.doneCorba(), alma.acs.logging.engine.LogReceiver.isInitialized(), alma.acs.container.AcsManagerProxy.logoutFromManager(), alma.acs.component.client.ComponentClientTestCase.m_acsManagerProxy, alma.acs.container.ContainerServicesImpl.releaseAllComponents(), alma.acs.container.AcsManagerProxy.shutdownNotify(), alma.acs.container.corba.AcsCorba.shutdownORB(), and alma.acs.logging.engine.LogReceiver.stop().
Referenced by alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.component.client.ComponentClientTestCase.getLogReceiver(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), alma.acs.component.client.ComponentClientTestCase.setUp(), and alma.acs.component.client.ComponentClientTestCase.tearDown().
Special tests that need to call directly the manager API could use this proxy object. To be used sparingly, as we need to exercise (and extend if necessary) the regular classes such as ContainerServices.
Referenced by alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.component.client.ComponentClientTestCase.getLogReceiver(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), alma.acs.component.client.ComponentClientTestCase.setUp(), and alma.acs.component.client.ComponentClientTestCase.tearDown().
Referenced by alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), alma.acs.component.client.ComponentClientTestCase.runTest(), alma.acs.component.client.ComponentClientTestCase.setUp(), alma.demo.client.XmlComponentClient.testAddNewSchedBlocks(), alma.acsexmpl.clients.ErrorComponentTest.testBadMethod(), alma.acsexmpl.clients.ErrorComponentTest.testCompletionFromCompletion(), alma.acsexmpl.clients.ErrorComponentTest.testCompletionFromException(), alma.demo.client.XmlComponentClient.testException(), alma.acsexmpl.clients.ErrorComponentTest.testExceptionFromCompletion(), alma.acsexmpl.clients.ErrorComponentTest.testOutCompletion(), alma.acsexmpl.clients.ErrorComponentTest.testReceiveCorbaSystemException(), and alma.acsexmpl.clients.ErrorComponentTest.testTypeException().
String alma.acs.component.client.ComponentClientTestCase.m_managerLoc [protected] |
from property ACS.manager, or defaults to localhost
Referenced by alma.acs.component.client.ComponentClientTestCase.connectToManager().