You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by se...@apache.org on 2018/01/15 10:53:49 UTC
[incubator-servicecomb-saga] branch master updated: SCB-232 update
to introduce the EventType in the pack-common.It should be shared between
the omega and alpha.
This is an automated email from the ASF dual-hosted git repository.
seanyinx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
The following commit(s) were added to refs/heads/master by this push:
new 5f1dce3 SCB-232 update to introduce the EventType in the pack-common.It should be shared between the omega and alpha.
5f1dce3 is described below
commit 5f1dce30b6cb4b761e3db9b9c6b9d55baa4cb46e
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Sun Jan 14 23:08:54 2018 +0800
SCB-232 update to introduce the EventType in the pack-common.It should be shared between the omega and alpha.
---
alpha/alpha-core/pom.xml | 4 +++
.../saga/alpha/core/TxConsistentService.java | 10 +++----
.../alpha/core/CompositeOmegaCallbackTest.java | 3 +-
.../saga/alpha/core/TxConsistentServiceTest.java | 13 ++++----
.../servicecomb/saga/alpha/core/TxEventMaker.java | 6 +++-
.../saga/alpha/server/AlphaIntegrationTest.java | 8 ++---
.../grpc/LoadBalancedClusterMessageSenderTest.java | 7 +++--
omega/omega-transaction/pom.xml | 4 +++
.../saga/omega/transaction/SagaEndedEvent.java | 2 ++
.../saga/omega/transaction/SagaStartedEvent.java | 2 ++
.../saga/omega/transaction/TxAbortedEvent.java | 2 ++
.../saga/omega/transaction/TxCompensatedEvent.java | 2 ++
.../saga/omega/transaction/TxEndedEvent.java | 2 ++
.../saga/omega/transaction/TxEvent.java | 10 ++-----
.../saga/omega/transaction/TxStartedEvent.java | 2 ++
.../transaction/CompensableInterceptorTest.java | 7 +++--
.../CompensationMessageHandlerTest.java | 3 +-
.../SagaStartAnnotationProcessorTest.java | 5 ++--
.../omega/transaction/SagaStartAspectTest.java | 9 +++---
.../omega/transaction/TransactionAspectTest.java | 9 +++---
{alpha/alpha-core => pack-common}/pom.xml | 35 ++--------------------
.../apache/servicecomb/saga/common}/EventType.java | 2 +-
pom.xml | 6 ++++
23 files changed, 78 insertions(+), 75 deletions(-)
diff --git a/alpha/alpha-core/pom.xml b/alpha/alpha-core/pom.xml
index 2fee5ab..4a6c1b0 100644
--- a/alpha/alpha-core/pom.xml
+++ b/alpha/alpha-core/pom.xml
@@ -31,6 +31,10 @@
<dependencies>
<dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>pack-common</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java
index 55de6b7..bddba36 100644
--- a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java
+++ b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java
@@ -17,11 +17,11 @@
package org.apache.servicecomb.saga.alpha.core;
-import static org.apache.servicecomb.saga.alpha.core.EventType.SagaEndedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxAbortedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxCompensatedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxEndedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.SagaEndedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxAbortedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxCompensatedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxEndedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxStartedEvent;
import java.util.Date;
import java.util.HashMap;
diff --git a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/CompositeOmegaCallbackTest.java b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/CompositeOmegaCallbackTest.java
index fd38061..5cda4c5 100644
--- a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/CompositeOmegaCallbackTest.java
+++ b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/CompositeOmegaCallbackTest.java
@@ -19,7 +19,7 @@ package org.apache.servicecomb.saga.alpha.core;
import static com.seanyinx.github.unit.scaffolding.AssertUtils.expectFailing;
import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxStartedEvent;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.servicecomb.saga.common.EventType;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
diff --git a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxConsistentServiceTest.java b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxConsistentServiceTest.java
index febbfaf..a44f16d 100644
--- a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxConsistentServiceTest.java
+++ b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxConsistentServiceTest.java
@@ -19,12 +19,12 @@ package org.apache.servicecomb.saga.alpha.core;
import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.servicecomb.saga.alpha.core.EventType.SagaEndedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.SagaStartedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxAbortedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxCompensatedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxEndedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.SagaEndedEvent;
+import static org.apache.servicecomb.saga.common.EventType.SagaStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxAbortedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxCompensatedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxEndedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxStartedEvent;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
@@ -39,6 +39,7 @@ import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
+import org.apache.servicecomb.saga.common.EventType;
import org.junit.Test;
public class TxConsistentServiceTest {
diff --git a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxEventMaker.java b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxEventMaker.java
index 21a0867..68c33a9 100644
--- a/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxEventMaker.java
+++ b/alpha/alpha-core/src/test/java/org/apache/servicecomb/saga/alpha/core/TxEventMaker.java
@@ -15,7 +15,11 @@
* limitations under the License.
*/
-package org.apache.servicecomb.saga.alpha.core;import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
+package org.apache.servicecomb.saga.alpha.core;
+
+import org.apache.servicecomb.saga.common.EventType;
+
+import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
import java.util.Date;
import java.util.UUID;
diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
index 9f13a8f..a501f75 100644
--- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
+++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
@@ -19,9 +19,9 @@ package org.apache.servicecomb.saga.alpha.server;
import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxAbortedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxEndedEvent;
-import static org.apache.servicecomb.saga.alpha.core.EventType.TxStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxAbortedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxEndedEvent;
+import static org.apache.servicecomb.saga.common.EventType.TxStartedEvent;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.notNullValue;
@@ -34,7 +34,7 @@ import java.util.Queue;
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;
-import org.apache.servicecomb.saga.alpha.core.EventType;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.alpha.core.OmegaCallback;
import org.apache.servicecomb.saga.alpha.core.TxConsistentService;
import org.apache.servicecomb.saga.alpha.core.TxEvent;
diff --git a/omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/LoadBalancedClusterMessageSenderTest.java b/omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/LoadBalancedClusterMessageSenderTest.java
index d5f432f..1fdfd2e 100644
--- a/omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/LoadBalancedClusterMessageSenderTest.java
+++ b/omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/LoadBalancedClusterMessageSenderTest.java
@@ -39,6 +39,7 @@ import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.ServiceConfig;
import org.apache.servicecomb.saga.omega.transaction.MessageDeserializer;
import org.apache.servicecomb.saga.omega.transaction.MessageHandler;
@@ -94,7 +95,7 @@ public class LoadBalancedClusterMessageSenderTest {
private final String localTxId = uniquify("localTxId");
private final String parentTxId = uniquify("parentTxId");
private final String compensationMethod = getClass().getCanonicalName();
- private final TxEvent event = new TxEvent(TxEvent.EventType.TxStartedEvent, globalTxId, localTxId, parentTxId, compensationMethod, "blah");
+ private final TxEvent event = new TxEvent(EventType.TxStartedEvent, globalTxId, localTxId, parentTxId, compensationMethod, "blah");
private final String serviceName = uniquify("serviceName");
private final String[] addresses = {"localhost:8080", "localhost:8090"};
@@ -324,7 +325,7 @@ public class LoadBalancedClusterMessageSenderTest {
@Override
public void onTxEvent(GrpcTxEvent request, StreamObserver<GrpcAck> responseObserver) {
events.offer(new TxEvent(
- TxEvent.EventType.valueOf(request.getType()),
+ EventType.valueOf(request.getType()),
request.getGlobalTxId(),
request.getLocalTxId(),
request.getParentTxId(),
@@ -333,7 +334,7 @@ public class LoadBalancedClusterMessageSenderTest {
sleep();
- if (TxEvent.EventType.TxAbortedEvent.name().equals(request.getType())) {
+ if (EventType.TxAbortedEvent.name().equals(request.getType())) {
this.responseObserver.onNext(GrpcCompensateCommand
.newBuilder()
.setGlobalTxId(request.getGlobalTxId())
diff --git a/omega/omega-transaction/pom.xml b/omega/omega-transaction/pom.xml
index 1aa77fb..a2bf293 100644
--- a/omega/omega-transaction/pom.xml
+++ b/omega/omega-transaction/pom.xml
@@ -32,6 +32,10 @@
<dependencies>
<dependency>
<groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>pack-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
<artifactId>omega-context</artifactId>
</dependency>
<dependency>
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaEndedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaEndedEvent.java
index 8a0c3eb..7074d8f 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaEndedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaEndedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
public class SagaEndedEvent extends TxEvent {
public SagaEndedEvent(String globalTxId, String localTxId) {
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaStartedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaStartedEvent.java
index d5bf70c..54f61e4 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaStartedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaStartedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
public class SagaStartedEvent extends TxEvent {
public SagaStartedEvent(String globalTxId, String localTxId) {
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
index af6ba84..13df2f7 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxCompensatedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxCompensatedEvent.java
index 089d4a8..dbbaeab 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxCompensatedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxCompensatedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
public class TxCompensatedEvent extends TxEvent {
public TxCompensatedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod) {
super(EventType.TxCompensatedEvent, globalTxId, localTxId, parentTxId, compensationMethod);
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEndedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEndedEvent.java
index d03155a..4e587c8 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEndedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEndedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
public class TxEndedEvent extends TxEvent {
public TxEndedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod) {
super(EventType.TxEndedEvent, globalTxId, localTxId, parentTxId, compensationMethod);
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEvent.java
index 58c79c6..1398d3e 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxEvent.java
@@ -17,17 +17,11 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
import java.util.Arrays;
public class TxEvent {
- public enum EventType {
- SagaStartedEvent,
- SagaEndedEvent,
- TxStartedEvent,
- TxEndedEvent,
- TxAbortedEvent,
- TxCompensatedEvent
- };
private final long timestamp;
private final EventType type;
diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxStartedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxStartedEvent.java
index bd72cd3..ce93ea3 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxStartedEvent.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxStartedEvent.java
@@ -17,6 +17,8 @@
package org.apache.servicecomb.saga.omega.transaction;
+import org.apache.servicecomb.saga.common.EventType;
+
public class TxStartedEvent extends TxEvent {
public TxStartedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod, Object... payloads) {
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensableInterceptorTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensableInterceptorTest.java
index a7aa456..d4bfef6 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensableInterceptorTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensableInterceptorTest.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.IdGenerator;
import org.apache.servicecomb.saga.omega.context.OmegaContext;
import org.junit.Before;
@@ -65,7 +66,7 @@ public class CompensableInterceptorTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(localTxId));
assertThat(event.parentTxId(), is(parentTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxStartedEvent));
+ assertThat(event.type(), is(EventType.TxStartedEvent));
assertThat(event.compensationMethod(), is(compensationMethod));
assertThat(asList(event.payloads()), contains(message));
}
@@ -79,7 +80,7 @@ public class CompensableInterceptorTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(localTxId));
assertThat(event.parentTxId(), is(parentTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxEndedEvent));
+ assertThat(event.type(), is(EventType.TxEndedEvent));
assertThat(event.compensationMethod(), is(compensationMethod));
assertThat(event.payloads().length, is(0));
}
@@ -93,7 +94,7 @@ public class CompensableInterceptorTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(localTxId));
assertThat(event.parentTxId(), is(parentTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxAbortedEvent));
+ assertThat(event.type(), is(EventType.TxAbortedEvent));
assertThat(event.compensationMethod(), is(compensationMethod));
}
}
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensationMessageHandlerTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensationMessageHandlerTest.java
index 0827833..bc126ae 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensationMessageHandlerTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/CompensationMessageHandlerTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.List;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.CompensationContext;
import org.junit.Test;
@@ -53,7 +54,7 @@ public class CompensationMessageHandlerTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(localTxId));
assertThat(event.parentTxId(), is(parentTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxCompensatedEvent));
+ assertThat(event.type(), is(EventType.TxCompensatedEvent));
assertThat(event.compensationMethod(), is(getClass().getCanonicalName()));
assertThat(event.payloads().length, is(0));
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAnnotationProcessorTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAnnotationProcessorTest.java
index 48399b4..c146f5b 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAnnotationProcessorTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAnnotationProcessorTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.IdGenerator;
import org.apache.servicecomb.saga.omega.context.OmegaContext;
import org.junit.Before;
@@ -65,7 +66,7 @@ public class SagaStartAnnotationProcessorTest {
assertThat(event.localTxId(), is(globalTxId));
assertThat(event.parentTxId(), is(nullValue()));
assertThat(event.compensationMethod().isEmpty(), is(true));
- assertThat(event.type(), is(TxEvent.EventType.SagaStartedEvent));
+ assertThat(event.type(), is(EventType.SagaStartedEvent));
assertThat(event.payloads().length, is(0));
}
@@ -79,7 +80,7 @@ public class SagaStartAnnotationProcessorTest {
assertThat(event.localTxId(), is(globalTxId));
assertThat(event.parentTxId(), is(nullValue()));
assertThat(event.compensationMethod().isEmpty(), is(true));
- assertThat(event.type(), is(TxEvent.EventType.SagaEndedEvent));
+ assertThat(event.type(), is(EventType.SagaEndedEvent));
assertThat(event.payloads().length, is(0));
}
}
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAspectTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAspectTest.java
index 2370325..6d2e1a6 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAspectTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAspectTest.java
@@ -33,6 +33,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.IdGenerator;
import org.apache.servicecomb.saga.omega.context.OmegaContext;
import org.apache.servicecomb.saga.omega.context.annotations.SagaStart;
@@ -77,14 +78,14 @@ public class SagaStartAspectTest {
assertThat(startedEvent.globalTxId(), is(globalTxId));
assertThat(startedEvent.localTxId(), is(globalTxId));
assertThat(startedEvent.parentTxId(), is(nullValue()));
- assertThat(startedEvent.type(), is(TxEvent.EventType.SagaStartedEvent));
+ assertThat(startedEvent.type(), is(EventType.SagaStartedEvent));
TxEvent endedEvent = messages.get(1);
assertThat(endedEvent.globalTxId(), is(globalTxId));
assertThat(endedEvent.localTxId(), is(globalTxId));
assertThat(endedEvent.parentTxId(), is(nullValue()));
- assertThat(endedEvent.type(), is(TxEvent.EventType.SagaEndedEvent));
+ assertThat(endedEvent.type(), is(EventType.SagaEndedEvent));
assertThat(omegaContext.globalTxId(), is(nullValue()));
assertThat(omegaContext.localTxId(), is(nullValue()));
@@ -109,7 +110,7 @@ public class SagaStartAspectTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(globalTxId));
assertThat(event.parentTxId(), is(nullValue()));
- assertThat(event.type(), is(TxEvent.EventType.SagaStartedEvent));
+ assertThat(event.type(), is(EventType.SagaStartedEvent));
assertThat(omegaContext.globalTxId(), is(nullValue()));
assertThat(omegaContext.localTxId(), is(nullValue()));
@@ -140,7 +141,7 @@ public class SagaStartAspectTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(globalTxId));
assertThat(event.parentTxId(), is(nullValue()));
- assertThat(event.type(), is(TxEvent.EventType.TxAbortedEvent));
+ assertThat(event.type(), is(EventType.TxAbortedEvent));
latch.countDown();
diff --git a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java
index 2d92d0f..63cdff0 100644
--- a/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java
+++ b/omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.servicecomb.saga.common.EventType;
import org.apache.servicecomb.saga.omega.context.IdGenerator;
import org.apache.servicecomb.saga.omega.context.OmegaContext;
import org.apache.servicecomb.saga.omega.transaction.annotations.Compensable;
@@ -83,14 +84,14 @@ public class TransactionAspectTest {
assertThat(startedEvent.globalTxId(), is(globalTxId));
assertThat(startedEvent.localTxId(), is(newLocalTxId));
assertThat(startedEvent.parentTxId(), is(localTxId));
- assertThat(startedEvent.type(), is(TxEvent.EventType.TxStartedEvent));
+ assertThat(startedEvent.type(), is(EventType.TxStartedEvent));
TxEvent endedEvent = messages.get(1);
assertThat(endedEvent.globalTxId(), is(globalTxId));
assertThat(endedEvent.localTxId(), is(newLocalTxId));
assertThat(endedEvent.parentTxId(), is(localTxId));
- assertThat(endedEvent.type(), is(TxEvent.EventType.TxEndedEvent));
+ assertThat(endedEvent.type(), is(EventType.TxEndedEvent));
assertThat(omegaContext.globalTxId(), is(globalTxId));
assertThat(omegaContext.localTxId(), is(localTxId));
@@ -114,7 +115,7 @@ public class TransactionAspectTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(newLocalTxId));
assertThat(event.parentTxId(), is(localTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxAbortedEvent));
+ assertThat(event.type(), is(EventType.TxAbortedEvent));
assertThat(omegaContext.globalTxId(), is(globalTxId));
assertThat(omegaContext.localTxId(), is(localTxId));
@@ -149,7 +150,7 @@ public class TransactionAspectTest {
assertThat(event.globalTxId(), is(globalTxId));
assertThat(event.localTxId(), is(newLocalTxId));
assertThat(event.parentTxId(), is(localTxId));
- assertThat(event.type(), is(TxEvent.EventType.TxAbortedEvent));
+ assertThat(event.type(), is(EventType.TxAbortedEvent));
latch.countDown();
diff --git a/alpha/alpha-core/pom.xml b/pack-common/pom.xml
similarity index 59%
copy from alpha/alpha-core/pom.xml
copy to pack-common/pom.xml
index 2fee5ab..0fa6439 100644
--- a/alpha/alpha-core/pom.xml
+++ b/pack-common/pom.xml
@@ -20,42 +20,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>alpha</artifactId>
+ <artifactId>saga</artifactId>
<groupId>org.apache.servicecomb.saga</groupId>
<version>0.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>alpha-core</artifactId>
- <name>Saga::Alpha::Core</name>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- </dependency>
- <dependency>
- <groupId>com.github.seanyinx</groupId>
- <artifactId>unit-scaffolding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.awaitility</groupId>
- <artifactId>awaitility</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </dependency>
- </dependencies>
-
+ <artifactId>pack-common</artifactId>
+ <name>Saga::Pack Common</name>
</project>
diff --git a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventType.java b/pack-common/src/main/java/org/apache/servicecomb/saga/common/EventType.java
similarity index 95%
rename from alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventType.java
rename to pack-common/src/main/java/org/apache/servicecomb/saga/common/EventType.java
index 3406294..d7743d9 100644
--- a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventType.java
+++ b/pack-common/src/main/java/org/apache/servicecomb/saga/common/EventType.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.saga.alpha.core;
+package org.apache.servicecomb.saga.common;
public enum EventType {
SagaStartedEvent,
diff --git a/pom.xml b/pom.xml
index c3919b6..1d41a45 100755
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
<module>omega</module>
<module>alpha</module>
<module>pack-contracts</module>
+ <module>pack-common</module>
<module>integration-tests</module>
</modules>
@@ -202,6 +203,11 @@
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>pack-common</artifactId>
+ <version>0.0.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
--
To stop receiving notification emails like this one, please contact
['"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>'].