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

(-)db/test/unit/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIsTest.java (-1 / +4 lines)
Lines 41-47 Link Here
41
 * Version 2 license, then the option applies only if the new code is
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
42
 * made subject to such option by the copyright holder.
43
 */
43
 */
44
45
package org.netbeans.api.db.explorer.support;
44
package org.netbeans.api.db.explorer.support;
46
45
47
import javax.swing.JComboBox;
46
import javax.swing.JComboBox;
Lines 111-122 Link Here
111
        DatabaseConnection dc = DatabaseConnection.create(Util.createDummyDriver(), "dc1", "user", "schema", "password", true);
110
        DatabaseConnection dc = DatabaseConnection.create(Util.createDummyDriver(), "dc1", "user", "schema", "password", true);
112
        ConnectionManager.getDefault().addConnection(dc);
111
        ConnectionManager.getDefault().addConnection(dc);
113
112
113
        forceFlush();
114
        
114
        assertEquals("Wrong number of items in the combobox", 4, combo.getItemCount());
115
        assertEquals("Wrong number of items in the combobox", 4, combo.getItemCount());
115
116
116
        assertSame(dc, combo.getItemAt(2));
117
        assertSame(dc, combo.getItemAt(2));
117
118
118
        ConnectionManager.getDefault().removeConnection(dc);
119
        ConnectionManager.getDefault().removeConnection(dc);
119
120
121
        forceFlush();
122
120
        assertEquals("Wrong number of items in the combobox", 3, combo.getItemCount());
123
        assertEquals("Wrong number of items in the combobox", 3, combo.getItemCount());
121
124
122
        assertSame(dbconn2, combo.getItemAt(0));
125
        assertSame(dbconn2, combo.getItemAt(0));
(-)db/test/unit/src/org/netbeans/modules/db/test/TestBase.java (+33 lines)
Lines 44-50 Link Here
44
44
45
package org.netbeans.modules.db.test;
45
package org.netbeans.modules.db.test;
46
46
47
import java.io.IOException;
48
import java.lang.reflect.InvocationTargetException;
49
import javax.swing.SwingUtilities;
47
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.junit.NbTestCase;
51
import org.openide.filesystems.FileSystem;
52
import org.openide.filesystems.FileUtil;
48
53
49
/**
54
/**
50
 * Common ancestor for all test classes.
55
 * Common ancestor for all test classes.
Lines 59-62 Link Here
59
        super(name);
64
        super(name);
60
    }
65
    }
61
66
67
    /**
68
     * Force flush of config filesystem and EDT.
69
     * 
70
     * Make sure outstanding writes to the config filesystem and outstanding 
71
     * events on the EDT are flushed
72
     */
73
    protected void forceFlush() {
74
        if(SwingUtilities.isEventDispatchThread()) {
75
            throw new IllegalStateException("forceFlush might only be called of the EDT!");
62
}
76
}
77
        try {
78
            FileUtil.getConfigRoot().getFileSystem()
79
                    .runAtomicAction(new FileSystem.AtomicAction() {
80
                @Override
81
                public void run() throws IOException {
82
                    // NOOP - force a wait         
83
                }
84
            });
85
            SwingUtilities.invokeAndWait(new Runnable() {
86
                @Override
87
                public void run() {
88
                    // NOOP - force a wait
89
                }
90
            });
91
        } catch (IOException | InterruptedException | InvocationTargetException ex) {
92
            throw new RuntimeException(ex);
93
        }
94
    }
95
}

Return to bug 229250