@Test(dependsOnMethods = "testGet")
  public void testDelete() {
    final List<Role> roles =
        api.getDeploymentApiForService(cloudService.name()).get(DEPLOYMENT).roleList();

    assertTrue(
        new ConflictManagementPredicate(api) {

          @Override
          protected String operation() {
            return api().delete(deployment.name());
          }
        }.apply(deployment.name()));

    assertTrue(deploymentGone.apply(deployment), deployment.toString());
    Logger.getAnonymousLogger().log(Level.INFO, "deployment deleted: {0}", deployment);

    assertTrue(
        new ConflictManagementPredicate(api) {

          @Override
          protected String operation() {
            return api.getCloudServiceApi().delete(cloudService.name());
          }
        }.apply(cloudService.name()));

    for (Role r : roles) {
      final Role.OSVirtualHardDisk disk = r.osVirtualHardDisk();
      if (disk != null) {
        assertTrue(
            new ConflictManagementPredicate(api) {

              @Override
              protected String operation() {
                return api.getDiskApi().delete(disk.diskName());
              }
            }.apply(disk.diskName()));
      }
    }
  }
示例#2
0
 @Override
 public Role getResult() {
   Role result =
       Role.create(
           roleName,
           roleType,
           vmImage,
           mediaLocation,
           configurationSets,
           resourceExtensionReferences,
           availabilitySetName,
           dataVirtualHardDisks,
           osVirtualHardDisk,
           roleSize,
           provisionGuestAgent,
           defaultWinRmCertificateThumbprint);
   resetState(); // handler is called in a loop.
   return result;
 }