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

(-)db/test/unit/src/org/netbeans/api/db/explorer/DatabaseConnectionTest.java (+35 lines)
Lines 195-200 Link Here
195
        }
195
        }
196
    }
196
    }
197
197
198
    /**
199
     * Verifies that the {@link DatabaseConnection#create(org.netbeans.api.db.explorer.JDBCDriver, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String)}
200
     * factory method creates a valid connection with the given display name
201
     *
202
     * @throws Exception
203
     */
204
    public void testDatabaseConnectionCreatedWithDisplayName() throws Exception{
205
        Util.clearConnections();
206
        Util.deleteDriverFiles();
207
208
        JDBCDriver driver = Util.createDummyDriver();
209
        DatabaseConnection dbconn = DatabaseConnection.create(driver, "database", "user", "schema", "password", true,"displayName");
210
211
        assertEquals("The connection was created with a display name different that the one provided", "displayName",dbconn.getDisplayName());
212
213
        Util.clearConnections();
214
215
    }
216
    /**
217
     * Verifies that the {@link DatabaseConnection#create(org.netbeans.api.db.explorer.JDBCDriver, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)}
218
     * creates some default display name that is not null
219
     * @throws Exception
220
     */
221
    public void testDatabaseConnectionCreatedWithDefaultDisplayName() throws Exception{
222
        Util.clearConnections();
223
        Util.deleteDriverFiles();
224
225
        JDBCDriver driver = Util.createDummyDriver();
226
        DatabaseConnection dbconn = DatabaseConnection.create(driver, "database", "user", "schema", "password", true);
227
228
        assertNotNull("The connection was created with a null display name ", dbconn.getDisplayName());
229
230
        Util.clearConnections();
231
    }
232
198
    private static boolean connectionIsValid(Connection conn) throws Exception {
233
    private static boolean connectionIsValid(Connection conn) throws Exception {
199
        return org.netbeans.modules.db.explorer.DatabaseConnection.isVitalConnection(conn, null);
234
        return org.netbeans.modules.db.explorer.DatabaseConnection.isVitalConnection(conn, null);
200
    }
235
    }

Return to bug 192150