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 197572
Collapse All | Expand All

(-)a/maven.model/src/org/netbeans/modules/maven/model/Utilities.java (-1 / +1 lines)
Lines 91-97 Link Here
91
91
92
    private Utilities() {}
92
    private Utilities() {}
93
93
94
    static final Logger logger = Logger.getLogger(Utilities.class.getName());
94
    private static final Logger logger = Logger.getLogger(Utilities.class.getName());
95
95
96
    /**
96
    /**
97
     * 
97
     * 
(-)a/maven.model/test/unit/src/org/netbeans/modules/maven/model/UtilitiesTest.java (-3 / +4 lines)
Lines 44-50 Link Here
44
44
45
import java.util.Collections;
45
import java.util.Collections;
46
import java.util.logging.Level;
46
import java.util.logging.Level;
47
import java.util.logging.Logger;
48
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
49
import org.netbeans.modules.maven.model.pom.POMModel;
48
import org.netbeans.modules.maven.model.pom.POMModel;
50
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileObject;
Lines 59-72 Link Here
59
58
60
    protected @Override void setUp() throws Exception {
59
    protected @Override void setUp() throws Exception {
61
        clearWorkDir();
60
        clearWorkDir();
62
        Logger.getLogger("").setLevel(Level.OFF);
63
        Utilities.logger.setLevel(Level.ALL);
64
    }
61
    }
65
62
66
    protected @Override Level logLevel() {
63
    protected @Override Level logLevel() {
67
        return Level.FINE;
64
        return Level.FINE;
68
    }
65
    }
69
66
67
    protected @Override String logRoot() {
68
        return Utilities.class.getName();
69
    }
70
70
    public void testPerformPOMModelOperations() throws Exception {
71
    public void testPerformPOMModelOperations() throws Exception {
71
        FileObject pom = TestFileUtils.writeFile(FileUtil.toFileObject(getWorkDir()), "p0m.xml",
72
        FileObject pom = TestFileUtils.writeFile(FileUtil.toFileObject(getWorkDir()), "p0m.xml",
72
                "<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd'>\n" +
73
                "<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd'>\n" +
(-)a/nbjunit/src/org/netbeans/junit/Log.java (-2 / +2 lines)
Lines 247-257 Link Here
247
247
248
248
249
249
250
    static void configure(Level lev, NbTestCase current) {
250
    static void configure(Level lev, String root, NbTestCase current) {
251
        IL il = new IL(false);
251
        IL il = new IL(false);
252
        
252
        
253
        String c = "handlers=" + Log.class.getName() + "\n" +
253
        String c = "handlers=" + Log.class.getName() + "\n" +
254
                   ".level=" + lev.intValue() + "\n";
254
                   root + ".level=" + lev.intValue() + "\n";
255
255
256
        ByteArrayInputStream is = new ByteArrayInputStream(c.getBytes());
256
        ByteArrayInputStream is = new ByteArrayInputStream(c.getBytes());
257
        try {
257
        try {
(-)a/nbjunit/src/org/netbeans/junit/NbTestCase.java (-2 / +11 lines)
Lines 194-200 Link Here
194
    * Allows easy collecting of log messages send thru java.util.logging API.
194
    * Allows easy collecting of log messages send thru java.util.logging API.
195
    * Overwrite and return the log level to collect logs to logging file. 
195
    * Overwrite and return the log level to collect logs to logging file. 
196
    * If the method returns non-null level, then the level is assigned to
196
    * If the method returns non-null level, then the level is assigned to
197
    * the <code>Logger.getLogger("")</code> and the messages reported to it
197
    * the <code>Logger.getLogger({@linkplain #logRoot logRoot()})</code> and the messages reported to it
198
    * are then send into regular log file (which is accessible thru {@link NbTestCase#getLog})
198
    * are then send into regular log file (which is accessible thru {@link NbTestCase#getLog})
199
    * and in case of failure the last few messages is also included
199
    * and in case of failure the last few messages is also included
200
    * in <code>failure.getMessage()</code>.
200
    * in <code>failure.getMessage()</code>.
Lines 209-214 Link Here
209
    }
209
    }
210
         
210
         
211
    /**
211
    /**
212
     * If overriding {@link #logLevel}, may override this as well to collect messages from only some code.
213
     * @return {@code ""} (default) to collect messages from all loggers; or {@code "my.pkg"} or {@code "my.pkg.Class"} etc.
214
     * @since XXX
215
     */
216
    protected String logRoot() {
217
        return "";
218
    }
219
         
220
    /**
212
     * Runs the test case, while conditionally skip some according to result of
221
     * Runs the test case, while conditionally skip some according to result of
213
     * {@link #canRun} method.
222
     * {@link #canRun} method.
214
     */
223
     */
Lines 223-229 Link Here
223
            } catch(BackingStoreException bex) {}
232
            } catch(BackingStoreException bex) {}
224
            Level lev = logLevel();
233
            Level lev = logLevel();
225
            if (lev != null) {
234
            if (lev != null) {
226
                Log.configure(lev, NbTestCase.this);
235
                Log.configure(lev, logRoot(), NbTestCase.this);
227
            }
236
            }
228
            super.run(result);
237
            super.run(result);
229
        }
238
        }

Return to bug 197572