Search in sources :

Example 6 with ProductInner

use of fixtures.lro.implementation.ProductInner in project autorest.java by Azure.

the class LROsTests method put202Retry200Async.

@Ignore("Can cause flakiness - only run manually")
public void put202Retry200Async() throws Exception {
    final CountDownLatch lock = new CountDownLatch(1);
    long startTime = System.currentTimeMillis();
    final long[] callbackTime = new long[1];
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    client.getAzureClient().setLongRunningOperationRetryTimeout(1);
    client.lROs().put202Retry200Async(product, new ServiceCallback<ProductInner>() {

        @Override
        public void failure(Throwable t) {
            fail();
        }

        @Override
        public void success(ProductInner result) {
            Assert.assertEquals("100", result.id());
            callbackTime[0] = System.currentTimeMillis();
            lock.countDown();
        }
    });
    long endTime = System.currentTimeMillis();
    Assert.assertTrue(500 > endTime - startTime);
    Assert.assertTrue(lock.await(3000, TimeUnit.MILLISECONDS));
    client.getAzureClient().setLongRunningOperationRetryTimeout(0);
    Assert.assertTrue(1000 < callbackTime[0] - startTime);
}
Also used : CountDownLatch(java.util.concurrent.CountDownLatch) ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Ignore(org.junit.Ignore)

Example 7 with ProductInner

use of fixtures.lro.implementation.ProductInner in project autorest.java by Azure.

the class LROsTests method post202Retry200.

@Test
public void post202Retry200() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    client.lROs().post202Retry200(product);
}
Also used : ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Example 8 with ProductInner

use of fixtures.lro.implementation.ProductInner in project autorest.java by Azure.

the class LROsTests method put200AsyncSucceeded.

@Test
public void put200AsyncSucceeded() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    ProductInner response = client.lROs().put200SucceededAsync(product, null).get();
    Assert.assertEquals("Succeeded", response.provisioningState());
}
Also used : ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Example 9 with ProductInner

use of fixtures.lro.implementation.ProductInner in project autorest.java by Azure.

the class LROsTests method putAsyncNoRetrySucceeded.

@Test
public void putAsyncNoRetrySucceeded() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    ProductInner response = client.lROs().putAsyncNoRetrySucceeded(product);
    Assert.assertEquals("Succeeded", response.provisioningState());
}
Also used : ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Example 10 with ProductInner

use of fixtures.lro.implementation.ProductInner in project autorest.java by Azure.

the class LROsTests method put200SucceededNoState.

@Test
public void put200SucceededNoState() throws Exception {
    ProductInner product = new ProductInner();
    product.withLocation("West US");
    ProductInner response = client.lROs().put200SucceededNoState(product);
    Assert.assertEquals("100", response.id());
}
Also used : ProductInner(fixtures.lro.implementation.ProductInner) SubProductInner(fixtures.lro.implementation.SubProductInner) Test(org.junit.Test)

Aggregations

ProductInner (fixtures.lro.implementation.ProductInner)51 Test (org.junit.Test)46 SubProductInner (fixtures.lro.implementation.SubProductInner)25 CloudException (com.microsoft.azure.CloudException)17 Ignore (org.junit.Ignore)5 CountDownLatch (java.util.concurrent.CountDownLatch)1