public static String getDataSourceName( DatabaseMeta dbMeta, String partitionId ) {

    String name = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getName(), "" ) );
    String username = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getUsername(), "" ) );
    String password = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getPassword(), "" ) );
    String preferredSchema = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getPreferredSchemaName(), "" ) );
    String database = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getDatabaseName(), "" ) );
    String hostname = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getHostname(), "" ) );
    String port = dbMeta.environmentSubstitute( Const.NVL( dbMeta.getDatabasePortNumberString(), "" ) );

    return name + username + password + preferredSchema + database + hostname + port + Const.NVL( partitionId, "" );
  }
@Test
  public void testGetDataSourceName() {
    DatabaseMeta dbMetaMock = mock( DatabaseMeta.class );
    String dbMetaName = UUID.randomUUID().toString();
    String dbMetaUsername = UUID.randomUUID().toString();
    String dbMetaPassword = UUID.randomUUID().toString();
    String dbMetaSchema = UUID.randomUUID().toString();
    String dbMetaDatabase = UUID.randomUUID().toString();
    String dbMetaHostname = UUID.randomUUID().toString();
    String dbMetaPort = UUID.randomUUID().toString();
    String partitionId = UUID.randomUUID().toString();

    when( dbMetaMock.getName() ).thenReturn( dbMetaName );
    when( dbMetaMock.getUsername() ).thenReturn( dbMetaUsername );
    when( dbMetaMock.getPassword() ).thenReturn( dbMetaPassword );
    when( dbMetaMock.getPreferredSchemaName() ).thenReturn( dbMetaSchema );
    when( dbMetaMock.getDatabaseName() ).thenReturn( dbMetaDatabase );
    when( dbMetaMock.getHostname() ).thenReturn( dbMetaHostname );
    when( dbMetaMock.getDatabasePortNumberString() ).thenReturn( dbMetaPort );

    when( dbMetaMock.environmentSubstitute( eq( dbMetaName ) ) ).thenReturn( dbMetaName );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaUsername ) ) ).thenReturn( dbMetaUsername );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaPassword ) ) ).thenReturn( dbMetaPassword );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaSchema ) ) ).thenReturn( dbMetaSchema );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaDatabase ) ) ).thenReturn( dbMetaDatabase );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaHostname ) ) ).thenReturn( dbMetaHostname );
    when( dbMetaMock.environmentSubstitute( eq( dbMetaPort ) ) ).thenReturn( dbMetaPort );

    String dataSourceNameExpected = dbMetaName + dbMetaUsername + dbMetaPassword + dbMetaSchema + dbMetaDatabase +
      dbMetaHostname + dbMetaPort + partitionId;
    String dataSourceName = ConnectionPoolUtil.getDataSourceName( dbMetaMock, partitionId );

    assertEquals( dataSourceNameExpected, dataSourceName );
  }