Skip to content
Snippets Groups Projects
Commit 95c0b7ec authored by kbeyro's avatar kbeyro
Browse files

small refactor

parent 8a97cb35
No related branches found
No related tags found
2 merge requests!273Release 1.8.0 update,!213Resolve "Support deployment of applications on remote clusters"
This commit is part of merge request !213. Comments created here will be created in the context of that merge request.
......@@ -349,7 +349,7 @@ public class RemoteClusterManager implements ClusterMonitoringService {
}
public boolean clusterExist(Long id) {
public boolean clusterExists(Long id) {
return clusterRepository.existsById(id);
}
......
......@@ -12,10 +12,6 @@ import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.geant.nmaas.orchestration.entities.DomainTechDetails;
import org.apache.commons.lang3.StringUtils;
import java.util.Optional;
@Entity
@Table(name = "k_cluster_deployment")
......
......@@ -107,7 +107,7 @@ public class KubernetesManager implements ContainerOrchestrator {
appDeployment.getDescriptiveDeploymentId()
);
//verify cluster
if(remoteClusterManager.clusterExist(appDeployment.getRemoteClusterId())) {
if(remoteClusterManager.clusterExists(appDeployment.getRemoteClusterId())) {
serviceInfo.setRemoteCluster(remoteClusterManager.getCluster(appDeployment.getRemoteClusterId()));
}
......
......@@ -43,7 +43,7 @@ public class AppRequestVerificationTask {
final AppDeployment appDeployment = repository.findByDeploymentId(deploymentId).orElseThrow(() -> new InvalidDeploymentIdException(deploymentId));
final Application application = appRepository.findById(Long.valueOf(appDeployment.getApplicationId().getValue())).orElseThrow(() ->
new InvalidApplicationIdException("Application for deployment " + deploymentId + " does not exist in repository"));
if(!remoteClusterManager.clusterExist(appDeployment.getRemoteClusterId())) {
if(!remoteClusterManager.clusterExists(appDeployment.getRemoteClusterId())) {
throw new InvalidAttributesException("Wrong remote cluster Id");
}
serviceDeployment.verifyRequest(
......
......@@ -42,7 +42,7 @@ public class AppRequestVerificationTaskTest {
public void shouldTriggerRequestVerify() throws InterruptedException {
when(deployments.findByDeploymentId(deploymentId)).thenReturn(Optional.of(AppDeployment.builder().applicationId(Identifier.newInstance(10L)).build()));
when(applications.findById(any(Long.class))).thenReturn(Optional.of(new Application()));
when(remoteClusterManager.clusterExist(any())).thenReturn(true);
when(remoteClusterManager.clusterExists(any())).thenReturn(true);
task.trigger(new AppVerifyRequestActionEvent(this, deploymentId));
verify(deploy, times(1)).verifyRequest(any(Identifier.class), any(AppDeployment.class), isNull());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment