public static ImmutablePair<DECISION, String> decide(final String data) { String modified = sanitize.matcher(data).replaceAll(""); if (InetAddresses.isInetAddress(data)) { // We return sanitized version with which we could operate as with IP address return new ImmutablePair<>(DECISION.IP, modified); } else { modified = dotUnderscoreRemove.matcher(modified).replaceAll(""); modified = dotUnderscoreSeparatorPattern.matcher(modified).replaceAll("\\."); if (HostSpecifier.isValid(modified)) { // We are satisfied that FQDN could be made of this data, but we return the original form. return new ImmutablePair<>(DECISION.FQDN, data); } else { return new ImmutablePair<>(DECISION.GARBAGE, data); } } }
public GlycerinHttpClient(HostSpecifier host, String apiKey, Optional<RateLimiter> limiter, Optional<String> root) { this.host = checkNotNull(host); this.apiKey = checkNotNull(apiKey); this.limiter = checkNotNull(limiter); this.root = checkNotNull(root); this.requestFactory = initRequestFactory(); }
@Parameters({"nitro.host", "nitro.apikey"}) @BeforeClass(groups = "integration") public void setup(String host, String apiKey) { glycerin = XmlGlycerin.builder(apiKey) .withHost(HostSpecifier.fromValid(host)) .build(); }
@Parameters({ "nitro.host", "nitro.apikey" }) @BeforeClass(groups = "integration") public void setUp(String host, String apiKey) throws ParseException { this.ignorableDeprecations = HashMultimap.create(); addDeprecatedElementsToTheIgnorableMap(); glycerinClient = new GlycerinHttpClient(HostSpecifier.from(host), apiKey, limiter, root); }
public static boolean isValidHost(String host) { return HostSpecifier.isValid(host) && InternetDomainName.isValid(host) && InternetDomainName.from(host).isUnderPublicSuffix(); }
public Builder withHost(HostSpecifier host) { this.host = host; return this; }
public XmlGlycerin(HostSpecifier host, String apiKey, Optional<RateLimiter> limiter, Optional<String> root) { this.client = new GlycerinHttpClient(host, apiKey, limiter, root); }