From 8ec16312bcf6626b4afe5e3e9501eb593270723a Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 21 Apr 2024 10:55:53 +0800 Subject: [PATCH] refact to using junit5 and jdk17 --- .../cola-component-catchlog-starter/pom.xml | 5 --- .../cola/catchlog/test/CatchLogTest.java | 8 +--- .../com/alibaba/cola/domain/Customer.java | 2 +- .../README.md | 2 +- .../com/alibaba/cola/extension/Extension.java | 1 - .../cola/extension/ExtensionExecutor.java | 2 +- .../alibaba/cola/extension/Extensions.java | 2 - .../register/ExtensionBootstrap.java | 5 ++- .../extension/register/ExtensionRegister.java | 17 +------- .../extension/{test => }/Application.java | 4 +- .../extension/{test => }/ExtensionTest.java | 30 +++++++------ .../{test => }/MultiCoordinateTests.java | 42 +++++++------------ .../customer/app/AddCustomerCmdExe.java | 15 ++++--- .../app/CustomerCreatedEventHandler.java | 4 +- .../customer/app/CustomerServiceImpl.java | 13 +++--- .../customer/app/GetOneCustomerQryExe.java | 4 +- ...ustomerBiz1UseCase1Scenario1Validator.java | 8 ++-- .../AddCustomerBiz1UseCase1Validator.java | 8 ++-- .../extension/AddCustomerBizOneValidator.java | 10 ++--- .../extension/AddCustomerBizTwoValidator.java | 8 ++-- .../extension/CustomerBizOneConvertorExt.java | 14 +++---- .../extension/CustomerBizTwoConvertorExt.java | 12 +++--- .../app/extension/CustomerConvertor.java | 8 ++-- .../app/extension/StatusNameConvertorExt.java | 12 ++---- .../AddCustomerValidatorExtPt.java | 4 +- .../CustomerConvertorExtPt.java | 6 +-- .../StatusNameConvertorExtPt.java | 2 +- .../customer/client/AddCustomerCmd.java | 2 +- .../{test => }/customer/client/Constants.java | 2 +- .../customer/client/CustomerCreatedEvent.java | 2 +- .../customer/client/CustomerDTO.java | 4 +- .../customer/client/CustomerServiceI.java | 2 +- .../customer/client/GetOneCustomerQry.java | 2 +- .../customer/domain/CustomerEntity.java | 6 +-- .../customer/domain/CustomerType.java | 2 +- .../customer/domain/SourceType.java | 2 +- .../domain/rule/CustomerBizOneRuleExt.java | 8 ++-- .../domain/rule/CustomerBizTwoRuleExt.java | 6 +-- .../domain/rule/CustomerRuleExtPt.java | 4 +- .../customer/infrastructure/CustomerDO.java | 4 +- .../infrastructure/CustomerRepository.java | 4 +- .../infrastructure/DomainEventPublisher.java | 2 +- .../register/ExtensionRegisterTest.java | 34 +++++++-------- 43 files changed, 143 insertions(+), 191 deletions(-) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/Application.java (70%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/ExtensionTest.java (74%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/MultiCoordinateTests.java (60%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/AddCustomerCmdExe.java (72%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/CustomerCreatedEventHandler.java (72%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/CustomerServiceImpl.java (66%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/GetOneCustomerQryExe.java (72%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java (63%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/AddCustomerBiz1UseCase1Validator.java (59%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/AddCustomerBizOneValidator.java (61%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/AddCustomerBizTwoValidator.java (65%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/CustomerBizOneConvertorExt.java (68%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/CustomerBizTwoConvertorExt.java (69%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/CustomerConvertor.java (74%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extension/StatusNameConvertorExt.java (67%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extensionpoint/AddCustomerValidatorExtPt.java (66%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extensionpoint/CustomerConvertorExtPt.java (57%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/app/extensionpoint/StatusNameConvertorExtPt.java (84%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/AddCustomerCmd.java (85%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/Constants.java (91%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/CustomerCreatedEvent.java (68%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/CustomerDTO.java (86%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/CustomerServiceI.java (85%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/client/GetOneCustomerQry.java (90%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/CustomerEntity.java (87%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/CustomerType.java (73%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/SourceType.java (77%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/rule/CustomerBizOneRuleExt.java (68%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/rule/CustomerBizTwoRuleExt.java (66%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/domain/rule/CustomerRuleExtPt.java (78%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/infrastructure/CustomerDO.java (95%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/infrastructure/CustomerRepository.java (70%) rename cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/{test => }/customer/infrastructure/DomainEventPublisher.java (83%) diff --git a/cola-components/cola-component-catchlog-starter/pom.xml b/cola-components/cola-component-catchlog-starter/pom.xml index 5fb3ff660..3dbdeef34 100644 --- a/cola-components/cola-component-catchlog-starter/pom.xml +++ b/cola-components/cola-component-catchlog-starter/pom.xml @@ -77,11 +77,6 @@ provided - - - org.slf4j - slf4j-api - diff --git a/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/CatchLogTest.java b/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/CatchLogTest.java index 583f881a8..c745fc6bd 100644 --- a/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/CatchLogTest.java +++ b/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/CatchLogTest.java @@ -2,17 +2,13 @@ import com.alibaba.cola.catchlog.CatchLogAspect; import com.alibaba.cola.catchlog.CatchLogAutoConfiguration; -import org.junit.Test; -import org.junit.runner.RunWith; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import javax.annotation.Resource; /** * */ -@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {CatchLogAutoConfiguration.class, Demo.class, CatchLogAspect.class, Application.class}) public class CatchLogTest { diff --git a/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/Customer.java b/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/Customer.java index 7ab16498a..5b880e190 100644 --- a/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/Customer.java +++ b/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/Customer.java @@ -1,8 +1,8 @@ package com.alibaba.cola.domain; import com.alibaba.cola.domain.Entity; +import jakarta.annotation.Resource; -import javax.annotation.Resource; /** * Customer diff --git a/cola-components/cola-component-extension-starter/README.md b/cola-components/cola-component-extension-starter/README.md index 23229e121..beb2398cf 100644 --- a/cola-components/cola-component-extension-starter/README.md +++ b/cola-components/cola-component-extension-starter/README.md @@ -5,5 +5,5 @@ https://blog.csdn.net/significantfrank/article/details/100074716 ## 使用介绍 -参看测试代码`com.alibaba.cola.extension.test.ExtensionTest` +参看测试代码`com.alibaba.cola.extension.ExtensionTest` diff --git a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extension.java b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extension.java index fcd63efb8..1e446967b 100644 --- a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extension.java +++ b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extension.java @@ -18,7 +18,6 @@ @Inherited @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) -@Repeatable(Extensions.class) @Component public @interface Extension { String bizId() default BizScenario.DEFAULT_BIZ_ID; diff --git a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/ExtensionExecutor.java b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/ExtensionExecutor.java index 17ad7f442..09c14cd26 100644 --- a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/ExtensionExecutor.java +++ b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/ExtensionExecutor.java @@ -8,11 +8,11 @@ package com.alibaba.cola.extension; import com.alibaba.cola.extension.register.AbstractComponentExecutor; +import jakarta.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; /** * ExtensionExecutor diff --git a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extensions.java b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extensions.java index fed45ffb0..cdd28b131 100644 --- a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extensions.java +++ b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/Extensions.java @@ -24,6 +24,4 @@ String[] scenario() default BizScenario.DEFAULT_SCENARIO; - Extension[] value() default {}; - } diff --git a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionBootstrap.java b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionBootstrap.java index d82083eb2..21490f803 100644 --- a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionBootstrap.java +++ b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionBootstrap.java @@ -3,13 +3,14 @@ import com.alibaba.cola.extension.Extension; import com.alibaba.cola.extension.ExtensionPointI; import com.alibaba.cola.extension.Extensions; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.Resource; + import java.util.Map; /** diff --git a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java index d29dc02e0..4fa4e566e 100644 --- a/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java +++ b/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java @@ -8,6 +8,7 @@ package com.alibaba.cola.extension.register; import com.alibaba.cola.extension.*; +import jakarta.annotation.Resource; import org.springframework.aop.support.AopUtils; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationUtils; @@ -15,8 +16,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; -import javax.annotation.Resource; - /** * ExtensionRegister * @@ -66,20 +65,8 @@ public void doRegistrationExtensions(ExtensionPointI extensionObject){ } Extensions extensionsAnnotation = AnnotationUtils.findAnnotation(extensionClz, Extensions.class); - Extension[] extensions = extensionsAnnotation.value(); - if (!ObjectUtils.isEmpty(extensions)){ - for (Extension extensionAnn : extensions) { - BizScenario bizScenario = BizScenario.valueOf(extensionAnn.bizId(), extensionAnn.useCase(), extensionAnn.scenario()); - ExtensionCoordinate extensionCoordinate = new ExtensionCoordinate(calculateExtensionPoint(extensionClz), bizScenario.getUniqueIdentity()); - ExtensionPointI preVal = extensionRepository.getExtensionRepo().put(extensionCoordinate, extensionObject); - if (preVal != null) { - String errMessage = "Duplicate registration is not allowed for :" + extensionCoordinate; - throw new ExtensionException(EXTENSION_DEFINE_DUPLICATE, errMessage); - } - } - } - // + //Support multiple extensions registration String[] bizIds = extensionsAnnotation.bizId(); String[] useCases = extensionsAnnotation.useCase(); String[] scenarios = extensionsAnnotation.scenario(); diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/Application.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/Application.java similarity index 70% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/Application.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/Application.java index 480f81bbd..c0fe7300b 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/Application.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/Application.java @@ -1,7 +1,8 @@ -package com.alibaba.cola.extension.test; +package com.alibaba.cola.extension; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; /** * Application @@ -10,6 +11,7 @@ * @date 2020-11-10 3:58 PM */ @SpringBootApplication +@ComponentScan(basePackages = "com.alibaba.cola") public class Application { public static void main(String[] args) { diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/ExtensionTest.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/ExtensionTest.java similarity index 74% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/ExtensionTest.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/ExtensionTest.java index d3f16d0f7..492455232 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/ExtensionTest.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/ExtensionTest.java @@ -1,19 +1,18 @@ -package com.alibaba.cola.extension.test; +package com.alibaba.cola.extension; import com.alibaba.cola.dto.Response; -import com.alibaba.cola.extension.BizScenario; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.client.CustomerDTO; -import com.alibaba.cola.extension.test.customer.client.CustomerServiceI; -import com.alibaba.cola.extension.test.customer.domain.CustomerType; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.client.CustomerDTO; +import com.alibaba.cola.extension.customer.client.CustomerServiceI; +import com.alibaba.cola.extension.customer.domain.CustomerType; +import jakarta.annotation.Resource; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; + /** * ExtensionTest @@ -21,7 +20,6 @@ * @author Frank Zhang * @date 2020-11-14 2:55 PM */ -@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class ExtensionTest { @Resource @@ -43,7 +41,7 @@ public void testBiz1UseCase1Scenario1AddCustomerSuccess(){ Response response = customerService.addCustomer(addCustomerCmd); //3. Expect Success - Assert.assertTrue(response.isSuccess()); + Assertions.assertTrue(response.isSuccess()); } @Test @@ -62,7 +60,7 @@ public void testBiz1UseCase1AddCustomerSuccess(){ Response response = customerService.addCustomer(addCustomerCmd); //3. Expect Success - Assert.assertTrue(response.isSuccess()); + Assertions.assertTrue(response.isSuccess()); } @Test @@ -81,6 +79,6 @@ public void testBiz1AddCustomerSuccess(){ Response response = customerService.addCustomer(addCustomerCmd); //3. Expect Success - Assert.assertTrue(response.isSuccess()); + Assertions.assertTrue(response.isSuccess()); } } diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/MultiCoordinateTests.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/MultiCoordinateTests.java similarity index 60% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/MultiCoordinateTests.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/MultiCoordinateTests.java index ff6119f7c..1d56027dc 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/MultiCoordinateTests.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/MultiCoordinateTests.java @@ -1,15 +1,12 @@ -package com.alibaba.cola.extension.test; +package com.alibaba.cola.extension; -import com.alibaba.cola.extension.BizScenario; -import com.alibaba.cola.extension.ExtensionExecutor; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.StatusNameConvertorExtPt; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; +import com.alibaba.cola.extension.customer.app.extensionpoint.StatusNameConvertorExtPt; + +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; /** * 多坐标测试 @@ -17,7 +14,6 @@ * @author wangguoqiang wrote on 2022/10/10 14:54 * @version 1.0 */ -@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class MultiCoordinateTests { @@ -45,23 +41,13 @@ public void testMultiCoordinate() { String name7 = extensionExecutor.execute(StatusNameConvertorExtPt.class, bizScenario7, pt -> pt.statusNameConvertor(7)); String name8 = extensionExecutor.execute(StatusNameConvertorExtPt.class, bizScenario8, pt -> pt.statusNameConvertor(8)); - Assert.assertEquals("one",name1); - Assert.assertEquals("two",name2); - Assert.assertEquals("three",name3); - Assert.assertEquals("four",name4); - Assert.assertEquals("five",name5); - Assert.assertEquals("six",name6); - Assert.assertEquals("seven",name7); - Assert.assertEquals("eight",name8); - } - - @Test - public void testMultiCoordinateWithAnnotation() { - BizScenario bizScenario1 = BizScenario.valueOf("Sony", "user", "scenario3"); - BizScenario bizScenario2 = BizScenario.valueOf("Siemens", "order", "scenario1"); - String name1 = extensionExecutor.execute(StatusNameConvertorExtPt.class, bizScenario1, pt -> pt.statusNameConvertor(1)); - String name2 = extensionExecutor.execute(StatusNameConvertorExtPt.class, bizScenario2, pt -> pt.statusNameConvertor(2)); - Assert.assertEquals("one",name1); - Assert.assertEquals("two",name2); + Assertions.assertEquals("one",name1); + Assertions.assertEquals("two",name2); + Assertions.assertEquals("three",name3); + Assertions.assertEquals("four",name4); + Assertions.assertEquals("five",name5); + Assertions.assertEquals("six",name6); + Assertions.assertEquals("seven",name7); + Assertions.assertEquals("eight",name8); } } diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/AddCustomerCmdExe.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/AddCustomerCmdExe.java similarity index 72% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/AddCustomerCmdExe.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/AddCustomerCmdExe.java index 86bdaa0e8..03b84b54a 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/AddCustomerCmdExe.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/AddCustomerCmdExe.java @@ -1,18 +1,17 @@ -package com.alibaba.cola.extension.test.customer.app; +package com.alibaba.cola.extension.customer.app; import com.alibaba.cola.dto.Response; import com.alibaba.cola.extension.ExtensionExecutor; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.CustomerConvertorExtPt; -import com.alibaba.cola.extension.test.customer.infrastructure.DomainEventPublisher; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.app.extensionpoint.CustomerConvertorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.infrastructure.DomainEventPublisher; +import jakarta.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; - /** * AddCustomerCmdExe * diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerCreatedEventHandler.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerCreatedEventHandler.java similarity index 72% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerCreatedEventHandler.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerCreatedEventHandler.java index 4e134c5cc..131e021ca 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerCreatedEventHandler.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerCreatedEventHandler.java @@ -1,7 +1,7 @@ -package com.alibaba.cola.extension.test.customer.app; +package com.alibaba.cola.extension.customer.app; import com.alibaba.cola.dto.Response; -import com.alibaba.cola.extension.test.customer.client.CustomerCreatedEvent; +import com.alibaba.cola.extension.customer.client.CustomerCreatedEvent; /** * CustomerCreatedEventHandler diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerServiceImpl.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerServiceImpl.java similarity index 66% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerServiceImpl.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerServiceImpl.java index a621460da..c2dd6fce5 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/CustomerServiceImpl.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerServiceImpl.java @@ -1,15 +1,14 @@ -package com.alibaba.cola.extension.test.customer.app; +package com.alibaba.cola.extension.customer.app; import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.SingleResponse; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.CustomerDTO; -import com.alibaba.cola.extension.test.customer.client.CustomerServiceI; -import com.alibaba.cola.extension.test.customer.client.GetOneCustomerQry; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.CustomerDTO; +import com.alibaba.cola.extension.customer.client.CustomerServiceI; +import com.alibaba.cola.extension.customer.client.GetOneCustomerQry; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; -import javax.annotation.Resource; - /** * CustomerServiceImpl * diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/GetOneCustomerQryExe.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/GetOneCustomerQryExe.java similarity index 72% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/GetOneCustomerQryExe.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/GetOneCustomerQryExe.java index 8704bc56c..7b6d5b241 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/GetOneCustomerQryExe.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/GetOneCustomerQryExe.java @@ -1,7 +1,7 @@ -package com.alibaba.cola.extension.test.customer.app; +package com.alibaba.cola.extension.customer.app; import com.alibaba.cola.dto.SingleResponse; -import com.alibaba.cola.extension.test.customer.client.GetOneCustomerQry; +import com.alibaba.cola.extension.customer.client.GetOneCustomerQry; import org.springframework.stereotype.Component; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java similarity index 63% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java index 9227071fa..7baf459a4 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Scenario1Validator.java @@ -1,9 +1,9 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.app.extensionpoint.AddCustomerValidatorExtPt; /** * AddCustomerBiz1UseCase1Scenario1Validator diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Validator.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Validator.java similarity index 59% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Validator.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Validator.java index 9ef14636f..a78711049 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBiz1UseCase1Validator.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBiz1UseCase1Validator.java @@ -1,9 +1,9 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.app.extensionpoint.AddCustomerValidatorExtPt; /** * AddCustomerBiz1UseCase1Validator diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizOneValidator.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizOneValidator.java similarity index 61% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizOneValidator.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizOneValidator.java index 6cdae6159..2f51b12f7 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizOneValidator.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizOneValidator.java @@ -1,11 +1,11 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.exception.BizException; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.domain.CustomerType; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.domain.CustomerType; +import com.alibaba.cola.extension.customer.app.extensionpoint.AddCustomerValidatorExtPt; /** * AddCustomerBizOneValidator diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizTwoValidator.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizTwoValidator.java similarity index 65% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizTwoValidator.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizTwoValidator.java index 4cb10872c..9de4d2da8 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/AddCustomerBizTwoValidator.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/AddCustomerBizTwoValidator.java @@ -1,10 +1,10 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.exception.BizException; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.AddCustomerValidatorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.app.extensionpoint.AddCustomerValidatorExtPt; /** * AddCustomerBizTwoValidator diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizOneConvertorExt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizOneConvertorExt.java similarity index 68% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizOneConvertorExt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizOneConvertorExt.java index 6c69c9fbb..4f3a464c7 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizOneConvertorExt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizOneConvertorExt.java @@ -1,12 +1,12 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.CustomerConvertorExtPt; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.client.CustomerDTO; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; -import com.alibaba.cola.extension.test.customer.domain.SourceType; +import com.alibaba.cola.extension.customer.app.extensionpoint.CustomerConvertorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.client.CustomerDTO; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.domain.SourceType; import org.springframework.beans.factory.annotation.Autowired; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizTwoConvertorExt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizTwoConvertorExt.java similarity index 69% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizTwoConvertorExt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizTwoConvertorExt.java index ad5b05bca..c877ee4c6 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerBizTwoConvertorExt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerBizTwoConvertorExt.java @@ -1,11 +1,11 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.CustomerConvertorExtPt; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; -import com.alibaba.cola.extension.test.customer.domain.SourceType; +import com.alibaba.cola.extension.customer.app.extensionpoint.CustomerConvertorExtPt; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.domain.SourceType; import org.springframework.beans.factory.annotation.Autowired; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerConvertor.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerConvertor.java similarity index 74% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerConvertor.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerConvertor.java index 2962e7ddc..a6b30594f 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/CustomerConvertor.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/CustomerConvertor.java @@ -1,9 +1,9 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; import com.alibaba.cola.domain.ApplicationContextHelper; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.client.CustomerDTO; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.CustomerDTO; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; import org.springframework.stereotype.Component; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/StatusNameConvertorExt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/StatusNameConvertorExt.java similarity index 67% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/StatusNameConvertorExt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/StatusNameConvertorExt.java index c36861eda..4e844b5bb 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extension/StatusNameConvertorExt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extension/StatusNameConvertorExt.java @@ -1,8 +1,7 @@ -package com.alibaba.cola.extension.test.customer.app.extension; +package com.alibaba.cola.extension.customer.app.extension; -import com.alibaba.cola.extension.Extension; import com.alibaba.cola.extension.Extensions; -import com.alibaba.cola.extension.test.customer.app.extensionpoint.StatusNameConvertorExtPt; +import com.alibaba.cola.extension.customer.app.extensionpoint.StatusNameConvertorExtPt; import java.util.HashMap; @@ -10,12 +9,7 @@ * @author wangguoqiang wrote on 2022/10/10 14:39 * @version 1.0 */ -@Extensions(bizId = {"Samsung", "Motorola"}, useCase = {"order", "parts"}, scenario = {"scenario1", "scenario2"}, - value = { - @Extension(bizId = "Sony", useCase = "user", scenario = "scenario3"), - @Extension(bizId = "Siemens", useCase = "order", scenario = "scenario1") - } -) +@Extensions(bizId = {"Samsung", "Motorola"}, useCase = {"order", "parts"}, scenario = {"scenario1", "scenario2"}) public class StatusNameConvertorExt implements StatusNameConvertorExtPt { /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/AddCustomerValidatorExtPt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/AddCustomerValidatorExtPt.java similarity index 66% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/AddCustomerValidatorExtPt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/AddCustomerValidatorExtPt.java index addc6cc13..c5fc75b23 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/AddCustomerValidatorExtPt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/AddCustomerValidatorExtPt.java @@ -1,7 +1,7 @@ -package com.alibaba.cola.extension.test.customer.app.extensionpoint; +package com.alibaba.cola.extension.customer.app.extensionpoint; import com.alibaba.cola.extension.ExtensionPointI; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; /** * AddCustomerValidatorExtPt diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/CustomerConvertorExtPt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/CustomerConvertorExtPt.java similarity index 57% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/CustomerConvertorExtPt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/CustomerConvertorExtPt.java index c094cc449..603dad743 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/CustomerConvertorExtPt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/CustomerConvertorExtPt.java @@ -1,8 +1,8 @@ -package com.alibaba.cola.extension.test.customer.app.extensionpoint; +package com.alibaba.cola.extension.customer.app.extensionpoint; import com.alibaba.cola.extension.ExtensionPointI; -import com.alibaba.cola.extension.test.customer.client.AddCustomerCmd; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.client.AddCustomerCmd; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; /** * CustomerConvertorExtPt diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/StatusNameConvertorExtPt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/StatusNameConvertorExtPt.java similarity index 84% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/StatusNameConvertorExtPt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/StatusNameConvertorExtPt.java index bdb392016..2586fda6d 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/app/extensionpoint/StatusNameConvertorExtPt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/StatusNameConvertorExtPt.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.app.extensionpoint; +package com.alibaba.cola.extension.customer.app.extensionpoint; import com.alibaba.cola.extension.ExtensionPointI; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/AddCustomerCmd.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/AddCustomerCmd.java similarity index 85% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/AddCustomerCmd.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/AddCustomerCmd.java index d772b027f..8839a75e3 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/AddCustomerCmd.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/AddCustomerCmd.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; import com.alibaba.cola.dto.Command; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/Constants.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/Constants.java similarity index 91% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/Constants.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/Constants.java index 5f98e3d75..2e1dbe39a 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/Constants.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/Constants.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; /** * Constants diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerCreatedEvent.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerCreatedEvent.java similarity index 68% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerCreatedEvent.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerCreatedEvent.java index 585594c61..066ba540c 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerCreatedEvent.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerCreatedEvent.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; /** * CustomerCreatedEvent diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerDTO.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerDTO.java similarity index 86% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerDTO.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerDTO.java index c13e32766..9f000df02 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerDTO.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerDTO.java @@ -1,7 +1,7 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; import com.alibaba.cola.dto.DTO; -import com.alibaba.cola.extension.test.customer.domain.CustomerType; +import com.alibaba.cola.extension.customer.domain.CustomerType; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerServiceI.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerServiceI.java similarity index 85% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerServiceI.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerServiceI.java index 2f8165e99..c9cb21137 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/CustomerServiceI.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerServiceI.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.SingleResponse; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/GetOneCustomerQry.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/GetOneCustomerQry.java similarity index 90% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/GetOneCustomerQry.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/GetOneCustomerQry.java index 615142f7d..2aaba907b 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/client/GetOneCustomerQry.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/GetOneCustomerQry.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.client; +package com.alibaba.cola.extension.customer.client; import com.alibaba.cola.dto.Query; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerEntity.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerEntity.java similarity index 87% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerEntity.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerEntity.java index e434f6a7e..2da8dfec1 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerEntity.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerEntity.java @@ -1,10 +1,10 @@ -package com.alibaba.cola.extension.test.customer.domain; +package com.alibaba.cola.extension.customer.domain; import com.alibaba.cola.domain.Entity; import com.alibaba.cola.extension.BizScenario; import com.alibaba.cola.extension.ExtensionExecutor; -import com.alibaba.cola.extension.test.customer.domain.rule.CustomerRuleExtPt; -import com.alibaba.cola.extension.test.customer.infrastructure.CustomerRepository; +import com.alibaba.cola.extension.customer.domain.rule.CustomerRuleExtPt; +import com.alibaba.cola.extension.customer.infrastructure.CustomerRepository; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerType.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerType.java similarity index 73% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerType.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerType.java index ff8175762..a41f69d88 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/CustomerType.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerType.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.domain; +package com.alibaba.cola.extension.customer.domain; /** * CustomerType diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/SourceType.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/SourceType.java similarity index 77% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/SourceType.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/SourceType.java index 9a38f2d38..c7f584c8e 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/SourceType.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/SourceType.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.domain; +package com.alibaba.cola.extension.customer.domain; /** * SourceType diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizOneRuleExt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizOneRuleExt.java similarity index 68% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizOneRuleExt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizOneRuleExt.java index 87ed3adf7..e2a3c3dc9 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizOneRuleExt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizOneRuleExt.java @@ -1,10 +1,10 @@ -package com.alibaba.cola.extension.test.customer.domain.rule; +package com.alibaba.cola.extension.customer.domain.rule; import com.alibaba.cola.exception.BizException; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; -import com.alibaba.cola.extension.test.customer.domain.SourceType; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.domain.SourceType; /** * CustomerBizOneRuleExt diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizTwoRuleExt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizTwoRuleExt.java similarity index 66% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizTwoRuleExt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizTwoRuleExt.java index a98bffe70..a072627f1 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerBizTwoRuleExt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizTwoRuleExt.java @@ -1,8 +1,8 @@ -package com.alibaba.cola.extension.test.customer.domain.rule; +package com.alibaba.cola.extension.customer.domain.rule; import com.alibaba.cola.extension.Extension; -import com.alibaba.cola.extension.test.customer.client.Constants; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.client.Constants; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; /** * CustomerBizTwoRuleExt diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerRuleExtPt.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerRuleExtPt.java similarity index 78% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerRuleExtPt.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerRuleExtPt.java index 2eb1efda6..07bb14470 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/domain/rule/CustomerRuleExtPt.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerRuleExtPt.java @@ -1,7 +1,7 @@ -package com.alibaba.cola.extension.test.customer.domain.rule; +package com.alibaba.cola.extension.customer.domain.rule; import com.alibaba.cola.extension.ExtensionPointI; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; /** * CustomerRuleExtPt diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerDO.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerDO.java similarity index 95% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerDO.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerDO.java index 5d3b205d5..8828a6b3b 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerDO.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerDO.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.infrastructure; +package com.alibaba.cola.extension.customer.infrastructure; /** * CustomerDO @@ -62,4 +62,4 @@ public String getCompanyType() { public void setCompanyType(String companyType) { this.companyType = companyType; } -} \ No newline at end of file +} diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerRepository.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerRepository.java similarity index 70% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerRepository.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerRepository.java index 8f1c4d8b0..28bfc4d24 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/CustomerRepository.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerRepository.java @@ -1,6 +1,6 @@ -package com.alibaba.cola.extension.test.customer.infrastructure; +package com.alibaba.cola.extension.customer.infrastructure; -import com.alibaba.cola.extension.test.customer.domain.CustomerEntity; +import com.alibaba.cola.extension.customer.domain.CustomerEntity; import org.springframework.stereotype.Repository; /** diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/DomainEventPublisher.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/DomainEventPublisher.java similarity index 83% rename from cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/DomainEventPublisher.java rename to cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/DomainEventPublisher.java index bb42f00d9..02e562c61 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/test/customer/infrastructure/DomainEventPublisher.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/DomainEventPublisher.java @@ -1,4 +1,4 @@ -package com.alibaba.cola.extension.test.customer.infrastructure; +package com.alibaba.cola.extension.customer.infrastructure; import org.springframework.stereotype.Component; diff --git a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/ExtensionRegisterTest.java b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/ExtensionRegisterTest.java index f671160b6..8ddf72539 100644 --- a/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/ExtensionRegisterTest.java +++ b/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/ExtensionRegisterTest.java @@ -1,20 +1,17 @@ package com.alibaba.cola.extension.register; -import javax.annotation.Resource; - import com.alibaba.cola.extension.BizScenario; +import com.alibaba.cola.extension.ExtensionException; import com.alibaba.cola.extension.ExtensionExecutor; -import com.alibaba.cola.extension.test.Application; - -import org.junit.Test; -import org.junit.runner.RunWith; +import com.alibaba.cola.extension.Application; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class ExtensionRegisterTest { - + @Resource private ExtensionRegister register; @@ -22,15 +19,16 @@ public class ExtensionRegisterTest { private ExtensionExecutor executor; @Test - public void test() { - SomeExtPt extA = new SomeExtensionA(); - register.doRegistration(extA); + public void testDuplicateRegistration() { + // expect: + //Duplicate registration is not allowed for :ExtensionCoordinate + // [extensionPointName=com.alibaba.cola.extension.register.SomeExtPt, bizScenarioUniqueIdentity=A.#defaultUseCase#.#defaultScenario#] + Assertions.assertThrows(ExtensionException.class, ()->{ + SomeExtPt extA = new SomeExtensionA(); + register.doRegistration(extA); - SomeExtPt extB = CglibProxyFactory.createProxy(new SomeExtensionB()); - register.doRegistration(extB); - - executor.executeVoid(SomeExtPt.class, BizScenario.valueOf("A"), SomeExtPt::doSomeThing); - executor.executeVoid(SomeExtPt.class, BizScenario.valueOf("B"), SomeExtPt::doSomeThing); + executor.executeVoid(SomeExtPt.class, BizScenario.valueOf("A"), SomeExtPt::doSomeThing); + }); } - + }