Skip to content

Commit

Permalink
Removed unnecessary publics
Browse files Browse the repository at this point in the history
  • Loading branch information
wlodarcp committed Oct 7, 2021
1 parent b6c4574 commit 0caf3fd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
@Component
public class UpdateServicesTask {

private String environment;
private String space;
private ServiceLocator serviceLocator;
private JudgeDPublisher publisher;
private final String environment;
private final String space;
private final ServiceLocator serviceLocator;
private final JudgeDPublisher publisher;

@Autowired
public UpdateServicesTask(
UpdateServicesTask(
@Value("${hltech.contracts.judge-d.environment}") String environment,
@Value("${hltech.contracts.judge-d.space:default}") String space,
ServiceLocator serviceLocator,
Expand Down Expand Up @@ -49,6 +49,4 @@ public void updateServices() {
private static JudgeDPublisher.ServiceForm toForm(ServiceLocator.Service service) {
return new JudgeDPublisher.ServiceForm(service.getName(), service.getVersion());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@

@Configuration
@EnableScheduling
public class BeanFactory {
class BeanFactory {

@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper() {
return new ObjectMapper();
}

@Bean
public JudgeDPublisher judgeDEnvironmentPublisher(Feign feign, @Value("${hltech.contracts.judge-d.baseUrl}") String baseUrl) {
JudgeDPublisher judgeDEnvironmentPublisher(Feign feign, @Value("${hltech.contracts.judge-d.baseUrl}") String baseUrl) {
return feign.newInstance(new Target.HardCodedTarget<>(JudgeDPublisher.class, baseUrl));
}

@Bean
public Feign feign(ObjectFactory<HttpMessageConverters> messageConverters, ObjectMapper objectMapper) throws KeyManagementException, NoSuchAlgorithmException {
Feign feign(ObjectFactory<HttpMessageConverters> messageConverters, ObjectMapper objectMapper) throws KeyManagementException, NoSuchAlgorithmException {
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, new TrustManager[]{new TrustAllX509TrustManager()}, null);
SSLSocketFactory trustingSSLSocketFactory = ctx.getSocketFactory();
Expand Down Expand Up @@ -81,5 +81,4 @@ public X509Certificate[] getAcceptedIssuers() {
return null;
}
}

}
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
package com.hltech.judged.agent.config;

import com.hltech.judged.agent.JudgeDPublisher;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.HashSet;
import java.util.Set;

@Slf4j
public class CachingDelegatingDPublisher {
@RequiredArgsConstructor
class CachingDelegatingDPublisher {

private final JudgeDPublisher judgeDPublisher;

private Set<JudgeDPublisher.ServiceForm> previouslySentEnvironment;

public CachingDelegatingDPublisher(JudgeDPublisher judgeDPublisher) {
this.judgeDPublisher = judgeDPublisher;
}

public void publish(String environment, String space, Set<JudgeDPublisher.ServiceForm> serviceForms) {
void publish(String environment, String space, Set<JudgeDPublisher.ServiceForm> serviceForms) {
if (previouslySentEnvironment == null || !previouslySentEnvironment.equals(serviceForms)) {
log.info("publishing services to Judge-D: " + serviceForms);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@Configuration
@Profile("consul")
@RequiredArgsConstructor
public class ConsulBeanFactory {
class ConsulBeanFactory {

@Value("${hltech.contracts.judge-d.consul-host}")
private String consulUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import java.util.Set;
import java.util.stream.Collectors;


@RequiredArgsConstructor
public class ConsulTagBasedServiceLocator implements ServiceLocator {
class ConsulTagBasedServiceLocator implements ServiceLocator {

private static final String VERSION_TAG_PREFIX = "version=";
private static final String TAG_SEPARATOR = "=";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

@Configuration
@Profile("kubernetes")
public class K8sBeanFactory {
class K8sBeanFactory {

@Bean
public KubernetesClient kubernetesClient() {
KubernetesClient kubernetesClient() {
return new DefaultKubernetesClient();
}

@Bean
public ServiceLocator serviceLocator(
ServiceLocator serviceLocator(
KubernetesClient kubernetesClient,
@Value("${hltech.contracts.judge-d.requiredLabel}") String requiredLabel,
@Value("${hltech.contracts.judge-d.excluded-namespaces:#{''}}") Set<String> excludedNamespaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static java.util.stream.Collectors.toList;

public class K8sLabelBasedServiceLocator implements ServiceLocator {
class K8sLabelBasedServiceLocator implements ServiceLocator {

private static final String EXCLUDE_FROM_JURISDICTION_LABEL = "exclude-from-judged-jurisdiction";

Expand All @@ -23,7 +23,7 @@ public class K8sLabelBasedServiceLocator implements ServiceLocator {
private final Predicate<Namespace> excludedNamespacesFilter;
private final Predicate<Namespace> includedNamespacesFilter;

public K8sLabelBasedServiceLocator(
K8sLabelBasedServiceLocator(
KubernetesClient kubernetesClient,
String requiredLabel,
Set<String> excludedNamespaces,
Expand Down

0 comments on commit 0caf3fd

Please sign in to comment.