

Classes | |
| class | FaultStateReceived |
| class | MiniFaultState |
Public Member Functions | |
| SourceStressTest () throws Exception | |
| void | receive (ACSJMSMessageEntity msg) throws Exception |
| void | testStressSameSource () throws Exception |
| void | testStressDifferentSources () throws Exception |
Protected Member Functions | |
| void | setUp () throws Exception |
| void | tearDown () throws Exception |
Private Member Functions | |
| void | send (MiniFaultState mfs, boolean sameSource) throws Exception |
| void | checkFaultStates (MiniFaultState sent, FaultState recv) throws Exception |
| void | buildData (int len) throws Exception |
| void | waitForFSs () throws Exception |
Private Attributes | |
| volatile Consumer | m_consumer |
| ACSAlarmSystemInterface | alarmSource |
| Vector< FaultStateReceived > | receivedFS |
| Vector< MiniFaultState > | statesToPublish |
Static Private Attributes | |
| static final int | NUM_OF_FS_TO_SEND_ONE_SOURCE = 10000 |
| static final int | NUM_OF_FS_TO_SEND_MORE_SOURCES = 1000 |
| static final String | m_channelName = "CMW.ALARM_SYSTEM.ALARMS.SOURCES.ALARM_SYSTEM_SOURCES" |
| static String | FF = "Family" |
| static String | FM = "Member" |
| static Random | rnd = new Random(System.currentTimeMillis()) |
| static int | count = 0 |
A stress test: it sends a great number of alarm sources and checks
The FaultStates are sent in the same order their are published if the sending is done with one source per each FS. If the source is only one for all the alarms, then it applies a kind of caching and the FSs do not arrive in the same order the are published. In the latter case, the FSs published and the FSs received are both sorted by FM and compared.
| alma::lasersource::test::SourceStressTest::SourceStressTest | ( | ) | throws Exception [inline] |
Constructor
| Exception |
| void alma::lasersource::test::SourceStressTest::buildData | ( | int | len | ) | throws Exception [inline, private] |
Build the data to publish and check for correctness
| len | The number of items to biuld and put in the array |
References statesToPublish.
Referenced by testStressDifferentSources(), and testStressSameSource().
| void alma::lasersource::test::SourceStressTest::checkFaultStates | ( | MiniFaultState | sent, | |
| FaultState | recv | |||
| ) | throws Exception [inline, private] |
Referenced by testStressDifferentSources(), and testStressSameSource().
| void alma::lasersource::test::SourceStressTest::receive | ( | ACSJMSMessageEntity | msg | ) | throws Exception [inline] |
References receivedFS.
| void alma::lasersource::test::SourceStressTest::send | ( | MiniFaultState | mfs, | |
| boolean | sameSource | |||
| ) | throws Exception [inline, private] |
Send a fault state to the NC. It uses the global source or build a new one depending on the parameter
| mfs | The fault state to publish | |
| sameSource | If true the same source is used to send the alarm if true a new source is built and the fault state is sent using this new source |
References alarmSource, alma::alarmsystem::source::ACSAlarmSystemInterface::push(), alma::alarmsystem::source::ACSFaultState::setDescriptor(), and alma::alarmsystem::source::ACSFaultState::setUserTimestamp().
Referenced by testStressDifferentSources(), and testStressSameSource().
| void alma::lasersource::test::SourceStressTest::setUp | ( | ) | throws Exception [inline, protected] |
Reimplemented from alma::acs::component::client::ComponentClientTestCase.
References alma::acs::nc::Consumer::addSubscription(), alarmSource, alma::acs::nc::Consumer::consumerReady(), alma::acs::component::client::ComponentClientTestCase::getContainerServices(), m_channelName, m_consumer, and receivedFS.
| void alma::lasersource::test::SourceStressTest::tearDown | ( | ) | throws Exception [inline, protected] |
Reimplemented from alma::acs::component::client::ComponentClientTestCase.
References alma::acs::nc::Consumer::disconnect(), and m_consumer.
| void alma::lasersource::test::SourceStressTest::testStressDifferentSources | ( | ) | throws Exception [inline] |
Test by sending all the fault states using the same source. When all the alarms have arrived it checks for their correctness
| Exception |
References buildData(), checkFaultStates(), NUM_OF_FS_TO_SEND_MORE_SOURCES, receivedFS, send(), statesToPublish, and waitForFSs().
| void alma::lasersource::test::SourceStressTest::testStressSameSource | ( | ) | throws Exception [inline] |
Test by sending all the fault states using the same source. When all the alarms have arrived it checks for their correctness.
NOTE: when using only on source, not all the FS arrive in the same order they are submitted to the source. For this reason the collection are sorted before comparing.
| Exception |
References buildData(), checkFaultStates(), NUM_OF_FS_TO_SEND_ONE_SOURCE, receivedFS, send(), statesToPublish, and waitForFSs().
| void alma::lasersource::test::SourceStressTest::waitForFSs | ( | ) | throws Exception [inline, private] |
Wait until all the fault states are received or a timeout happened.
| Exception | in case of timeout |
References count, receivedFS, and statesToPublish.
Referenced by testStressDifferentSources(), and testStressSameSource().
int alma::lasersource::test::SourceStressTest::count = 0 [static, private] |
String alma::lasersource::test::SourceStressTest::FF = "Family" [static, private] |
String alma::lasersource::test::SourceStressTest::FM = "Member" [static, private] |
final String alma::lasersource::test::SourceStressTest::m_channelName = "CMW.ALARM_SYSTEM.ALARMS.SOURCES.ALARM_SYSTEM_SOURCES" [static, private] |
Referenced by setUp().
volatile Consumer alma::lasersource::test::SourceStressTest::m_consumer [private] |
Referenced by setUp(), and tearDown().
final int alma::lasersource::test::SourceStressTest::NUM_OF_FS_TO_SEND_MORE_SOURCES = 1000 [static, private] |
Referenced by testStressDifferentSources().
final int alma::lasersource::test::SourceStressTest::NUM_OF_FS_TO_SEND_ONE_SOURCE = 10000 [static, private] |
Referenced by testStressSameSource().
Vector<FaultStateReceived> alma::lasersource::test::SourceStressTest::receivedFS [private] |
Referenced by receive(), setUp(), testStressDifferentSources(), testStressSameSource(), and waitForFSs().
Random alma::lasersource::test::SourceStressTest::rnd = new Random(System.currentTimeMillis()) [static, private] |
Vector<MiniFaultState> alma::lasersource::test::SourceStressTest::statesToPublish [private] |
Referenced by buildData(), testStressDifferentSources(), testStressSameSource(), and waitForFSs().
1.6.2