@Test public void testLoadAccessData() throws Exception { when( accessBox.getSelectedItem() ).thenReturn( "Native" ); DatabaseInterface dbInterface = mock( DatabaseInterface.class ); when( dbInterface.getDefaultDatabasePort() ).thenReturn( 5309 ); DataHandler.connectionMap.put( "myDb", dbInterface ); dataHandler.loadAccessData(); dataHandler.loadAccessData(); }
public void loadAccessData() { getControls(); pushCache(); Object key = connectionBox.getSelectedItem(); if ( key == null ) { key = connectionMap.firstKey(); connectionBox.setSelectedItem( key ); return; } DatabaseInterface database = connectionMap.get( key ); int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); for ( int value : acc ) { accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) ); } accessBox.setRows( accessBox.getRows() ); if ( accessKey != null ) { accessBox.setSelectedItem( accessKey ); } if ( accessBox.getSelectedItem() == null ) { accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[0] ) ); } Map<String, String> options = null; if ( this.databaseMeta != null ) { this.databaseMeta.applyDefaultOptions( database ); options = this.databaseMeta.getExtraOptions(); } else { clearOptionsData(); options = database.getDefaultOptions(); } setOptionsData( options ); PartitionDatabaseMeta[] clusterInfo = null; if ( this.databaseMeta != null ) { clusterInfo = this.databaseMeta.getPartitioningInformation(); } setClusterData( clusterInfo ); popCache(); }
DataHandler extends AbstractXulEventHandler { public void loadAccessData() { getControls(); pushCache(); Object key = connectionBox.getSelectedItem(); if ( key == null ) { key = connectionMap.firstKey(); connectionBox.setSelectedItem( key ); return; } DatabaseInterface database = connectionMap.get( key ); int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); for ( int value : acc ) { accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) ); } accessBox.setRows( accessBox.getRows() ); if ( accessKey != null ) { accessBox.setSelectedItem( accessKey ); } if ( accessBox.getSelectedItem() == null ) { accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[0] ) ); } Map<String, String> options = null; if ( this.databaseMeta != null ) { this.databaseMeta.applyDefaultOptions( database ); options = this.databaseMeta.getExtraOptions(); } else { clearOptionsData(); options = database.getDefaultOptions(); } setOptionsData( options ); PartitionDatabaseMeta[] clusterInfo = null; if ( this.databaseMeta != null ) { clusterInfo = this.databaseMeta.getPartitioningInformation(); } setClusterData( clusterInfo ); popCache(); } }
DataHandler extends AbstractXulEventHandler { public void loadAccessData() { getControls(); pushCache(); Object key = connectionBox.getSelectedItem(); if ( key == null ) { key = connectionMap.firstKey(); connectionBox.setSelectedItem( key ); return; } DatabaseInterface database = connectionMap.get( key ); int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); for ( int value : acc ) { accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) ); } accessBox.setRows( accessBox.getRows() ); if ( accessKey != null ) { accessBox.setSelectedItem( accessKey ); } if ( accessBox.getSelectedItem() == null ) { accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[0] ) ); } Map<String, String> options = null; if ( this.databaseMeta != null ) { this.databaseMeta.applyDefaultOptions( database ); options = this.databaseMeta.getExtraOptions(); } else { clearOptionsData(); options = database.getDefaultOptions(); } setOptionsData( options ); PartitionDatabaseMeta[] clusterInfo = null; if ( this.databaseMeta != null ) { clusterInfo = this.databaseMeta.getPartitioningInformation(); } setClusterData( clusterInfo ); popCache(); } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void loadAccessData() { getControls(); pushCache(); Object key = connectionBox.getSelectedItem(); if ( key == null ) { key = connectionMap.firstKey(); connectionBox.setSelectedItem( key ); return; } DatabaseInterface database = connectionMap.get( key ); int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); for ( int value : acc ) { accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) ); } accessBox.setRows( accessBox.getRows() ); if ( accessKey != null ) { accessBox.setSelectedItem( accessKey ); } if ( accessBox.getSelectedItem() == null ) { accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[0] ) ); } Map<String, String> options = null; if ( this.databaseMeta != null ) { this.databaseMeta.applyDefaultOptions( database ); options = this.databaseMeta.getExtraOptions(); } else { clearOptionsData(); options = database.getDefaultOptions(); } setOptionsData( options ); PartitionDatabaseMeta[] clusterInfo = null; if ( this.databaseMeta != null ) { clusterInfo = this.databaseMeta.getPartitioningInformation(); } setClusterData( clusterInfo ); popCache(); } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void loadAccessData() { getControls(); pushCache(); Object key = connectionBox.getSelectedItem(); if ( key == null ) { key = connectionMap.firstKey(); connectionBox.setSelectedItem( key ); return; } DatabaseInterface database = connectionMap.get( key ); int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); for ( int value : acc ) { accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) ); } accessBox.setRows( accessBox.getRows() ); if ( accessKey != null ) { accessBox.setSelectedItem( accessKey ); } if ( accessBox.getSelectedItem() == null ) { accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[0] ) ); } Map<String, String> options = null; if ( this.databaseMeta != null ) { this.databaseMeta.applyDefaultOptions( database ); options = this.databaseMeta.getExtraOptions(); } else { clearOptionsData(); options = database.getDefaultOptions(); } setOptionsData( options ); PartitionDatabaseMeta[] clusterInfo = null; if ( this.databaseMeta != null ) { clusterInfo = this.databaseMeta.getPartitioningInformation(); } setClusterData( clusterInfo ); popCache(); } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }