ListenPortEntityBuilder implements EntityBuilder { @NotNull static ListenPort createDefaultHttps() { ListenPort defaultHttps = new ListenPort(); defaultHttps.setPort(ListenPort.HTTPS_DEFAULT_PORT); defaultHttps.setProtocol(ListenPort.PROTOCOL_HTTPS); defaultHttps.setEnabledFeatures(new HashSet<>(asList(Feature.MESSAGE_INPUT.getDescription(), Feature.ADMIN_REMOTE.getDescription(), Feature.ADMIN_APPLET.getDescription(), Feature.OTHER_SERVLETS.getDescription()))); defaultHttps.setTlsSettings(new ListenPortTlsSettings()); defaultHttps.getTlsSettings().setClientAuthentication(ClientAuthentication.OPTIONAL); defaultHttps.getTlsSettings().setEnabledVersions(new HashSet<>(ListenPort.TLS_VERSIONS)); defaultHttps.getTlsSettings().setEnabledCipherSuites(new HashSet<>(ListenPort.DEFAULT_RECOMMENDED_CIPHERS)); defaultHttps.getTlsSettings().setProperties(new HashMap<>()); defaultHttps.getTlsSettings().getProperties().put(USES_TLS, TRUE); return defaultHttps; } @Inject  ListenPortEntityBuilder(IdGenerator idGenerator); @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @NotNull @Override Integer getOrder();  }
@Test void checkDefaultHttpsPortConfiguration() { ListenPort defaultHttps = ListenPortEntityBuilder.createDefaultHttps(); Assertions.assertEquals(ListenPort.HTTPS_DEFAULT_PORT.intValue(), defaultHttps.getPort()); Assertions.assertEquals(ListenPort.PROTOCOL_HTTPS, defaultHttps.getProtocol()); assertTrue(defaultHttps.getEnabledFeatures().containsAll(asList(Feature.MESSAGE_INPUT.getDescription(), Feature.ADMIN_REMOTE.getDescription(), Feature.ADMIN_APPLET.getDescription(), Feature.OTHER_SERVLETS.getDescription()))); assertNotNull(defaultHttps.getTlsSettings()); Assertions.assertEquals(ClientAuthentication.OPTIONAL, defaultHttps.getTlsSettings().getClientAuthentication()); assertTrue(defaultHttps.getTlsSettings().getEnabledVersions().containsAll(ListenPort.TLS_VERSIONS)); assertTrue(defaultHttps.getTlsSettings().getEnabledCipherSuites().containsAll(ListenPort.DEFAULT_RECOMMENDED_CIPHERS)); assertNotNull(defaultHttps.getTlsSettings().getProperties()); assertFalse(defaultHttps.getTlsSettings().getProperties().isEmpty()); assertEquals(1, defaultHttps.getTlsSettings().getProperties().size()); assertNotNull(defaultHttps.getTlsSettings().getProperties().get("usesTLS")); assertTrue((Boolean) defaultHttps.getTlsSettings().getProperties().get("usesTLS")); }