Search in sources :

Example 16 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure by TAKETODAY.

the class MapRetryContextCacheTests method testPut.

@Test
public void testPut() {
    RetryContextSupport context = new RetryContextSupport(null);
    cache.put("foo", context);
    assertEquals(context, cache.get("foo"));
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 17 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure by TAKETODAY.

the class MapRetryContextCacheTests method testRemove.

@Test
public void testRemove() {
    assertFalse(cache.containsKey("foo"));
    RetryContextSupport context = new RetryContextSupport(null);
    cache.put("foo", context);
    assertTrue(cache.containsKey("foo"));
    cache.remove("foo");
    assertFalse(cache.containsKey("foo"));
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 18 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure by TAKETODAY.

the class RetrySynchronizationManagerTests method testStatusRegistration.

@Test
public void testStatusRegistration() throws Exception {
    RetryContext status = new RetryContextSupport(null);
    RetryContext value = RetrySynchronizationManager.register(status);
    assertNull(value);
    value = RetrySynchronizationManager.register(status);
    assertEquals(status, value);
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 19 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure by TAKETODAY.

the class RetrySynchronizationManagerTests method testClear.

@Test
public void testClear() throws Exception {
    RetryContext status = new RetryContextSupport(null);
    RetryContext value = RetrySynchronizationManager.register(status);
    assertNull(value);
    RetrySynchronizationManager.clear();
    value = RetrySynchronizationManager.register(status);
    assertNull(value);
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 20 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure by TAKETODAY.

the class RetrySynchronizationManagerTests method testParent.

@Test
public void testParent() throws Exception {
    RetryContext parent = new RetryContextSupport(null);
    RetryContext child = new RetryContextSupport(parent);
    assertSame(parent, child.getParent());
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Aggregations

RetryContextSupport (cn.taketoday.retry.context.RetryContextSupport)22 Test (org.junit.Test)18 RetryContext (cn.taketoday.retry.RetryContext)6 RetryPolicy (cn.taketoday.retry.RetryPolicy)2