Ejemplo n.º 1
0
        private void StepsCrudTests(
            string serviceTopologyId,
            string artifactSourceId,
            string serviceUnitId,
            string failureServiceUnitId,
            string location,
            DeploymentManagerClientHelper clientHelper,
            AzureDeploymentManagerClient deploymentManagerClient)
        {
            // Test Create step.
            var stepName       = clientHelper.ResourceGroupName + "WaitStep";
            var stepProperties = new WaitStepProperties()
            {
                Attributes = new WaitStepAttributes()
                {
                    Duration = "PT5M"
                }
            };

            var inputStep = new StepResource(
                location: location,
                properties: stepProperties,
                name: stepName);

            var stepResponse = deploymentManagerClient.Steps.CreateOrUpdate(
                resourceGroupName: clientHelper.ResourceGroupName,
                stepName: stepName,
                stepInfo: inputStep);

            this.ValidateStep(inputStep, stepResponse);

            // Test Get step.
            var getStepResource = deploymentManagerClient.Steps.Get(
                resourceGroupName: clientHelper.ResourceGroupName,
                stepName: stepName);

            this.ValidateStep(inputStep, getStepResource);

            this.RolloutCrudTests(
                serviceTopologyId: serviceTopologyId,
                artifactSourceId: artifactSourceId,
                serviceUnitId: serviceUnitId,
                failureServiceUnitId: failureServiceUnitId,
                stepId: getStepResource.Id,
                location: location,
                deploymentManagerClient: deploymentManagerClient,
                clientHelper: clientHelper);

            // Test Update step.
            ((WaitStepProperties)(getStepResource.Properties)).Attributes.Duration = "PT10M";
            var updatedStepResource = deploymentManagerClient.Steps.CreateOrUpdate(
                resourceGroupName: clientHelper.ResourceGroupName,
                stepName: stepName,
                stepInfo: getStepResource);

            this.ValidateStep(getStepResource, updatedStepResource);

            // Test Delete step.
            deploymentManagerClient.Steps.Delete(
                resourceGroupName: clientHelper.ResourceGroupName,
                stepName: stepName);

            var cloudException = Assert.Throws <CloudException>(() => deploymentManagerClient.Steps.Get(
                                                                    resourceGroupName: clientHelper.ResourceGroupName,
                                                                    stepName: stepName));

            Assert.Equal(HttpStatusCode.NotFound, cloudException.Response.StatusCode);
        }
Ejemplo n.º 2
0
 public PSWaitStepProperties(WaitStepProperties waitStepProperties) : base(waitStepProperties)
 {
     this.Duration = waitStepProperties.Attributes?.Duration;
 }