@Test(expectedExceptions = LookupException.class) public void triggerException() throws Exception { new DynamicHostnameGenerator("B-", "acc.edelivery.tech.ec.europa.eu", "SHA-224").generate(null); }
public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); String generate(ParticipantIdentifier participantIdentifier); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); String generate(ParticipantIdentifier participantIdentifier);  }