You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2020/01/14 11:33:51 UTC

[servicecomb-pack] 02/08: SCB-1696 Remove keepRetryingTillXXX test cases

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git

commit 67881c29ddef5f7658a58e4539314248eb961210
Author: Lei Zhang <zh...@apache.org>
AuthorDate: Sat Jan 11 02:57:57 2020 +0800

    SCB-1696 Remove keepRetryingTillXXX test cases
---
 .../omega/transaction/ForwardRecoveryTest.java     | 27 ----------------
 .../omega/transaction/TransactionAspectTest.java   | 36 ----------------------
 2 files changed, 63 deletions(-)

diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/ForwardRecoveryTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/ForwardRecoveryTest.java
index 97f5d66..a089873 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/ForwardRecoveryTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/ForwardRecoveryTest.java
@@ -161,33 +161,6 @@ public class ForwardRecoveryTest {
     assertThat(messages.get(2).type(), is(EventType.TxAbortedEvent));
   }
 
-  @Test
-  public void keepRetryingTillInterrupted() throws Throwable {
-    when(compensable.forwardRetries()).thenReturn(-1);
-    when(compensable.retryDelayInMilliseconds()).thenReturn(1000);
-    when(joinPoint.proceed()).thenThrow(oops);
-
-    Thread thread = new Thread(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          recoveryPolicy.apply(joinPoint, compensable, interceptor, omegaContext, parentTxId, -1);
-          expectFailing(OmegaException.class);
-        } catch (OmegaException e) {
-          exception = e;
-        } catch (Throwable throwable) {
-          fail("unexpected exception throw: " + throwable);
-        }
-      }
-    });
-    thread.start();
-
-    thread.interrupt();
-    thread.join();
-
-    assertThat(exception.getMessage().contains("Failed to handle tx because it is interrupted"), is(true));
-  }
-
   private String doNothing() {
     return "doNothing";
   }
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java
index 5f38282..934c2d2 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java
@@ -20,7 +20,6 @@ package org.apache.servicecomb.pack.omega.transaction;
 import static com.seanyinx.github.unit.scaffolding.AssertUtils.expectFailing;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
@@ -356,41 +355,6 @@ public class TransactionAspectTest {
     assertThat(omegaContext.localTxId(), is(localTxId));
   }
 
-//  @Test
-//  public void keepRetryingTillSuccess() throws Throwable {
-//    RuntimeException oops = new RuntimeException("oops");
-//    when(joinPoint.proceed()).thenThrow(oops).thenThrow(oops).thenReturn(null);
-//    when(compensable.forwardRetries()).thenReturn(-1);
-//
-//    aspect.advise(joinPoint, compensable);
-//
-//    assertThat(messages.size(), is(4));
-//
-//    TxEvent startedEvent1 = messages.get(0);
-//    assertThat(startedEvent1.globalTxId(), is(globalTxId));
-//    assertThat(startedEvent1.localTxId(), is(newLocalTxId));
-//    assertThat(startedEvent1.parentTxId(), is(localTxId));
-//    assertThat(startedEvent1.type(), is(EventType.TxStartedEvent));
-//    assertThat(startedEvent1.forwardRetries(), is(-1));
-//    assertThat(startedEvent1.retryMethod(),
-//        is(this.getClass().getDeclaredMethod("doNothing").toString()));
-//
-//    TxEvent startedEvent2 = messages.get(1);
-//    assertThat(startedEvent2.localTxId(), is(newLocalTxId));
-//    assertThat(startedEvent2.type(), is(EventType.TxStartedEvent));
-//    assertThat(startedEvent2.forwardRetries(), is(-1));
-//
-//    TxEvent startedEvent3 = messages.get(2);
-//    assertThat(startedEvent3.localTxId(), is(newLocalTxId));
-//    assertThat(startedEvent3.type(), is(EventType.TxStartedEvent));
-//    assertThat(startedEvent3.forwardRetries(), is(-1));
-//
-//    assertThat(messages.get(3).type(), is(EventType.TxEndedEvent));
-//
-//    assertThat(omegaContext.globalTxId(), is(globalTxId));
-//    assertThat(omegaContext.localTxId(), is(localTxId));
-//  }
-
   private String doNothing() {
     return "doNothing";
   }