@Test public void testCleanStartup() { assertEquals(DomainValidationResult.DomainValidationResultType.OK, validator.validate("_123435").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.OK, validator.validate("a_35").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.ERRORS, validator.validate("12asd").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.ERRORS, validator.validate("a-sd").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.OK, validator.validate("asd/a12").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.OK, validator.validate("asd/_a12/foo123").getResultType()); assertEquals(DomainValidationResult.DomainValidationResultType.ERRORS, validator.validate("/aaa/bbb") .getResultType()); }
@Override public DomainValidationResult validate(String hostId) { hostId = hostId.trim(); if (hostId.isEmpty()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, "A host ID is required."); } if (!HOST_ID_VALIDATION_PATTERN.matcher(hostId).matches()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, HOST_ID_FORMAT_DESCRIPTION); } return new DomainValidationResult(DomainValidationResultType.OK, null); }
SpaceControllerHostIdValidator implements Validator { @Override public DomainValidationResult validate(String hostId) { hostId = hostId.trim(); if (hostId.isEmpty()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, "A host ID is required."); } if (!HOST_ID_VALIDATION_PATTERN.matcher(hostId).matches()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, HOST_ID_FORMAT_DESCRIPTION); } return new DomainValidationResult(DomainValidationResultType.OK, null); } }
SpaceControllerHostIdValidator implements Validator { @Override public DomainValidationResult validate(String hostId) { hostId = hostId.trim(); if (hostId.isEmpty()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, "A host ID is required."); } if (!HOST_ID_VALIDATION_PATTERN.matcher(hostId).matches()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, HOST_ID_FORMAT_DESCRIPTION); } return new DomainValidationResult(DomainValidationResultType.OK, null); }  }
SpaceControllerHostIdValidator implements Validator { @Override public DomainValidationResult validate(String hostId) { hostId = hostId.trim(); if (hostId.isEmpty()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, "A host ID is required."); } if (!HOST_ID_VALIDATION_PATTERN.matcher(hostId).matches()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, HOST_ID_FORMAT_DESCRIPTION); } return new DomainValidationResult(DomainValidationResultType.OK, null); }  @Override DomainValidationResult validate(String hostId); }
SpaceControllerHostIdValidator implements Validator { @Override public DomainValidationResult validate(String hostId) { hostId = hostId.trim(); if (hostId.isEmpty()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, "A host ID is required."); } if (!HOST_ID_VALIDATION_PATTERN.matcher(hostId).matches()) { return new DomainValidationResult(DomainValidationResultType.ERRORS, HOST_ID_FORMAT_DESCRIPTION); } return new DomainValidationResult(DomainValidationResultType.OK, null); }  @Override DomainValidationResult validate(String hostId); static final String HOST_ID_SEGMENT_VALIDATION_REGEX; static final Pattern HOST_ID_VALIDATION_PATTERN; static final String HOST_ID_FORMAT_DESCRIPTION; }