This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 102780 - RecognizeInstanceObjectsTest ordering attributes broken
Summary: RecognizeInstanceObjectsTest ordering attributes broken
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL: http://beetle.czech.sun.com:8080/unit...
Keywords: RANDOM, TEST
Depends on:
Blocks:
 
Reported: 2007-04-27 14:45 UTC by Jaroslav Tulach
Modified: 2008-12-22 11:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test report (138.97 KB, text/html)
2007-08-22 10:48 UTC, pzajac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2007-04-27 14:45:19 UTC
java.lang.reflect.InvocationTargetException: null Log:
Starting test testOrderingAttributes
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-1.jar
[Test.testOrderingAttributes] THREAD: main MSG: 
generating /space/test4u/builds/bindist_netbeans_Dev_daily_latest/unit/platform7/org-netbeans-modules-settings/work/user/org.netbeans.modules.settings.RecognizeInstanceObjectsTest/testOrderingAttributes/jars/services-jar-1.jar
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/somedummyfile
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/foo/Interface.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.lang.Runnable
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/foo/impl/Runnable1.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.util.Comparator
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/foo/impl/Comparator1.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.util.Iterator
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/foo/impl/Iterator1.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/org.foo.Interface
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/foo/impl/Implementation1.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/foo/Interface.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/foo/impl/Comparator1.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/foo/impl/Implementation1.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/foo/impl/Iterator1.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/foo/impl/Runnable1.class
[Test.testOrderingAttributes] THREAD: main MSG: 
done /space/test4u/builds/bindist_netbeans_Dev_daily_latest/unit/platform7/org-netbeans-modules-settings/work/user/org.netbeans.modules.settings.RecognizeInstanceObjectsTest/testOrderingAttributes/jars/services-jar-1.jar
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-2.jar
[Test.testOrderingAttributes] THREAD: main MSG: 
generating /space/test4u/builds/bindist_netbeans_Dev_daily_latest/unit/platform7/org-netbeans-modules-settings/work/user/org.netbeans.modules.settings.RecognizeInstanceObjectsTest/testOrderingAttributes/jars/services-jar-2.jar
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.lang.Runnable
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.util.Comparator
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/bar/Comparator2.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/java.util.Iterator
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/bar/Iterator2.class
[Test.testOrderingAttributes] THREAD: main MSG: putting there entry: 
META-INF/namedservices/sub/path/org.foo.Interface
[Test.testOrderingAttributes] THREAD: main MSG: will copy 
org/bar/Implementation2.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/bar/Comparator2.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/bar/Implementation2.class
[Test.testOrderingAttributes] THREAD: main MSG: copying 
org/bar/Iterator2.class
[Test.testOrderingAttributes] THREAD: main MSG: 
done /space/test4u/builds/bindist_netbeans_Dev_daily_latest/unit/platform7/org-netbeans-modules-settings/work/user/org.netbeans.modules.settings.RecognizeInstanceObjectsTest/testOrderingAttributes/jars/services-jar-2.jar
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-2.jar
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-2.jar
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-1.jar
[Test.testOrderingAttributes] THREAD: main MSG: Looking for services-jar-2.jar

        at org.netbeans.junit.Log.wrapWithMessages(Log.java:268)
        at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:226)
        at org.netbeans.junit.NbTestCase.runBare(NbTestCase.java:302)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at org.netbeans.junit.NbTestCase.run(NbTestCase.java:165)
        at junit.framework.TestSuite.runTest(TestSuite.java:230)
        at junit.framework.TestSuite.run(TestSuite.java:225)
        at 
org.netbeans.xtest.testrunner.JUnitTestRunner.runTests(JUnitTestRunner.java:169)
        at 
org.netbeans.xtest.testrunner.JUnitTestRunner.runTests(JUnitTestRunner.java:124)
        at 
org.netbeans.xtest.plugin.jvm.JUnitTestRunnerLauncher.main(JUnitTestRunnerLauncher.java:60)
Caused by: java.util.NoSuchElementException
        at java.util.AbstractList$Itr.next(AbstractList.java:350)
        at 
java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1010)
        at 
org.netbeans.core.startup.layers.NamedFSServicesLookupTest.testOrderingAttributes(NamedFSServicesLookupTest.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:59)
        at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:286)
        at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:224)
        ... 11 more
Comment 1 Marian Mirilovic 2007-04-29 20:24:46 UTC
Jarda, 
this is yours, isn't it ?
Comment 2 Jaroslav Tulach 2007-06-19 10:12:25 UTC
Jesse, I expect these failures to be due to recent changes in ordering you have made. Can you look at the issue?
Comment 3 Jesse Glick 2007-06-19 20:32:19 UTC
1. The behavior is random. Sometimes it passes, sometimes it fails (with different results).

2. The test was failing from time to time long before I did anything with relative ordering attributes.

3. NamedFSServicesLookupTest consistently passes for me.

Expected println's from a passing run:

df.children=[InstanceDataObject[MultiFileObject[inst/ordering/A.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/C.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/X.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/B.instance]]]
l.allInstances=[500, 700, 1000, 1500]
[org.openide.filesystems.Ordering] THREAD: Folder recognizer MSG: Relative ordering attribute A.instance/C.instance on
inst/ordering is deprecated in favor of numeric position attributes
[org.openide.filesystems.Ordering] THREAD: Folder recognizer MSG: Relative ordering attribute C.instance/X.instance on
inst/ordering is deprecated in favor of numeric position attributes
[org.openide.filesystems.Ordering] THREAD: Folder recognizer MSG: Relative ordering attribute X.instance/B.instance on
inst/ordering is deprecated in favor of numeric position attributes

Sometimes I get:

df.children=[InstanceDataObject[MultiFileObject[inst/ordering/A.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/C.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/X.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/B.instance]]]
l.allInstances=[700, 1000, 1500]

Note that the FolderLookup here is missing A.instance entirely.

Most often I get:

df.children=[InstanceDataObject[MultiFileObject[inst/ordering/A.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/B.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/C.instance]],
InstanceDataObject[MultiFileObject[inst/ordering/X.instance]]]
l.allInstances=[500, 1500, 700, 1000]
[org.openide.filesystems.Ordering] THREAD: Folder recognizer MSG: Relative ordering attribute A.instance/C.instance on
inst/ordering is deprecated in favor of numeric position attributes

Note that the DataFolder.children is wrong. Curiously, however, Ordering reports a warning only about A/C, which implies
to me that the folder attrs C/X and X/B were not present when it did the ordering (which is consistent with an order of
A-B-C-X).

I have verified that (1) the folder is really created by the test (not leftover from a previous run or whatever), (2)
the test has written all three ordering attrs by the time it calls Lookups.forPath.

My only guess is that the problem is with testOrderingAttributes and testNumericOrdering clashing over a folder, so I
have tried to use a different folder in the latter, which seems to help. BTW the suite should really set a new
Repository in setUp to prevent any interference between test cases.

Checking in NamedFSServicesLookupTest.java;
/shared/data/ccvs/repository/core/startup/test/unit/src/org/netbeans/core/startup/layers/NamedFSServicesLookupTest.java,v
 <--  NamedFSServicesLookupTest.java
new revision: 1.4; previous revision: 1.3
done
Comment 4 Jesse Glick 2007-06-22 21:14:40 UTC
Still sometimes failing.
Comment 5 Jesse Glick 2007-06-22 21:17:28 UTC
Sometimes passes, sometimes fails randomly in ways I explained before (see comments from Tuesday). I suspect there is
simply something asynchronous in loaders or settings which makes this test inherently unreliable.
Comment 6 Jesse Glick 2007-06-22 22:10:47 UTC
I patched NamedFSServicesLookupTest:

        System.setProperty("XXX", "true");
        System.err.println("XXX turning on logging for testOA");
        try {
        Lookup l = Lookups.forPath("inst/ordering");
// as before
        } finally {
            System.setProperty("XXX", "false");
        }


and also Ordering:

        boolean xxx = Boolean.getBoolean("XXX");
        if (xxx) System.err.println("XXX children=" + children);
        Iterator<FileObject> it = children.iterator();
// as before...
            Object val = parent.getAttribute(attr);
            if (xxx) System.err.println("XXX " + parent + "(" + attr + ") -> " + val);
            if (!Boolean.TRUE.equals(val)) {
// as before...

Now NFFSLT prints, as expected:

XXX turning on logging for testOA
XXX children=[MultiFileObject@11946c2[inst/ordering/X.instance], MultiFileObject@1f2cea2[inst/ordering/A.instance],
MultiFileObject@10fd7f6[inst/ordering/B.instance], MultiFileObject@32060c[inst/ordering/C.instance]]
XXX MultiFileObject@1124746[inst/ordering](A.instance/C.instance) -> true
XXX MultiFileObject@1124746[inst/ordering](C.instance/X.instance) -> true
XXX MultiFileObject@1124746[inst/ordering](X.instance/B.instance) -> true

Sometimes RIOT prints the same. Usually it prints just

XXX turning on logging for testOA

and fails. Meaning that FileUtil.getOrder is not even being called. I tried to determine why, but quickly became lost in
the maze of callbacks and aynchronous tasks created in FolderList and FolderInstance. All I can figure out is that
FolderList.getChildrenList is called on inst/ordering _before_ Lookups.forPath is called, which doesn't make any sense
to me because there should have been no calls to Datasystems on that folder before then.
Comment 7 Jaroslav Tulach 2007-08-21 10:11:32 UTC
Why you used System.err and not LOG.fine? I've added more logging.

IDE:-------------------------------------------------
IDE: [21.8.07 11:10] Committing started
Checking in core/startup/test/unit/src/org/netbeans/core/startup/layers/NamedFSServicesLookupTest.java;
/shared/data/ccvs/repository/core/startup/test/unit/src/org/netbeans/core/startup/layers/NamedFSServicesLookupTest.java,v  
<--  NamedFSServicesLookupTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in openide/fs/src/org/openide/filesystems/Ordering.java;
/shared/data/ccvs/repository/openide/fs/src/org/openide/filesystems/Ordering.java,v  <--  Ordering.java
new revision: 1.5; previous revision: 1.4
done
IDE: [21.8.07 11:10] Committing finished
Comment 8 pzajac 2007-08-22 10:47:22 UTC
Test fails again.
Comment 9 pzajac 2007-08-22 10:48:04 UTC
Created attachment 47041 [details]
Test report
Comment 10 Jaroslav Tulach 2007-08-22 14:38:39 UTC
IDE:-------------------------------------------------
IDE: [22.8.07 15:37] Committing "NamedFSServicesLookupTest.java" started
Checking in NamedFSServicesLookupTest.java;
/shared/data/ccvs/repository/core/startup/test/unit/src/org/netbeans/core/startup/layers/NamedFSServicesLookupTest.java,v  
<--  NamedFSServicesLookupTest.java
new revision: 1.6; previous revision: 1.5
done
IDE: [22.8.07 15:37] Committing "NamedFSServicesLookupTest.java" finished