Skip to content

Commit

Permalink
Fix further checksytle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wederbn committed Nov 20, 2023
1 parent c21c1f9 commit cb1bc76
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -704,36 +704,36 @@ public static List<ServiceTemplateId> checkServiceTemplateForEquivalency(Service
assert topologyTemplateFilter != null;

// check if number of nodetemplates matches
if (topology.getNodeTemplateOrRelationshipTemplate().size() != topologyTemplateFilter.getNodeTemplateOrRelationshipTemplate().size()){
if (topology.getNodeTemplateOrRelationshipTemplate().size() != topologyTemplateFilter.getNodeTemplateOrRelationshipTemplate().size()) {
return false;
}

// check if type of all nodetemplates match
List<TNodeTemplate> nodeTemplatesFilter = topologyTemplateFilter.getNodeTemplates();
if (!nodeTemplates.stream().allMatch( nt -> nodeTemplatesFilter.stream().anyMatch( ntFilter -> nt.getType().equals(ntFilter.getType())))){
if (!nodeTemplates.stream().allMatch( nt -> nodeTemplatesFilter.stream().anyMatch( ntFilter -> nt.getType().equals(ntFilter.getType())))) {
return false;
}

// check if deployment artifacts of all nodetemplates match
if (!nodeTemplates.stream().allMatch( nt -> nodeTemplatesFilter.stream().anyMatch( ntFilter -> {
// if both nodetemplates have no DAs return match
if (ntFilter.getDeploymentArtifacts() == null && nt.getDeploymentArtifacts() == null){
if (ntFilter.getDeploymentArtifacts() == null && nt.getDeploymentArtifacts() == null) {
return true;
}
// if one of the nodetemplates does not have any DAs but the other does, return no match
if (ntFilter.getDeploymentArtifacts() == null || nt.getDeploymentArtifacts() == null){
if (ntFilter.getDeploymentArtifacts() == null || nt.getDeploymentArtifacts() == null) {
return false;
}

// check if the artifactRef of all DAs of the nodetemplate also exist in the other nodetemplate
return nt.getDeploymentArtifacts().stream().allMatch(da -> ntFilter.getDeploymentArtifacts().stream().anyMatch(daFilter -> da.getArtifactRef().equals(daFilter.getArtifactRef())));
}))){
}))) {
return false;
}

// check if types of all relationship templates match
List<TRelationshipTemplate> relationshipTemplatesFilter = topologyTemplateFilter.getRelationshipTemplates();
if (!relationshipTemplates.stream().allMatch( rt -> relationshipTemplatesFilter.stream().anyMatch( rtFilter -> rt.getType().equals(rtFilter.getType())))){
if (!relationshipTemplates.stream().allMatch( rt -> relationshipTemplatesFilter.stream().anyMatch( rtFilter -> rt.getType().equals(rtFilter.getType())))) {
return false;
}
return true;
Expand Down

0 comments on commit cb1bc76

Please sign in to comment.