@Test void testGetCommonNameWhenTheEndpointNameIsLongerThan17AndEnvNameLongerThan8Chars() { String endpointName = "test-cl-longyloooooooooooong-name-master0"; String envName = "notashort-env-name-as28chars"; String accountName = "xcu2-8y8x"; String rootDomain = "wl.cloudera.site"; ReflectionTestUtils.setField(underTest, "rootDomain", rootDomain); String commonName = underTest.getCommonName(endpointName, envName, accountName); String expected = String.format("a7c2a45fc8f917fe.%s.%s.%s", envName.substring(0, 8), accountName, rootDomain); assertEquals(expected, commonName); }
public String getCommonName(String endpointName, String environmentName, String accountName) { String domain = getDomainName(environmentName, accountName); String uniqueNameToBeHashed = endpointName + environmentName; String clusterHash = sipHash24().hashUnencodedChars(uniqueNameToBeHashed).toString(); return clusterHash + DOMAIN_PART_DELIMITER + domain; }
EnvironmentBasedDomainNameProvider { public String getCommonName(String endpointName, String environmentName, String accountName) { String domain = getDomainName(environmentName, accountName); String uniqueNameToBeHashed = endpointName + environmentName; String clusterHash = sipHash24().hashUnencodedChars(uniqueNameToBeHashed).toString(); return clusterHash + DOMAIN_PART_DELIMITER + domain; } }
EnvironmentBasedDomainNameProvider { public String getCommonName(String endpointName, String environmentName, String accountName) { String domain = getDomainName(environmentName, accountName); String uniqueNameToBeHashed = endpointName + environmentName; String clusterHash = sipHash24().hashUnencodedChars(uniqueNameToBeHashed).toString(); return clusterHash + DOMAIN_PART_DELIMITER + domain; }  }
EnvironmentBasedDomainNameProvider { public String getCommonName(String endpointName, String environmentName, String accountName) { String domain = getDomainName(environmentName, accountName); String uniqueNameToBeHashed = endpointName + environmentName; String clusterHash = sipHash24().hashUnencodedChars(uniqueNameToBeHashed).toString(); return clusterHash + DOMAIN_PART_DELIMITER + domain; }  String getDomainName(String environmentName, String accountName); String getFullyQualifiedEndpointName(String endpointName, String environmentName, String accountName); String getCommonName(String endpointName, String environmentName, String accountName); }
EnvironmentBasedDomainNameProvider { public String getCommonName(String endpointName, String environmentName, String accountName) { String domain = getDomainName(environmentName, accountName); String uniqueNameToBeHashed = endpointName + environmentName; String clusterHash = sipHash24().hashUnencodedChars(uniqueNameToBeHashed).toString(); return clusterHash + DOMAIN_PART_DELIMITER + domain; }  String getDomainName(String environmentName, String accountName); String getFullyQualifiedEndpointName(String endpointName, String environmentName, String accountName); String getCommonName(String endpointName, String environmentName, String accountName);  }