@Test void buildWithCustomPortEnvironmentBundle_expectCustomAndDefaults() { ListenPortEntityBuilder builder = new ListenPortEntityBuilder(ID_GENERATOR); final Bundle bundle = new Bundle(); addPortToBundle(bundle, buildPort()); final List<Entity> listenPortEntities = builder.build(bundle, BundleType.ENVIRONMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument()); assertEquals(3, listenPortEntities.size(),"More than 3 expected ports"); checkExpectedPorts(listenPortEntities, ListenPort.HTTP_DEFAULT_PORT, ListenPort.HTTPS_DEFAULT_PORT, TEST_HTTP_PORT); }
@Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, ListenPort> listenPortMap = Optional.ofNullable(bundle.getListenPorts()).orElse(Collections.emptyMap()); return buildEntities(listenPortMap, ((AnnotatedBundle) bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getListenPorts(), bundle, bundleType, document); } }
ListenPortEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, ListenPort> listenPortMap = Optional.ofNullable(bundle.getListenPorts()).orElse(Collections.emptyMap()); return buildEntities(listenPortMap, ((AnnotatedBundle) bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getListenPorts(), bundle, bundleType, document); } } }
ListenPortEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, ListenPort> listenPortMap = Optional.ofNullable(bundle.getListenPorts()).orElse(Collections.emptyMap()); return buildEntities(listenPortMap, ((AnnotatedBundle) bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getListenPorts(), bundle, bundleType, document); } } @Inject  ListenPortEntityBuilder(IdGenerator idGenerator); }
ListenPortEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, ListenPort> listenPortMap = Optional.ofNullable(bundle.getListenPorts()).orElse(Collections.emptyMap()); return buildEntities(listenPortMap, ((AnnotatedBundle) bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getListenPorts(), bundle, bundleType, document); } } @Inject  ListenPortEntityBuilder(IdGenerator idGenerator); @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @NotNull @Override Integer getOrder(); }
ListenPortEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, ListenPort> listenPortMap = Optional.ofNullable(bundle.getListenPorts()).orElse(Collections.emptyMap()); return buildEntities(listenPortMap, ((AnnotatedBundle) bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getListenPorts(), bundle, bundleType, document); } } @Inject  ListenPortEntityBuilder(IdGenerator idGenerator); @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @NotNull @Override Integer getOrder();  }