コード例 #1
0
  public void testCreate() {
    final DeploymentParams params =
        DeploymentParams.builder()
            .name(DEPLOYMENT)
            .os(OSImage.Type.LINUX)
            .sourceImageName(DeploymentApiLiveTest.IMAGE_NAME)
            .mediaLink(
                AzureComputeServiceAdapter.createMediaLink(
                    storageService.serviceName(), DEPLOYMENT))
            .username("test")
            .password("supersecurePassword1!")
            .size(RoleSize.Type.BASIC_A0)
            .externalEndpoints(
                ImmutableSet.of(DeploymentParams.ExternalEndpoint.inboundTcpToLocalPort(22, 22)))
            .build();
    final String requestId = api().create(params);
    assertTrue(operationSucceeded.apply(requestId), requestId);

    deployment = api().get(DEPLOYMENT);
    assertNotNull(deployment);
    assertTrue(deploymentCreated.apply(deployment), deployment.toString());
    assertThat(deployment.name()).isEqualTo(DEPLOYMENT);
    assertThat(deployment.status()).isEqualTo(Deployment.Status.RUNNING);
    assertThat(deployment.label()).isEqualTo(DEPLOYMENT);
    assertThat(deployment.slot()).isEqualTo(Deployment.Slot.PRODUCTION);
    assertThat(deployment.roleList().size()).isEqualTo(1);
    assertThat(deployment.roleInstanceList().size()).isEqualTo(1);
  }
コード例 #2
0
  private void checkDeployment(Deployment deployment) {
    assertNotNull(deployment);
    assertNotNull(deployment.name(), "Name cannot be Null for Deployment" + deployment);
    assertTrue(
        deployment.roleList().size() > 0,
        "There should be atleast 1 Virtual machine for a deployment  ");
    assertNotNull(deployment.label(), "Label cannot be Null for Deployment" + deployment);

    Deployment.Slot slot = deployment.slot();
    assertTrue((slot == Deployment.Slot.PRODUCTION) || (slot == Deployment.Slot.STAGING));
    assertEquals(deployment.name(), DEPLOYMENT);
  }