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 bbc42c8e405b7b37fabc81b697b5097145f5e1bb Author: Lei Zhang <zhang...@apache.org> AuthorDate: Sun Sep 4 18:34:03 2022 +0800 SCB-2679 Move test cases to the correct location --- .../saga/db/AlphaIntegrationWithSpecSagaDbTest.java} | 12 +++++++++--- ...lphaIntegrationWithSpecSagaDbWithRandomPortTest.java} | 16 ++++++++++------ .../db/AlphaIntegrationWithSpecSagaDbWithSSLTest.java} | 12 +++++++++--- .../alpha/spec/tcc/db/test/AlphaTccEventController.java | 1 + 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbTest.java similarity index 98% rename from alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationTest.java rename to alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbTest.java index 07994265..1056d3a8 100644 --- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationTest.java +++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.servicecomb.pack.alpha.server; +package org.apache.servicecomb.pack.alpha.spec.saga.db; import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify; import static java.util.concurrent.TimeUnit.SECONDS; @@ -48,6 +48,8 @@ import java.util.function.Consumer; import javax.annotation.PostConstruct; import org.apache.servicecomb.pack.alpha.core.*; +import org.apache.servicecomb.pack.alpha.server.AlphaApplication; +import org.apache.servicecomb.pack.alpha.server.AlphaConfig; import org.apache.servicecomb.pack.alpha.spec.saga.db.CommandEntityRepository; import org.apache.servicecomb.pack.alpha.spec.saga.db.TxEventEnvelopeRepository; import org.apache.servicecomb.pack.alpha.spec.saga.db.TxTimeoutEntityRepository; @@ -78,9 +80,13 @@ import org.springframework.test.context.junit4.SpringRunner; "alpha.server.host=0.0.0.0", "alpha.server.port=8090", "alpha.event.pollingInterval=1", - "spring.main.allow-bean-definition-overriding=true" + "spring.main.allow-bean-definition-overriding=true", + "alpha.spec.names=saga-db", + "alpha.spec.saga.db.datasource.username=sa", + "alpha.spec.saga.db.datasource.url=jdbc:hsqldb:mem:saga", + "alpha.spec.saga.db.cluster.enabled=false" }) -public class AlphaIntegrationTest { +public class AlphaIntegrationWithSpecSagaDbTest { private static final int port = 8090; protected static ManagedChannel clientChannel; diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithRandomPortTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithRandomPortTest.java similarity index 97% rename from alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithRandomPortTest.java rename to alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithRandomPortTest.java index 6ec5a727..a47246e7 100644 --- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithRandomPortTest.java +++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithRandomPortTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.servicecomb.pack.alpha.server; +package org.apache.servicecomb.pack.alpha.spec.saga.db; import com.google.protobuf.ByteString; import io.grpc.ManagedChannel; @@ -23,9 +23,9 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.stub.StreamObserver; import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.pack.alpha.core.*; -import org.apache.servicecomb.pack.alpha.spec.saga.db.CommandEntityRepository; -import org.apache.servicecomb.pack.alpha.spec.saga.db.TxEventEnvelopeRepository; -import org.apache.servicecomb.pack.alpha.spec.saga.db.TxTimeoutEntityRepository; +import org.apache.servicecomb.pack.alpha.server.AlphaApplication; +import org.apache.servicecomb.pack.alpha.server.AlphaConfig; +import org.apache.servicecomb.pack.alpha.server.ServerStartable; import org.apache.servicecomb.pack.common.EventType; import org.apache.servicecomb.pack.contract.grpc.*; import org.apache.servicecomb.pack.contract.grpc.TxEventServiceGrpc.TxEventServiceBlockingStub; @@ -65,9 +65,13 @@ import static org.junit.Assert.assertThat; "alpha.server.portAutoIncrement=true", "alpha.server.portCount=100", "alpha.event.pollingInterval=1", - "spring.main.allow-bean-definition-overriding=true" + "spring.main.allow-bean-definition-overriding=true", + "alpha.spec.names=saga-db", + "alpha.spec.saga.db.datasource.username=sa", + "alpha.spec.saga.db.datasource.url=jdbc:hsqldb:mem:saga", + "alpha.spec.saga.db.cluster.enabled=false", }) -public class AlphaIntegrationWithRandomPortTest { +public class AlphaIntegrationWithSpecSagaDbWithRandomPortTest { protected static ManagedChannel clientChannel; private static boolean setUpIsDone = false; diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithSSLTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithSSLTest.java similarity index 81% rename from alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithSSLTest.java rename to alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithSSLTest.java index e5e279a4..dc91efd8 100644 --- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/server/AlphaIntegrationWithSSLTest.java +++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/pack/alpha/spec/saga/db/AlphaIntegrationWithSpecSagaDbWithSSLTest.java @@ -15,12 +15,14 @@ * limitations under the License. */ -package org.apache.servicecomb.pack.alpha.server; +package org.apache.servicecomb.pack.alpha.spec.saga.db; import java.io.File; import java.util.Arrays; import javax.net.ssl.SSLException; +import org.apache.servicecomb.pack.alpha.server.AlphaApplication; +import org.apache.servicecomb.pack.alpha.server.AlphaConfig; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -39,9 +41,13 @@ import io.netty.handler.ssl.SslProvider; "alpha.server.port=8092", "alpha.event.pollingInterval=1", "spring.main.allow-bean-definition-overriding=true", + "alpha.spec.names=saga-db", + "alpha.spec.saga.db.datasource.username=sa", + "alpha.spec.saga.db.datasource.url=jdbc:hsqldb:mem:saga", + "alpha.spec.saga.db.cluster.enabled=false", "spring.profiles.active=ssl" }) -public class AlphaIntegrationWithSSLTest extends AlphaIntegrationTest { +public class AlphaIntegrationWithSpecSagaDbWithSSLTest extends AlphaIntegrationWithSpecSagaDbTest { private static final int port = 8092; @BeforeClass @@ -53,7 +59,7 @@ public class AlphaIntegrationWithSSLTest extends AlphaIntegrationTest { } private static SslContext getSslContext(){ - ClassLoader classLoader = AlphaIntegrationWithSSLTest.class.getClassLoader(); + ClassLoader classLoader = AlphaIntegrationWithSpecSagaDbWithSSLTest.class.getClassLoader(); SslContext sslContext = null; try { sslContext = GrpcSslContexts.forClient().sslProvider(SslProvider.OPENSSL) diff --git a/alpha/alpha-spec-tcc-db/src/main/java/org/apache/servicecomb/pack/alpha/spec/tcc/db/test/AlphaTccEventController.java b/alpha/alpha-spec-tcc-db/src/main/java/org/apache/servicecomb/pack/alpha/spec/tcc/db/test/AlphaTccEventController.java index 2cfdaae7..82048722 100644 --- a/alpha/alpha-spec-tcc-db/src/main/java/org/apache/servicecomb/pack/alpha/spec/tcc/db/test/AlphaTccEventController.java +++ b/alpha/alpha-spec-tcc-db/src/main/java/org/apache/servicecomb/pack/alpha/spec/tcc/db/test/AlphaTccEventController.java @@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/tcc") +@Profile("test") public class AlphaTccEventController { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());