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.

View | Details | Raw Unified | Return to bug 157429
Collapse All | Expand All

(-)a/ide.kit/test/qa-functional/data/blacklist.txt (+4 lines)
Lines 1-5 Link Here
1
# Black list for BlacklistedClassesHandler
1
# Black list for BlacklistedClassesHandler
2
# Enter full qualified class names, one class name per line
2
# Enter full qualified class names, one class name per line
3
4
# editor.deprecated.pre61settings is disabled autoload and shall not be loaded
5
org.netbeans.modules.editor.deprecated.pre61settings.EditorPreferencesInjector
6
org.netbeans.modules.editor.deprecated.pre61settings.KeybindingsInjector
3
7
4
#
8
#
5
# Loaders that shall not be needed during startup, but probably they still are
9
# Loaders that shall not be needed during startup, but probably they still are
(-)a/ide.kit/test/qa-functional/src/org/netbeans/test/ide/IDECommitValidationTest.java (-1 / +1 lines)
Lines 89-95 Link Here
89
        
89
        
90
        NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(
90
        NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(
91
            IDEValidation.class
91
            IDEValidation.class
92
        ).clusters(".*").enableModules(".*");
92
        ).clusters(".*").enableModules(".*").enableAutoloads(false);
93
93
94
        Set<String> allowedFiles = new HashSet<String>();
94
        Set<String> allowedFiles = new HashSet<String>();
95
        InputStream is = IDECommitValidationTest.class.getResourceAsStream("allowed-file-writes.txt");
95
        InputStream is = IDECommitValidationTest.class.getResourceAsStream("allowed-file-writes.txt");
(-)a/nbjunit/apichanges.xml (+17 lines)
Lines 55-60 Link Here
55
    <!-- ACTUAL CHANGES BEGIN HERE: -->
55
    <!-- ACTUAL CHANGES BEGIN HERE: -->
56
56
57
<changes>
57
<changes>
58
    <change id="NbModuleSuite.enableAutoloads">
59
        <api name="nbjunit"/>
60
        <summary>Leave autoloads as autoloads</summary>
61
        <version major="1" minor="57"/>
62
        <date day="13" month="2" year="2009"/>
63
        <author login="jtulach"/>
64
        <compatibility addition="yes" semantic="compatible" binary="compatible" source="compatible" modification="no"/>
65
        <description>
66
            <p>
67
            One can decide to <b>not</b> enable autoload modules
68
            by calling
69
            <a href="@TOP@/org/netbeans/junit/NbModuleSuite.Configuration.html#enableAutoloads(boolean)">
70
                Configuration.enableAutoloads(false)</a>.
71
            </p>
72
        </description>
73
        <class package="org.netbeans.junit" name="NbModuleSuite"/>
74
    </change>
58
    <change id="NbModuleSuite.enableClasspathModules">
75
    <change id="NbModuleSuite.enableClasspathModules">
59
        <api name="nbjunit"/>
76
        <api name="nbjunit"/>
60
        <summary>Ignore modules on classpath</summary>
77
        <summary>Ignore modules on classpath</summary>
(-)a/nbjunit/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.nbjunit/1
2
OpenIDE-Module: org.netbeans.modules.nbjunit/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/junit/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/junit/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.56
4
OpenIDE-Module-Specification-Version: 1.57
5
5
(-)a/nbjunit/src/org/netbeans/junit/NbModuleSuite.java (-20 / +50 lines)
Lines 113-118 Link Here
113
        final boolean reuseUserDir;
113
        final boolean reuseUserDir;
114
        final boolean gui;
114
        final boolean gui;
115
        final boolean enableClasspathModules;
115
        final boolean enableClasspathModules;
116
        final boolean enableAutoloads;
116
117
117
        private Configuration(
118
        private Configuration(
118
            List<String> clusterRegExp,
119
            List<String> clusterRegExp,
Lines 122-128 Link Here
122
            Class<? extends TestCase> latestTestCase,
123
            Class<? extends TestCase> latestTestCase,
123
            boolean reuseUserDir,
124
            boolean reuseUserDir,
124
            boolean gui,
125
            boolean gui,
125
            boolean enableCPModules
126
            boolean enableCPModules,
127
            boolean enableAutoloads
126
        ) {
128
        ) {
127
            this.clusterRegExp = clusterRegExp;
129
            this.clusterRegExp = clusterRegExp;
128
            this.moduleRegExp = moduleRegExp;
130
            this.moduleRegExp = moduleRegExp;
Lines 132-143 Link Here
132
            this.latestTestCaseClass = latestTestCase;
134
            this.latestTestCaseClass = latestTestCase;
133
            this.gui = gui;
135
            this.gui = gui;
134
            this.enableClasspathModules = enableCPModules;
136
            this.enableClasspathModules = enableCPModules;
137
            this.enableAutoloads = enableAutoloads;
135
        }
138
        }
136
139
137
        static Configuration create(Class<? extends TestCase> clazz) {            
140
        static Configuration create(Class<? extends TestCase> clazz) {            
138
            return new Configuration(
141
            return new Configuration(
139
                null, null, ClassLoader.getSystemClassLoader().getParent(),
142
                null, null, ClassLoader.getSystemClassLoader().getParent(),
140
                Collections.<Item>emptyList(), clazz, false, true, true
143
                Collections.<Item>emptyList(), clazz, false, true, true, true
141
            );
144
            );
142
        }
145
        }
143
        
146
        
Lines 165-171 Link Here
165
            }
168
            }
166
            return new Configuration(
169
            return new Configuration(
167
                list, moduleRegExp, parentClassLoader, tests,
170
                list, moduleRegExp, parentClassLoader, tests,
168
                latestTestCaseClass, reuseUserDir, gui, enableClasspathModules
171
                latestTestCaseClass, reuseUserDir, gui, enableClasspathModules,
172
                enableAutoloads
169
            );
173
            );
170
        }
174
        }
171
175
Lines 206-219 Link Here
206
            return new Configuration(
210
            return new Configuration(
207
                this.clusterRegExp, arr, parentClassLoader,
211
                this.clusterRegExp, arr, parentClassLoader,
208
                tests, latestTestCaseClass, reuseUserDir, gui,
212
                tests, latestTestCaseClass, reuseUserDir, gui,
209
                enableClasspathModules
213
                enableClasspathModules, enableAutoloads);
210
            );
211
        }
214
        }
212
215
213
        Configuration classLoader(ClassLoader parent) {
216
        Configuration classLoader(ClassLoader parent) {
214
            return new Configuration(
217
            return new Configuration(
215
                clusterRegExp, moduleRegExp, parent, tests,
218
                clusterRegExp, moduleRegExp, parent, tests,
216
                latestTestCaseClass, reuseUserDir, gui, enableClasspathModules
219
                latestTestCaseClass, reuseUserDir, gui, enableClasspathModules,
220
                enableAutoloads
217
            );
221
            );
218
        }
222
        }
219
223
Lines 237-244 Link Here
237
            return new Configuration(
241
            return new Configuration(
238
                clusterRegExp, moduleRegExp, parentClassLoader,
242
                clusterRegExp, moduleRegExp, parentClassLoader,
239
                newTests, latestTestCaseClass, reuseUserDir, gui,
243
                newTests, latestTestCaseClass, reuseUserDir, gui,
240
                enableClasspathModules
244
                enableClasspathModules, enableAutoloads);
241
            );
242
        }
245
        }
243
        
246
        
244
        /** Adds new test class to run, together with a list of its methods
247
        /** Adds new test class to run, together with a list of its methods
Lines 263-269 Link Here
263
            }
266
            }
264
            return new Configuration(
267
            return new Configuration(
265
                clusterRegExp, moduleRegExp, parentClassLoader,
268
                clusterRegExp, moduleRegExp, parentClassLoader,
266
                newTests, test, reuseUserDir, gui, enableClasspathModules
269
                newTests, test, reuseUserDir, gui, enableClasspathModules,
270
                enableAutoloads
267
            );
271
            );
268
        }
272
        }
269
        
273
        
Lines 288-294 Link Here
288
            return new Configuration(
292
            return new Configuration(
289
                clusterRegExp, moduleRegExp, parentClassLoader,
293
                clusterRegExp, moduleRegExp, parentClassLoader,
290
                newTests, latestTestCaseClass, reuseUserDir,
294
                newTests, latestTestCaseClass, reuseUserDir,
291
                gui, enableClasspathModules
295
                gui, enableClasspathModules, enableAutoloads
292
            );
296
            );
293
        }
297
        }
294
298
Lines 305-311 Link Here
305
            return new Configuration(
309
            return new Configuration(
306
                clusterRegExp, moduleRegExp, parentClassLoader,
310
                clusterRegExp, moduleRegExp, parentClassLoader,
307
                tests, latestTestCaseClass, reuseUserDir,
311
                tests, latestTestCaseClass, reuseUserDir,
308
                gui, enable
312
                gui, enable, enableAutoloads);
313
        }
314
315
        /** By default the {@link #enableModules(java.lang.String)} method
316
         * converts all autoloads into regular modules and enables them. This
317
         * is maybe useful in certain situations, but does not really mimic the
318
         * real behaviour of the system when it is executed. Those who need
319
         * to as closely as possible simulate the real run, can use
320
         * <code>enableAutoloads(false)</code>.
321
         *
322
         * @param enable false in case autoloads shall remain autoloads
323
         * @return new configuration filled with this data
324
         * @since 1.57
325
         */
326
        public Configuration enableAutoloads(boolean enable) {
327
            return new Configuration(
328
                clusterRegExp, moduleRegExp, parentClassLoader,
329
                tests, latestTestCaseClass, reuseUserDir,
330
                gui, enableAutoloads, enable
309
            );
331
            );
310
        }
332
        }
311
333
Lines 328-334 Link Here
328
                clusterRegExp, moduleRegExp, parentClassLoader,
350
                clusterRegExp, moduleRegExp, parentClassLoader,
329
                newTests, latestTestCaseClass, reuseUserDir, gui,
351
                newTests, latestTestCaseClass, reuseUserDir, gui,
330
                enableClasspathModules
352
                enableClasspathModules
331
            );
353
            ,enableAutoloads);
332
        }
354
        }
333
        
355
        
334
        /** Should the system run with GUI or without? The default behaviour
356
        /** Should the system run with GUI or without? The default behaviour
Lines 345-351 Link Here
345
                clusterRegExp, moduleRegExp, parentClassLoader,
367
                clusterRegExp, moduleRegExp, parentClassLoader,
346
                tests, latestTestCaseClass, reuseUserDir, gui,
368
                tests, latestTestCaseClass, reuseUserDir, gui,
347
                enableClasspathModules
369
                enableClasspathModules
348
            );
370
            ,enableAutoloads);
349
        }
371
        }
350
372
351
        /**
373
        /**
Lines 358-364 Link Here
358
            return new Configuration(
380
            return new Configuration(
359
                clusterRegExp, moduleRegExp, parentClassLoader, tests,
381
                clusterRegExp, moduleRegExp, parentClassLoader, tests,
360
                latestTestCaseClass, reuse, gui, enableClasspathModules
382
                latestTestCaseClass, reuse, gui, enableClasspathModules
361
            );
383
            ,enableAutoloads);
362
        }
384
        }
363
    }
385
    }
364
386
Lines 568-574 Link Here
568
            modules.remove("org.netbeans.insane");
590
            modules.remove("org.netbeans.insane");
569
            modules.add("org.netbeans.core.startup");
591
            modules.add("org.netbeans.core.startup");
570
            modules.add("org.netbeans.bootstrap");
592
            modules.add("org.netbeans.bootstrap");
571
            turnModules(ud, modules, config.moduleRegExp, platform);
593
            turnModules(ud, config.enableAutoloads, modules, config.moduleRegExp, platform);
572
            if (config.enableClasspathModules) {
594
            if (config.enableClasspathModules) {
573
                turnClassPathModules(ud, NbTestSuite.class.getClassLoader());
595
                turnClassPathModules(ud, NbTestSuite.class.getClassLoader());
574
            }
596
            }
Lines 576-582 Link Here
576
            StringBuilder sb = new StringBuilder();
598
            StringBuilder sb = new StringBuilder();
577
            String sep = "";
599
            String sep = "";
578
            for (File f : findClusters()) {
600
            for (File f : findClusters()) {
579
                turnModules(ud, modules, config.moduleRegExp, f);
601
                turnModules(ud, config.enableAutoloads, modules, config.moduleRegExp, f);
580
                sb.append(sep);
602
                sb.append(sep);
581
                sb.append(f.getPath());
603
                sb.append(f.getPath());
582
                sep = File.pathSeparator;
604
                sep = File.pathSeparator;
Lines 882-888 Link Here
882
        private static Pattern AUTO = Pattern.compile("<param name=[\"']autoload[\"']>([^<]*)</param>", Pattern.MULTILINE);
904
        private static Pattern AUTO = Pattern.compile("<param name=[\"']autoload[\"']>([^<]*)</param>", Pattern.MULTILINE);
883
        private static Pattern EAGER = Pattern.compile("<param name=[\"']eager[\"']>([^<]*)</param>", Pattern.MULTILINE);
905
        private static Pattern EAGER = Pattern.compile("<param name=[\"']eager[\"']>([^<]*)</param>", Pattern.MULTILINE);
884
        
906
        
885
        private static void turnModules(File ud, TreeSet<String> modules, List<String> regExp, File... clusterDirs) throws IOException {
907
        private static void turnModules(File ud, boolean autoloads, TreeSet<String> modules, List<String> regExp, File... clusterDirs) throws IOException {
886
            if (regExp == null) {
908
            if (regExp == null) {
887
                return;
909
                return;
888
            }
910
            }
Lines 923-938 Link Here
923
                        if (!contains) {
945
                        if (!contains) {
924
                            continue;
946
                            continue;
925
                        }
947
                        }
926
                        enableModule(xml, contains, new File(config, m.getName()));
948
                        enableModule(xml, autoloads, contains, new File(config, m.getName()));
927
                    }
949
                    }
928
                }
950
                }
929
            }
951
            }
930
        }
952
        }
931
        
953
        
932
        private static void enableModule(String xml, boolean enable, File target) throws IOException {
954
        private static void enableModule(String xml, boolean autoloads, boolean enable, File target) throws IOException {
933
            boolean toEnable = false;
955
            boolean toEnable = false;
934
            {
956
            {
935
                Matcher matcherEnabled = ENABLED.matcher(xml);
957
                  Matcher matcherEnabled = ENABLED.matcher(xml);
936
                if (matcherEnabled.find()) {
958
                if (matcherEnabled.find()) {
937
                    toEnable = "false".equals(matcherEnabled.group(1));
959
                    toEnable = "false".equals(matcherEnabled.group(1));
938
                }
960
                }
Lines 940-945 Link Here
940
                if (matcherEager.find()) {
962
                if (matcherEager.find()) {
941
                    if ("true".equals(matcherEager.group(1))) {
963
                    if ("true".equals(matcherEager.group(1))) {
942
                        return;
964
                        return;
965
                    }
966
                }
967
                if (!autoloads) {
968
                    Matcher matcherAuto = AUTO.matcher(xml);
969
                    if (matcherAuto.find()) {
970
                        if ("true".equals(matcherAuto.group(1))) {
971
                            return;
972
                        }
943
                    }
973
                    }
944
                }
974
                }
945
                if (toEnable) {
975
                if (toEnable) {
(-)a/nbjunit/test/unit/src/org/netbeans/junit/NbModuleSuiteTest.java (+11 lines)
Lines 238-243 Link Here
238
        junit.textui.TestRunner.run(instance);
238
        junit.textui.TestRunner.run(instance);
239
239
240
        assertEquals("OK", System.getProperty("en.one"));
240
        assertEquals("OK", System.getProperty("en.one"));
241
    }
242
243
    public void testAutoloadNotUsedIfAutoloadsAreSupposedToBeIgnored() {
244
        System.setProperty("en.one", "No");
245
246
        NbModuleSuite.Configuration config = NbModuleSuite.Configuration.create(AskForOrgOpenideUtilEnumClass.class);
247
        NbModuleSuite.Configuration addEnum = config.enableModules("org.openide.util.enumerations");
248
        Test instance = NbModuleSuite.create(addEnum.gui(false).enableAutoloads(false));
249
        junit.textui.TestRunner.run(instance);
250
251
        assertEquals("No", System.getProperty("en.one"));
241
    }
252
    }
242
253
243
    public void testClustersCanBeCumulated() {
254
    public void testClustersCanBeCumulated() {

Return to bug 157429