Search in sources :

Example 11 with CloudException

use of com.microsoft.azure.CloudException in project autorest.java by Azure.

the class LROSADsTests method putNonRetry400.

@Test
public void putNonRetry400() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    try {
        client.lROSADs().putNonRetry400(product);
        fail();
    } catch (CloudException ex) {
        Assert.assertEquals(400, ex.response().code());
    }
}
Also used : CloudException(com.microsoft.azure.CloudException) ProductInner(fixtures.lro.implementation.ProductInner) Test(org.junit.Test)

Example 12 with CloudException

use of com.microsoft.azure.CloudException in project autorest.java by Azure.

the class LROSADsTests method putAsyncRelativeRetryNoStatusPayload.

@Test
public void putAsyncRelativeRetryNoStatusPayload() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    try {
        client.lROSADs().putAsyncRelativeRetryNoStatusPayload(product);
        fail();
    } catch (CloudException ex) {
        Assert.assertEquals(200, ex.response().code());
        Assert.assertTrue(ex.getMessage().contains("does not contain a valid body"));
    }
}
Also used : CloudException(com.microsoft.azure.CloudException) ProductInner(fixtures.lro.implementation.ProductInner) Test(org.junit.Test)

Example 13 with CloudException

use of com.microsoft.azure.CloudException in project autorest.java by Azure.

the class LROSADsTests method postNonRetry400.

@Test
public void postNonRetry400() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    try {
        client.lROSADs().postNonRetry400(product);
        fail();
    } catch (CloudException ex) {
        Assert.assertEquals(400, ex.response().code());
    }
}
Also used : CloudException(com.microsoft.azure.CloudException) ProductInner(fixtures.lro.implementation.ProductInner) Test(org.junit.Test)

Example 14 with CloudException

use of com.microsoft.azure.CloudException in project autorest.java by Azure.

the class LROsTests method postAsyncRetrycanceled.

@Test
public void postAsyncRetrycanceled() throws Exception {
    try {
        ProductInner product = new ProductInner();
        product.withLocation("West US");
        client.lROs().postAsyncRetrycanceled(product);
        fail();
    } catch (CloudException e) {
        Assert.assertEquals("Async operation failed with provisioning state: Canceled", e.getMessage());
    }
}
Also used : CloudException(com.microsoft.azure.CloudException) ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Example 15 with CloudException

use of com.microsoft.azure.CloudException in project autorest.java by Azure.

the class LROsTests method putAsyncNoRetrycanceled.

@Test
public void putAsyncNoRetrycanceled() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    try {
        ProductInner response = client.lROs().putAsyncNoRetrycanceled(product);
        fail();
    } catch (CloudException e) {
        Assert.assertEquals("Async operation failed with provisioning state: Canceled", e.getMessage());
    }
}
Also used : CloudException(com.microsoft.azure.CloudException) ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Aggregations

CloudException (com.microsoft.azure.CloudException)35 Test (org.junit.Test)20 ProductInner (fixtures.lro.implementation.ProductInner)17 SubProductInner (fixtures.lro.implementation.SubProductInner)6 ArrayList (java.util.ArrayList)6 CloudError (com.microsoft.azure.CloudError)5 AzureClient (com.sequenceiq.cloudbreak.cloud.azure.client.AzureClient)5 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)5 HashMap (java.util.HashMap)5 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)4 AzureCredentialView (com.sequenceiq.cloudbreak.cloud.azure.view.AzureCredentialView)3 ActionWentFailException (com.sequenceiq.cloudbreak.service.Retry.ActionWentFailException)3 VirtualMachine (com.microsoft.azure.management.compute.VirtualMachine)2 AddressSpace (com.microsoft.azure.management.network.AddressSpace)2 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)2 SubnetInner (com.microsoft.azure.management.network.implementation.SubnetInner)2 VirtualNetworkInner (com.microsoft.azure.management.network.implementation.VirtualNetworkInner)2 Deployment (com.microsoft.azure.management.resources.Deployment)2 ResourceGroup (com.microsoft.azure.management.resources.ResourceGroup)2 Region (com.microsoft.azure.management.resources.fluentcore.arm.Region)2