KafkaConnectCluster extends AbstractModel { public Service generateService() { List<ServicePort> ports = new ArrayList<>(1); ports.add(createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT, "TCP")); return createService("ClusterIP", ports, Util.mergeLabelsOrAnnotations(templateServiceAnnotations)); } protected  KafkaConnectCluster(HasMetadata resource); protected  KafkaConnectCluster(HasMetadata resource, String applicationName); static KafkaConnectCluster fromCrd(KafkaConnect kafkaConnect, KafkaVersion.Lookup versions); Service generateService(); Deployment generateDeployment(Map<String, String> annotations, boolean isOpenShift, ImagePullPolicy imagePullPolicy, List<LocalObjectReference> imagePullSecrets); PodDisruptionBudget generatePodDisruptionBudget(); @Override String getServiceAccountName(); NetworkPolicy generateNetworkPolicy(boolean namespaceAndPodSelectorNetworkPolicySupported, boolean connectorOperatorEnabled); Tracing getTracing(); ClusterRoleBinding generateClusterRoleBinding(); static final int REST_API_PORT; static final Probe DEFAULT_HEALTHCHECK_OPTIONS; }
@Test public void testGenerateService() { Service svc = kc.generateService(); assertThat(svc.getSpec().getType(), is("ClusterIP")); assertThat(svc.getMetadata().getLabels(), is(expectedLabels(kc.getServiceName()))); assertThat(svc.getSpec().getSelector(), is(expectedSelectorLabels())); assertThat(svc.getSpec().getPorts().size(), is(1)); assertThat(svc.getSpec().getPorts().get(0).getPort(), is(Integer.valueOf(KafkaConnectCluster.REST_API_PORT))); assertThat(svc.getSpec().getPorts().get(0).getName(), is(KafkaConnectCluster.REST_API_PORT_NAME)); assertThat(svc.getSpec().getPorts().get(0).getProtocol(), is("TCP")); assertThat(svc.getMetadata().getAnnotations().size(), is(0)); checkOwnerReference(kc.createOwnerReference(), svc); }