public void loadAccessData() {

    getControls();

    pushCache();

    Object key = connectionBox.getSelectedItem();

    // Nothing selected yet...
    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();

    // Add those access types applicable to this conneciton type

    for ( int value : acc ) {
      accessBox.addItem( DatabaseMeta.getAccessTypeDescLong( value ) );
    }

    // HACK: Need to force height of list control, as it does not behave
    // well when using relative layouting

    accessBox.setRows( accessBox.getRows() );

    // May not exist for this connection type.
    if ( accessKey != null ) { // This check keeps the SwtListbox from complaining about a null value
      accessBox.setSelectedItem( accessKey );
    }

    // Last resort, set first as default
    if ( accessBox.getSelectedItem() == null ) {
      accessBox.setSelectedItem( DatabaseMeta.getAccessTypeDescLong( acc[ 0 ] ) );
    }

    Map<String, String> options = null;
    if ( this.databaseMeta != null ) {
      // Apply defaults to meta if set (only current db type will be displayed)
      this.databaseMeta.applyDefaultOptions( database );
      options = this.databaseMeta.getExtraOptions();
    } else {
      // Otherwise clear and display defaults directly
      clearOptionsData();
      options = database.getDefaultOptions();
    }
    setOptionsData( options );
    PartitionDatabaseMeta[] clusterInfo = null;
    if ( this.databaseMeta != null ) {
      clusterInfo = this.databaseMeta.getPartitioningInformation();
    }
    setClusterData( clusterInfo );

    popCache();

  }
@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();

    // Should immediately return if called again since the connectionBox will have been loaded
    dataHandler.loadAccessData();
  }