harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4461) [buildtest][func] Test javax/management/monitor/stringmonitor/FunctionsTest is not correct
Date Fri, 13 Jul 2007 09:00:13 GMT
[buildtest][func] Test javax/management/monitor/stringmonitor/FunctionsTest is not correct
------------------------------------------------------------------------------------------

                 Key: HARMONY-4461
                 URL: https://issues.apache.org/jira/browse/HARMONY-4461
             Project: Harmony
          Issue Type: Bug
            Reporter: Vera Petrashkova
            Priority: Minor


The following test from Functional test suite
    functional/org/apache/harmony/test/func/api/javax/management/monitor/stringmonitor/FunctionsTest.xml

contains incorrect testcase testIrregularValues.

According to the testcase description:
 testIrregularValues:
   This test is intended to check the functionality of StringMonitor in case
    when string-to-compare and observed string can be assigned with boundary
    values (null and "")
    MBeanServer is created; StringMonitor and MyStringBuffer aMBeans are registered.
    StringMonitor is configured: only notifyMatch flag is set to true,
    string-to-compare is common non-empty string.
    NotificationListener is added to monitor.
    MyStringBuffer is started in a separate thread, monitor is activated
    (empty and null strings are possible values for observed string).
    NotificationListener checks that string-to-compare is equal to string
    being observed.
    StringMonitor is reconfigured (string-to-compare is empty).
    NotificationListener waits for next notification.
     f correct notification is received test considered to be passed.

It is not clear what does this test really verify when it string-to-compare equals null.

J2SE API specification of StringMonitor.setStringToCompare(String) method
its can not be invoked with null parameter. VM should throw IllegalArgumentException.

So string-to-compare is assigned with string "null" .
But observed string is assigned with null value.
See source code:
----------------FunctionsTest.java------------------
    public Result testIrregularValues() throws Exception {

        /* Monitor is configured in setUp method */
        monitor.setStringToCompare("");

        /*
         * Now test begins. String to compare matches to observed attribute, so
         * "matches" notification should be sent. Due to NotifyDiffer
         * flag=false, "differs" notifications shouldn't be sent
         */
        nListener.setParameters("String", mySbName,
                "jmx.monitor.string.differs");

        log.add("Test: Waiting for 2 notifications " + "for empty string");

        enableTimer();
        monitor.start();
        synchronized (sync) {
            sync.wait();
        }
        res &= timer.getRes();
        res &= nListener.getRes();
        timer.interrupt();

        nListener.setParameters("String", mySbName,
                "jmx.monitor.string.matches");

        enableTimer();
        mySb.setString("");
        synchronized (sync) {
            sync.wait();
        }
        res &= timer.getRes();
        res &= nListener.getRes();
        timer.interrupt();

        log.add("Test: Waiting for error notification for null string");

        monitor.setStringToCompare("null");  <<<<<<<<<<<<<<<<<<<<<<

        nListener.setParameters("String", mySbName, "jmx.monitor.error.type");

        enableTimer();
        mySb.setString(null);    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        synchronized (sync) {
            sync.wait();
        }
        res &= timer.getRes();
        res &= nListener.getRes();
        timer.interrupt();

        return res ? passed() : failed("");
    }
------------------------------

As the result this test case fails on RI.
It should be removed or redesigned.






-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message