Search in sources :

Example 21 with DeploymentTopologyDTO

use of alien4cloud.deployment.DeploymentTopologyDTO in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method theDeploymentTopologyShouldNotHaveAnyInputArtifacts.

@Then("^the deployment topology should not have any input artifacts$")
public void theDeploymentTopologyShouldNotHaveAnyInputArtifacts() throws Throwable {
    DeploymentTopologyDTO dto = getDeploymentTopologyDTO();
    Assert.assertTrue(MapUtils.isEmpty(dto.getTopology().getUploadedInputArtifacts()));
}
Also used : DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) Then(cucumber.api.java.en.Then)

Example 22 with DeploymentTopologyDTO

use of alien4cloud.deployment.DeploymentTopologyDTO in project alien4cloud by alien4cloud.

the class DeploymentSetupValidationStepDefinitions method getDTOAndassertNotNull.

private DeploymentTopologyDTO getDTOAndassertNotNull() throws IOException {
    String response = Context.getInstance().getRestResponse();
    DeploymentTopologyDTO dto = JsonUtil.read(response, DeploymentTopologyDTO.class, Context.getJsonMapper()).getData();
    assertNotNull(dto);
    return dto;
}
Also used : DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO)

Example 23 with DeploymentTopologyDTO

use of alien4cloud.deployment.DeploymentTopologyDTO in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method the_node_in_the_deployment_topology_should_have_the_property_with_value.

@Then("^The node \"(.*?)\" in the deployment topology should have the property \"(.*?)\" with value \"(.*?)\"$")
public void the_node_in_the_deployment_topology_should_have_the_property_with_value(String nodeName, String propertyName, String expectPropertyValue) throws Throwable {
    DeploymentTopologyDTO dto = getDeploymentTopologyDTO();
    NodeTemplate node = dto.getTopology().getNodeTemplates().get(nodeName);
    assertNodePropertyValueEquals(node, propertyName, expectPropertyValue);
}
Also used : NodeTemplate(org.alien4cloud.tosca.model.templates.NodeTemplate) DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) Then(cucumber.api.java.en.Then)

Example 24 with DeploymentTopologyDTO

use of alien4cloud.deployment.DeploymentTopologyDTO in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method theDeploymentTopologyShouldHaveTheFollowingInputsArtifacts.

@Then("^the deployment topology should have the following inputs artifacts$")
public void theDeploymentTopologyShouldHaveTheFollowingInputsArtifacts(Map<String, String> expectedArtifacts) throws Throwable {
    DeploymentTopologyDTO dto = getDeploymentTopologyDTO();
    Map<String, String> uploadedArtifacts = dto.getTopology().getUploadedInputArtifacts().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getArtifactName()));
    Assert.assertEquals(expectedArtifacts, uploadedArtifacts);
}
Also used : Arrays(java.util.Arrays) AlienUtils.safe(alien4cloud.utils.AlienUtils.safe) RestResponse(alien4cloud.rest.model.RestResponse) Map(java.util.Map) FunctionPropertyValue(org.alien4cloud.tosca.model.definitions.FunctionPropertyValue) Application(alien4cloud.model.application.Application) ArtifactRepositoryConstants(alien4cloud.component.repository.ArtifactRepositoryConstants) Then(cucumber.api.java.en.Then) DeploymentArtifact(org.alien4cloud.tosca.model.definitions.DeploymentArtifact) PropertyUtil(alien4cloud.utils.PropertyUtil) DataTable(cucumber.api.DataTable) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) Collectors(java.util.stream.Collectors) EvaluationContext(org.springframework.expression.EvaluationContext) List(java.util.List) ToscaFunctionConstants(org.alien4cloud.tosca.normative.constants.ToscaFunctionConstants) Entry(java.util.Map.Entry) SetLocationPoliciesRequest(alien4cloud.rest.application.model.SetLocationPoliciesRequest) NameValuePair(org.apache.http.NameValuePair) PolicyLocationResourceTemplate(alien4cloud.model.orchestrators.locations.PolicyLocationResourceTemplate) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) TestUtils(alien4cloud.it.utils.TestUtils) Getter(lombok.Getter) UpdateDeploymentTopologyRequest(alien4cloud.rest.application.model.UpdateDeploymentTopologyRequest) ScalarPropertyValue(org.alien4cloud.tosca.model.definitions.ScalarPropertyValue) DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) MapUtil(alien4cloud.utils.MapUtil) UpdatePropertyRequest(alien4cloud.rest.topology.UpdatePropertyRequest) AlienConstants(alien4cloud.utils.AlienConstants) Lists(com.google.common.collect.Lists) AbstractPropertyValue(org.alien4cloud.tosca.model.definitions.AbstractPropertyValue) SPELUtils.evaluateAndAssertExpression(org.alien4cloud.test.util.SPELUtils.evaluateAndAssertExpression) Capability(org.alien4cloud.tosca.model.templates.Capability) MapUtils(org.apache.commons.collections4.MapUtils) And(cucumber.api.java.en.And) Files(java.nio.file.Files) RegisteredStringUtils(alien4cloud.it.utils.RegisteredStringUtils) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) JsonUtil(alien4cloud.rest.utils.JsonUtil) Maps(com.google.common.collect.Maps) Paths(java.nio.file.Paths) Context(alien4cloud.it.Context) NodeTemplate(org.alien4cloud.tosca.model.templates.NodeTemplate) AbstractLocationResourceTemplate(alien4cloud.model.orchestrators.locations.AbstractLocationResourceTemplate) Assert(org.junit.Assert) AllArgsConstructor(lombok.AllArgsConstructor) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) LocationResourceTemplate(alien4cloud.model.orchestrators.locations.LocationResourceTemplate) Assert.assertEquals(org.junit.Assert.assertEquals) When(cucumber.api.java.en.When) NoArgsConstructor(lombok.NoArgsConstructor) DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Then(cucumber.api.java.en.Then)

Example 25 with DeploymentTopologyDTO

use of alien4cloud.deployment.DeploymentTopologyDTO in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method theDeploymentTopologyShouldNotHaveAnyLocationPolicies.

@Then("^the deployment topology should not have any location policies$")
public void theDeploymentTopologyShouldNotHaveAnyLocationPolicies() throws Throwable {
    DeploymentTopologyDTO dto = getDeploymentTopologyDTO();
    Assert.assertTrue(MapUtils.isEmpty(dto.getLocationPolicies()));
}
Also used : DeploymentTopologyDTO(alien4cloud.deployment.DeploymentTopologyDTO) Then(cucumber.api.java.en.Then)

Aggregations

DeploymentTopologyDTO (alien4cloud.deployment.DeploymentTopologyDTO)27 Then (cucumber.api.java.en.Then)13 Application (alien4cloud.model.application.Application)8 ApiOperation (io.swagger.annotations.ApiOperation)8 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 ApplicationEnvironment (alien4cloud.model.application.ApplicationEnvironment)7 ApplicationTopologyVersion (alien4cloud.model.application.ApplicationTopologyVersion)7 DeploymentTopology (alien4cloud.model.deployment.DeploymentTopology)7 Topology (org.alien4cloud.tosca.model.templates.Topology)7 Audit (alien4cloud.audit.annotation.Audit)6 NodeTemplate (org.alien4cloud.tosca.model.templates.NodeTemplate)5 ConstraintFunctionalException (org.alien4cloud.tosca.exceptions.ConstraintFunctionalException)4 ConstraintTechnicalException (org.alien4cloud.tosca.exceptions.ConstraintTechnicalException)4 FunctionPropertyValue (org.alien4cloud.tosca.model.definitions.FunctionPropertyValue)3 Context (alien4cloud.it.Context)2 AbstractLocationResourceTemplate (alien4cloud.model.orchestrators.locations.AbstractLocationResourceTemplate)2 LocationResourceTemplate (alien4cloud.model.orchestrators.locations.LocationResourceTemplate)2 RestError (alien4cloud.rest.model.RestError)2 RestResponse (alien4cloud.rest.model.RestResponse)2