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/17 10:02:28 UTC

[incubator-servicecomb-saga] 02/03: SCB-249 replaced mysql with postgres to comply with APL2

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

seanyinx pushed a commit to branch SCB-249_apl_compliance
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git

commit a70fe34826ece7b2a245e09c9c3d46f7d4932f12
Author: seanyinx <se...@huawei.com>
AuthorDate: Wed Jan 17 17:02:21 2018 +0800

    SCB-249 replaced mysql with postgres to comply with APL2
    
    Signed-off-by: seanyinx <se...@huawei.com>
---
 alpha/alpha-server/pom.xml                         |  9 ++-
 ...nImpl.java => EclipseLinkJpaConfiguration.java} |  4 +-
 .../src/main/resources/application.yaml            | 13 +---
 .../src/main/resources/schema-mysql.sql            | 14 ----
 .../src/main/resources/schema-postgresql.sql       | 14 ++++
 integration-tests/pack-tests/pom.xml               | 50 +++++++++----
 .../pack/tests/EclipseLinkJpaConfiguration.java    |  8 +-
 .../saga/integration/pack/tests/PackIT.java        | 52 ++++++-------
 .../integration/pack/tests/TxEventEnvelope.java    | 87 ----------------------
 .../pack/tests/TxEventEnvelopeRepository.java      |  7 +-
 .../pack-tests/src/test/resources/application.yaml |  8 +-
 11 files changed, 98 insertions(+), 168 deletions(-)

diff --git a/alpha/alpha-server/pom.xml b/alpha/alpha-server/pom.xml
index 6335c91..856d86c 100644
--- a/alpha/alpha-server/pom.xml
+++ b/alpha/alpha-server/pom.xml
@@ -59,6 +59,10 @@
       <artifactId>alpha-core</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.servicecomb.saga</groupId>
+      <artifactId>pack-common</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter</artifactId>
     </dependency>
@@ -77,8 +81,9 @@
       <artifactId>org.eclipse.persistence.jpa</artifactId>
     </dependency>
     <dependency>
-      <groupId>mysql</groupId>
-      <artifactId>mysql-connector-java</artifactId>
+      <groupId>org.postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <scope>runtime</scope>
     </dependency>
 
     <dependency>
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/EclipseLinkJpaConfiguration.java
similarity index 94%
copy from alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java
copy to alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/EclipseLinkJpaConfiguration.java
index 0bf0fad..4061c49 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/EclipseLinkJpaConfiguration.java
@@ -31,8 +31,8 @@ import org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter;
 import org.springframework.transaction.jta.JtaTransactionManager;
 
 @Configuration
-class JpaBaseConfigurationImpl extends JpaBaseConfiguration {
-  JpaBaseConfigurationImpl(DataSource dataSource,
+class EclipseLinkJpaConfiguration extends JpaBaseConfiguration {
+  EclipseLinkJpaConfiguration(DataSource dataSource,
       JpaProperties properties,
       ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
     super(dataSource, properties, jtaTransactionManagerProvider);
diff --git a/alpha/alpha-server/src/main/resources/application.yaml b/alpha/alpha-server/src/main/resources/application.yaml
index 9b166c8..cf3c896 100644
--- a/alpha/alpha-server/src/main/resources/application.yaml
+++ b/alpha/alpha-server/src/main/resources/application.yaml
@@ -19,13 +19,6 @@ spring:
   datasource:
     username: saga
     password: password
-    driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://mysql.servicecomb.io:3306/saga?useSSL=false
-    platform: mysql
-    continue-on-error: true
-  jpa:
-    properties:
-      hibernate:
-        dialect: org.hibernate.dialect.MySQL5Dialect
-    hibernate:
-      ddl-auto: none
+    url: jdbc:postgresql://postgresql.servicecomb.io:5432/saga?useSSL=false
+    platform: postgresql
+#    continue-on-error: true
diff --git a/alpha/alpha-server/src/main/resources/schema-mysql.sql b/alpha/alpha-server/src/main/resources/schema-mysql.sql
deleted file mode 100644
index bd98c2a..0000000
--- a/alpha/alpha-server/src/main/resources/schema-mysql.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-CREATE TABLE IF NOT EXISTS `tx_event_envelope` (
-  `surrogate_id` bigint NOT NULL AUTO_INCREMENT,
-  `service_name` varchar(16) NOT NULL,
-  `instance_id` varchar(36) NOT NULL,
-  `creation_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
-  `global_tx_id` varchar(36) NOT NULL,
-  `local_tx_id` varchar(36) NOT NULL,
-  `parent_tx_id` varchar(36) DEFAULT NULL,
-  `type` varchar(50) NOT NULL,
-  `compensation_method` varchar(256) NOT NULL,
-  `payloads` varbinary(10240),
-  PRIMARY KEY (`surrogate_id`),
-  INDEX `running_sagas_index` (`global_tx_id`, `local_tx_id`, `type`)
-) DEFAULT CHARSET=utf8;
diff --git a/alpha/alpha-server/src/main/resources/schema-postgresql.sql b/alpha/alpha-server/src/main/resources/schema-postgresql.sql
new file mode 100644
index 0000000..e84a9c3
--- /dev/null
+++ b/alpha/alpha-server/src/main/resources/schema-postgresql.sql
@@ -0,0 +1,14 @@
+CREATE TABLE IF NOT EXISTS TxEvent (
+  surrogateId BIGSERIAL PRIMARY KEY,
+  serviceName varchar(16) NOT NULL,
+  instanceId varchar(36) NOT NULL,
+  creationTime timestamp(6) NOT NULL DEFAULT CURRENT_DATE,
+  globalTxId varchar(36) NOT NULL,
+  localTxId varchar(36) NOT NULL,
+  parentTxId varchar(36) DEFAULT NULL,
+  type varchar(50) NOT NULL,
+  compensationMethod varchar(256) NOT NULL,
+  payloads bytea
+);
+
+CREATE INDEX IF NOT EXISTS running_sagas_index ON TxEvent (globalTxId, localTxId, type);
diff --git a/integration-tests/pack-tests/pom.xml b/integration-tests/pack-tests/pom.xml
index b493851..f7b1d01 100644
--- a/integration-tests/pack-tests/pom.xml
+++ b/integration-tests/pack-tests/pom.xml
@@ -45,6 +45,10 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb.saga</groupId>
+      <artifactId>alpha-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb.saga</groupId>
       <artifactId>omega-spring-starter</artifactId>
     </dependency>
     <dependency>
@@ -79,14 +83,29 @@
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-data-jpa</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.hibernate</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>mysql</groupId>
-      <artifactId>mysql-connector-java</artifactId>
+      <groupId>javax.persistence</groupId>
+      <artifactId>javax.persistence-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>org.eclipse.persistence.jpa</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
       <scope>test</scope>
@@ -114,26 +133,25 @@
             <configuration>
               <images>
                 <image>
-                  <name>mysql/mysql-server:5.7</name>
-                  <alias>mysql</alias>
+                  <name>postgres</name>
+                  <alias>postgres</alias>
                   <run>
                     <env>
-                      <MYSQL_ROOT_PASSWORD>password</MYSQL_ROOT_PASSWORD>
-                      <MYSQL_DATABASE>saga</MYSQL_DATABASE>
-                      <MYSQL_USER>saga</MYSQL_USER>
-                      <MYSQL_PASSWORD>password</MYSQL_PASSWORD>
+                      <POSTGRES_DB>saga</POSTGRES_DB>
+                      <POSTGRES_USER>saga</POSTGRES_USER>
+                      <POSTGRES_PASSWORD>password</POSTGRES_PASSWORD>
                     </env>
                     <wait>
-                      <log>Starting MySQL 5.7</log>
+                      <log>database system is ready to accept connections</log>
                       <tcp>
                         <ports>
-                          <port>3306</port>
+                          <port>5432</port>
                         </ports>
                       </tcp>
                       <time>60000</time>
                     </wait>
                     <ports>
-                      <port>mysql.port:3306</port>
+                      <port>postgres.port:5432</port>
                     </ports>
                   </run>
                 </image>
@@ -147,7 +165,7 @@
                       </JAVA_OPTS>
                     </env>
                     <links>
-                      <link>mysql:mysql.servicecomb.io</link>
+                      <link>postgres:postgresql.servicecomb.io</link>
                     </links>
                     <wait>
                       <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
@@ -162,7 +180,7 @@
                       <port>alpha.port:8080</port>
                     </ports>
                     <dependsOn>
-                      <dependsOn>mysql</dependsOn>
+                      <dependsOn>postgres</dependsOn>
                     </dependsOn>
                   </run>
                 </image>
@@ -214,7 +232,7 @@
                   ${docker.hostname}:${alpha.port}
                 </alpha.cluster.address>
                 <spring.datasource.url>
-                  jdbc:mysql://${docker.hostname}:${mysql.port}/saga?useSSL=false
+                  jdbc:postgresql://${docker.hostname}:${postgres.port}/saga?useSSL=false
                 </spring.datasource.url>
               </systemPropertyVariables>
               <argLine>${jacoco.failsafe.argLine}</argLine>
@@ -228,6 +246,10 @@
               </execution>
             </executions>
           </plugin>
+          <plugin>
+            <groupId>com.ethlo.persistence.tools</groupId>
+            <artifactId>eclipselink-maven-plugin</artifactId>
+          </plugin>
         </plugins>
       </build>
     </profile>
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/EclipseLinkJpaConfiguration.java
similarity index 85%
rename from alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java
rename to integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/EclipseLinkJpaConfiguration.java
index 0bf0fad..75d1a8c 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/JpaBaseConfigurationImpl.java
+++ b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/EclipseLinkJpaConfiguration.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.saga.alpha.server;
+package org.apache.servicecomb.saga.integration.pack.tests;
 
 import java.util.Collections;
 import java.util.Map;
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.sql.DataSource;
 
 import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
 import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
 import org.springframework.context.annotation.Configuration;
@@ -31,8 +32,9 @@ import org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter;
 import org.springframework.transaction.jta.JtaTransactionManager;
 
 @Configuration
-class JpaBaseConfigurationImpl extends JpaBaseConfiguration {
-  JpaBaseConfigurationImpl(DataSource dataSource,
+@EntityScan(basePackages = "org.apache.servicecomb.saga.alpha")
+class EclipseLinkJpaConfiguration extends JpaBaseConfiguration {
+  EclipseLinkJpaConfiguration(DataSource dataSource,
       JpaProperties properties,
       ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
     super(dataSource, properties, jtaTransactionManagerProvider);
diff --git a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/PackIT.java b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/PackIT.java
index 0a340db..b3045e3 100644
--- a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/PackIT.java
+++ b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/PackIT.java
@@ -30,8 +30,8 @@ import static org.springframework.http.HttpStatus.OK;
 
 import java.util.List;
 import java.util.Queue;
-import java.util.UUID;
 
+import org.apache.servicecomb.saga.alpha.core.TxEvent;
 import org.apache.servicecomb.saga.omega.context.OmegaContext;
 import org.junit.After;
 import org.junit.Test;
@@ -79,46 +79,46 @@ public class PackIT {
     assertThat(distinctGlobalTxIds.size(), is(1));
 
     String globalTxId = distinctGlobalTxIds.get(0);
-    List<TxEventEnvelope> envelopes = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
+    List<TxEvent> events = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
 
-    assertThat(envelopes.size(), is(6));
+    assertThat(events.size(), is(6));
 
-    TxEventEnvelope sagaStartedEvent = envelopes.get(0);
+    TxEvent sagaStartedEvent = events.get(0);
     assertThat(sagaStartedEvent.type(), is("SagaStartedEvent"));
     assertThat(sagaStartedEvent.localTxId(), is(globalTxId));
     assertThat(sagaStartedEvent.parentTxId(), is(nullValue()));
     assertThat(sagaStartedEvent.serviceName(), is(serviceName));
     assertThat(sagaStartedEvent.instanceId(), is(notNullValue()));
 
-    TxEventEnvelope txStartedEvent1 = envelopes.get(1);
+    TxEvent txStartedEvent1 = events.get(1);
     assertThat(txStartedEvent1.type(), is("TxStartedEvent"));
     assertThat(txStartedEvent1.localTxId(), is(notNullValue()));
     assertThat(txStartedEvent1.parentTxId(), is(globalTxId));
     assertThat(txStartedEvent1.serviceName(), is(serviceName));
     assertThat(txStartedEvent1.instanceId(), is(sagaStartedEvent.instanceId()));
 
-    TxEventEnvelope txEndedEvent1 = envelopes.get(2);
+    TxEvent txEndedEvent1 = events.get(2);
     assertThat(txEndedEvent1.type(), is("TxEndedEvent"));
     assertThat(txEndedEvent1.localTxId(), is(txStartedEvent1.localTxId()));
     assertThat(txEndedEvent1.parentTxId(), is(globalTxId));
     assertThat(txEndedEvent1.serviceName(), is(serviceName));
     assertThat(txEndedEvent1.instanceId(), is(txStartedEvent1.instanceId()));
 
-    TxEventEnvelope txStartedEvent2 = envelopes.get(3);
+    TxEvent txStartedEvent2 = events.get(3);
     assertThat(txStartedEvent2.type(), is("TxStartedEvent"));
     assertThat(txStartedEvent2.localTxId(), is(notNullValue()));
     assertThat(txStartedEvent2.parentTxId(), is(globalTxId));
     assertThat(txStartedEvent2.serviceName(), is(serviceName));
     assertThat(txStartedEvent2.instanceId(), is(notNullValue()));
 
-    TxEventEnvelope txEndedEvent2 = envelopes.get(4);
+    TxEvent txEndedEvent2 = events.get(4);
     assertThat(txEndedEvent2.type(), is("TxEndedEvent"));
     assertThat(txEndedEvent2.localTxId(), is(txStartedEvent2.localTxId()));
     assertThat(txEndedEvent2.parentTxId(), is(globalTxId));
     assertThat(txEndedEvent2.serviceName(), is(serviceName));
     assertThat(txEndedEvent2.instanceId(), is(txStartedEvent2.instanceId()));
 
-    TxEventEnvelope sagaEndedEvent = envelopes.get(5);
+    TxEvent sagaEndedEvent = events.get(5);
     assertThat(sagaEndedEvent.type(), is("SagaEndedEvent"));
     assertThat(sagaEndedEvent.localTxId(), is(globalTxId));
     assertThat(sagaEndedEvent.parentTxId(), is(nullValue()));
@@ -142,20 +142,20 @@ public class PackIT {
     assertThat(distinctGlobalTxIds.size(), is(1));
 
     String globalTxId = distinctGlobalTxIds.get(0);
-    List<TxEventEnvelope> envelopes = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
-    assertThat(envelopes.size(), is(7));
+    List<TxEvent> events = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
+    assertThat(events.size(), is(7));
 
-    TxEventEnvelope sagaStartedEvent = envelopes.get(0);
+    TxEvent sagaStartedEvent = events.get(0);
     assertThat(sagaStartedEvent.type(), is("SagaStartedEvent"));
 
-    TxEventEnvelope txStartedEvent1 = envelopes.get(1);
+    TxEvent txStartedEvent1 = events.get(1);
     assertThat(txStartedEvent1.type(), is("TxStartedEvent"));
-    assertThat(envelopes.get(2).type(), is("TxEndedEvent"));
+    assertThat(events.get(2).type(), is("TxEndedEvent"));
 
-    TxEventEnvelope txStartedEvent2 = envelopes.get(3);
+    TxEvent txStartedEvent2 = events.get(3);
     assertThat(txStartedEvent2.type(), is("TxStartedEvent"));
 
-    TxEventEnvelope txAbortedEvent = envelopes.get(4);
+    TxEvent txAbortedEvent = events.get(4);
     assertThat(txAbortedEvent.type(), is("TxAbortedEvent"));
     assertThat(txAbortedEvent.localTxId(), is(txStartedEvent2.localTxId()));
     assertThat(txAbortedEvent.parentTxId(), is(globalTxId));
@@ -163,14 +163,14 @@ public class PackIT {
     assertThat(txAbortedEvent.instanceId(), is(txStartedEvent2.instanceId()));
 
     // TODO: 2018/1/9 compensation shall be done in reverse order
-    TxEventEnvelope txCompensatedEvent1 = envelopes.get(5);
+    TxEvent txCompensatedEvent1 = events.get(5);
     assertThat(txCompensatedEvent1.type(), is("TxCompensatedEvent"));
     assertThat(txCompensatedEvent1.localTxId(), is(txStartedEvent1.localTxId()));
     assertThat(txCompensatedEvent1.parentTxId(), is(globalTxId));
     assertThat(txCompensatedEvent1.serviceName(), is(serviceName));
     assertThat(txCompensatedEvent1.instanceId(), is(txStartedEvent1.instanceId()));
 
-    assertThat(envelopes.get(6).type(), is("SagaEndedEvent"));
+    assertThat(events.get(6).type(), is("SagaEndedEvent"));
 
     assertThat(compensatedMessages, contains("Goodbye, " + TRESPASSER));
   }
@@ -188,34 +188,34 @@ public class PackIT {
     assertThat(distinctGlobalTxIds.size(), is(1));
 
     String globalTxId = distinctGlobalTxIds.get(0);
-    List<TxEventEnvelope> envelopes = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
+    List<TxEvent> events = repository.findByGlobalTxIdOrderByCreationTime(globalTxId);
 
-    assertThat(envelopes.size(), is(6));
+    assertThat(events.size(), is(6));
 
-    TxEventEnvelope sagaStartedEvent = envelopes.get(0);
+    TxEvent sagaStartedEvent = events.get(0);
     assertThat(sagaStartedEvent.type(), is("SagaStartedEvent"));
 
-    TxEventEnvelope txStartedEvent1 = envelopes.get(1);
+    TxEvent txStartedEvent1 = events.get(1);
     assertThat(txStartedEvent1.type(), is("TxStartedEvent"));
     assertThat(txStartedEvent1.localTxId(), is(notNullValue()));
     assertThat(txStartedEvent1.parentTxId(), is(globalTxId));
 
-    TxEventEnvelope txStartedEvent2 = envelopes.get(2);
+    TxEvent txStartedEvent2 = events.get(2);
     assertThat(txStartedEvent2.type(), is("TxStartedEvent"));
     assertThat(txStartedEvent2.localTxId(), is(notNullValue()));
     assertThat(txStartedEvent2.parentTxId(), is(txStartedEvent1.localTxId()));
 
-    TxEventEnvelope txEndedEvent2 = envelopes.get(3);
+    TxEvent txEndedEvent2 = events.get(3);
     assertThat(txEndedEvent2.type(), is("TxEndedEvent"));
     assertThat(txEndedEvent2.localTxId(), is(txStartedEvent2.localTxId()));
     assertThat(txEndedEvent2.parentTxId(), is(txStartedEvent1.localTxId()));
 
-    TxEventEnvelope txEndedEvent1 = envelopes.get(4);
+    TxEvent txEndedEvent1 = events.get(4);
     assertThat(txEndedEvent1.type(), is("TxEndedEvent"));
     assertThat(txEndedEvent1.localTxId(), is(txStartedEvent1.localTxId()));
     assertThat(txEndedEvent1.parentTxId(), is(globalTxId));
 
-    TxEventEnvelope sagaEndedEvent = envelopes.get(5);
+    TxEvent sagaEndedEvent = events.get(5);
     assertThat(sagaEndedEvent.type(), is("SagaEndedEvent"));
 
     assertThat(compensatedMessages.isEmpty(), is(true));
diff --git a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelope.java b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelope.java
deleted file mode 100644
index 0087dd7..0000000
--- a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelope.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.saga.integration.pack.tests;
-
-import java.util.Arrays;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
-class TxEventEnvelope {
-  @Id
-  @GeneratedValue
-  private long surrogateId;
-
-  private String serviceName;
-  private String instanceId;
-  private Date creationTime;
-  private String globalTxId;
-  private String localTxId;
-  private String parentTxId;
-  private String type;
-  private byte[] payloads;
-
-  private TxEventEnvelope() {
-  }
-
-  String serviceName() {
-    return serviceName;
-  }
-
-  String instanceId() {
-    return instanceId;
-  }
-
-  String globalTxId() {
-    return globalTxId;
-  }
-
-  String localTxId() {
-    return localTxId;
-  }
-
-  String parentTxId() {
-    return parentTxId;
-  }
-
-  String type() {
-    return type;
-  }
-
-  public byte[] payloads() {
-    return payloads;
-  }
-
-  @Override
-  public String toString() {
-    return "TxEventEnvelope{" +
-        "surrogateId=" + surrogateId +
-        ", serviceName='" + serviceName + '\'' +
-        ", instanceId='" + instanceId + '\'' +
-        ", creationTime=" + creationTime +
-        ", globalTxId='" + globalTxId + '\'' +
-        ", localTxId='" + localTxId + '\'' +
-        ", parentTxId='" + parentTxId + '\'' +
-        ", type='" + type + '\'' +
-        ", payloads=" + Arrays.toString(payloads) +
-        '}';
-  }
-}
diff --git a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelopeRepository.java b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelopeRepository.java
index 5400d7c..77bcb8f 100644
--- a/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelopeRepository.java
+++ b/integration-tests/pack-tests/src/test/java/org/apache/servicecomb/saga/integration/pack/tests/TxEventEnvelopeRepository.java
@@ -19,12 +19,13 @@ package org.apache.servicecomb.saga.integration.pack.tests;
 
 import java.util.List;
 
+import org.apache.servicecomb.saga.alpha.core.TxEvent;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.CrudRepository;
 
-interface TxEventEnvelopeRepository extends CrudRepository<TxEventEnvelope, Long> {
-  List<TxEventEnvelope> findByGlobalTxIdOrderByCreationTime(String globalTxId);
+interface TxEventEnvelopeRepository extends CrudRepository<TxEvent, Long> {
+  List<TxEvent> findByGlobalTxIdOrderByCreationTime(String globalTxId);
 
-  @Query("SELECT DISTINCT(e.globalTxId) from TxEventEnvelope e")
+  @Query("SELECT DISTINCT(e.globalTxId) from TxEvent e")
   List<String> findDistinctGlobalTxId();
 }
diff --git a/integration-tests/pack-tests/src/test/resources/application.yaml b/integration-tests/pack-tests/src/test/resources/application.yaml
index a7ed531..34b72c3 100644
--- a/integration-tests/pack-tests/src/test/resources/application.yaml
+++ b/integration-tests/pack-tests/src/test/resources/application.yaml
@@ -18,10 +18,4 @@ spring:
   datasource:
     username: saga
     password: password
-    driver-class-name: com.mysql.jdbc.Driver
-  jpa:
-    properties:
-      hibernate:
-        dialect: org.hibernate.dialect.MySQL5Dialect
-    hibernate:
-      ddl-auto: none
+    driver-class-name: org.postgresql.Driver

-- 
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.