protected static String clusterNameWithRouting(final String clusterName,
                                                 final String destinationColo,
                                                 final String masterColo,
                                                 final boolean defaultRoutingToMasterColo,
                                                 final boolean enableSymlink)
  {
    final String defaultColoClusterName;
    if (!"".matches(destinationColo) && defaultRoutingToMasterColo)
    {
      // If this service is configured to route all requests to the master colo by default
      // then we need to configure the service to use the master colo.
      if (enableSymlink)
      {
        defaultColoClusterName = D2Utils.getSymlinkNameForMaster(clusterName);
      }
      else
      {
        defaultColoClusterName = D2Utils.addSuffixToBaseName(clusterName, masterColo);
      }
    }
    else
    {
      // For regular service node, if not route to master colo, the cluster name should be the original
      // cluster without suffix.
      defaultColoClusterName = clusterName;
    }
    return defaultColoClusterName;
  }
@Test
  public static void testClusterNameWithRouting() throws Exception
  {
    String clusterNameWithRouting;

    clusterNameWithRouting = D2Config.clusterNameWithRouting("clusterName",
                                                             "destinationColo",
                                                             "masterColo",
                                                             false,
                                                             false);
    assertEquals("clusterName", clusterNameWithRouting);

    clusterNameWithRouting = D2Config.clusterNameWithRouting("clusterName",
                                                             "destinationColo",
                                                             "masterColo",
                                                             true,
                                                             false);
    assertEquals("clusterName-masterColo", clusterNameWithRouting);

    clusterNameWithRouting = D2Config.clusterNameWithRouting("clusterName",
                                                             "destinationColo",
                                                             "masterColo",
                                                             true,
                                                             true);
    assertEquals(D2Utils.getSymlinkNameForMaster("clusterName"), clusterNameWithRouting);

    clusterNameWithRouting = D2Config.clusterNameWithRouting("clusterName",
                                                             "",
                                                             "masterColo",
                                                             false,
                                                             false);
    assertEquals("clusterName", clusterNameWithRouting);

    clusterNameWithRouting = D2Config.clusterNameWithRouting("clusterName",
                                                             "",
                                                             "masterColo",
                                                             true,
                                                             false);
    assertEquals("clusterName", clusterNameWithRouting);
  }