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
1 merge request!213Resolve "Support deployment of applications on remote clusters"
...@@ -349,7 +349,7 @@ public class RemoteClusterManager implements ClusterMonitoringService { ...@@ -349,7 +349,7 @@ public class RemoteClusterManager implements ClusterMonitoringService {
} }
public boolean clusterExist(Long id) { public boolean clusterExists(Long id) {
return clusterRepository.existsById(id); return clusterRepository.existsById(id);
} }
......
...@@ -12,10 +12,6 @@ import lombok.Builder; ...@@ -12,10 +12,6 @@ import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.geant.nmaas.orchestration.entities.DomainTechDetails;
import org.apache.commons.lang3.StringUtils;
import java.util.Optional;
@Entity @Entity
@Table(name = "k_cluster_deployment") @Table(name = "k_cluster_deployment")
......
...@@ -107,7 +107,7 @@ public class KubernetesManager implements ContainerOrchestrator { ...@@ -107,7 +107,7 @@ public class KubernetesManager implements ContainerOrchestrator {
appDeployment.getDescriptiveDeploymentId() appDeployment.getDescriptiveDeploymentId()
); );
//verify cluster //verify cluster
if(remoteClusterManager.clusterExist(appDeployment.getRemoteClusterId())) { if(remoteClusterManager.clusterExists(appDeployment.getRemoteClusterId())) {
serviceInfo.setRemoteCluster(remoteClusterManager.getCluster(appDeployment.getRemoteClusterId())); serviceInfo.setRemoteCluster(remoteClusterManager.getCluster(appDeployment.getRemoteClusterId()));
} }
......
...@@ -43,7 +43,7 @@ public class AppRequestVerificationTask { ...@@ -43,7 +43,7 @@ public class AppRequestVerificationTask {
final AppDeployment appDeployment = repository.findByDeploymentId(deploymentId).orElseThrow(() -> new InvalidDeploymentIdException(deploymentId)); final AppDeployment appDeployment = repository.findByDeploymentId(deploymentId).orElseThrow(() -> new InvalidDeploymentIdException(deploymentId));
final Application application = appRepository.findById(Long.valueOf(appDeployment.getApplicationId().getValue())).orElseThrow(() -> final Application application = appRepository.findById(Long.valueOf(appDeployment.getApplicationId().getValue())).orElseThrow(() ->
new InvalidApplicationIdException("Application for deployment " + deploymentId + " does not exist in repository")); 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"); throw new InvalidAttributesException("Wrong remote cluster Id");
} }
serviceDeployment.verifyRequest( serviceDeployment.verifyRequest(
......
...@@ -42,7 +42,7 @@ public class AppRequestVerificationTaskTest { ...@@ -42,7 +42,7 @@ public class AppRequestVerificationTaskTest {
public void shouldTriggerRequestVerify() throws InterruptedException { public void shouldTriggerRequestVerify() throws InterruptedException {
when(deployments.findByDeploymentId(deploymentId)).thenReturn(Optional.of(AppDeployment.builder().applicationId(Identifier.newInstance(10L)).build())); 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(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)); task.trigger(new AppVerifyRequestActionEvent(this, deploymentId));
verify(deploy, times(1)).verifyRequest(any(Identifier.class), any(AppDeployment.class), isNull()); 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