The response has been limited to 50k tokens of the smallest files in the repo. You can remove this limitation by removing the max tokens filter.
├── .editorconfig
├── .github
    ├── dependabot.yml
    └── workflows
    │   ├── ci.yaml
    │   └── ci_by_multiply_java_versions.yaml
├── .gitignore
├── .gitmodules
├── .mvn
    └── wrapper
    │   └── maven-wrapper.properties
├── LICENSE
├── README.md
├── cola-archetypes
    ├── cola-archetype-light
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── resources
    │   │       │   ├── META-INF
    │   │       │       └── maven
    │   │       │       │   └── archetype-metadata.xml
    │   │       │   └── archetype-resources
    │   │       │       ├── README.md
    │   │       │       ├── img.png
    │   │       │       ├── img_1.png
    │   │       │       ├── pom.xml
    │   │       │       └── src
    │   │       │           ├── main
    │   │       │               ├── java
    │   │       │               │   ├── Application.java
    │   │       │               │   ├── adapter
    │   │       │               │   │   └── ChargeController.java
    │   │       │               │   ├── application
    │   │       │               │   │   ├── ChargeServiceI.java
    │   │       │               │   │   ├── ChargeServiceImpl.java
    │   │       │               │   │   └── dto
    │   │       │               │   │   │   ├── BeginSessionRequest.java
    │   │       │               │   │   │   ├── ChargeRecordDto.java
    │   │       │               │   │   │   ├── ChargeRequest.java
    │   │       │               │   │   │   ├── EndSessionRequest.java
    │   │       │               │   │   │   ├── MultiResponse.java
    │   │       │               │   │   │   ├── Response.java
    │   │       │               │   │   │   └── SingleResponse.java
    │   │       │               │   ├── domain
    │   │       │               │   │   ├── ApplicationContextHelper.java
    │   │       │               │   │   ├── BizException.java
    │   │       │               │   │   ├── DomainFactory.java
    │   │       │               │   │   ├── Entity.java
    │   │       │               │   │   ├── account
    │   │       │               │   │   │   ├── Account.java
    │   │       │               │   │   │   └── AccountDomainService.java
    │   │       │               │   │   ├── charge
    │   │       │               │   │   │   ├── CallType.java
    │   │       │               │   │   │   ├── ChargeContext.java
    │   │       │               │   │   │   ├── ChargeRecord.java
    │   │       │               │   │   │   ├── Money.java
    │   │       │               │   │   │   ├── MoneyConverter.java
    │   │       │               │   │   │   ├── Session.java
    │   │       │               │   │   │   ├── chargeplan
    │   │       │               │   │   │   │   ├── BasicChargePlan.java
    │   │       │               │   │   │   │   ├── ChargePlan.java
    │   │       │               │   │   │   │   ├── ChargePlanType.java
    │   │       │               │   │   │   │   ├── FamilyChargePlan.java
    │   │       │               │   │   │   │   ├── FixedTimeChangePlan.java
    │   │       │               │   │   │   │   └── Resource.java
    │   │       │               │   │   │   └── chargerule
    │   │       │               │   │   │   │   ├── AbstractChargeRule.java
    │   │       │               │   │   │   │   ├── BasicChargeRule.java
    │   │       │               │   │   │   │   ├── ChargeRule.java
    │   │       │               │   │   │   │   ├── ChargeRuleFactory.java
    │   │       │               │   │   │   │   ├── CompositeChargeRule.java
    │   │       │               │   │   │   │   ├── FamilyChargeRule.java
    │   │       │               │   │   │   │   └── FixedTimeChargeRule.java
    │   │       │               │   │   └── gateway
    │   │       │               │   │   │   ├── AccountGateway.java
    │   │       │               │   │   │   ├── ChargeGateway.java
    │   │       │               │   │   │   └── SessionGateway.java
    │   │       │               │   └── infrastructure
    │   │       │               │   │   ├── AccountGatewayImpl.java
    │   │       │               │   │   ├── RestClientBean.java
    │   │       │               │   │   └── SessionGatewayImpl.java
    │   │       │               └── resources
    │   │       │               │   ├── application.yml
    │   │       │               │   └── logback.xml
    │   │       │           └── test
    │   │       │               ├── charge.http
    │   │       │               ├── java
    │   │       │                   ├── CleanArchTest.java
    │   │       │                   ├── TestsContainerBoot.java
    │   │       │                   ├── application
    │   │       │                   │   └── ChargeServiceTest.java
    │   │       │                   ├── domain
    │   │       │                   │   ├── ChargeRecordPlanTest.java
    │   │       │                   │   ├── ChargeRecordRuleTest.java
    │   │       │                   │   └── CompositeChargeRuleTestRecord.java
    │   │       │                   └── infrastructure
    │   │       │                   │   ├── AccountGatewayTest.java
    │   │       │                   │   ├── ChargeRecordRepoTest.java
    │   │       │                   │   ├── FixtureLoader.java
    │   │       │                   │   ├── JSONTest.java
    │   │       │                   │   ├── SpingBootConfTest.java
    │   │       │                   │   ├── WireMockBasicTest.java
    │   │       │                   │   └── WireMockRegister.java
    │   │       │               └── resources
    │   │       │                   ├── application-test.yml
    │   │       │                   ├── application.yml
    │   │       │                   ├── fixture
    │   │       │                       └── wiremock
    │   │       │                       │   ├── stub_account.json
    │   │       │                       │   ├── stub_insufficient_account.json
    │   │       │                       │   └── stub_wire_mock_basic.json
    │   │       │                   └── logback-test.xml
    │   │   └── test
    │   │       └── resources
    │   │           └── projects
    │   │               └── basic
    │   │                   ├── archetype.properties
    │   │                   └── goal.txt
    ├── cola-archetype-service
    │   ├── .gitignore
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── resources
    │   │       │   ├── META-INF
    │   │       │       └── maven
    │   │       │       │   └── archetype-metadata.xml
    │   │       │   └── archetype-resources
    │   │       │       ├── __gitignore__
    │   │       │       ├── __rootArtifactId__-app
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       └── java
    │   │       │           │       │   ├── customer
    │   │       │           │       │       ├── CustomerServiceImpl.java
    │   │       │           │       │       └── executor
    │   │       │           │       │       │   ├── CustomerAddCmdExe.java
    │   │       │           │       │       │   └── query
    │   │       │           │       │       │       └── CustomerListByNameQryExe.java
    │   │       │           │       │   └── order
    │   │       │           │       │       └── OrderServiceImpl.java
    │   │       │           │   └── test
    │   │       │           │       └── java
    │   │       │           │           └── app
    │   │       │           │               ├── CustomerConvertorTest.java
    │   │       │           │               └── CustomerValidatorTest.java
    │   │       │       ├── __rootArtifactId__-client
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   └── main
    │   │       │           │       └── java
    │   │       │           │           ├── api
    │   │       │           │               └── CustomerServiceI.java
    │   │       │           │           └── dto
    │   │       │           │               ├── CustomerAddCmd.java
    │   │       │           │               ├── CustomerListByNameQry.java
    │   │       │           │               ├── data
    │   │       │           │                   ├── CustomerDTO.java
    │   │       │           │                   └── ErrorCode.java
    │   │       │           │               └── event
    │   │       │           │                   ├── CustomerCreatedEvent.java
    │   │       │           │                   └── DomainEventConstant.java
    │   │       │       ├── __rootArtifactId__-domain
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       └── java
    │   │       │           │       │   └── domain
    │   │       │           │       │       ├── customer
    │   │       │           │       │           ├── CompanyType.java
    │   │       │           │       │           ├── Credit.java
    │   │       │           │       │           ├── Customer.java
    │   │       │           │       │           ├── CustomerType.java
    │   │       │           │       │           ├── SourceType.java
    │   │       │           │       │           ├── domainservice
    │   │       │           │       │           │   └── CreditChecker.java
    │   │       │           │       │           └── gateway
    │   │       │           │       │           │   ├── CreditGateway.java
    │   │       │           │       │           │   └── CustomerGateway.java
    │   │       │           │       │       ├── order
    │   │       │           │       │           └── Order.java
    │   │       │           │       │       └── package-info.java
    │   │       │           │   └── test
    │   │       │           │       └── java
    │   │       │           │           └── domain
    │   │       │           │               └── CustomerEntityTest.java
    │   │       │       ├── __rootArtifactId__-infrastructure
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       ├── java
    │   │       │           │       │   ├── config
    │   │       │           │       │   │   └── DiamondConfig.java
    │   │       │           │       │   ├── customer
    │   │       │           │       │   │   ├── CreditGatewayImpl.java
    │   │       │           │       │   │   ├── CustomerDO.java
    │   │       │           │       │   │   ├── CustomerGatewayImpl.java
    │   │       │           │       │   │   └── CustomerMapper.java
    │   │       │           │       │   └── order
    │   │       │           │       │   │   └── OrderGatewayImpl.java
    │   │       │           │       └── resources
    │   │       │           │       │   ├── logback-spring.xml
    │   │       │           │       │   └── mybatis
    │   │       │           │       │       ├── customer-mapper.xml
    │   │       │           │       │       └── mybatis-config.xml
    │   │       │           │   └── test
    │   │       │           │       ├── java
    │   │       │           │           └── repository
    │   │       │           │           │   └── CustomerMapperTest.java
    │   │       │           │       └── resources
    │   │       │           │           └── sample.properties
    │   │       │       ├── pom.xml
    │   │       │       └── start
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │               ├── main
    │   │       │                   ├── java
    │   │       │                   │   └── Application.java
    │   │       │                   └── resources
    │   │       │                   │   ├── application.properties
    │   │       │                   │   └── logback-spring.xml
    │   │       │               └── test
    │   │       │                   ├── java
    │   │       │                       ├── TestApplication.java
    │   │       │                       └── test
    │   │       │                       │   └── CustomerServiceTest.java
    │   │       │                   └── resources
    │   │       │                       ├── logback-test.xml
    │   │       │                       └── test.properties
    │   │   └── test
    │   │       └── resources
    │   │           └── projects
    │   │               └── basic
    │   │                   ├── archetype.properties
    │   │                   └── goal.txt
    ├── cola-archetype-web
    │   ├── .gitignore
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── resources
    │   │       │   ├── META-INF
    │   │       │       └── maven
    │   │       │       │   └── archetype-metadata.xml
    │   │       │   └── archetype-resources
    │   │       │       ├── __gitignore__
    │   │       │       ├── __rootArtifactId__-adapter
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   └── main
    │   │       │           │       └── java
    │   │       │           │           ├── mobile
    │   │       │           │               └── CustomerMobileAdaptor.java
    │   │       │           │           ├── wap
    │   │       │           │               └── CustomerWapAdaptor.java
    │   │       │           │           └── web
    │   │       │           │               └── CustomerController.java
    │   │       │       ├── __rootArtifactId__-app
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       └── java
    │   │       │           │       │   ├── customer
    │   │       │           │       │       ├── CustomerServiceImpl.java
    │   │       │           │       │       └── executor
    │   │       │           │       │       │   ├── CustomerAddCmdExe.java
    │   │       │           │       │       │   └── query
    │   │       │           │       │       │       └── CustomerListByNameQryExe.java
    │   │       │           │       │   └── order
    │   │       │           │       │       └── OrderServiceImpl.java
    │   │       │           │   └── test
    │   │       │           │       └── java
    │   │       │           │           └── app
    │   │       │           │               ├── CustomerConvertorTest.java
    │   │       │           │               └── CustomerValidatorTest.java
    │   │       │       ├── __rootArtifactId__-client
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   └── main
    │   │       │           │       └── java
    │   │       │           │           ├── api
    │   │       │           │               └── CustomerServiceI.java
    │   │       │           │           └── dto
    │   │       │           │               ├── CustomerAddCmd.java
    │   │       │           │               ├── CustomerListByNameQry.java
    │   │       │           │               ├── data
    │   │       │           │                   ├── CustomerDTO.java
    │   │       │           │                   └── ErrorCode.java
    │   │       │           │               └── event
    │   │       │           │                   ├── CustomerCreatedEvent.java
    │   │       │           │                   └── DomainEventConstant.java
    │   │       │       ├── __rootArtifactId__-domain
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       └── java
    │   │       │           │       │   └── domain
    │   │       │           │       │       ├── customer
    │   │       │           │       │           ├── CompanyType.java
    │   │       │           │       │           ├── Credit.java
    │   │       │           │       │           ├── Customer.java
    │   │       │           │       │           ├── CustomerType.java
    │   │       │           │       │           ├── SourceType.java
    │   │       │           │       │           ├── domainservice
    │   │       │           │       │           │   └── CreditChecker.java
    │   │       │           │       │           └── gateway
    │   │       │           │       │           │   ├── CreditGateway.java
    │   │       │           │       │           │   └── CustomerGateway.java
    │   │       │           │       │       ├── order
    │   │       │           │       │           └── Order.java
    │   │       │           │       │       └── package-info.java
    │   │       │           │   └── test
    │   │       │           │       └── java
    │   │       │           │           └── domain
    │   │       │           │               └── CustomerEntityTest.java
    │   │       │       ├── __rootArtifactId__-infrastructure
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │           │   ├── main
    │   │       │           │       ├── java
    │   │       │           │       │   ├── config
    │   │       │           │       │   │   └── DiamondConfig.java
    │   │       │           │       │   ├── customer
    │   │       │           │       │   │   ├── CreditGatewayImpl.java
    │   │       │           │       │   │   ├── CustomerDO.java
    │   │       │           │       │   │   ├── CustomerGatewayImpl.java
    │   │       │           │       │   │   └── CustomerMapper.java
    │   │       │           │       │   └── order
    │   │       │           │       │   │   └── OrderGatewayImpl.java
    │   │       │           │       └── resources
    │   │       │           │       │   ├── logback-spring.xml
    │   │       │           │       │   └── mybatis
    │   │       │           │       │       ├── customer-mapper.xml
    │   │       │           │       │       └── mybatis-config.xml
    │   │       │           │   └── test
    │   │       │           │       ├── java
    │   │       │           │           └── repository
    │   │       │           │           │   └── CustomerMapperTest.java
    │   │       │           │       └── resources
    │   │       │           │           └── sample.properties
    │   │       │       ├── pom.xml
    │   │       │       └── start
    │   │       │           ├── pom.xml
    │   │       │           └── src
    │   │       │               ├── main
    │   │       │                   ├── java
    │   │       │                   │   └── Application.java
    │   │       │                   └── resources
    │   │       │                   │   ├── application.properties
    │   │       │                   │   └── logback-spring.xml
    │   │       │               └── test
    │   │       │                   ├── java
    │   │       │                       ├── TestApplication.java
    │   │       │                       └── test
    │   │       │                       │   └── CustomerServiceTest.java
    │   │       │                   └── resources
    │   │       │                       ├── logback-test.xml
    │   │       │                       └── test.properties
    │   │   └── test
    │   │       └── resources
    │   │           └── projects
    │   │               └── basic
    │   │                   ├── archetype.properties
    │   │                   └── goal.txt
    └── pom.xml
├── cola-components
    ├── cola-component-catchlog-starter
    │   ├── .gitignore
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       ├── java
    │   │       │   └── com
    │   │       │   │   └── alibaba
    │   │       │   │       └── cola
    │   │       │   │           └── catchlog
    │   │       │   │               ├── ApplicationContextHelper.java
    │   │       │   │               ├── CatchAndLog.java
    │   │       │   │               ├── CatchLogAspect.java
    │   │       │   │               ├── CatchLogAutoConfiguration.java
    │   │       │   │               ├── DefaultResponseHandler.java
    │   │       │   │               ├── ResponseHandlerFactory.java
    │   │       │   │               └── ResponseHandlerI.java
    │   │       └── resources
    │   │       │   └── META-INF
    │   │       │       └── spring.factories
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── catchlog
    │   │           │               └── test
    │   │           │                   ├── Application.java
    │   │           │                   ├── CatchLogTest.java
    │   │           │                   ├── CustomResponseHandler.java
    │   │           │                   └── Demo.java
    │   │       └── resources
    │   │           ├── application.properties
    │   │           └── logback-test.xml
    ├── cola-component-domain-starter
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       ├── java
    │   │       │   └── com
    │   │       │   │   └── alibaba
    │   │       │   │       └── cola
    │   │       │   │           └── domain
    │   │       │   │               ├── ApplicationContextHelper.java
    │   │       │   │               ├── DomainAutoConfiguration.java
    │   │       │   │               ├── DomainFactory.java
    │   │       │   │               └── Entity.java
    │   │       └── resources
    │   │       │   └── META-INF
    │   │       │       └── spring.factories
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── domain
    │   │           │               ├── Application.java
    │   │           │               ├── Customer.java
    │   │           │               └── PurchasePowerGateway.java
    │   │       └── resources
    │   │           ├── application.properties
    │   │           └── logback-test.xml
    ├── cola-component-dto
    │   ├── .gitignore
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               ├── dto
    │   │       │                   ├── ClientObject.java
    │   │       │                   ├── Command.java
    │   │       │                   ├── DTO.java
    │   │       │                   ├── MultiResponse.java
    │   │       │                   ├── PageQuery.java
    │   │       │                   ├── PageResponse.java
    │   │       │                   ├── Query.java
    │   │       │                   ├── Response.java
    │   │       │                   ├── Scope.java
    │   │       │                   └── SingleResponse.java
    │   │       │               └── extension
    │   │       │                   └── BizScenario.java
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── Test.java
    │   │       └── resources
    │   │           └── logback-test.xml
    ├── cola-component-exception
    │   ├── .gitignore
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               └── exception
    │   │       │                   ├── Assert.java
    │   │       │                   ├── BaseException.java
    │   │       │                   ├── BizException.java
    │   │       │                   ├── ExceptionFactory.java
    │   │       │                   └── SysException.java
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── exception
    │   │           │               └── Test.java
    │   │       └── resources
    │   │           └── logback-test.xml
    ├── cola-component-extension-starter
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       ├── java
    │   │       │   └── com
    │   │       │   │   └── alibaba
    │   │       │   │       └── cola
    │   │       │   │           └── extension
    │   │       │   │               ├── Extension.java
    │   │       │   │               ├── ExtensionAutoConfiguration.java
    │   │       │   │               ├── ExtensionCoordinate.java
    │   │       │   │               ├── ExtensionException.java
    │   │       │   │               ├── ExtensionExecutor.java
    │   │       │   │               ├── ExtensionPointI.java
    │   │       │   │               ├── ExtensionRepository.java
    │   │       │   │               ├── Extensions.java
    │   │       │   │               └── register
    │   │       │   │                   ├── AbstractComponentExecutor.java
    │   │       │   │                   ├── ExtensionBootstrap.java
    │   │       │   │                   └── ExtensionRegister.java
    │   │       └── resources
    │   │       │   └── META-INF
    │   │       │       └── spring.factories
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── extension
    │   │           │               ├── Application.java
    │   │           │               ├── ExtensionTest.java
    │   │           │               ├── MultiCoordinateTests.java
    │   │           │               ├── customer
    │   │           │                   ├── app
    │   │           │                   │   ├── AddCustomerCmdExe.java
    │   │           │                   │   ├── CustomerCreatedEventHandler.java
    │   │           │                   │   ├── CustomerServiceImpl.java
    │   │           │                   │   ├── GetOneCustomerQryExe.java
    │   │           │                   │   ├── extension
    │   │           │                   │   │   ├── AddCustomerBiz1UseCase1Scenario1Validator.java
    │   │           │                   │   │   ├── AddCustomerBiz1UseCase1Validator.java
    │   │           │                   │   │   ├── AddCustomerBizOneValidator.java
    │   │           │                   │   │   ├── AddCustomerBizTwoValidator.java
    │   │           │                   │   │   ├── CustomerBizOneConvertorExt.java
    │   │           │                   │   │   ├── CustomerBizTwoConvertorExt.java
    │   │           │                   │   │   ├── CustomerConvertor.java
    │   │           │                   │   │   └── StatusNameConvertorExt.java
    │   │           │                   │   └── extensionpoint
    │   │           │                   │   │   ├── AddCustomerValidatorExtPt.java
    │   │           │                   │   │   ├── CustomerConvertorExtPt.java
    │   │           │                   │   │   └── StatusNameConvertorExtPt.java
    │   │           │                   ├── client
    │   │           │                   │   ├── AddCustomerCmd.java
    │   │           │                   │   ├── Constants.java
    │   │           │                   │   ├── CustomerCreatedEvent.java
    │   │           │                   │   ├── CustomerDTO.java
    │   │           │                   │   ├── CustomerServiceI.java
    │   │           │                   │   └── GetOneCustomerQry.java
    │   │           │                   ├── domain
    │   │           │                   │   ├── CustomerEntity.java
    │   │           │                   │   ├── CustomerType.java
    │   │           │                   │   ├── SourceType.java
    │   │           │                   │   └── rule
    │   │           │                   │   │   ├── CustomerBizOneRuleExt.java
    │   │           │                   │   │   ├── CustomerBizTwoRuleExt.java
    │   │           │                   │   │   └── CustomerRuleExtPt.java
    │   │           │                   └── infrastructure
    │   │           │                   │   ├── CustomerDO.java
    │   │           │                   │   ├── CustomerRepository.java
    │   │           │                   │   └── DomainEventPublisher.java
    │   │           │               └── register
    │   │           │                   ├── CglibProxyFactory.java
    │   │           │                   ├── ExtensionRegisterTest.java
    │   │           │                   ├── SomeExtPt.java
    │   │           │                   ├── SomeExtensionA.java
    │   │           │                   └── SomeExtensionB.java
    │   │       └── resources
    │   │           ├── application.properties
    │   │           └── logback-test.xml
    ├── cola-component-job
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       ├── java
    │   │       │   └── com
    │   │       │   │   └── alibaba
    │   │       │   │       └── cola
    │   │       │   │           └── job
    │   │       │   │               ├── BatchJobLauncher.java
    │   │       │   │               ├── ExecutionContext.java
    │   │       │   │               ├── JobBuilderFactory.java
    │   │       │   │               ├── JobException.java
    │   │       │   │               ├── JobLauncher.java
    │   │       │   │               ├── UuidGenerator.java
    │   │       │   │               ├── config
    │   │       │   │                   ├── DBAutoConfiguration.java
    │   │       │   │                   ├── EnableColaJob.java
    │   │       │   │                   ├── EnableJobConfiguration.java
    │   │       │   │                   ├── JobProperties.java
    │   │       │   │                   └── RedisConfig.java
    │   │       │   │               ├── model
    │   │       │   │                   ├── AbstractStep.java
    │   │       │   │                   ├── BatchJob.java
    │   │       │   │                   ├── BatchJobExecution.java
    │   │       │   │                   ├── ExecutionStatus.java
    │   │       │   │                   ├── Job.java
    │   │       │   │                   ├── JobExecution.java
    │   │       │   │                   ├── JobInstance.java
    │   │       │   │                   ├── Step.java
    │   │       │   │                   └── StepExecution.java
    │   │       │   │               └── repository
    │   │       │   │                   ├── AbstractJobRepository.java
    │   │       │   │                   ├── JobRepository.java
    │   │       │   │                   ├── JsonUtil.java
    │   │       │   │                   ├── RepositoryType.java
    │   │       │   │                   ├── db
    │   │       │   │                       ├── BatchJobExecutionRepository.java
    │   │       │   │                       ├── DataBaseJobRepository.java
    │   │       │   │                       ├── JobExecutionRepository.java
    │   │       │   │                       └── StepExecutionRepository.java
    │   │       │   │                   ├── memory
    │   │       │   │                       └── MemoryJobRepository.java
    │   │       │   │                   └── redis
    │   │       │   │                       └── RedisJobRepository.java
    │   │       └── resources
    │   │       │   └── schema-mysql.sql
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── job
    │   │           │               └── test
    │   │           │                   ├── AbstractBaseJobTest.java
    │   │           │                   ├── MemoryDBJobTest.java
    │   │           │                   ├── MemoryJobTest.java
    │   │           │                   ├── MySQLJobTest.java
    │   │           │                   ├── RedisJobTest.java
    │   │           │                   ├── TestApplication.java
    │   │           │                   ├── TestsContainerBoot.java
    │   │           │                   └── steps
    │   │           │                       ├── FailedStep.java
    │   │           │                       ├── LongTimeStep.java
    │   │           │                       ├── MyStep1.java
    │   │           │                       ├── MyStep2.java
    │   │           │                       ├── MyStep3.java
    │   │           │                       ├── MyStep4.java
    │   │           │                       ├── MyStep5.java
    │   │           │                       └── SwitchStep.java
    │   │       └── resources
    │   │           ├── application-h2-test.yml
    │   │           ├── application-mysql-test.yml
    │   │           ├── application-redis-test.yml
    │   │           └── logback-test.xml
    ├── cola-component-ruleengine
    │   ├── README.md
    │   ├── gitignore.txt
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               └── ruleengine
    │   │       │                   ├── api
    │   │       │                       ├── Action.java
    │   │       │                       ├── Condition.java
    │   │       │                       ├── Fact.java
    │   │       │                       ├── Facts.java
    │   │       │                       ├── Rule.java
    │   │       │                       └── RuleEngine.java
    │   │       │                   └── core
    │   │       │                       ├── AbstractRule.java
    │   │       │                       ├── AllRules.java
    │   │       │                       ├── AnyRules.java
    │   │       │                       ├── CompositeRule.java
    │   │       │                       ├── DefaultRule.java
    │   │       │                       ├── DefaultRuleEngine.java
    │   │       │                       ├── NaturalRules.java
    │   │       │                       └── RuleBuilder.java
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── ruleengine
    │   │           │               ├── CompositeRuleTest.java
    │   │           │               ├── FactsTest.java
    │   │           │               ├── FizzBuzz.java
    │   │           │               ├── HelloWorld.java
    │   │           │               ├── PriorityTest.java
    │   │           │               ├── RuleBuilderTest.java
    │   │           │               ├── RuleEngineTest.java
    │   │           │               └── fizzbuzz
    │   │           │                   ├── FizzBuzzTest.java
    │   │           │                   ├── v1
    │   │           │                       └── FizzBuzz.java
    │   │           │                   └── v2
    │   │           │                       ├── Action.java
    │   │           │                       ├── Condition.java
    │   │           │                       ├── FizzBuzz.java
    │   │           │                       ├── Rule.java
    │   │           │                       ├── SimpleRuleEngine.java
    │   │           │                       └── TimesCondition.java
    │   │       └── resources
    │   │           └── logback-test.xml
    ├── cola-component-statemachine
    │   ├── .gitignore
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               └── statemachine
    │   │       │                   ├── Action.java
    │   │       │                   ├── Condition.java
    │   │       │                   ├── State.java
    │   │       │                   ├── StateContext.java
    │   │       │                   ├── StateMachine.java
    │   │       │                   ├── StateMachineFactory.java
    │   │       │                   ├── Transition.java
    │   │       │                   ├── Visitable.java
    │   │       │                   ├── Visitor.java
    │   │       │                   ├── builder
    │   │       │                       ├── AbstractParallelTransitionBuilder.java
    │   │       │                       ├── AbstractTransitionBuilder.java
    │   │       │                       ├── AlertFailCallback.java
    │   │       │                       ├── ExternalParallelTransitionBuilder.java
    │   │       │                       ├── ExternalTransitionBuilder.java
    │   │       │                       ├── ExternalTransitionsBuilder.java
    │   │       │                       ├── FailCallback.java
    │   │       │                       ├── From.java
    │   │       │                       ├── InternalTransitionBuilder.java
    │   │       │                       ├── NumbFailCallback.java
    │   │       │                       ├── On.java
    │   │       │                       ├── ParallelFrom.java
    │   │       │                       ├── ParallelTransitionBuilderImpl.java
    │   │       │                       ├── StateMachineBuilder.java
    │   │       │                       ├── StateMachineBuilderFactory.java
    │   │       │                       ├── StateMachineBuilderImpl.java
    │   │       │                       ├── To.java
    │   │       │                       ├── TransitionBuilderImpl.java
    │   │       │                       ├── TransitionsBuilderImpl.java
    │   │       │                       ├── When.java
    │   │       │                       └── package-info.java
    │   │       │                   ├── exception
    │   │       │                       └── TransitionFailException.java
    │   │       │                   └── impl
    │   │       │                       ├── Debugger.java
    │   │       │                       ├── EventTransitions.java
    │   │       │                       ├── PlantUMLVisitor.java
    │   │       │                       ├── StateHelper.java
    │   │       │                       ├── StateImpl.java
    │   │       │                       ├── StateMachineException.java
    │   │       │                       ├── StateMachineImpl.java
    │   │       │                       ├── SysOutVisitor.java
    │   │       │                       ├── TransitionImpl.java
    │   │       │                       └── TransitionType.java
    │   │   └── test
    │   │       └── java
    │   │           └── com
    │   │               └── alibaba
    │   │                   └── cola
    │   │                       └── test
    │   │                           ├── StateMachineChoiceTest.java
    │   │                           ├── StateMachinePlantUMLTest.java
    │   │                           ├── StateMachineTest.java
    │   │                           └── StateMachineUnNormalTest.java
    ├── cola-component-test-container
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               └── test
    │   │       │                   ├── BeanMetaUtils.java
    │   │       │                   ├── TestExecutor.java
    │   │       │                   ├── TestsContainer.java
    │   │       │                   └── command
    │   │       │                       ├── AbstractCommand.java
    │   │       │                       ├── CommandEnum.java
    │   │       │                       ├── GuideCmd.java
    │   │       │                       ├── TestClassRunCmd.java
    │   │       │                       └── TestMethodRunCmd.java
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── test
    │   │           │               ├── Demo.java
    │   │           │               ├── DemoWithExtension.java
    │   │           │               ├── SpringBootConfig.java
    │   │           │               ├── SpringConfig.java
    │   │           │               └── TestsContainerTest.java
    │   │       └── resources
    │   │           └── logback-test.xml
    ├── cola-component-unittest
    │   ├── .gitignore
    │   ├── README.md
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       └── java
    │   │       │   └── com
    │   │       │       └── alibaba
    │   │       │           └── cola
    │   │       │               └── unittest
    │   │       │                   ├── FixtureLoader.java
    │   │       │                   ├── kafka
    │   │       │                       ├── KafkaExtension.java
    │   │       │                       ├── MessageData.java
    │   │       │                       └── ProduceMessage.java
    │   │       │                   ├── redis
    │   │       │                       ├── ExpectRedis.java
    │   │       │                       ├── RedisData.java
    │   │       │                       ├── RedisExtension.java
    │   │       │                       └── SetupRedis.java
    │   │       │                   └── wiremock
    │   │       │                       └── WireMockRegister.java
    │   │   └── test
    │   │       ├── java
    │   │           └── com
    │   │           │   └── alibaba
    │   │           │       └── cola
    │   │           │           └── unittest
    │   │           │               ├── Application.java
    │   │           │               ├── TestsContainerBoot.java
    │   │           │               ├── db
    │   │           │                   ├── DBSetupTest.java
    │   │           │                   ├── Person.java
    │   │           │                   └── PersonRepository.java
    │   │           │               ├── kafka
    │   │           │                   ├── KafkaConsumer.java
    │   │           │                   └── KafkaExtensionTest.java
    │   │           │               ├── redis
    │   │           │                   └── RedisExtensionTest.java
    │   │           │               └── wiremock
    │   │           │                   ├── Account.java
    │   │           │                   └── WireMockBasicTest.java
    │   │       └── resources
    │   │           ├── application.properties
    │   │           ├── fixture
    │   │               ├── db
    │   │               │   └── sample-data.xml
    │   │               ├── kafka
    │   │               │   └── produce-message.json
    │   │               ├── redis
    │   │               │   ├── array-setup.json
    │   │               │   ├── hash-setup.json
    │   │               │   ├── string-expect.json
    │   │               │   └── string-setup.json
    │   │               └── wiremock
    │   │               │   ├── stub-account.json
    │   │               │   └── stub-wire-mock-basic.json
    │   │           └── logback-test.xml
    ├── cola-components-bom
    │   └── pom.xml
    ├── dev-util-archetypes
    │   ├── README.md
    │   ├── cola-normal-component-archetype
    │   │   ├── .gitignore
    │   │   ├── pom.xml
    │   │   └── src
    │   │   │   ├── main
    │   │   │       └── resources
    │   │   │       │   ├── META-INF
    │   │   │       │       └── maven
    │   │   │       │       │   └── archetype-metadata.xml
    │   │   │       │   └── archetype-resources
    │   │   │       │       ├── gitignore.txt
    │   │   │       │       ├── pom.xml
    │   │   │       │       └── src
    │   │   │       │           ├── main
    │   │   │       │               └── java
    │   │   │       │               │   └── Dummy.java
    │   │   │       │           └── test
    │   │   │       │               └── resources
    │   │   │       │                   └── logback-test.xml
    │   │   │   └── test
    │   │   │       └── resources
    │   │   │           └── projects
    │   │   │               └── basic
    │   │   │                   ├── archetype.properties
    │   │   │                   └── goal.txt
    │   ├── cola-starter-component-archetype
    │   │   ├── pom.xml
    │   │   └── src
    │   │   │   ├── main
    │   │   │       └── resources
    │   │   │       │   ├── META-INF
    │   │   │       │       └── maven
    │   │   │       │       │   └── archetype-metadata.xml
    │   │   │       │   └── archetype-resources
    │   │   │       │       ├── README.md
    │   │   │       │       ├── gitignore.txt
    │   │   │       │       ├── pom.xml
    │   │   │       │       └── src
    │   │   │       │           ├── main
    │   │   │       │               ├── java
    │   │   │       │               │   ├── CatchAndLog.java
    │   │   │       │               │   ├── CatchLogAspect.java
    │   │   │       │               │   └── CatchLogAutoConfiguration.java
    │   │   │       │               └── resources
    │   │   │       │               │   └── META-INF
    │   │   │       │               │       └── spring.factories
    │   │   │       │           └── test
    │   │   │       │               ├── java
    │   │   │       │                   └── test
    │   │   │       │                   │   └── Application.java
    │   │   │       │               └── resources
    │   │   │       │                   ├── application.properties
    │   │   │       │                   └── logback-test.xml
    │   │   │   └── test
    │   │   │       └── resources
    │   │   │           └── projects
    │   │   │               └── basic
    │   │   │                   ├── archetype.properties
    │   │   │                   └── goal.txt
    │   ├── new-cola-normal-component.sh
    │   └── new-cola-starter-component.sh
    └── pom.xml
├── cola-samples
    ├── charge
    │   ├── README.md
    │   ├── img.png
    │   ├── img_1.png
    │   ├── pom.xml
    │   └── src
    │   │   ├── main
    │   │       ├── java
    │   │       │   └── com
    │   │       │   │   └── huawei
    │   │       │   │       └── charging
    │   │       │   │           ├── Application.java
    │   │       │   │           ├── adapter
    │   │       │   │               └── ChargeController.java
    │   │       │   │           ├── application
    │   │       │   │               ├── ChargeServiceI.java
    │   │       │   │               ├── ChargeServiceImpl.java
    │   │       │   │               └── dto
    │   │       │   │               │   ├── BeginSessionRequest.java
    │   │       │   │               │   ├── ChargeRecordDto.java
    │   │       │   │               │   ├── ChargeRequest.java
    │   │       │   │               │   ├── EndSessionRequest.java
    │   │       │   │               │   ├── MultiResponse.java
    │   │       │   │               │   ├── Response.java
    │   │       │   │               │   └── SingleResponse.java
    │   │       │   │           ├── domain
    │   │       │   │               ├── ApplicationContextHelper.java
    │   │       │   │               ├── BizException.java
    │   │       │   │               ├── DomainFactory.java
    │   │       │   │               ├── Entity.java
    │   │       │   │               ├── account
    │   │       │   │               │   ├── Account.java
    │   │       │   │               │   └── AccountDomainService.java
    │   │       │   │               ├── charge
    │   │       │   │               │   ├── CallType.java
    │   │       │   │               │   ├── ChargeContext.java
    │   │       │   │               │   ├── ChargeRecord.java
    │   │       │   │               │   ├── Money.java
    │   │       │   │               │   ├── MoneyConverter.java
    │   │       │   │               │   ├── Session.java
    │   │       │   │               │   ├── chargeplan
    │   │       │   │               │   │   ├── BasicChargePlan.java
    │   │       │   │               │   │   ├── ChargePlan.java
    │   │       │   │               │   │   ├── ChargePlanType.java
    │   │       │   │               │   │   ├── FamilyChargePlan.java
    │   │       │   │               │   │   ├── FixedTimeChangePlan.java
    │   │       │   │               │   │   └── Resource.java
    │   │       │   │               │   └── chargerule
    │   │       │   │               │   │   ├── AbstractChargeRule.java
    │   │       │   │               │   │   ├── BasicChargeRule.java
    │   │       │   │               │   │   ├── ChargeRule.java
    │   │       │   │               │   │   ├── ChargeRuleFactory.java
    │   │       │   │               │   │   ├── CompositeChargeRule.java
    │   │       │   │               │   │   ├── FamilyChargeRule.java
    │   │       │   │               │   │   └── FixedTimeChargeRule.java
    │   │       │   │               └── gateway
    │   │       │   │               │   ├── AccountGateway.java
    │   │       │   │               │   ├── ChargeGateway.java
    │   │       │   │               │   └── SessionGateway.java
    │   │       │   │           └── infrastructure
    │   │       │   │               ├── AccountGatewayImpl.java
    │   │       │   │               ├── RestClientBean.java
    │   │       │   │               └── SessionGatewayImpl.java
    │   │       └── resources
    │   │       │   ├── application.yml
    │   │       │   └── logback.xml
    │   │   └── test
    │   │       ├── charge.http
    │   │       ├── java
    │   │           └── com
    │   │           │   └── huawei
    │   │           │       └── charging
    │   │           │           ├── CleanArchTest.java
    │   │           │           ├── TestsContainerBoot.java
    │   │           │           ├── application
    │   │           │               └── ChargeServiceTest.java
    │   │           │           ├── domain
    │   │           │               ├── ChargeRecordPlanTest.java
    │   │           │               ├── ChargeRecordRuleTest.java
    │   │           │               └── CompositeChargeRuleTestRecord.java
    │   │           │           └── infrastructure
    │   │           │               ├── AccountGatewayTest.java
    │   │           │               ├── ChargeRecordRepoTest.java
    │   │           │               ├── FixtureLoader.java
    │   │           │               ├── JSONTest.java
    │   │           │               ├── SpingBootConfTest.java
    │   │           │               ├── WireMockBasicTest.java
    │   │           │               └── WireMockRegister.java
    │   │       └── resources
    │   │           ├── application-test.yml
    │   │           ├── application.yml
    │   │           ├── fixture
    │   │               └── wiremock
    │   │               │   ├── stub_account.json
    │   │               │   ├── stub_insufficient_account.json
    │   │               │   └── stub_wire_mock_basic.json
    │   │           └── logback-test.xml
    └── craftsman
    │   ├── craftsman-adapter
    │       ├── pom.xml
    │       └── src
    │       │   └── main
    │       │       └── java
    │       │           └── com
    │       │               └── alibaba
    │       │                   └── craftsman
    │       │                       └── web
    │       │                           └── MetricsController.java
    │   ├── craftsman-app
    │       ├── pom.xml
    │       └── src
    │       │   ├── main
    │       │       └── java
    │       │       │   └── com
    │       │       │       └── alibaba
    │       │       │           └── craftsman
    │       │       │               ├── command
    │       │       │                   ├── ATAMetricAddCmdExe.java
    │       │       │                   ├── CodeReviewMetricAddCmdExe.java
    │       │       │                   ├── MetricDeleteCmdExe.java
    │       │       │                   ├── MiscMetricAddCmdExe.java
    │       │       │                   ├── PaperMetricAddCmdExe.java
    │       │       │                   ├── PatentMetricAddCmdExe.java
    │       │       │                   ├── RefactoringMetricAddCmdExe.java
    │       │       │                   ├── RefreshScoreCmdExe.java
    │       │       │                   ├── SharingMetricAddCmdExe.java
    │       │       │                   ├── UserProfileAddCmdExe.java
    │       │       │                   ├── UserProfileUpdateCmdExe.java
    │       │       │                   ├── package-info.java
    │       │       │                   └── query
    │       │       │                   │   ├── ATAMetricQryExe.java
    │       │       │                   │   ├── UserProfileGetQryExe.java
    │       │       │                   │   ├── UserProfileListQryExe.java
    │       │       │                   │   └── package-info.java
    │       │       │               ├── event
    │       │       │                   └── handler
    │       │       │                   │   └── MetricItemCreatedHandler.java
    │       │       │               └── service
    │       │       │                   ├── MetricsServiceImpl.java
    │       │       │                   ├── UserProfileServiceImpl.java
    │       │       │                   └── package-info.java
    │       │   └── test
    │       │       ├── java
    │       │           └── com
    │       │           │   └── alibaba
    │       │           │       └── craftsman
    │       │           │           └── app
    │       │           │               └── ContextInterceptorTest.java
    │       │       └── resources
    │       │           └── logback-test.xml
    │   ├── craftsman-client
    │       ├── pom.xml
    │       └── src
    │       │   └── main
    │       │       └── java
    │       │           └── com
    │       │               └── alibaba
    │       │                   └── craftsman
    │       │                       ├── api
    │       │                           ├── MetricsServiceI.java
    │       │                           └── UserProfileServiceI.java
    │       │                       ├── context
    │       │                           └── UserContext.java
    │       │                       └── dto
    │       │                           ├── ATAMetricAddCmd.java
    │       │                           ├── ATAMetricQry.java
    │       │                           ├── CodeReviewMetricAddCmd.java
    │       │                           ├── CommonCommand.java
    │       │                           ├── MetricDeleteCmd.java
    │       │                           ├── MiscMetricAddCmd.java
    │       │                           ├── PaperMetricAddCmd.java
    │       │                           ├── PatentMetricAddCmd.java
    │       │                           ├── RefactoringMetricAddCmd.java
    │       │                           ├── RefreshScoreCmd.java
    │       │                           ├── SharingMetricAddCmd.java
    │       │                           ├── UserProfileAddCmd.java
    │       │                           ├── UserProfileGetQry.java
    │       │                           ├── UserProfileListQry.java
    │       │                           ├── UserProfileUpdateCmd.java
    │       │                           ├── clientobject
    │       │                               ├── ATAMetricCO.java
    │       │                               ├── AbstractMetricCO.java
    │       │                               ├── MiscMetricCO.java
    │       │                               ├── PaperMetricCO.java
    │       │                               ├── PatentMetricCO.java
    │       │                               ├── RefactoringMetricCO.java
    │       │                               ├── SharingMetricCO.java
    │       │                               └── UserProfileCO.java
    │       │                           └── domainevent
    │       │                               ├── CustomerCreatedEvent.java
    │       │                               └── MetricItemCreatedEvent.java
    │   ├── craftsman-domain
    │       ├── pom.xml
    │       └── src
    │       │   ├── main
    │       │       └── java
    │       │       │   └── com
    │       │       │       └── alibaba
    │       │       │           └── craftsman
    │       │       │               └── domain
    │       │       │                   ├── DomainFactory.java
    │       │       │                   ├── gateway
    │       │       │                       ├── MetricGateway.java
    │       │       │                       └── UserProfileGateway.java
    │       │       │                   ├── metrics
    │       │       │                       ├── JSONPropertyFilter.java
    │       │       │                       ├── MainMetric.java
    │       │       │                       ├── MainMetricType.java
    │       │       │                       ├── Measurable.java
    │       │       │                       ├── Metric.java
    │       │       │                       ├── MetricItem.java
    │       │       │                       ├── SubMetric.java
    │       │       │                       ├── SubMetricType.java
    │       │       │                       ├── appquality
    │       │       │                       │   ├── AppMetric.java
    │       │       │                       │   ├── AppMetricItem.java
    │       │       │                       │   └── AppQualityMetric.java
    │       │       │                       ├── devquality
    │       │       │                       │   ├── BugMetric.java
    │       │       │                       │   ├── BugMetricItem.java
    │       │       │                       │   └── DevQualityMetric.java
    │       │       │                       ├── techcontribution
    │       │       │                       │   ├── CodeReviewMetric.java
    │       │       │                       │   ├── CodeReviewMetricItem.java
    │       │       │                       │   ├── ContributionMetric.java
    │       │       │                       │   ├── MiscMetric.java
    │       │       │                       │   ├── MiscMetricItem.java
    │       │       │                       │   ├── RefactoringLevel.java
    │       │       │                       │   ├── RefactoringMetric.java
    │       │       │                       │   └── RefactoringMetricItem.java
    │       │       │                       ├── techinfluence
    │       │       │                       │   ├── ATAMetric.java
    │       │       │                       │   ├── ATAMetricItem.java
    │       │       │                       │   ├── AuthorType.java
    │       │       │                       │   ├── InfluenceMetric.java
    │       │       │                       │   ├── PaperMetric.java
    │       │       │                       │   ├── PaperMetricItem.java
    │       │       │                       │   ├── PatentMetric.java
    │       │       │                       │   ├── PatentMetricItem.java
    │       │       │                       │   ├── SharingMetric.java
    │       │       │                       │   ├── SharingMetricItem.java
    │       │       │                       │   └── SharingScope.java
    │       │       │                       └── weight
    │       │       │                       │   ├── DevWeight.java
    │       │       │                       │   ├── OtherWeight.java
    │       │       │                       │   ├── QAWeight.java
    │       │       │                       │   ├── Weight.java
    │       │       │                       │   └── WeightFactory.java
    │       │       │                   ├── package-info.java
    │       │       │                   └── user
    │       │       │                       ├── Role.java
    │       │       │                       └── UserProfile.java
    │       │   └── test
    │       │       └── java
    │       │           └── com
    │       │               └── alibaba
    │       │                   └── craftsman
    │       │                       └── domain
    │       │                           ├── ATAMetricTest.java
    │       │                           ├── AppMetricTest.java
    │       │                           ├── BugMetricTest.java
    │       │                           ├── InfluenceMetricTest.java
    │       │                           ├── PatentMetricTest.java
    │       │                           ├── SharingMetricTest.java
    │       │                           └── UserProfileTest.java
    │   ├── craftsman-infrastructure
    │       ├── pom.xml
    │       └── src
    │       │   ├── main
    │       │       ├── java
    │       │       │   └── com
    │       │       │   │   └── alibaba
    │       │       │   │       └── craftsman
    │       │       │   │           ├── common
    │       │       │   │               ├── BizCode.java
    │       │       │   │               ├── event
    │       │       │   │               │   └── DomainEventPublisher.java
    │       │       │   │               └── exception
    │       │       │   │               │   └── ErrorCode.java
    │       │       │   │           ├── config
    │       │       │   │               └── CraftsmanConfig.java
    │       │       │   │           ├── convertor
    │       │       │   │               ├── MetricConvertor.java
    │       │       │   │               └── UserProfileConvertor.java
    │       │       │   │           └── gatewayimpl
    │       │       │   │               ├── MetricGatewayImpl.java
    │       │       │   │               ├── UserProfileGatewayImpl.java
    │       │       │   │               ├── database
    │       │       │   │                   ├── MetricMapper.java
    │       │       │   │                   ├── UserProfileMapper.java
    │       │       │   │                   └── dataobject
    │       │       │   │                   │   ├── BaseDO.java
    │       │       │   │                   │   ├── MetricDO.java
    │       │       │   │                   │   └── UserProfileDO.java
    │       │       │   │               └── rpc
    │       │       │   │                   ├── AppMetricMapper.java
    │       │       │   │                   ├── BugMetricMapper.java
    │       │       │   │                   └── dataobject
    │       │       │   │                       ├── AppMetricDO.java
    │       │       │   │                       └── BugMetricDO.java
    │       │       └── resources
    │       │       │   ├── TableCreationDDL.sql
    │       │       │   ├── mybatis-config.xml
    │       │       │   └── mybatis
    │       │       │       ├── MetricMapper.xml
    │       │       │       └── UserProfileMapper.xml
    │       │   └── test
    │       │       ├── java
    │       │           └── com
    │       │           │   └── alibaba
    │       │           │       └── craftsman
    │       │           │           └── gatewayimpl
    │       │           │               ├── Mybatis3Utils.java
    │       │           │               └── MybatisTest.java
    │       │       └── resources
    │       │           ├── logback-test.xml
    │       │           └── mybatis-config-test.xml
    │   ├── pom.xml
    │   └── start
    │       ├── pom.xml
    │       └── src
    │           ├── main
    │               ├── java
    │               │   └── com
    │               │   │   └── alibaba
    │               │   │       └── craftsman
    │               │   │           └── Application.java
    │               └── resources
    │               │   ├── application.properties
    │               │   └── logback-spring.xml
    │           └── test
    │               ├── java
    │                   └── com
    │                   │   └── alibaba
    │                   │       └── craftsman
    │                   │           ├── TestApplication.java
    │                   │           └── gatewayimpl
    │                   │               ├── MetricTunnelTest.java
    │                   │               └── UserProfileTunnelTest.java
    │               ├── resources
    │                   ├── logback-test.xml
    │                   ├── mockfile
    │                   │   ├── com.alibaba.craftsman.app.ATAMetricAddCmdExeTest_testATAMetricAddSuccess
    │                   │   ├── com.alibaba.craftsman.app.ATAMetricAddCmdExeTest_testATAMetricAddSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.CodeReviewMetricAddCmdExeTest_testSuccess
    │                   │   ├── com.alibaba.craftsman.app.CodeReviewMetricAddCmdExeTest_testSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.MetricDeleteCmdExeTest_testSuccess
    │                   │   ├── com.alibaba.craftsman.app.MetricDeleteCmdExeTest_testSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.MiscMetricAddCmdExeTest_testSuccess
    │                   │   ├── com.alibaba.craftsman.app.MiscMetricAddCmdExeTest_testSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.PaperMetricAddCmdExeTest_testPaperMetricAddSuccess
    │                   │   ├── com.alibaba.craftsman.app.PaperMetricAddCmdExeTest_testPaperMetricAddSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.PatentMetricAddCmdExeTest_testPatentMetricAddSuccess
    │                   │   ├── com.alibaba.craftsman.app.PatentMetricAddCmdExeTest_testPatentMetricAddSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.RefactoringMetricAddCmdExeTest_testSuccess
    │                   │   ├── com.alibaba.craftsman.app.RefactoringMetricAddCmdExeTest_testSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.ScoreRecalculateTest_testDevSuccess
    │                   │   ├── com.alibaba.craftsman.app.ScoreRecalculateTest_testDevSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.SharingMetricAddCmdExeTest_testSharingMetricAddSuccess
    │                   │   ├── com.alibaba.craftsman.app.SharingMetricAddCmdExeTest_testSharingMetricAddSuccess_inputParams
    │                   │   ├── com.alibaba.craftsman.app.UserProfileCmdExeTest_testSuccessAdd
    │                   │   ├── com.alibaba.craftsman.app.UserProfileCmdExeTest_testSuccessAdd_inputParams
    │                   │   ├── com.alibaba.craftsman.app.UserProfileCmdExeTest_testSuccessUpdate
    │                   │   ├── com.alibaba.craftsman.app.UserProfileCmdExeTest_testSuccessUpdate_inputParams
    │                   │   └── service.list
    │                   └── spring-mock-test.xml
    │               ├── testAddCmd.http
    │               └── testQry.http
├── mvnw
├── mvnw.cmd
├── pom.xml
└── scripts
    ├── bump_cola_version
    ├── integration_test
    └── maven-deploy.md


/.editorconfig:
--------------------------------------------------------------------------------
 1 | root = true
 2 | 
 3 | [*]
 4 | charset = utf-8
 5 | end_of_line = lf
 6 | insert_final_newline = true
 7 | tab_width = 4
 8 | indent_style = space
 9 | trim_trailing_whitespace = true
10 | 
11 | [*.xml]
12 | indent_size = 4
13 | 
14 | [*.{yml,yaml}]
15 | indent_size = 2
16 | 
17 | [*.{md,mkd,markdown}]
18 | indent_size = 4
19 | trim_trailing_whitespace = false
20 | 


--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
 1 | # To get started with Dependabot version updates, you'll need to specify which
 2 | # package ecosystems to update and where the package manifests are located.
 3 | # Please see the documentation for all configuration options:
 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
 5 | 
 6 | version: 2
 7 | updates:
 8 |   - package-ecosystem: "maven" # See documentation for possible values
 9 |     directory: "/" # Location of package manifests
10 |     schedule:
11 |       interval: "daily"
12 |     open-pull-requests-limit: 32
13 | 


--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | !.mvn/wrapper/maven-wrapper.jar
 3 | 
 4 | ### STS ###
 5 | .apt_generated
 6 | .classpath
 7 | .factorypath
 8 | .project
 9 | .settings
10 | .springBeans
11 | 
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 | 
18 | ### BUILD ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | target/
27 | out/
28 | .DS_Store
29 | .vscode/settings.json
30 | ${project.build.directory}
31 | 


--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "scripts/bash-buddy"]
2 | 	path = scripts/bash-buddy
3 | 	url = https://github.com/foldright/bash-buddy.git
4 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/img.png


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/img_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/img_1.png


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/Application.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import org.springframework.boot.SpringApplication;
 7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 8 | 
 9 | @SpringBootApplication
10 | public class Application {
11 | 
12 |     public static void main(String[] args) {
13 |         SpringApplication.run(Application.class, args);
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/application/ChargeServiceI.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.application;
 5 | 
 6 | import ${package}.application.dto.*;
 7 | 
 8 | public interface ChargeServiceI {
 9 |     Response begin(BeginSessionRequest request);
10 | 
11 |     Response charge(ChargeRequest request);
12 | 
13 |     Response end(EndSessionRequest request);
14 | 
15 |     MultiResponse<ChargeRecordDto> listChargeRecords(String sessionId);
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/application/dto/ChargeRequest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.application.dto;
 5 | 
 6 | import lombok.Data;
 7 | 
 8 | @Data
 9 | public class ChargeRequest {
10 | 
11 |     private String sessionId;
12 | 
13 |     /**
14 |      * 当前通话,截止目前的累计时间
15 |      */
16 |     private int duration;
17 | 
18 |     public ChargeRequest() {
19 |     }
20 | 
21 |     public ChargeRequest(String sessionId, int duration) {
22 |         this.sessionId = sessionId;
23 |         this.duration = duration;
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/BizException.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain;
 5 | 
 6 | public class BizException extends RuntimeException{
 7 | 
 8 |     public BizException(String errMessage) {
 9 |         super(errMessage);
10 |     }
11 | 
12 |     public static BizException of(String errMessage){
13 |         return new BizException(errMessage);
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/DomainFactory.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain;
 5 | 
 6 | public class DomainFactory {
 7 | 
 8 |     public static <T> T get(Class<T> entityClz){
 9 |         return ApplicationContextHelper.getBean(entityClz);
10 |     }
11 | 
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/Entity.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain;
 5 | 
 6 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 7 | import org.springframework.context.annotation.Scope;
 8 | import org.springframework.stereotype.Component;
 9 | 
10 | import java.lang.annotation.*;
11 | 
12 | @Inherited
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target({ElementType.TYPE})
15 | @Component
16 | @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
17 | public @interface Entity {
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/CallType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge;
 5 | 
 6 | public enum CallType {
 7 |     /**
 8 |      * 主叫
 9 |      */
10 |     CALLING,
11 |     /**
12 |      * 被叫
13 |      */
14 |     CALLED
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/MoneyConverter.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge;
 5 | 
 6 | 
 7 | import jakarta.persistence.AttributeConverter;
 8 | import jakarta.persistence.Converter;
 9 | 
10 | @Converter(autoApply = true)
11 | public class MoneyConverter implements AttributeConverter<Money,Long> {
12 |     @Override
13 |     public Long convertToDatabaseColumn(Money entityData) {
14 |         return Long.valueOf(entityData.getAmount());
15 |     }
16 | 
17 |     @Override
18 |     public Money convertToEntityAttribute(Long dbData) {
19 |         return Money.of(dbData.intValue());
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/chargeplan/ChargePlanType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge.chargeplan;
 5 | 
 6 | public enum ChargePlanType {
 7 |     /**
 8 |      * 基础套餐
 9 |      */
10 |     BASIC,
11 |     /**
12 |      * 固定时常套餐
13 |      */
14 |     FIXED_TIME,
15 |     /**
16 |      * 家庭套餐
17 |      */
18 |     FAMILY
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/chargeplan/Resource.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge.chargeplan;
 5 | 
 6 | /**
 7 |  * 套餐背后所绑定的资源
 8 |  */
 9 | public interface Resource {
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/chargerule/AbstractChargeRule.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge.chargerule;
 5 | 
 6 | import ${package}.domain.charge.chargeplan.ChargePlan;
 7 | 
 8 | public abstract class AbstractChargeRule implements ChargeRule{
 9 |     protected ChargePlan chargePlan;
10 | 
11 |     @Override
12 |     public void belongsTo(ChargePlan chargePlan){
13 |         this.chargePlan = chargePlan;
14 |     }
15 | 
16 | 
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/charge/chargerule/ChargeRule.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.charge.chargerule;
 5 | 
 6 | import ${package}.domain.charge.ChargeRecord;
 7 | import ${package}.domain.charge.ChargeContext;
 8 | import ${package}.domain.charge.chargeplan.ChargePlan;
 9 | 
10 | public interface ChargeRule {
11 |     ChargeRecord doCharge(ChargeContext ctx);
12 | 
13 |     void belongsTo(ChargePlan chargePlan);
14 | 
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/gateway/ChargeGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.gateway;
 5 | 
 6 | import ${package}.domain.charge.ChargeRecord;
 7 | import org.springframework.data.jpa.repository.JpaRepository;
 8 | import org.springframework.stereotype.Repository;
 9 | 
10 | import java.util.List;
11 | 
12 | @Repository
13 | public interface ChargeGateway extends JpaRepository<ChargeRecord, Long> {
14 |     public List<ChargeRecord> findBySessionId(String sessionId);
15 | 
16 |     public ChargeRecord getBySessionId(String sessionId);
17 | 
18 |     public List<ChargeRecord> findByPhoneNo(long phoneNo);
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/domain/gateway/SessionGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.gateway;
 5 | 
 6 | import ${package}.domain.charge.Session;
 7 | 
 8 | public interface SessionGateway {
 9 | 
10 |     void create(Session session);
11 | 
12 |     Session get(String sessionId);
13 | 
14 |     void end(String sessionId);
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/java/infrastructure/RestClientBean.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.infrastructure;
 5 | 
 6 | import org.springframework.beans.factory.annotation.Value;
 7 | import org.springframework.context.annotation.Bean;
 8 | import org.springframework.context.annotation.Configuration;
 9 | import org.springframework.web.client.RestClient;
10 | 
11 | @Configuration
12 | public class RestClientBean {
13 | 
14 |     @Value("${symbol_dollar}{REMOTE_BASE_URI:http://localhost:8080}")
15 |     String baseURI;
16 | 
17 |     @Bean
18 |     RestClient restClient() {
19 |         return RestClient.create(baseURI);
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/main/resources/application.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: com.mysql.cj.jdbc.Driver
 4 |     url: jdbc:mysql://${MYSQL_SERVER:localhost}:${MYSQL_PORT:3306}/${MYSQL_DB_NAME:chargeDB}?serverTimezone=UTC
 5 |     #如果运行出错,可以把连接写成下面的路径进行测试
 6 |     #url: jdbc:mysql://localhost:3306/blogDB?useUnicode=true&characterEncoding=utf-8
 7 |     username: ${MYSQL_USER_TEST:root}
 8 |     password: ${MYSQL_PASSWORD_TEST:root}
 9 |   jpa:
10 |     hibernate:
11 |       ddl-auto: update
12 |     show-sql: true
13 | 
14 | server:
15 |   port: 8081
16 | 
17 | my-name: default
18 | my-age: default
19 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/charge.http:
--------------------------------------------------------------------------------
 1 | ### list charge records by sessionId
 2 | GET http://localhost:8080/123145/chargeRecords
 3 | Accept: application/json
 4 | 
 5 | ### end session
 6 | POST http://localhost:8080/session/123145/end?duration=10
 7 | Content-Type: application/x-www-form-urlencoded
 8 | 
 9 | duration=10
10 | 
11 | ### do charge
12 | POST http://localhost:8080/session/123145/charge?duration=10
13 | 
14 | 
15 | ### begin Session
16 | POST http://localhost:8080/session/123145/begin?callingPhoneNo=13681874561&calledPhoneNo=15921252125
17 | 
18 | <> 2022-11-03T150743.200.json
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/java/TestsContainerBoot.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import com.alibaba.cola.test.TestsContainer;
 7 | 
 8 | public class TestsContainerBoot {
 9 |     public static void main(String[] args) {
10 |         TestsContainer.start();
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/java/infrastructure/WireMockRegister.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.infrastructure;
 5 | 
 6 | import com.github.tomakehurst.wiremock.client.WireMock;
 7 | import com.github.tomakehurst.wiremock.stubbing.StubMapping;
 8 | 
 9 | public class WireMockRegister {
10 | 
11 |     public static void registerStub(WireMock wireMock, String resourcePath){
12 |         StubMapping stubMapping = StubMapping.buildFrom(FixtureLoader.loadResource(resourcePath));
13 |         wireMock.register(stubMapping);
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: com.mysql.cj.jdbc.Driver
 4 |     # hard code for test purpose
 5 |     url: jdbc:mysql://localhost:3306/chargeDB?serverTimezone=UTC
 6 |     username: root
 7 |     password: root
 8 | 
 9 |   jpa:
10 |     hibernate:
11 |       ddl-auto: update
12 |     show-sql: true
13 | 
14 | # this will override config in test/resources/application.yml and resources/application.yml
15 | my-age: 30
16 | 
17 | my-age-test: 40
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/resources/application.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: org.h2.Driver
 4 |     url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=1
 5 |     username: sa
 6 |     password:
 7 | 
 8 |   jpa:
 9 |     hibernate:
10 |       ddl-auto: update
11 |     show-sql: true
12 | 
13 | server:
14 |   port: 8081
15 | 
16 | my-name: frank
17 | my-age: 35
18 | REMOTE_BASE_URI: http://localhost:8080
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/resources/fixture/wiremock/stub_account.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/api/account/[0-9]+",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "transformers": [
12 |       "response-template"
13 |     ],
14 |     "jsonBody": {
15 |       "name": "frank",
16 |       "phoneNo": "{{request.path.[3]}}",
17 |       "remaining": "400",
18 |       "chargePlanList": [
19 |         {
20 |           "priority": "2",
21 |           "type": "fixedTime"
22 |         },
23 |         {
24 |           "priority": "1",
25 |           "type": "familyMember"
26 |         }
27 |       ]
28 |     }
29 |   }
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/main/resources/archetype-resources/src/test/resources/fixture/wiremock/stub_insufficient_account.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/api/account/[0-9]+",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "transformers": [
12 |       "response-template"
13 |     ],
14 |     "jsonBody": {
15 |       "name": "frank",
16 |       "phoneNo": "{{request.path.[3]}}",
17 |       "remaining": "0",
18 |       "chargePlanList": [
19 |         {
20 |           "priority": "2",
21 |           "type": "fixedTime"
22 |         },
23 |         {
24 |           "priority": "1",
25 |           "type": "familyMember"
26 |         }
27 |       ]
28 |     }
29 |   }
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/test/resources/projects/basic/archetype.properties:
--------------------------------------------------------------------------------
1 | #Sun May 12 20:30:31 CST 2024
2 | package=it.pkg
3 | groupId=archetype.it
4 | artifactId=basic
5 | version=0.1-SNAPSHOT
6 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-light/src/test/resources/projects/basic/goal.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-archetypes/cola-archetype-light/src/test/resources/projects/basic/goal.txt


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### eclipse ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__gitignore__:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### eclipse ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-app/src/main/java/order/OrderServiceImpl.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.order;
 5 | 
 6 | //package by domain, not by duty
 7 | 
 8 | 
 9 | public class OrderServiceImpl{
10 | 
11 | }


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-app/src/test/java/app/CustomerConvertorTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.app;
 5 | 
 6 | 
 7 | public class CustomerConvertorTest {
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-app/src/test/java/app/CustomerValidatorTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.app;
 5 | 
 6 | import org.junit.Test;
 7 | 
 8 | public class CustomerValidatorTest {
 9 | 
10 |     @Test
11 |     public void testValidation(){
12 | 
13 |     }
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/api/CustomerServiceI.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.api;
 5 | 
 6 | import com.alibaba.cola.dto.MultiResponse;
 7 | import com.alibaba.cola.dto.Response;
 8 | import ${package}.dto.CustomerAddCmd;
 9 | import ${package}.dto.CustomerListByNameQry;
10 | import ${package}.dto.data.CustomerDTO;
11 | 
12 | public interface CustomerServiceI {
13 | 
14 |     Response addCustomer(CustomerAddCmd customerAddCmd);
15 | 
16 |     MultiResponse<CustomerDTO> listByName(CustomerListByNameQry customerListByNameQry);
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/CustomerAddCmd.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto;
 5 | 
 6 | import ${package}.dto.data.CustomerDTO;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | public class CustomerAddCmd{
11 | 
12 |     private CustomerDTO customerDTO;
13 | 
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/CustomerListByNameQry.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto;
 5 | 
 6 | import com.alibaba.cola.dto.Query;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | public class CustomerListByNameQry extends Query{
11 |    private String name;
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/data/CustomerDTO.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.data;
 5 | 
 6 | import lombok.Data;
 7 | 
 8 | import javax.validation.constraints.NotEmpty;
 9 | 
10 | @Data
11 | public class CustomerDTO{
12 |     private String customerId;
13 |     private String memberId;
14 |     private String customerName;
15 |     private String customerType;
16 |     @NotEmpty
17 |     private String companyName;
18 |     @NotEmpty
19 |     private String source;
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/data/ErrorCode.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.data;
 5 | 
 6 | 
 7 | public class ErrorCode {
 8 |     public static final String B_CUSTOMER_companyNameConflict = "B_CUSTOMER_companyNameConflict";
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/event/CustomerCreatedEvent.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.event;
 5 | 
 6 | import static ${package}.dto.event.DomainEventConstant.CUSTOMER_CREATED_TOPIC;
 7 | 
 8 | /**
 9 |  * CustomerCreatedEvent
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-01-04 10:32 AM
13 |  */
14 | public class CustomerCreatedEvent{
15 | 
16 |     private String customerId;
17 | 
18 |     public String getCustomerId() {
19 |         return customerId;
20 |     }
21 | 
22 |     public void setCustomerId(String customerId) {
23 |         this.customerId = customerId;
24 |     }
25 | 
26 | }
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/event/DomainEventConstant.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.event;
 5 | 
 6 | /**
 7 |  * @author niexiaolong
 8 |  * @date 2019/4/16
 9 |  */
10 | public class DomainEventConstant {
11 | 
12 | 	public static final String CUSTOMER_CREATED_TOPIC = "CRM_CUSTOMER_CREATED_DOMAIN_EVENT_TOPIC";
13 | 
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/CompanyType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * CompanyType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 11:02 AM
11 |  */
12 | public enum CompanyType {
13 |     POTENTIAL,
14 |     INTENTIONAL,
15 |     IMPORTANT,
16 |     VIP;
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/Credit.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | import com.alibaba.cola.domain.Entity;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | @Entity
11 | public class Credit{
12 |     
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/CustomerType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * CustomerType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 8:51 AM
11 |  */
12 | public enum CustomerType {
13 |     POTENTIAL,
14 |     INTENTIONAL,
15 |     IMPORTANT,
16 |     VIP;
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/SourceType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * SourceType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 11:09 AM
11 |  */
12 | public enum SourceType {
13 |     BIZ_ONE, //From biz one
14 |     BIZ_TWO; //From biz two
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/domainservice/CreditChecker.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.domainservice;
 5 | 
 6 | //The domain's ablility can also be placed here
 7 | public class CreditChecker{
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/gateway/CreditGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.gateway;
 5 | 
 6 | import ${package}.domain.customer.Customer;
 7 | import ${package}.domain.customer.Credit;
 8 | 
 9 | //Assume that the credit info is in antoher distributed Service
10 | public interface CreditGateway {
11 |     Credit getCredit(String customerId);
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/gateway/CustomerGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.gateway;
 5 | 
 6 | import ${package}.domain.customer.Customer;
 7 | 
 8 | public interface CustomerGateway {
 9 |     Customer getByById(String customerId);
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/order/Order.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.domain.order;
5 | 
6 | public class Order{
7 | 
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/package-info.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | /**
5 |  * This is domain module, the core business logic is implemented here.
6 |  * 
7 |  * @author fulan.zjf
8 |  */
9 | package ${package}.domain;


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/test/java/domain/CustomerEntityTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain;
 5 | 
 6 | 
 7 | public class CustomerEntityTest {
 8 | 
 9 |     public void testCustomerConflict() {
10 |         System.out.println("Please mock gatewayimpl, test pure Domain Knowledge");
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/config/DiamondConfig.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.config;
5 | 
6 | public class DiamondConfig {
7 |     public final static String DummyConfig = "DummyConfig";
8 | }


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CreditGatewayImpl.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import ${package}.domain.customer.Credit;
 7 | import ${package}.domain.customer.gateway.CreditGateway;
 8 | 
 9 | public class CreditGatewayImpl implements CreditGateway {
10 |     public Credit getCredit(String customerId){
11 |       return null;
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CustomerDO.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import lombok.Data;
 7 | 
 8 | @Data
 9 | public class CustomerDO{
10 |   private String customerId;
11 |   private String memberId;
12 |   private String globalId;
13 |   private long registeredCapital;
14 |   private String companyName;
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CustomerMapper.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import org.apache.ibatis.annotations.Mapper;
 7 | 
 8 | @Mapper
 9 | public interface CustomerMapper{
10 | 
11 |   CustomerDO getById(String customerId);
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/order/OrderGatewayImpl.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.order;
5 | 
6 | public class OrderGatewayImpl{
7 | 
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/resources/mybatis/mybatis-config.xml:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | <?xml version="1.0" encoding="UTF-8" ?>
 5 | <!-- mybatis的配置文件 -->
 6 | <!DOCTYPE configuration
 7 |         PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
 8 |         "http://mybatis.org/dtd/mybatis-3-config.dtd">
 9 | <configuration>
10 | 	<mappers>
11 |         <mapper resource="mybatis/customer-mapper.xml"/>
12 |     </mappers>
13 | </configuration>


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/test/java/repository/CustomerMapperTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.repository;
 5 | 
 6 | 
 7 | public class CustomerMapperTest {
 8 | 
 9 |     public void testFindByID() {
10 |         System.out.println("Write your test here");
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/test/resources/sample.properties:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/start/src/main/java/Application.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import org.mybatis.spring.annotation.MapperScan;
 7 | import org.springframework.boot.SpringApplication;
 8 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 9 | 
10 | /**
11 |  * Spring Boot Starter
12 |  *
13 |  *
14 |  * @author Frank Zhang
15 |  */
16 | @SpringBootApplication
17 | public class Application {
18 | 
19 |     public static void main(String[] args) {
20 |         SpringApplication.run(Application.class, args);
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/start/src/main/resources/application.properties:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | project.name=${artifactId}
 5 | 
 6 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 7 | spring.datasource.url=jdbc:mysql://localhost:3306/test
 8 | spring.datasource.username=root
 9 | spring.datasource.password=root
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/main/resources/archetype-resources/start/src/test/java/TestApplication.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import org.springframework.boot.SpringApplication;
 7 | import org.springframework.context.ApplicationContext;
 8 | 
 9 | public class TestApplication {
10 | 
11 |     public static void main(String[] args) {
12 |         //这里填的是TestApplication
13 |         ApplicationContext context = SpringApplication.run(Application.class, args);
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/test/resources/projects/basic/archetype.properties:
--------------------------------------------------------------------------------
1 | #Tue Apr 16 18:52:28 CST 2019
2 | package=it.pkg
3 | version=0.1-SNAPSHOT
4 | groupId=archetype.it
5 | artifactId=basic
6 | gitignore=.gitignore
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-service/src/test/resources/projects/basic/goal.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-archetypes/cola-archetype-service/src/test/resources/projects/basic/goal.txt


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__gitignore__:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### eclipse ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-adapter/src/main/java/mobile/CustomerMobileAdaptor.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.mobile;
 5 | 
 6 | /**
 7 |  * Customer Mobile Adaptor
 8 |  *
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2020-10-27 8:04 PM
12 |  */
13 | public class CustomerMobileAdaptor {
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-adapter/src/main/java/wap/CustomerWapAdaptor.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.wap;
 5 | 
 6 | /**
 7 |  * Customer Wap Adaptor
 8 |  *
 9 |  * WAP : Wireless Application Protocol)
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2020-10-27 8:03 PM
13 |  */
14 | public class CustomerWapAdaptor {
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-app/src/main/java/order/OrderServiceImpl.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.order;
 5 | 
 6 | //package by domain, not by duty
 7 | 
 8 | 
 9 | public class OrderServiceImpl{
10 | 
11 | }


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-app/src/test/java/app/CustomerConvertorTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.app;
 5 | 
 6 | 
 7 | public class CustomerConvertorTest {
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-app/src/test/java/app/CustomerValidatorTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.app;
 5 | 
 6 | import org.junit.Test;
 7 | 
 8 | public class CustomerValidatorTest {
 9 | 
10 |     @Test
11 |     public void testValidation(){
12 | 
13 |     }
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/api/CustomerServiceI.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.api;
 5 | 
 6 | import com.alibaba.cola.dto.MultiResponse;
 7 | import com.alibaba.cola.dto.Response;
 8 | import ${package}.dto.CustomerAddCmd;
 9 | import ${package}.dto.CustomerListByNameQry;
10 | import ${package}.dto.data.CustomerDTO;
11 | 
12 | public interface CustomerServiceI {
13 | 
14 |     Response addCustomer(CustomerAddCmd customerAddCmd);
15 | 
16 |     MultiResponse<CustomerDTO> listByName(CustomerListByNameQry customerListByNameQry);
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/CustomerAddCmd.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto;
 5 | 
 6 | import ${package}.dto.data.CustomerDTO;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | public class CustomerAddCmd{
11 | 
12 |     private CustomerDTO customerDTO;
13 | 
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/CustomerListByNameQry.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto;
 5 | 
 6 | import com.alibaba.cola.dto.Query;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | public class CustomerListByNameQry extends Query{
11 |    private String name;
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/data/CustomerDTO.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.data;
 5 | 
 6 | import lombok.Data;
 7 | 
 8 | import javax.validation.constraints.NotEmpty;
 9 | 
10 | @Data
11 | public class CustomerDTO{
12 |     private String customerId;
13 |     private String memberId;
14 |     private String customerName;
15 |     private String customerType;
16 |     @NotEmpty
17 |     private String companyName;
18 |     @NotEmpty
19 |     private String source;
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/data/ErrorCode.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.data;
 5 | 
 6 | public enum ErrorCode{
 7 |     B_CUSTOMER_companyNameConflict("B_CUSTOMER_companyNameConflict", "客户公司名冲突");
 8 | 
 9 |     private final String errCode;
10 |     private final String errDesc;
11 | 
12 |     private ErrorCode(String errCode, String errDesc) {
13 |         this.errCode = errCode;
14 |         this.errDesc = errDesc;
15 |     }
16 | 
17 |     public String getErrCode() {
18 |         return errCode;
19 |     }
20 | 
21 |     public String getErrDesc() {
22 |         return errDesc;
23 |     }
24 | }
25 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/event/CustomerCreatedEvent.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.event;
 5 | 
 6 | import static ${package}.dto.event.DomainEventConstant.CUSTOMER_CREATED_TOPIC;
 7 | 
 8 | /**
 9 |  * CustomerCreatedEvent
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-01-04 10:32 AM
13 |  */
14 | public class CustomerCreatedEvent{
15 | 
16 |     private String customerId;
17 | 
18 |     public String getCustomerId() {
19 |         return customerId;
20 |     }
21 | 
22 |     public void setCustomerId(String customerId) {
23 |         this.customerId = customerId;
24 |     }
25 | 
26 | }
27 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/dto/event/DomainEventConstant.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.dto.event;
 5 | 
 6 | /**
 7 |  * @author niexiaolong
 8 |  * @date 2019/4/16
 9 |  */
10 | public class DomainEventConstant {
11 | 
12 | 	public static final String CUSTOMER_CREATED_TOPIC = "CRM_CUSTOMER_CREATED_DOMAIN_EVENT_TOPIC";
13 | 
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/CompanyType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * CompanyType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 11:02 AM
11 |  */
12 | public enum CompanyType {
13 |     POTENTIAL,
14 |     INTENTIONAL,
15 |     IMPORTANT,
16 |     VIP;
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/Credit.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | import com.alibaba.cola.domain.Entity;
 7 | import lombok.Data;
 8 | 
 9 | @Data
10 | @Entity
11 | public class Credit{
12 |     
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/CustomerType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * CustomerType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 8:51 AM
11 |  */
12 | public enum CustomerType {
13 |     POTENTIAL,
14 |     INTENTIONAL,
15 |     IMPORTANT,
16 |     VIP;
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/SourceType.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer;
 5 | 
 6 | /**
 7 |  * SourceType
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-08 11:09 AM
11 |  */
12 | public enum SourceType {
13 |     BIZ_ONE, //From biz one
14 |     BIZ_TWO; //From biz two
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/domainservice/CreditChecker.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.domainservice;
 5 | 
 6 | //The domain's ability can also be placed here
 7 | public class CreditChecker{
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/gateway/CreditGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.gateway;
 5 | 
 6 | import ${package}.domain.customer.Credit;
 7 | 
 8 | //Assume that the credit info is in another distributed Service
 9 | public interface CreditGateway {
10 |     Credit getCredit(String customerId);
11 | }
12 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/customer/gateway/CustomerGateway.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain.customer.gateway;
 5 | 
 6 | import ${package}.domain.customer.Customer;
 7 | 
 8 | public interface CustomerGateway {
 9 |     Customer getByById(String customerId);
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/order/Order.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.domain.order;
5 | 
6 | public class Order{
7 | 
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/main/java/domain/package-info.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | /**
5 |  * This is domain module, the core business logic is implemented here.
6 |  * 
7 |  * @author fulan.zjf
8 |  */
9 | package ${package}.domain;


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-domain/src/test/java/domain/CustomerEntityTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.domain;
 5 | 
 6 | 
 7 | public class CustomerEntityTest {
 8 | 
 9 |     public void testCustomerConflict() {
10 |         System.out.println("Please mock gatewayimpl, test pure Domain Knowledge");
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/config/DiamondConfig.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.config;
5 | 
6 | public class DiamondConfig {
7 |     public final static String DummyConfig = "DummyConfig";
8 | }


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CreditGatewayImpl.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import ${package}.domain.customer.Credit;
 7 | import ${package}.domain.customer.gateway.CreditGateway;
 8 | 
 9 | public class CreditGatewayImpl implements CreditGateway {
10 |     public Credit getCredit(String customerId){
11 |       return null;
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CustomerDO.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import lombok.Data;
 7 | 
 8 | @Data
 9 | public class CustomerDO{
10 |   private String customerId;
11 |   private String memberId;
12 |   private String globalId;
13 |   private long registeredCapital;
14 |   private String companyName;
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/customer/CustomerMapper.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.customer;
 5 | 
 6 | import org.apache.ibatis.annotations.Mapper;
 7 | 
 8 | @Mapper
 9 | public interface CustomerMapper{
10 | 
11 |   CustomerDO getById(String customerId);
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/java/order/OrderGatewayImpl.java:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | package ${package}.order;
5 | 
6 | public class OrderGatewayImpl{
7 | 
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/main/resources/mybatis/mybatis-config.xml:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | <?xml version="1.0" encoding="UTF-8" ?>
 5 | <!-- mybatis的配置文件 -->
 6 | <!DOCTYPE configuration
 7 |         PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
 8 |         "http://mybatis.org/dtd/mybatis-3-config.dtd">
 9 | <configuration>
10 | 	<mappers>
11 |         <mapper resource="mybatis/customer-mapper.xml"/>
12 |     </mappers>
13 | </configuration>


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/test/java/repository/CustomerMapperTest.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.repository;
 5 | 
 6 | 
 7 | public class CustomerMapperTest {
 8 | 
 9 |     public void testFindByID() {
10 |         System.out.println("Write your test here");
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/src/test/resources/sample.properties:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/main/java/Application.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import org.mybatis.spring.annotation.MapperScan;
 7 | import org.springframework.boot.SpringApplication;
 8 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 9 | 
10 | /**
11 |  * Spring Boot Starter
12 |  *
13 |  * @author Frank Zhang
14 |  */
15 | @SpringBootApplication(scanBasePackages = {"${package}", "com.alibaba.cola"})
16 | public class Application {
17 | 
18 |     public static void main(String[] args) {
19 |         SpringApplication.run(Application.class, args);
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/main/resources/application.properties:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | project.name=${artifactId}
 5 | 
 6 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 7 | spring.datasource.url=jdbc:mysql://localhost:3306/test
 8 | spring.datasource.username=root
 9 | spring.datasource.password=root
10 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/test/java/TestApplication.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | import org.springframework.boot.SpringApplication;
 7 | import org.springframework.context.ApplicationContext;
 8 | 
 9 | public class TestApplication {
10 | 
11 |     public static void main(String[] args) {
12 |         SpringApplication.run(Application.class, args);
13 |     }
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/test/resources/projects/basic/archetype.properties:
--------------------------------------------------------------------------------
1 | #Tue Apr 16 18:52:28 CST 2019
2 | package=it.pkg
3 | version=0.1-SNAPSHOT
4 | groupId=archetype.it
5 | artifactId=basic
6 | gitignore=.gitignore
7 | 


--------------------------------------------------------------------------------
/cola-archetypes/cola-archetype-web/src/test/resources/projects/basic/goal.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-archetypes/cola-archetype-web/src/test/resources/projects/basic/goal.txt


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/main/java/com/alibaba/cola/catchlog/CatchAndLog.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.catchlog;
 2 | 
 3 | /**
 4 |  * CatchAndLog
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-11-10 10:48 AM
 8 |  */
 9 | 
10 | import java.lang.annotation.ElementType;
11 | import java.lang.annotation.Retention;
12 | import java.lang.annotation.RetentionPolicy;
13 | import java.lang.annotation.Target;
14 | 
15 | @Target({ElementType.METHOD, ElementType.TYPE})
16 | @Retention(RetentionPolicy.RUNTIME)
17 | public @interface CatchAndLog {
18 | 
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/main/java/com/alibaba/cola/catchlog/ResponseHandlerFactory.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.catchlog;
 2 | 
 3 | import org.springframework.context.annotation.Bean;
 4 | 
 5 | public class ResponseHandlerFactory {
 6 | 
 7 |     public static ResponseHandlerI get(){
 8 |         if(ApplicationContextHelper.getBean(ResponseHandlerI.class) != null){
 9 |             return ApplicationContextHelper.getBean(ResponseHandlerI.class);
10 |         }
11 |         return new DefaultResponseHandler();
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/main/java/com/alibaba/cola/catchlog/ResponseHandlerI.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.catchlog;
2 | 
3 | import com.alibaba.cola.exception.BaseException;
4 | 
5 | public interface ResponseHandlerI {
6 |     public Object handle(Class returnType, String errCode, String errMsg);
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration = com.alibaba.cola.catchlog.CatchLogAutoConfiguration
2 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/Application.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.catchlog.test;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | 
 6 | /**
 7 |  * Application
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-11-10 3:58 PM
11 |  */
12 | @SpringBootApplication(scanBasePackages = {"com.alibaba.cola.catchlog"})
13 | public class Application {
14 | 
15 |     public static void main(String[] args) {
16 |         SpringApplication.run(Application.class, args);
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/test/java/com/alibaba/cola/catchlog/test/CustomResponseHandler.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.catchlog.test;
 2 | 
 3 | import com.alibaba.cola.catchlog.ResponseHandlerI;
 4 | import org.springframework.stereotype.Component;
 5 | 
 6 | @Component
 7 | public class CustomResponseHandler implements ResponseHandlerI{
 8 | 
 9 |     @Override
10 |     public Object handle(Class returnType, String errCode, String errMsg) {
11 |         System.out.println("==== This is Customized Response handler");
12 |         Demo.DemoResponse response = new Demo.DemoResponse();
13 |         response.setSuccess(false);
14 |         return response;
15 |     }
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/test/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-components/cola-component-catchlog-starter/src/test/resources/application.properties


--------------------------------------------------------------------------------
/cola-components/cola-component-catchlog-starter/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <!--定义了两个appender,日志会通过往这两个appender里面写-->
14 |         <appender-ref ref="CONSOLE"/>
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
19 |     <logger name="com.alibaba.cola.catchlog" level="DEBUG"/>
20 | 
21 | </configuration>
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/README.md:
--------------------------------------------------------------------------------
1 | ## 作用
2 | 主要提供了@Entity注解,该注解将Spring的Bean的scope定义为prototype,因为Domain Entity是有状态的,不能
3 | 进行多线程共享,所以必须是多实例的。
4 | 
5 | 另外提供了DomainFactory辅助类,帮助应用创建Domain Entity。
6 | 
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/main/java/com/alibaba/cola/domain/DomainAutoConfiguration.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.domain;
 2 | 
 3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 4 | import org.springframework.context.annotation.Bean;
 5 | import org.springframework.context.annotation.Configuration;
 6 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
 7 | 
 8 | /**
 9 |  * @ Description   :
10 |  * @ Author        :  Frank Zhang
11 |  * @ CreateDate    :  2020/11/09
12 |  * @ Version       :  1.0
13 |  */
14 | @Configuration
15 | public class DomainAutoConfiguration {
16 | 
17 |     @Bean
18 |     @ConditionalOnMissingBean(ApplicationContextHelper.class)
19 |     public ApplicationContextHelper applicationContextHelper() {
20 |         return new ApplicationContextHelper();
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/main/java/com/alibaba/cola/domain/DomainFactory.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.domain;
 2 | 
 3 | /**
 4 |  * DomainFactory
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2019-01-03 2:41 PM
 8 |  */
 9 | public class DomainFactory {
10 | 
11 |     public static <T> T create(Class<T> entityClz){
12 |         return ApplicationContextHelper.getBean(entityClz);
13 |     }
14 | 
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/main/java/com/alibaba/cola/domain/Entity.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.domain;
 2 | 
 3 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 4 | import org.springframework.context.annotation.Scope;
 5 | import org.springframework.stereotype.Component;
 6 | 
 7 | import java.lang.annotation.*;
 8 | 
 9 | /**
10 |  * Entity, Entity Object is prototype and is not thread-safe
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-01-03 2:53 PM
14 |  */
15 | @Inherited
16 | @Retention(RetentionPolicy.RUNTIME)
17 | @Target({ElementType.TYPE})
18 | @Component
19 | @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
20 | public @interface Entity {
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration = com.alibaba.cola.domain.DomainAutoConfiguration
2 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/Application.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.domain;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | 
 6 | /**
 7 |  * Application
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-11-10 3:58 PM
11 |  */
12 | @SpringBootApplication
13 | public class Application {
14 | 
15 |     public static void main(String[] args) {
16 |         SpringApplication.run(Application.class, args);
17 | 
18 |         Customer customer = DomainFactory.create(Customer.class);
19 | 
20 |         System.out.println("Customer purchase power score : " + customer.getPurchasePowerScore());
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/test/java/com/alibaba/cola/domain/PurchasePowerGateway.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.domain;
 2 | 
 3 | import org.springframework.stereotype.Component;
 4 | 
 5 | /**
 6 |  * PurchasePowerGateway
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-11-14 2:45 PM
10 |  */
11 | @Component
12 | public class PurchasePowerGateway {
13 | 
14 |     public Long getScore(){
15 |         return 96L;
16 |     }
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/test/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-components/cola-component-domain-starter/src/test/resources/application.properties


--------------------------------------------------------------------------------
/cola-components/cola-component-domain-starter/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <!--定义了两个appender,日志会通过往这两个appender里面写-->
14 |         <appender-ref ref="CONSOLE"/>
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
19 |     <logger name="com.alibaba.cola.domain" level="DEBUG"/>
20 | 
21 | </configuration>
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/README.md:
--------------------------------------------------------------------------------
1 | ## 作用
2 | 制定了DTO的相关规范,一是,为了复用;二是,使得应用层面的Logging和异常处理AOP成为可能。
3 | 
4 | 关于Logging和异常处理的更多信息,请参考cola-component-catchlog-starter。
5 | 
6 | 
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/main/java/com/alibaba/cola/dto/Command.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.dto;
 2 | 
 3 | /**
 4 |  * Command request from Client.
 5 |  *
 6 |  * @author Frank Zhang 2020.11.13
 7 |  *
 8 |  */
 9 | public abstract class Command extends DTO {
10 | 
11 |     private static final long serialVersionUID = 1L;
12 | 
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/main/java/com/alibaba/cola/dto/DTO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.dto;
 2 | 
 3 | import java.io.Serializable;
 4 | 
 5 | /**
 6 |  * Data Transfer object, including Command, Query and Response,
 7 |  *
 8 |  * Command and Query is CQRS concept.
 9 |  *
10 |  * @author Frank Zhang 2020.11.13
11 |  *
12 |  */
13 | public abstract class DTO implements Serializable {
14 | 
15 |     private static final long serialVersionUID = 1L;
16 | 
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/main/java/com/alibaba/cola/dto/Query.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.dto;
 2 | 
 3 | /**
 4 |  * Query request from Client.
 5 |  *
 6 |  * @author Frank Zhang 2020.11.13
 7 |  *
 8 |  */
 9 | public abstract class Query extends Command {
10 | 
11 |     private static final long serialVersionUID = 1L;
12 | 
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/main/java/com/alibaba/cola/dto/Scope.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.dto;
 2 | 
 3 | /**
 4 |  * 结果范围控制
 5 |  *
 6 |  * @author xiaochu.lbj
 7 |  */
 8 | public abstract class Scope extends DTO {
 9 | 
10 |     private static final long serialVersionUID = 1L;
11 | }
12 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/test/java/com/alibaba/cola/Test.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola;
2 | 
3 | public class Test {
4 | 
5 | }
6 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-dto/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml" />
 3 | 
 4 | 
 5 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 6 |        <encoder>
 7 |            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 8 |            <charset>utf8</charset>
 9 |        </encoder>
10 |    </appender>
11 | 
12 |    <!--rootLogger是默认的logger-->
13 |    <root level="INFO">
14 |        <!--定义了两个appender,日志会通过往这两个appender里面写-->
15 |        <appender-ref ref="CONSOLE"/>
16 |    </root>
17 | 
18 |    <!--应用日志-->
19 |    <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
20 |    <logger name="com.alibaba.cola" level="DEBUG"/>
21 | 
22 | </configuration>
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-exception/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-exception/README.md:
--------------------------------------------------------------------------------
 1 | ## 作用
 2 | 制定了Exception的相关规范,一是,为了复用;二是,使得应用层面的Logging和异常处理AOP成为可能。
 3 | 
 4 | 实际上,对于应用系统而言,只有三种类型的异常:
 5 | 1. BizException:业务异常,有明确的业务语义,不需要记录Error日志,不需要Retry
 6 | 2. SysException:已知的系统异常,需要记录Error日志,可以Retry
 7 | 3. Exception:未知的其它异常,需要完整的Error Stack日志,可以Retry
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-exception/src/test/java/com/alibaba/cola/exception/Test.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.exception;
2 | 
3 | public class Test {
4 | 
5 | }
6 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-exception/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml" />
 3 | 
 4 | 
 5 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 6 |        <encoder>
 7 |            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 8 |            <charset>utf8</charset>
 9 |        </encoder>
10 |    </appender>
11 | 
12 |    <!--rootLogger是默认的logger-->
13 |    <root level="INFO">
14 |        <!--定义了两个appender,日志会通过往这两个appender里面写-->
15 |        <appender-ref ref="CONSOLE"/>
16 |    </root>
17 | 
18 |    <!--应用日志-->
19 |    <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
20 |    <logger name="com.alibaba.cola.exception" level="DEBUG"/>
21 | 
22 | </configuration>
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/README.md:
--------------------------------------------------------------------------------
 1 | ## 作用
 2 | 该组件继承了老Cola Framework中的扩展点功能,旨在通过统一的扩展形式来支撑业务的变化。
 3 | 
 4 | ## 原理
 5 | https://blog.csdn.net/significantfrank/article/details/100074716
 6 | 
 7 | ## 使用介绍
 8 | 参看测试代码`com.alibaba.cola.extension.ExtensionTest`
 9 | 
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/ExtensionPointI.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension;
 2 | 
 3 | /**
 4 |  *  ExtensionPointI is the parent interface of all ExtensionPoints
 5 |  *  扩展点表示一块逻辑在不同的业务有不同的实现,使用扩展点做接口申明,然后用Extension(扩展)去实现扩展点。 
 6 |  * @author fulan.zjf 2017-10-22
 7 |  */
 8 | public interface ExtensionPointI {
 9 | 
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration = com.alibaba.cola.extension.ExtensionAutoConfiguration
2 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/Application.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | import org.springframework.context.annotation.ComponentScan;
 6 | 
 7 | /**
 8 |  * Application
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2020-11-10 3:58 PM
12 |  */
13 | @SpringBootApplication
14 | @ComponentScan(basePackages = "com.alibaba.cola")
15 | public class Application {
16 | 
17 |     public static void main(String[] args) {
18 |         SpringApplication.run(Application.class, args);
19 |     }
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/CustomerCreatedEventHandler.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.app;
 2 | 
 3 | import com.alibaba.cola.dto.Response;
 4 | import com.alibaba.cola.extension.customer.client.CustomerCreatedEvent;
 5 | 
 6 | /**
 7 |  * CustomerCreatedEventHandler
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-06-22 7:00 PM
11 |  */
12 | public class CustomerCreatedEventHandler {
13 | 
14 |     public Response execute(CustomerCreatedEvent customerCreatedEvent) {
15 |         System.out.println("customerCreatedEvent processed");
16 |         return null;
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/GetOneCustomerQryExe.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.app;
 2 | 
 3 | import com.alibaba.cola.dto.SingleResponse;
 4 | import com.alibaba.cola.extension.customer.client.GetOneCustomerQry;
 5 | import org.springframework.stereotype.Component;
 6 | 
 7 | /**
 8 |  * GetOneCustomerQryExe
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2020-06-22 5:12 PM
12 |  */
13 | @Component
14 | public class GetOneCustomerQryExe {
15 | 
16 |     public SingleResponse execute(GetOneCustomerQry getOneCustomerQry){
17 |         return null;
18 |     }
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/AddCustomerValidatorExtPt.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.app.extensionpoint;
 2 | 
 3 | import com.alibaba.cola.extension.ExtensionPointI;
 4 | import com.alibaba.cola.extension.customer.client.AddCustomerCmd;
 5 | 
 6 | /**
 7 |  * AddCustomerValidatorExtPt
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-07 1:27 AM
11 |  */
12 | public interface AddCustomerValidatorExtPt extends ExtensionPointI {
13 | 
14 |     public void validate(AddCustomerCmd addCustomerCmd);
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/CustomerConvertorExtPt.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.app.extensionpoint;
 2 | 
 3 | import com.alibaba.cola.extension.ExtensionPointI;
 4 | import com.alibaba.cola.extension.customer.client.AddCustomerCmd;
 5 | import com.alibaba.cola.extension.customer.domain.CustomerEntity;
 6 | 
 7 | /**
 8 |  * CustomerConvertorExtPt
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2018-01-07 2:37 AM
12 |  */
13 | public interface CustomerConvertorExtPt extends ExtensionPointI {
14 | 
15 |     public CustomerEntity clientToEntity(AddCustomerCmd addCustomerCmd);
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/app/extensionpoint/StatusNameConvertorExtPt.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.app.extensionpoint;
 2 | 
 3 | import com.alibaba.cola.extension.ExtensionPointI;
 4 | 
 5 | /**
 6 |  * This extension point supports state transition operations of multiple manufacturers and different business lines
 7 |  *
 8 |  * @author wangguoqiang wrote on 2022/10/10 14:37
 9 |  * @version 1.0
10 |  */
11 | public interface StatusNameConvertorExtPt extends ExtensionPointI {
12 |     String statusNameConvertor(Integer statusCode);
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/AddCustomerCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.client;
 2 | 
 3 | 
 4 | import com.alibaba.cola.dto.Command;
 5 | import com.alibaba.cola.extension.BizScenario;
 6 | import lombok.Data;
 7 | 
 8 | /**
 9 |  * AddCustomerCmd
10 |  *
11 |  * @author Frank Zhang 2018-01-06 7:28 PM
12 |  */
13 | @Data
14 | public class AddCustomerCmd extends Command {
15 | 
16 |     private CustomerDTO customerDTO;
17 | 
18 |     private String biz;
19 | 
20 |     private BizScenario bizScenario;
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerCreatedEvent.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.client;
 2 | 
 3 | /**
 4 |  * CustomerCreatedEvent
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-06-22 6:59 PM
 8 |  */
 9 | public class CustomerCreatedEvent {
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/CustomerServiceI.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.client;
 2 | 
 3 | import com.alibaba.cola.dto.Response;
 4 | import com.alibaba.cola.dto.SingleResponse;
 5 | 
 6 | /**
 7 |  * CustomerServiceI
 8 |  *
 9 |  * @author Frank Zhang 2018-01-06 7:24 PM
10 |  */
11 | public interface CustomerServiceI {
12 |     public Response addCustomer(AddCustomerCmd addCustomerCmd);
13 |     public SingleResponse<CustomerDTO> getCustomer(GetOneCustomerQry getOneCustomerQry);
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/client/GetOneCustomerQry.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.client;
 2 | 
 3 | import com.alibaba.cola.dto.Query;
 4 | 
 5 | /**
 6 |  * GetOneCustomerQry
 7 |  *
 8 |  * @author Frank Zhang 2018-01-06 7:38 PM
 9 |  */
10 | public class GetOneCustomerQry extends Query{
11 |     private long customerId;
12 |     private String companyName;
13 | 
14 |     public long getCustomerId() {
15 |         return customerId;
16 |     }
17 | 
18 |     public void setCustomerId(long customerId) {
19 |         this.customerId = customerId;
20 |     }
21 | 
22 |     public String getCompanyName() {
23 |         return companyName;
24 |     }
25 | 
26 |     public void setCompanyName(String companyName) {
27 |         this.companyName = companyName;
28 |     }
29 | }
30 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/CustomerType.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.domain;
 2 | 
 3 | /**
 4 |  * CustomerType
 5 |  *
 6 |  * @author Frank Zhang 2018-01-06 7:35 PM
 7 |  */
 8 | public enum CustomerType {
 9 |     POTENTIAL,
10 |     INTENTIONAL,
11 |     IMPORTANT,
12 |     VIP;
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/SourceType.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.domain;
 2 | 
 3 | /**
 4 |  * SourceType
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2018-01-07 3:02 AM
 8 |  */
 9 | public enum SourceType {
10 |     AD, //Advertisement 广告
11 |     WB, // Web site 网站
12 |     RFQ; // Request For Quota 询盘
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerBizTwoRuleExt.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.domain.rule;
 2 | 
 3 | import com.alibaba.cola.extension.Extension;
 4 | import com.alibaba.cola.extension.customer.client.Constants;
 5 | import com.alibaba.cola.extension.customer.domain.CustomerEntity;
 6 | 
 7 | /**
 8 |  * CustomerBizTwoRuleExt
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2018-01-07 12:10 PM
12 |  */
13 | @Extension(bizId = Constants.BIZ_2)
14 | public class CustomerBizTwoRuleExt implements CustomerRuleExtPt{
15 | 
16 |     @Override
17 |     public boolean addCustomerCheck(CustomerEntity customerEntity) {
18 |         //Any Customer can be added
19 |         return true;
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/domain/rule/CustomerRuleExtPt.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.domain.rule;
 2 | 
 3 | import com.alibaba.cola.extension.ExtensionPointI;
 4 | import com.alibaba.cola.extension.customer.domain.CustomerEntity;
 5 | 
 6 | /**
 7 |  * CustomerRuleExtPt
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-07 12:03 PM
11 |  */
12 | public interface CustomerRuleExtPt extends ExtensionPointI {
13 | 
14 |     //Different business check for different biz
15 |     public boolean addCustomerCheck(CustomerEntity customerEntity);
16 | 
17 |     //Different upgrade policy for different biz
18 |     default public void customerUpgradePolicy(CustomerEntity customerEntity){
19 |         //Nothing special
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/CustomerRepository.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.infrastructure;
 2 | 
 3 | import com.alibaba.cola.extension.customer.domain.CustomerEntity;
 4 | import org.springframework.stereotype.Repository;
 5 | 
 6 | /**
 7 |  * CustomerRepository
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-01-07 11:59 AM
11 |  */
12 | @Repository
13 | public class CustomerRepository {
14 | 
15 |     public void persist(CustomerEntity customerEntity){
16 |         System.out.println("Persist customer to DB : "+ customerEntity);
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/customer/infrastructure/DomainEventPublisher.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.customer.infrastructure;
 2 | 
 3 | import org.springframework.stereotype.Component;
 4 | 
 5 | /**
 6 |  * DomainEventPublisher
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-06-22 7:04 PM
10 |  */
11 | @Component
12 | public class DomainEventPublisher {
13 | /*    @Resource
14 |     private EventBusI eventBus;
15 | 
16 |     public void publish(DomainEventI domainEvent) {
17 |         eventBus.fire(domainEvent);
18 |     }*/
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/SomeExtPt.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.extension.register;
2 | 
3 | import com.alibaba.cola.extension.ExtensionPointI;
4 | 
5 | public interface SomeExtPt extends ExtensionPointI {
6 |     
7 |     public void doSomeThing();
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/SomeExtensionA.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.register;
 2 | 
 3 | import com.alibaba.cola.extension.Extension;
 4 | 
 5 | import org.springframework.stereotype.Component;
 6 | 
 7 | @Extension(bizId = "A")
 8 | @Component
 9 | public class SomeExtensionA implements SomeExtPt {
10 | 
11 |     @Override
12 |     public void doSomeThing() {
13 |         System.out.println("SomeExtensionA::doSomething");
14 |     }
15 | 
16 | }


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/java/com/alibaba/cola/extension/register/SomeExtensionB.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.extension.register;
 2 | 
 3 | import com.alibaba.cola.extension.Extension;
 4 | 
 5 | import org.springframework.stereotype.Component;
 6 | 
 7 | @Extension(bizId = "B")
 8 | @Component
 9 | public class SomeExtensionB implements SomeExtPt {
10 | 
11 |     @Override
12 |     public void doSomeThing() {
13 |         System.out.println("SomeExtensionB::doSomething");
14 |     }
15 |     
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-components/cola-component-extension-starter/src/test/resources/application.properties


--------------------------------------------------------------------------------
/cola-components/cola-component-extension-starter/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <!--定义了两个appender,日志会通过往这两个appender里面写-->
14 |         <appender-ref ref="CONSOLE"/>
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
19 |     <logger name="com.alibaba.cola.extension" level="DEBUG"/>
20 | 
21 | </configuration>
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/JobException.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job;
 2 | 
 3 | public class JobException extends RuntimeException{
 4 |     public JobException(String message){
 5 |         super(message);
 6 |     }
 7 | 
 8 |     public JobException(Exception e){
 9 |         super(e);
10 |     }
11 | }
12 | 
13 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/config/EnableColaJob.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.config;
 2 | 
 3 | 
 4 | import org.springframework.context.annotation.Import;
 5 | 
 6 | import java.lang.annotation.Documented;
 7 | import java.lang.annotation.ElementType;
 8 | import java.lang.annotation.Retention;
 9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 | 
12 | @Target(ElementType.TYPE)
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Import(EnableJobConfiguration.class)
15 | @Documented
16 | public @interface EnableColaJob {
17 | 
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/config/JobProperties.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.config;
 2 | 
 3 | import com.alibaba.cola.job.repository.RepositoryType;
 4 | import lombok.Data;
 5 | import org.springframework.boot.context.properties.ConfigurationProperties;
 6 | import org.springframework.context.annotation.Configuration;
 7 | 
 8 | @Data
 9 | @Configuration
10 | @ConfigurationProperties(prefix = "cola.job")
11 | public class JobProperties {
12 |     private RepositoryType repositoryType;
13 |     private DatabaseProperties database;
14 | 
15 |     // database配置,数据库配置会自动映射到 cola.job.database 路径下
16 |     @Data
17 |     public static class DatabaseProperties {
18 |         private Boolean autoDdl;
19 |         private String ddlLocation;
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/model/JobInstance.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.model;
 2 | 
 3 | 
 4 | import com.alibaba.cola.job.ExecutionContext;
 5 | import lombok.AllArgsConstructor;
 6 | import lombok.Data;
 7 | 
 8 | /**
 9 |  * Job实例:包含了Job的定义,以及运行job的runtime信息,也就是ExecutionContext
10 |  * 一个BatchJob会包含多个JobInstance,是为了BatchJob创建的模型。
11 |  */
12 | @Data
13 | @AllArgsConstructor
14 | public class JobInstance {
15 |     private Job job;
16 |     private ExecutionContext executionContext;
17 | }
18 | 
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/model/Step.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.model;
 2 | 
 3 | public interface Step {
 4 | 
 5 |     void execute(StepExecution stepExecution);
 6 | 
 7 |     void rollback(StepExecution stepExecution);
 8 | 
 9 |     boolean needRollBack(StepExecution stepExecution);
10 | 
11 |     void setJob(Job job);
12 | 
13 |     Job getJob();
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/repository/AbstractJobRepository.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.repository;
 2 | 
 3 | import com.alibaba.cola.job.model.BatchJobExecution;
 4 | 
 5 | import java.time.LocalDateTime;
 6 | import java.util.List;
 7 | 
 8 | public abstract class AbstractJobRepository implements JobRepository {
 9 |     @Override
10 |     public List<BatchJobExecution> findNotCompletedBatchJobsOlderThan(LocalDateTime thresholdTime) {
11 |         return null;
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/repository/RepositoryType.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.job.repository;
2 | 
3 | public enum RepositoryType {
4 |     REDIS,
5 |     DB,
6 |     MEMORY
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/repository/db/JobExecutionRepository.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.repository.db;
 2 | 
 3 | 
 4 | import com.alibaba.cola.job.model.JobExecution;
 5 | import org.springframework.data.jpa.repository.JpaRepository;
 6 | import org.springframework.stereotype.Repository;
 7 | 
 8 | @Repository
 9 | public interface JobExecutionRepository extends JpaRepository<JobExecution, String> {
10 |     JobExecution getByJobId(String jobId);
11 | }
12 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/repository/db/StepExecutionRepository.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.repository.db;
 2 | 
 3 | import com.alibaba.cola.job.model.StepExecution;
 4 | import org.springframework.data.jpa.repository.JpaRepository;
 5 | import org.springframework.stereotype.Repository;
 6 | 
 7 | import java.util.List;
 8 | 
 9 | @Repository
10 | public interface StepExecutionRepository extends JpaRepository<StepExecution, String> {
11 |     StepExecution getByStepId(String stepId);
12 |     StepExecution getByJobIdAndStepName(String jobId, String stepName);
13 |     List<StepExecution> findByJobId(String jobId);
14 | }
15 | 
16 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/TestApplication.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test;
 2 | 
 3 | import com.alibaba.cola.job.config.EnableColaJob;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | 
 6 | @SpringBootApplication
 7 | @EnableColaJob
 8 | public class TestApplication {
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/TestsContainerBoot.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test;
 2 | 
 3 | import com.alibaba.cola.test.TestsContainer;
 4 | 
 5 | public class TestsContainerBoot {
 6 |     public static void main(String[] args) {
 7 |         TestsContainer.start();
 8 |     }
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/steps/FailedStep.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test.steps;
 2 | 
 3 | import com.alibaba.cola.job.model.AbstractStep;
 4 | import com.alibaba.cola.job.model.StepExecution;
 5 | 
 6 | // This class is used to simulate a step that fails during execution
 7 | public class FailedStep extends AbstractStep {
 8 |     @Override
 9 |     public void doExecute(StepExecution stepExecution) {
10 |         System.out.println("this is FailedStep");
11 |         throw new RuntimeException("something wrong happened");
12 |     }
13 | 
14 |     @Override
15 |     public void doRollback(StepExecution stepExecution) {
16 | 
17 |     }
18 | 
19 |     @Override
20 |     public boolean needRollBack(StepExecution stepExecution) {
21 |         return false;
22 |     }
23 | }
24 | 
25 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/steps/MyStep1.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test.steps;
 2 | 
 3 | 
 4 | import com.alibaba.cola.job.model.AbstractStep;
 5 | import com.alibaba.cola.job.model.StepExecution;
 6 | 
 7 | public class MyStep1 extends AbstractStep {
 8 | 
 9 |     @Override
10 |     public void doRollback(StepExecution stepExecution) {
11 | 
12 |     }
13 | 
14 |     @Override
15 |     public void doExecute(StepExecution stepExecution) {
16 |         System.out.println("this is step1");
17 |         stepExecution.getExecutionContext().putString("step1", "something need pass to step2");
18 |     }
19 | 
20 |     @Override
21 |     public boolean needRollBack(StepExecution stepExecution) {
22 |         return true;
23 |     }
24 | }
25 | 
26 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/steps/MyStep2.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test.steps;
 2 | 
 3 | 
 4 | import com.alibaba.cola.job.model.AbstractStep;
 5 | import com.alibaba.cola.job.model.StepExecution;
 6 | 
 7 | public class MyStep2 extends AbstractStep {
 8 | 
 9 |     @Override
10 |     public void doRollback(StepExecution stepExecution) {
11 | 
12 |     }
13 | 
14 |     @Override
15 |     public void doExecute(StepExecution stepExecution) {
16 |         System.out.println("this is step2, information from step1: " + stepExecution.getExecutionContext().getString("step1"));
17 |         stepExecution.getExecutionContext().putString("step2", "valuable information to next");
18 |     }
19 | 
20 |     @Override
21 |     public boolean needRollBack(StepExecution stepExecution) {
22 |         return true;
23 |     }
24 | }
25 | 
26 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/steps/MyStep3.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test.steps;
 2 | 
 3 | 
 4 | import com.alibaba.cola.job.model.AbstractStep;
 5 | import com.alibaba.cola.job.model.StepExecution;
 6 | 
 7 | public class MyStep3 extends AbstractStep {
 8 | 
 9 |     @Override
10 |     public void doRollback(StepExecution stepExecution) {
11 |         System.out.println("this is step3 rollback");
12 |     }
13 | 
14 |     @Override
15 |     public void doExecute(StepExecution stepExecution) {
16 |         System.out.println("this is step3");
17 |         throw new RuntimeException("something wrong happened");
18 |     }
19 | 
20 |     @Override
21 |     public boolean needRollBack(StepExecution stepExecution) {
22 |         return true;
23 |     }
24 | }
25 | 
26 | 
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/java/com/alibaba/cola/job/test/steps/MyStep4.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.job.test.steps;
 2 | 
 3 | import com.alibaba.cola.job.model.AbstractStep;
 4 | import com.alibaba.cola.job.model.StepExecution;
 5 | 
 6 | public class MyStep4 extends AbstractStep {
 7 | 
 8 |     @Override
 9 |     public void doRollback(StepExecution stepExecution) {
10 |         System.out.println("this is step4 rollback");
11 |         throw new RuntimeException("oops, rollback failed");
12 |     }
13 | 
14 |     @Override
15 |     public void doExecute(StepExecution stepExecution) {
16 |         System.out.println("this is step4");
17 |         throw new RuntimeException("something wrong happened");
18 |     }
19 | 
20 |     @Override
21 |     public boolean needRollBack(StepExecution stepExecution) {
22 |         return true;
23 |     }
24 | }
25 | 
26 | 
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/resources/application-h2-test.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     url: jdbc:h2:mem:testdb
 4 |     username: sa
 5 |     password:
 6 |     driver-class-name: org.h2.Driver
 7 |   jpa:
 8 |     database-platform: org.hibernate.dialect.H2Dialect
 9 |     properties:
10 |       hibernate:
11 |         format_sql: true
12 | 
13 | cola:
14 |   job:
15 |     repository-type: db
16 |     database:
17 |       auto-ddl: true
18 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/resources/application-mysql-test.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: com.mysql.cj.jdbc.Driver
 4 |     # hard code for test purpose
 5 |     url: jdbc:mysql://localhost:3306/colaJob?serverTimezone=UTC
 6 |     username: root
 7 |     password: root
 8 |   jpa:
 9 |     database-platform: org.hibernate.dialect.H2Dialect
10 |     properties:
11 |       hibernate:
12 |         format_sql: true
13 | 
14 | cola:
15 |   job:
16 |     repository-type: db
17 |     database:
18 |       auto-ddl: true
19 |       ddl-location: schema-mysql.sql
20 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-job/src/test/resources/application-redis-test.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   data:
 3 |     redis:
 4 |       host: localhost
 5 |       port: 6379
 6 | 
 7 | cola:
 8 |   job:
 9 |     repository-type: redis
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/README.md:
--------------------------------------------------------------------------------
 1 | ## 介绍
 2 | 这是COLA规则引擎
 3 | 
 4 | ## 使用
 5 | hello world 案例:
 6 | ```java
 7 |         RuleEngine ruleEngine = new DefaultRuleEngine();
 8 |         Rule rule = new RuleBuilder()
 9 |                 .name("hello world rule")
10 |                 .description("always say hello world")
11 |                 .priority(1)
12 |                 .when(facts -> true)
13 |                 .then(facts -> System.out.println("hello world"))
14 |                 .build();
15 |         Rules rules = new Rules();
16 |         rules.register(rule);
17 | 
18 |         ruleEngine.fire(rules, null);
19 | ```
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/gitignore.txt:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/main/java/com/alibaba/cola/ruleengine/api/Action.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.ruleengine.api;
2 | 
3 | @FunctionalInterface
4 | public interface Action {
5 |     void execute(Facts facts);
6 | }
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/main/java/com/alibaba/cola/ruleengine/api/RuleEngine.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.ruleengine.api;
 2 | 
 3 | public interface RuleEngine {
 4 |     /**
 5 |      * Fire rule on given facts.
 6 |      */
 7 |     void fire(Rule rule, Facts facts);
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/main/java/com/alibaba/cola/ruleengine/core/DefaultRuleEngine.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.ruleengine.core;
 2 | 
 3 | import com.alibaba.cola.ruleengine.api.Facts;
 4 | import com.alibaba.cola.ruleengine.api.Rule;
 5 | import com.alibaba.cola.ruleengine.api.RuleEngine;
 6 | import org.slf4j.Logger;
 7 | import org.slf4j.LoggerFactory;
 8 | 
 9 | public class DefaultRuleEngine implements RuleEngine {
10 |     private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRuleEngine.class);
11 | 
12 |     @Override
13 |     public void fire(Rule rule, Facts facts) {
14 |         if (rule == null) {
15 |             LOGGER.error("Rules is null! Nothing to apply");
16 |             return;
17 |         }
18 |         rule.apply(facts);
19 |     }
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/java/com/alibaba/cola/ruleengine/fizzbuzz/v1/FizzBuzz.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.ruleengine.fizzbuzz.v1;
 2 | 
 3 | public class FizzBuzz {
 4 |     public static String count(int n){
 5 |         if (((n % 3) == 0) && ((n % 5) == 0))
 6 |             return "FizzBuzz";
 7 |         if ((n % 3) == 0)
 8 |             return "Fizz";
 9 |         if ((n % 5) == 0)
10 |             return "Buzz";
11 |         return String.valueOf(n);
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/java/com/alibaba/cola/ruleengine/fizzbuzz/v2/Action.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.ruleengine.fizzbuzz.v2;
2 | 
3 | @FunctionalInterface
4 | public interface Action {
5 |     String execute(int n);
6 | }
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/java/com/alibaba/cola/ruleengine/fizzbuzz/v2/Condition.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.ruleengine.fizzbuzz.v2;
 2 | 
 3 | import java.util.Objects;
 4 | 
 5 | @FunctionalInterface
 6 | public interface Condition {
 7 | 
 8 |     boolean evaluate(int n);
 9 | 
10 |     //谓词and逻辑,参考Predicate
11 |     default Condition and(Condition other) {
12 |         Objects.requireNonNull(other);
13 |         return (n) -> {
14 |             return this.evaluate(n) && other.evaluate(n);
15 |         };
16 |     }
17 | 
18 |     //谓词or逻辑,参考Predicate
19 |     default Condition or(Condition other) {
20 |         Objects.requireNonNull(other);
21 |         return (n) -> {
22 |             return this.evaluate(n) || other.evaluate(n);
23 |         };
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/java/com/alibaba/cola/ruleengine/fizzbuzz/v2/Rule.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.ruleengine.fizzbuzz.v2;
2 | 
3 | @FunctionalInterface
4 | public interface Rule {
5 |     String apply(int n);
6 | }
7 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/java/com/alibaba/cola/ruleengine/fizzbuzz/v2/TimesCondition.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.ruleengine.fizzbuzz.v2;
 2 | 
 3 | /**
 4 |  * 计算倍数关系的谓词逻辑
 5 |  */
 6 | public class TimesCondition {
 7 |     public static Condition times(int i){
 8 |         return n -> n % i == 0;
 9 |     }
10 | }
11 | 
12 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-ruleengine/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <!--定义了两个appender,日志会通过往这两个appender里面写-->
14 |         <appender-ref ref="CONSOLE"/>
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
19 |     <logger name="com.alibaba.cola.ruleengine" level="DEBUG"/>
20 | 
21 | </configuration>
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/README.md:
--------------------------------------------------------------------------------
1 | ## 作用
2 | 简单、轻量、性能极高的状态机DSL实现,解决业务中的状态流转问题。
3 | 
4 | ## 原理
5 | https://blog.csdn.net/significantfrank/article/details/104996419
6 | 
7 | 
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/Action.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine;
 2 | 
 3 | /**
 4 |  * Generic strategy interface used by a state machine to respond
 5 |  * events by executing an {@code Action} with a {@link StateContext}.
 6 |  *
 7 |  * @author Frank Zhang
 8 |  * @date 2020-02-07 2:51 PM
 9 |  */
10 | public interface Action<S, E, C> {
11 | 
12 | //    /**
13 | //     * Execute action with a {@link StateContext}.
14 | //     *
15 | //     * @param context the state context
16 | //     */
17 | //    void execute(StateContext<S, E> context);
18 | 
19 |     public void execute(S from, S to, E event, C context);
20 | 
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/Condition.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine;
 2 | 
 3 | /**
 4 |  * Condition
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 2:50 PM
 8 |  */
 9 | public interface Condition<C> {
10 | 
11 |     /**
12 |      * @param context context object
13 |      * @return whether the context satisfied current condition
14 |      */
15 |     boolean isSatisfied(C context);
16 | 
17 |     default String name(){
18 |         return this.getClass().getSimpleName();
19 |     }
20 | }


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/StateContext.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine;
 2 | 
 3 | /**
 4 |  * StateContext
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 2:49 PM
 8 |  */
 9 | public interface StateContext<S, E, C> {
10 |     /**
11 |      * Gets the transition.
12 |      *
13 |      * @return the transition
14 |      */
15 |     Transition<S, E, C> getTransition();
16 | 
17 |     /**
18 |      * Gets the state machine.
19 |      *
20 |      * @return the state machine
21 |      */
22 |     StateMachine<S, E, C> getStateMachine();
23 | }
24 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/Visitable.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine;
 2 | 
 3 | /**
 4 |  * Visitable
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-08 8:41 PM
 8 |  */
 9 | public interface Visitable {
10 |     String accept(final Visitor visitor);
11 | }
12 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/AlertFailCallback.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | import com.alibaba.cola.statemachine.exception.TransitionFailException;
 4 | 
 5 | /**
 6 |  * Alert fail callback, throw an {@code TransitionFailException}
 7 |  *
 8 |  * @author 龙也
 9 |  * @date 2022/9/15 12:02 PM
10 |  */
11 | public class AlertFailCallback<S, E, C> implements FailCallback<S, E, C> {
12 | 
13 |     @Override
14 |     public void onFail(S sourceState, E event, C context) {
15 |         throw new TransitionFailException(
16 |             "Cannot fire event [" + event + "] on current state [" + sourceState + "] with context [" + context + "]"
17 |         );
18 |     }
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/ExternalParallelTransitionBuilder.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | 
 4 | public interface ExternalParallelTransitionBuilder<S, E, C> {
 5 |     /**
 6 |      * Build transition source state.
 7 |      * @param stateId id of state
 8 |      * @return from clause builder
 9 |      */
10 |     ParallelFrom<S, E, C> from(S stateId);
11 | 
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/ExternalTransitionBuilder.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * ExternalTransitionBuilder
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 6:11 PM
 8 |  */
 9 | public interface ExternalTransitionBuilder<S, E, C> {
10 |     /**
11 |      * Build transition source state.
12 |      * @param stateId id of state
13 |      * @return from clause builder
14 |      */
15 |     From<S, E, C> from(S stateId);
16 | 
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/ExternalTransitionsBuilder.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * ExternalTransitionsBuilder
 5 |  *
 6 |  * This builder is for multiple transitions, currently only support multiple sources <----> one target
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-02-08 7:41 PM
10 |  */
11 | public interface ExternalTransitionsBuilder<S, E, C> {
12 |     From<S, E, C> fromAmong(S... stateIds);
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/FailCallback.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * FailCallback
 5 |  *
 6 |  * @author 龙也
 7 |  * @date 2022/9/15 12:02 PM
 8 |  */
 9 | @FunctionalInterface
10 | public interface FailCallback<S, E, C> {
11 | 
12 |     /**
13 |      * Callback function to execute if failed to trigger an Event
14 |      *
15 |      * @param sourceState
16 |      * @param event
17 |      * @param context
18 |      */
19 |     void onFail(S sourceState, E event, C context);
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/From.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * From
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 6:13 PM
 8 |  */
 9 | public interface From<S, E, C> {
10 |     /**
11 |      * Build transition target state and return to clause builder
12 |      * @param stateId id of state
13 |      * @return To clause builder
14 |      */
15 |     To<S, E, C> to(S stateId);
16 | 
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/InternalTransitionBuilder.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * InternalTransitionBuilder
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 9:39 PM
 8 |  */
 9 | public interface InternalTransitionBuilder <S, E, C> {
10 |     /**
11 |      * Build a internal transition
12 |      * @param stateId id of transition
13 |      * @return To clause builder
14 |      */
15 |     To<S, E, C> within(S stateId);
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/NumbFailCallback.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * Default fail callback, do nothing.
 5 |  *
 6 |  * @author 龙也
 7 |  * @date 2022/9/15 12:02 PM
 8 |  */
 9 | public class NumbFailCallback<S, E, C> implements FailCallback<S, E, C> {
10 | 
11 |     @Override
12 |     public void onFail(S sourceState, E event, C context) {
13 |         //do nothing
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/On.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | import com.alibaba.cola.statemachine.Condition;
 4 | 
 5 | /**
 6 |  * On
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-02-07 6:14 PM
10 |  */
11 | public interface On<S, E, C> extends When<S, E, C>{
12 |     /**
13 |      * Add condition for the transition
14 |      * @param condition transition condition
15 |      * @return When clause builder
16 |      */
17 |     When<S, E, C> when(Condition<C> condition);
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/ParallelFrom.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | 
 4 | public interface ParallelFrom<S, E, C> {
 5 |     /**
 6 |      * Build transition target state and return to clause builder
 7 |      * @param stateIds id of state
 8 |      * @return To clause builder
 9 |      */
10 |     To<S, E, C> toAmong(S ... stateIds);
11 | 
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/StateMachineBuilderFactory.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * StateMachineBuilderFactory
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-08 12:33 PM
 8 |  */
 9 | public class StateMachineBuilderFactory {
10 |     public static <S, E, C> StateMachineBuilder<S, E, C> create(){
11 |         return new StateMachineBuilderImpl<>();
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/To.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | /**
 4 |  * To
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-07 6:14 PM
 8 |  */
 9 | public interface To<S, E, C> {
10 |     /**
11 |      * Build transition event
12 |      * @param event transition event
13 |      * @return On clause builder
14 |      */
15 |     On<S, E, C> on(E event);
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/When.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.builder;
 2 | 
 3 | import com.alibaba.cola.statemachine.Action;
 4 | 
 5 | /**
 6 |  * When
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-02-07 9:33 PM
10 |  */
11 | public interface When<S, E, C>{
12 |     /**
13 |      * Define action to be performed during transition
14 |      *
15 |      * @param action performed action
16 |      */
17 |     void perform(Action<S, E, C> action);
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 |  * The builder is to provide fluent interfaces for statemachine, which is a classic Internal DSL implementing skill.
3 |  *
4 |  * For more information, please check Martin Fowler's Article: <a>https://martinfowler.com/bliki/FluentInterface.html</a>
5 |  * @author Frank Zhang
6 |  */
7 | package com.alibaba.cola.statemachine.builder;


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/exception/TransitionFailException.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.exception;
 2 | 
 3 | /**
 4 |  * @author 龙也
 5 |  * @date 2022/9/15 12:08 PM
 6 |  */
 7 | public class TransitionFailException extends RuntimeException {
 8 | 
 9 |     public TransitionFailException(String errMsg) {
10 |         super(errMsg);
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/impl/Debugger.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.impl;
 2 | 
 3 | /**
 4 |  * Debugger, This is used to decouple Logging framework dependency
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-11 11:08 AM
 8 |  */
 9 | public class Debugger {
10 | 
11 |     private static boolean isDebugOn = false;
12 | 
13 |     public static void debug(String message){
14 |         if(isDebugOn){
15 |             System.out.println(message);
16 |         }
17 |     }
18 | 
19 |     public static void enableDebug(){
20 |         isDebugOn = true;
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-statemachine/src/main/java/com/alibaba/cola/statemachine/impl/StateMachineException.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.statemachine.impl;
 2 | 
 3 | /**
 4 |  * StateMachineException
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-02-08 5:28 PM
 8 |  */
 9 | public class StateMachineException extends RuntimeException{
10 |     public StateMachineException(String message){
11 |         super(message);
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/README.md:
--------------------------------------------------------------------------------
 1 | ## 作用
 2 | 测试工具,当容器启动比较耗时的时候,这个工具特别有用,用法摘要:
 3 | 
 4 | 启动TestsContainer
 5 | 1. 运行测试类,在命令行中输入类全称:com.alibaba.cola.test.Demo
 6 | 2. 运行单个方法,在命令行中输入方法引用:com.alibaba.cola.test.Demo#testTwo
 7 | 3. 重复运行,输入r
 8 | 
 9 | 
10 | 
11 | 
12 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/src/main/java/com/alibaba/cola/test/command/TestClassRunCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.test.command;
 2 | 
 3 | import com.alibaba.cola.test.TestsContainer;
 4 | 
 5 | /**
 6 |  * TestClassRunCmd
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-11-17 4:42 PM
10 |  */
11 | public class TestClassRunCmd extends AbstractCommand {
12 |     private String className;
13 | 
14 |     public TestClassRunCmd(String cmdRaw) {
15 |         super(cmdRaw);
16 |         this.className = cmdRaw;
17 |     }
18 | 
19 |     @Override
20 |     protected void action() {
21 |         try {
22 |             TestsContainer.getTestExecutor().execute(this);
23 |         } catch (Exception e) {
24 |             e.printStackTrace();
25 |         }
26 |     }
27 | 
28 |     public String getClassName() {
29 |         return className;
30 |     }
31 | }
32 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/src/test/java/com/alibaba/cola/test/SpringBootConfig.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.cola.test;
2 | 
3 | import org.springframework.boot.autoconfigure.SpringBootApplication;
4 | 
5 | @SpringBootApplication
6 | public class SpringBootConfig {
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/src/test/java/com/alibaba/cola/test/SpringConfig.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.test;
 2 | 
 3 | import org.springframework.context.annotation.Bean;
 4 | import org.springframework.context.annotation.ComponentScan;
 5 | import org.springframework.context.annotation.Configuration;
 6 | 
 7 | /**
 8 |  * SpringConfig
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2020-11-17 5:11 PM
12 |  */
13 | @Configuration
14 | @ComponentScan
15 | public class SpringConfig {
16 | 
17 |     @Bean("demo")
18 |     public Demo generateDemo(){
19 |         return new Demo();
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/src/test/java/com/alibaba/cola/test/TestsContainerTest.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.test;
 2 | 
 3 | import org.springframework.context.ApplicationContext;
 4 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 5 | 
 6 | /**
 7 |  * TestsContainerTest
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-11-17 4:55 PM
11 |  */
12 | public class TestsContainerTest {
13 |     public static void main(String[] args) {
14 |         TestsContainer.start();
15 |     }
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-test-container/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml" />
 3 | 
 4 | 
 5 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 6 |        <encoder>
 7 |            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 8 |            <charset>utf8</charset>
 9 |        </encoder>
10 |    </appender>
11 | 
12 |    <!--rootLogger是默认的logger-->
13 |    <root level="INFO">
14 |        <!--定义了两个appender,日志会通过往这两个appender里面写-->
15 |        <appender-ref ref="CONSOLE"/>
16 |    </root>
17 | 
18 |    <!--应用日志-->
19 |    <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
20 |    <logger name="com.alibaba.cola.test" level="DEBUG"/>
21 | 
22 | </configuration>
23 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/kafka/MessageData.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.kafka;
 2 | 
 3 | import com.fasterxml.jackson.databind.node.ObjectNode;
 4 | import lombok.Data;
 5 | import lombok.EqualsAndHashCode;
 6 | import lombok.ToString;
 7 | 
 8 | import java.util.List;
 9 | 
10 | @Data
11 | @EqualsAndHashCode
12 | @ToString
13 | public class MessageData {
14 |     private String topic;
15 |     private List<ObjectNode> messages;
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/kafka/ProduceMessage.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.kafka;
 2 | 
 3 | import java.lang.annotation.ElementType;
 4 | import java.lang.annotation.Retention;
 5 | import java.lang.annotation.RetentionPolicy;
 6 | import java.lang.annotation.Target;
 7 | 
 8 | @Retention(RetentionPolicy.RUNTIME)
 9 | @Target( {ElementType.TYPE, ElementType.METHOD})
10 | public @interface ProduceMessage {
11 | 
12 |     String value();
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/redis/ExpectRedis.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.redis;
 2 | 
 3 | import java.lang.annotation.ElementType;
 4 | import java.lang.annotation.Retention;
 5 | import java.lang.annotation.RetentionPolicy;
 6 | import java.lang.annotation.Target;
 7 | 
 8 | @Retention(RetentionPolicy.RUNTIME)
 9 | @Target( {ElementType.TYPE, ElementType.METHOD})
10 | public @interface ExpectRedis {
11 |     /**
12 |      * 测试校验数据路径, 通常放在测试夹具(fixture)下面
13 |      */
14 |     String value();
15 | 
16 |     /**
17 |      * 重试等待key生效的间隔(ms)
18 |      */
19 |     long interval() default 200L;
20 | 
21 |     /**
22 |      * 验证超时时间(ms)
23 |      */
24 |     long timeout() default 3000L;
25 | }
26 | 
27 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/redis/RedisData.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.redis;
 2 | 
 3 | import com.fasterxml.jackson.databind.JsonNode;
 4 | import lombok.AllArgsConstructor;
 5 | import lombok.Data;
 6 | import lombok.NoArgsConstructor;
 7 | 
 8 | import java.util.Map;
 9 | 
10 | /**
11 |  * 使用jackson:https://zhuanlan.zhihu.com/p/646744855
12 |  */
13 | @Data
14 | @AllArgsConstructor
15 | @NoArgsConstructor
16 | public class RedisData {
17 |     // Map<redis key, json content>
18 |     private Map<String, JsonNode> records;
19 | }
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/redis/SetupRedis.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.redis;
 2 | 
 3 | import java.lang.annotation.ElementType;
 4 | import java.lang.annotation.Retention;
 5 | import java.lang.annotation.RetentionPolicy;
 6 | import java.lang.annotation.Target;
 7 | 
 8 | /**
 9 |  * 测试启动时注入redis记录
10 |  */
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Target( {ElementType.TYPE, ElementType.METHOD})
13 | public @interface SetupRedis {
14 |     /**
15 |      * 测试准备数据路径, 通常放在测试夹具(fixture)下面,比如:/fixture/job.json
16 |      */
17 |     String value();
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/main/java/com/alibaba/cola/unittest/wiremock/WireMockRegister.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.wiremock;
 2 | 
 3 | import com.alibaba.cola.unittest.FixtureLoader;
 4 | import com.github.tomakehurst.wiremock.client.WireMock;
 5 | import com.github.tomakehurst.wiremock.stubbing.StubMapping;
 6 | 
 7 | public class WireMockRegister {
 8 | 
 9 |     public static void registerStub(WireMock wireMock, String resourcePath){
10 |         StubMapping stubMapping = StubMapping.buildFrom(FixtureLoader.loadResource(resourcePath));
11 |         wireMock.register(stubMapping);
12 |     }
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/java/com/alibaba/cola/unittest/Application.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | 
 6 | /**
 7 |  * Application
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-11-10 3:58 PM
11 |  */
12 | @SpringBootApplication(scanBasePackages = {"com.alibaba.cola.unittest"})
13 | public class Application {
14 | 
15 |     public static void main(String[] args) {
16 |         SpringApplication.run(Application.class, args);
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/java/com/alibaba/cola/unittest/TestsContainerBoot.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest;
 2 | 
 3 | import com.alibaba.cola.test.TestsContainer;
 4 | 
 5 | public class TestsContainerBoot {
 6 |     public static void main(String[] args) {
 7 |         TestsContainer.start();
 8 |     }
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/java/com/alibaba/cola/unittest/wiremock/Account.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.cola.unittest.wiremock;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class Account {
 7 |     /**
 8 |      * 用户号码
 9 |      */
10 |     private long phoneNo;
11 | 
12 |     /**
13 |      * 账户余额
14 |      */
15 |     private String remaining;
16 | 
17 | 
18 |     private String name;
19 | }
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/application.properties:
--------------------------------------------------------------------------------
1 | test.topic=embedded-test-topic
2 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/db/sample-data.xml:
--------------------------------------------------------------------------------
1 | <?xml version='1.0' encoding='UTF-8'?>
2 | 
3 | <dataset>
4 |     <Person id="0" title="Mr" first_name="Phillip" last_name="Webb"/>
5 |     <Person id="1" title="Mr" first_name="Mario" last_name="Zagar"/>
6 | </dataset>
7 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/redis/array-setup.json:
--------------------------------------------------------------------------------
1 | {
2 |   "records": {
3 |     "test:array": [
4 |       "30000000-0000-0000-0000-000000000001",
5 |       "30000000-0000-0000-0000-000000000002"
6 |     ]
7 |   }
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/redis/hash-setup.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "records": {
 3 |     "test:hash": {
 4 |       "version": 1,
 5 |       "json": {
 6 |         "id": "30000000-0000-0000-0000-000000000001",
 7 |         "name": "port-01",
 8 |         "project_id": "7a9941d34fc1497d8d0797429ecfd354",
 9 |         "provisioning_status": "active",
10 |         "created_at": "2024-01-01T12:00:00Z",
11 |         "updated_at": "2024-01-01T12:00:00Z"
12 |       }
13 |     }
14 |   }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/redis/string-expect.json:
--------------------------------------------------------------------------------
1 | {
2 |   "records": {
3 |     "topo:child_job:222": "{\"id\":\"12345678-1234-1234-1234-childJob0000\",\"parent_job_id\":\"12345678-1234-1234-1234-noParentJob0\",\"resource_id\":\"1.1.1.4\",\"status\":\"success\"}",
4 |     "topo:child_job:333": "{\"id\":\"12345678-1234-1234-1234-childJob0000\"}"
5 | 
6 |   }
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/redis/string-setup.json:
--------------------------------------------------------------------------------
1 | {
2 |   "records": {
3 |     "topo:child_job:222": "{\"id\":\"12345678-1234-1234-1234-childJob0000\",\"parent_job_id\":\"12345678-1234-1234-1234-noParentJob0\",\"resource_id\":\"1.1.1.4\",\"status\":\"success\"}",
4 |     "topo:child_job:333": "{\"id\":\"12345678-1234-1234-1234-childJob0000\"}"
5 | 
6 |   }
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/wiremock/stub-account.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/api/account/[0-9]+",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "transformers": [
12 |       "response-template"
13 |     ],
14 |     "jsonBody": {
15 |       "name": "frank",
16 |       "phoneNo": "{{request.path.[3]}}",
17 |       "remaining": "400",
18 |       "chargePlanList": [
19 |         {
20 |           "priority": "2",
21 |           "type": "fixedTime"
22 |         },
23 |         {
24 |           "priority": "1",
25 |           "type": "familyMember"
26 |         }
27 |       ]
28 |     }
29 |   }
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/fixture/wiremock/stub-wire-mock-basic.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/wiremock/basic",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "jsonBody": {
12 |       "request_id": "f7f9e747-f073-4ea8-8360-b42fc754a049",
13 |       "test_resource": {
14 |         "name": "1520-001",
15 |         "created_at": "2024-02-04 15:11:13",
16 |         "updated_at": "2020-02-04 15:11:13",
17 |         "type": "l1"
18 |       }
19 |     }
20 |   }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/cola-component-unittest/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%date{HH:mm:ss} %highlight(%-5level) [%blue(%t)] %yellow(%C{35}): %msg%n%throwable</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <!--定义了两个appender,日志会通过往这两个appender里面写-->
14 |         <appender-ref ref="CONSOLE"/>
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
19 |     <logger name="com.alibaba.cola.unittest" level="DEBUG"/>
20 | 
21 | </configuration>
22 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/README.md:
--------------------------------------------------------------------------------
1 | # COLA Dev Util Archetypes
2 | 
3 | 用于开发时快速生成`COLA Components`工程的Archetypes,即方便COLA自身开发的工具工程。
4 | 
5 | 提供了脚本,调用`Util Archetypes`生成`COLA Components`工程:
6 | 
7 | - [`new-cola-normal-component.sh`](new-cola-normal-component.sh)
8 | - [`new-cola-starter-component.sh`](new-cola-starter-component.sh)
9 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-normal-component-archetype/.gitignore:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-normal-component-archetype/src/main/resources/archetype-resources/gitignore.txt:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-normal-component-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | /**
 7 |  *
 8 |  * Dummy class
 9 |  *
10 |  * @author Frank Zhang
11 |  */
12 | public abstract class Dummy{
13 | 
14 |     private static final long serialVersionUID = 1L;
15 | 
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-normal-component-archetype/src/test/resources/projects/basic/archetype.properties:
--------------------------------------------------------------------------------
1 | #Fri Nov 13 12:26:43 CST 2020
2 | package=it.pkg
3 | version=0.1-SNAPSHOT
4 | groupId=archetype.it
5 | artifactId=basic
6 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-normal-component-archetype/src/test/resources/projects/basic/goal.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-components/dev-util-archetypes/cola-normal-component-archetype/src/test/resources/projects/basic/goal.txt


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/main/resources/archetype-resources/gitignore.txt:
--------------------------------------------------------------------------------
 1 | target/
 2 | 
 3 | ### STS ###
 4 | .apt_generated
 5 | .classpath
 6 | .factorypath
 7 | .project
 8 | .settings
 9 | .springBeans
10 | 
11 | ### IntelliJ IDEA ###
12 | .idea
13 | *.iws
14 | *.iml
15 | *.ipr
16 | out/
17 | 
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | bin/
25 | doc/
26 | .DS_Store
27 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/main/resources/archetype-resources/src/main/java/CatchAndLog.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package};
 5 | 
 6 | /**
 7 |  * CatchAndLog
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2020-11-10 10:48 AM
11 |  */
12 | 
13 | import java.lang.annotation.ElementType;
14 | import java.lang.annotation.Retention;
15 | import java.lang.annotation.RetentionPolicy;
16 | import java.lang.annotation.Target;
17 | 
18 | @Target({ElementType.METHOD, ElementType.TYPE})
19 | @Retention(RetentionPolicy.RUNTIME)
20 | public @interface CatchAndLog {
21 | 
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | org.springframework.boot.autoconfigure.EnableAutoConfiguration = ${package}.CatchLogAutoConfiguration
5 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/main/resources/archetype-resources/src/test/java/test/Application.java:
--------------------------------------------------------------------------------
 1 | #set( $symbol_pound = '#' )
 2 | #set( $symbol_dollar = '
#39; )
 3 | #set( $symbol_escape = '\' )
 4 | package ${package}.test;
 5 | 
 6 | import org.springframework.boot.SpringApplication;
 7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 8 | 
 9 | /**
10 |  * Application
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2020-11-10 3:58 PM
14 |  */
15 | @SpringBootApplication(scanBasePackages = {"${package}"})
16 | public class Application {
17 | 
18 |     public static void main(String[] args) {
19 |         SpringApplication.run(Application.class, args);
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/main/resources/archetype-resources/src/test/resources/application.properties:
--------------------------------------------------------------------------------
1 | #set( $symbol_pound = '#' )
2 | #set( $symbol_dollar = '
#39; )
3 | #set( $symbol_escape = '\' )
4 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/test/resources/projects/basic/archetype.properties:
--------------------------------------------------------------------------------
1 | #Fri Nov 13 16:34:48 CST 2020
2 | package=it.pkg
3 | version=0.1-SNAPSHOT
4 | groupId=archetype.it
5 | artifactId=basic
6 | 


--------------------------------------------------------------------------------
/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/test/resources/projects/basic/goal.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-components/dev-util-archetypes/cola-starter-component-archetype/src/test/resources/projects/basic/goal.txt


--------------------------------------------------------------------------------
/cola-samples/charge/img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-samples/charge/img.png


--------------------------------------------------------------------------------
/cola-samples/charge/img_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alibaba/COLA/d948f204d58fe7bd30a3ac919308a1311b76fec5/cola-samples/charge/img_1.png


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/Application.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | 
 6 | @SpringBootApplication
 7 | public class Application {
 8 | 
 9 |     public static void main(String[] args) {
10 |         SpringApplication.run(Application.class, args);
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/application/ChargeServiceI.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.application;
 2 | 
 3 | import com.huawei.charging.application.dto.*;
 4 | 
 5 | public interface ChargeServiceI {
 6 |     Response begin(BeginSessionRequest request);
 7 | 
 8 |     Response charge(ChargeRequest request);
 9 | 
10 |     Response end(EndSessionRequest request);
11 | 
12 |     MultiResponse<ChargeRecordDto> listChargeRecords(String sessionId);
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/application/dto/ChargeRequest.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.application.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class ChargeRequest {
 7 | 
 8 |     private String sessionId;
 9 | 
10 |     /**
11 |      * 当前通话,截止目前的累计时间
12 |      */
13 |     private int duration;
14 | 
15 |     public ChargeRequest() {
16 |     }
17 | 
18 |     public ChargeRequest(String sessionId, int duration) {
19 |         this.sessionId = sessionId;
20 |         this.duration = duration;
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/application/dto/EndSessionRequest.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.application.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class EndSessionRequest {
 7 |     private String sessionId;
 8 | 
 9 |     /**
10 |      * 当前通话,截止目前的累计时间
11 |      */
12 |     private int duration;
13 | 
14 |     public ChargeRequest toChargeRequest() {
15 |         ChargeRequest chargeRequest = new ChargeRequest();
16 |         chargeRequest.setSessionId(sessionId);
17 |         chargeRequest.setDuration(duration);
18 |         return chargeRequest;
19 |     }
20 | 
21 |     public EndSessionRequest() {
22 |     }
23 | 
24 |     public EndSessionRequest(String sessionId, int duration) {
25 |         this.sessionId = sessionId;
26 |         this.duration = duration;
27 |     }
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/BizException.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain;
 2 | 
 3 | public class BizException extends RuntimeException{
 4 | 
 5 |     public BizException(String errMessage) {
 6 |         super(errMessage);
 7 |     }
 8 | 
 9 |     public static BizException of(String errMessage){
10 |         return new BizException(errMessage);
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/DomainFactory.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain;
 2 | 
 3 | public class DomainFactory {
 4 | 
 5 |     public static <T> T get(Class<T> entityClz){
 6 |         return ApplicationContextHelper.getBean(entityClz);
 7 |     }
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/Entity.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain;
 2 | 
 3 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 4 | import org.springframework.context.annotation.Scope;
 5 | import org.springframework.stereotype.Component;
 6 | 
 7 | import java.lang.annotation.*;
 8 | 
 9 | @Inherited
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Target({ElementType.TYPE})
12 | @Component
13 | @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14 | public @interface Entity {
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/account/AccountDomainService.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.account;
 2 | 
 3 | import com.huawei.charging.domain.charge.Session;
 4 | import com.huawei.charging.domain.gateway.AccountGateway;
 5 | import jakarta.annotation.Resource;
 6 | import org.springframework.stereotype.Component;
 7 | 
 8 | 
 9 | @Component
10 | public class AccountDomainService {
11 | 
12 |     @Resource
13 |     private AccountGateway accountGateway;
14 | 
15 |     public void canSessionStart(Session session){
16 |         Account callingAccount = accountGateway.getAccount(session.getCallingPhoneNo());
17 |         Account calledAccount = accountGateway.getAccount(session.getCalledPhoneNo());
18 |         callingAccount.checkRemaining();
19 |         calledAccount.checkRemaining();
20 |     }
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/CallType.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.charge;
 2 | 
 3 | public enum CallType {
 4 |     /**
 5 |      * 主叫
 6 |      */
 7 |     CALLING,
 8 |     /**
 9 |      * 被叫
10 |      */
11 |     CALLED
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/MoneyConverter.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.charge;
 2 | 
 3 | 
 4 | import jakarta.persistence.AttributeConverter;
 5 | import jakarta.persistence.Converter;
 6 | 
 7 | @Converter(autoApply = true)
 8 | public class MoneyConverter implements AttributeConverter<Money,Long> {
 9 |     @Override
10 |     public Long convertToDatabaseColumn(Money entityData) {
11 |         return Long.valueOf(entityData.getAmount());
12 |     }
13 | 
14 |     @Override
15 |     public Money convertToEntityAttribute(Long dbData) {
16 |         return Money.of(dbData.intValue());
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/chargeplan/ChargePlanType.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.charge.chargeplan;
 2 | 
 3 | public enum ChargePlanType {
 4 |     /**
 5 |      * 基础套餐
 6 |      */
 7 |     BASIC,
 8 |     /**
 9 |      * 固定时常套餐
10 |      */
11 |     FIXED_TIME,
12 |     /**
13 |      * 家庭套餐
14 |      */
15 |     FAMILY
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/chargeplan/Resource.java:
--------------------------------------------------------------------------------
1 | package com.huawei.charging.domain.charge.chargeplan;
2 | 
3 | /**
4 |  * 套餐背后所绑定的资源
5 |  */
6 | public interface Resource {
7 | }
8 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/chargerule/AbstractChargeRule.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.charge.chargerule;
 2 | 
 3 | import com.huawei.charging.domain.charge.chargeplan.ChargePlan;
 4 | 
 5 | public abstract class AbstractChargeRule implements ChargeRule{
 6 |     protected ChargePlan chargePlan;
 7 | 
 8 |     @Override
 9 |     public void belongsTo(ChargePlan chargePlan){
10 |         this.chargePlan = chargePlan;
11 |     }
12 | 
13 | 
14 | }
15 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/chargerule/ChargeRule.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.charge.chargerule;
 2 | 
 3 | import com.huawei.charging.domain.charge.ChargeRecord;
 4 | import com.huawei.charging.domain.charge.ChargeContext;
 5 | import com.huawei.charging.domain.charge.chargeplan.ChargePlan;
 6 | 
 7 | public interface ChargeRule {
 8 |     ChargeRecord doCharge(ChargeContext ctx);
 9 | 
10 |     void belongsTo(ChargePlan chargePlan);
11 | 
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/gateway/AccountGateway.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.gateway;
 2 | 
 3 | import com.huawei.charging.domain.account.Account;
 4 | import com.huawei.charging.domain.charge.ChargeRecord;
 5 | 
 6 | import java.util.List;
 7 | 
 8 | /**
 9 |  * 跟账户系统交互的网关(Gateway)
10 |  *
11 |  * @version 1.0
12 |  */
13 | public interface AccountGateway {
14 | 
15 |     /**
16 |      * 根据用户号码获取账户信息(含计费项余额等信息)
17 |      *
18 |      * @param phoneNo 电话号码
19 |      * @return 账户信息
20 |      */
21 |     Account getAccount(long phoneNo);
22 | 
23 |     /**
24 |      * 将扣费记录同步到账户中
25 |      *
26 |      * @param phoneNo 电话号码
27 |      * @param records 扣费记录
28 |      */
29 |     void sync(long phoneNo, List<ChargeRecord> records);
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/gateway/ChargeGateway.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.gateway;
 2 | 
 3 | import com.huawei.charging.domain.charge.ChargeRecord;
 4 | import org.springframework.data.jpa.repository.JpaRepository;
 5 | import org.springframework.stereotype.Repository;
 6 | 
 7 | import java.util.List;
 8 | 
 9 | @Repository
10 | public interface ChargeGateway extends JpaRepository<ChargeRecord, Long> {
11 |     public List<ChargeRecord> findBySessionId(String sessionId);
12 | 
13 |     public ChargeRecord getBySessionId(String sessionId);
14 | 
15 |     public List<ChargeRecord> findByPhoneNo(long phoneNo);
16 | }
17 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/domain/gateway/SessionGateway.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.domain.gateway;
 2 | 
 3 | import com.huawei.charging.domain.charge.Session;
 4 | 
 5 | public interface SessionGateway {
 6 | 
 7 |     void create(Session session);
 8 | 
 9 |     Session get(String sessionId);
10 | 
11 |     void end(String sessionId);
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/java/com/huawei/charging/infrastructure/RestClientBean.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.infrastructure;
 2 | 
 3 | import org.springframework.beans.factory.annotation.Value;
 4 | import org.springframework.context.annotation.Bean;
 5 | import org.springframework.context.annotation.Configuration;
 6 | import org.springframework.web.client.RestClient;
 7 | 
 8 | @Configuration
 9 | public class RestClientBean {
10 | 
11 |     @Value("${REMOTE_BASE_URI:http://localhost:8080}")
12 |     String baseURI;
13 | 
14 |     @Bean
15 |     RestClient restClient() {
16 |         return RestClient.create(baseURI);
17 |     }
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/resources/application.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: com.mysql.cj.jdbc.Driver
 4 |     url: jdbc:mysql://${MYSQL_SERVER:localhost}:${MYSQL_PORT:3306}/${MYSQL_DB_NAME:chargeDB}?serverTimezone=UTC
 5 |     #如果运行出错,可以把连接写成下面的路径进行测试
 6 |     #url: jdbc:mysql://localhost:3306/blogDB?useUnicode=true&characterEncoding=utf-8
 7 |     username: ${MYSQL_USER_TEST:root}
 8 |     password: ${MYSQL_PASSWORD_TEST:root}
 9 |   jpa:
10 |     hibernate:
11 |       ddl-auto: update
12 |     show-sql: true
13 | 
14 | server:
15 |   port: 8081
16 | 
17 | my-name: default
18 | my-age: default
19 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
 1 | <configuration>
 2 |     <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
 3 | 
 4 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 5 |         <encoder>
 6 |             <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
 7 |             <charset>utf8</charset>
 8 |         </encoder>
 9 |     </appender>
10 | 
11 |     <!--rootLogger是默认的logger-->
12 |     <root level="INFO">
13 |         <appender-ref ref="CONSOLE"/>
14 |     </root>
15 | 
16 |     <!--应用日志-->
17 |     <!--这个logger没有指定appender,它会继承root节点中定义的那些appender-->
18 |     <logger name="com.huawei" level="DEBUG"/>
19 | 
20 |     <!--全局的访问日志-->
21 |     <logger name="com.alibaba.cola.catchlog" level="DEBUG"/>
22 | 
23 | </configuration>
24 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/charge.http:
--------------------------------------------------------------------------------
 1 | ### list charge records by sessionId
 2 | GET http://localhost:8080/123145/chargeRecords
 3 | Accept: application/json
 4 | 
 5 | ### end session
 6 | POST http://localhost:8080/session/123145/end?duration=10
 7 | Content-Type: application/x-www-form-urlencoded
 8 | 
 9 | duration=10
10 | 
11 | ### do charge
12 | POST http://localhost:8080/session/123145/charge?duration=10
13 | 
14 | 
15 | ### begin Session
16 | POST http://localhost:8080/session/123145/begin?callingPhoneNo=13681874561&calledPhoneNo=15921252125
17 | 
18 | <> 2022-11-03T150743.200.json
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/java/com/huawei/charging/TestsContainerBoot.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging;
 2 | 
 3 | import com.alibaba.cola.test.TestsContainer;
 4 | 
 5 | public class TestsContainerBoot {
 6 |     public static void main(String[] args) {
 7 |         TestsContainer.start();
 8 |     }
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/java/com/huawei/charging/infrastructure/WireMockRegister.java:
--------------------------------------------------------------------------------
 1 | package com.huawei.charging.infrastructure;
 2 | 
 3 | import com.github.tomakehurst.wiremock.client.WireMock;
 4 | import com.github.tomakehurst.wiremock.stubbing.StubMapping;
 5 | 
 6 | public class WireMockRegister {
 7 | 
 8 |     public static void registerStub(WireMock wireMock, String resourcePath){
 9 |         StubMapping stubMapping = StubMapping.buildFrom(FixtureLoader.loadResource(resourcePath));
10 |         wireMock.register(stubMapping);
11 |     }
12 | }
13 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: com.mysql.cj.jdbc.Driver
 4 |     # hard code for test purpose
 5 |     url: jdbc:mysql://localhost:3306/chargeDB?serverTimezone=UTC
 6 |     username: root
 7 |     password: root
 8 | 
 9 |   jpa:
10 |     hibernate:
11 |       ddl-auto: update
12 |     show-sql: true
13 | 
14 | # this will override config in test/resources/application.yml and resources/application.yml
15 | my-age: 30
16 | 
17 | my-age-test: 40
18 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/resources/application.yml:
--------------------------------------------------------------------------------
 1 | spring:
 2 |   datasource:
 3 |     driver-class-name: org.h2.Driver
 4 |     url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=1
 5 |     username: sa
 6 |     password:
 7 | 
 8 |   jpa:
 9 |     hibernate:
10 |       ddl-auto: update
11 |     show-sql: true
12 | 
13 | server:
14 |   port: 8081
15 | 
16 | my-name: frank
17 | my-age: 35
18 | REMOTE_BASE_URI: http://localhost:8080
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/resources/fixture/wiremock/stub_account.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/api/account/[0-9]+",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "transformers": [
12 |       "response-template"
13 |     ],
14 |     "jsonBody": {
15 |       "name": "frank",
16 |       "phoneNo": "{{request.path.[3]}}",
17 |       "remaining": "400",
18 |       "chargePlanList": [
19 |         {
20 |           "priority": "2",
21 |           "type": "fixedTime"
22 |         },
23 |         {
24 |           "priority": "1",
25 |           "type": "familyMember"
26 |         }
27 |       ]
28 |     }
29 |   }
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-samples/charge/src/test/resources/fixture/wiremock/stub_insufficient_account.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "request": {
 3 |     "urlPathPattern": "/v1/api/account/[0-9]+",
 4 |     "method": "GET"
 5 |   },
 6 |   "response": {
 7 |     "status": 200,
 8 |     "headers": {
 9 |       "Content-Type": "application/json"
10 |     },
11 |     "transformers": [
12 |       "response-template"
13 |     ],
14 |     "jsonBody": {
15 |       "name": "frank",
16 |       "phoneNo": "{{request.path.[3]}}",
17 |       "remaining": "0",
18 |       "chargePlanList": [
19 |         {
20 |           "priority": "2",
21 |           "type": "fixedTime"
22 |         },
23 |         {
24 |           "priority": "1",
25 |           "type": "familyMember"
26 |         }
27 |       ]
28 |     }
29 |   }
30 | }
31 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-app/src/main/java/com/alibaba/craftsman/command/MetricDeleteCmdExe.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.command;
 2 | 
 3 | import com.alibaba.cola.dto.Response;
 4 | import com.alibaba.craftsman.domain.gateway.MetricGateway;
 5 | import com.alibaba.craftsman.dto.MetricDeleteCmd;
 6 | import org.springframework.stereotype.Component;
 7 | 
 8 | import javax.annotation.Resource;
 9 | 
10 | /**
11 |  * MetricDeleteCmdExe
12 |  *
13 |  * @author Frank Zhang
14 |  * @date 2019-03-04 3:01 PM
15 |  */
16 | @Component
17 | public class MetricDeleteCmdExe{
18 | 
19 |     @Resource
20 |     private MetricGateway metricGateway;
21 | 
22 |     public Response execute(MetricDeleteCmd cmd) {
23 | 
24 |         metricGateway.delete(cmd.getMetricId(), cmd.getOperater());
25 | 
26 |         return Response.buildSuccess();
27 |     }
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-app/src/main/java/com/alibaba/craftsman/command/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 |  * This package contains CommandExecutors which are used to process Command Request.
3 |  * 
4 |  * @author fulan.zjf
5 |  */
6 | package com.alibaba.craftsman.command;


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-app/src/main/java/com/alibaba/craftsman/command/query/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 |  * This package contains QueryExecutors which are used to process Query Request.
3 |  * 
4 |  * @author fulan.zjf
5 |  */
6 | package com.alibaba.craftsman.command.query;


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-app/src/main/java/com/alibaba/craftsman/service/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 |  * Service is the facade of application API
3 |  * 
4 |  * @author fulan.zjf
5 |  */
6 | package com.alibaba.craftsman.service;


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-app/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
 1 | <?xml version="1.0" encoding="UTF-8"?>
 2 | <configuration>
 3 |     <!-- https://github.com/spring-projects/spring-boot/blob/v1.4.2.RELEASE/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml -->
 4 |     <include resource="org/springframework/boot/logging/logback/defaults.xml" />
 5 | 
 6 |     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 7 |         <encoder>
 8 |             <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
 9 |             <charset>utf8</charset>
10 |         </encoder>
11 |     </appender>
12 | 
13 |     <root level="INFO">
14 |         <appender-ref ref="CONSOLE" />
15 |     </root>
16 | 
17 |     <!--应用日志-->
18 |     <logger name="com.alibaba.craftsman" level="DEBUG"/>
19 | 
20 | </configuration>


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/context/UserContext.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.context;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | /**
 6 |  * UserContext
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2019-02-28 7:08 PM
10 |  */
11 | @Data
12 | public class UserContext {
13 |     private String operator;
14 |     private String loginUserId;
15 |     private String loginUserName;
16 |     private String loginUserRole;
17 |     private String loginUserPrivilege;
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/ATAMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.ATAMetricCO;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotEmpty;
 7 | import javax.validation.constraints.NotNull;
 8 | 
 9 | /**
10 |  * ATAMetricAddCmd
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-03-01 10:12 AM
14 |  */
15 | @Data
16 | public class ATAMetricAddCmd extends CommonCommand{
17 |     @NotNull
18 |     private ATAMetricCO ataMetricCO;
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/ATAMetricQry.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class ATAMetricQry extends CommonCommand {
 7 |     public String ownerId;
 8 | }
 9 | 
10 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/CodeReviewMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | import javax.validation.constraints.NotEmpty;
 6 | import javax.validation.constraints.Positive;
 7 | 
 8 | /**
 9 |  * CodeReviewMetricAddCmd
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-01 10:09 AM
13 |  */
14 | @Data
15 | public class CodeReviewMetricAddCmd extends CommonCommand{
16 | 
17 |     @NotEmpty
18 |     private String ownerId;
19 | 
20 |     @NotEmpty
21 |     private String reviewId;
22 | 
23 |     /**
24 |      * 评论数
25 |      */
26 |     @Positive
27 |     private int noteCount;
28 | 
29 |     /**
30 |      * 文档链接
31 |      */
32 |     private String reviewDocLink;
33 | }
34 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/CommonCommand.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.cola.dto.Command;
 4 | import lombok.Data;
 5 | 
 6 | /**
 7 |  * 整个应用通用的Command
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2019-02-28 7:18 PM
11 |  */
12 | public class CommonCommand extends Command{
13 |     private String operater;
14 |     private boolean needsOperator;
15 | 
16 |     public String getOperater() {
17 |         return this.operater;
18 |     }
19 | 
20 |     public void setOperater(String operater) {
21 |         this.operater = operater;
22 |         needsOperator = true;
23 |     }
24 | 
25 |     public boolean isNeedsOperator(){
26 |         return needsOperator;
27 |     }
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/MetricDeleteCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | /**
 6 |  * MetricDeleteCmd
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2019-03-01 10:11 AM
10 |  */
11 | @Data
12 | public class MetricDeleteCmd extends CommonCommand{
13 |     /**
14 |      * Metric ID
15 |      */
16 |     private String metricId;
17 | }
18 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/MiscMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.MiscMetricCO;
 4 | import com.alibaba.craftsman.dto.clientobject.PatentMetricCO;
 5 | import lombok.Data;
 6 | 
 7 | import javax.validation.constraints.NotNull;
 8 | 
 9 | /**
10 |  * MiscMetricAddCmd
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-03-04 11:04 AM
14 |  */
15 | @Data
16 | public class MiscMetricAddCmd extends CommonCommand{
17 |     @NotNull
18 |     private MiscMetricCO miscMetricCO;
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/PaperMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.PaperMetricCO;
 4 | import com.alibaba.craftsman.dto.clientobject.PatentMetricCO;
 5 | import lombok.Data;
 6 | 
 7 | import javax.validation.constraints.NotNull;
 8 | 
 9 | /**
10 |  * PaperMetricAddCmd
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-03-03 11:38 AM
14 |  */
15 | @Data
16 | public class PaperMetricAddCmd extends CommonCommand{
17 |     @NotNull
18 |     private PaperMetricCO paperMetricCO;
19 | }


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/PatentMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.ATAMetricCO;
 4 | import com.alibaba.craftsman.dto.clientobject.PatentMetricCO;
 5 | import lombok.Data;
 6 | 
 7 | import javax.validation.constraints.NotNull;
 8 | 
 9 | /**
10 |  * PatentMetricAddCmd
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-03-03 11:37 AM
14 |  */
15 | @Data
16 | public class PatentMetricAddCmd extends CommonCommand{
17 |     @NotNull
18 |     private PatentMetricCO  patentMetricCO;
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/RefactoringMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.MiscMetricCO;
 4 | import com.alibaba.craftsman.dto.clientobject.RefactoringMetricCO;
 5 | import lombok.Data;
 6 | 
 7 | import javax.validation.constraints.NotNull;
 8 | 
 9 | /**
10 |  * RefactoringMetricAddCmd
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-03-04 11:04 AM
14 |  */
15 | @Data
16 | public class RefactoringMetricAddCmd extends CommonCommand{
17 |     @NotNull
18 |     private RefactoringMetricCO refactoringMetricCO;
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/RefreshScoreCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import lombok.AllArgsConstructor;
 4 | import lombok.Data;
 5 | 
 6 | @Data
 7 | @AllArgsConstructor
 8 | public class RefreshScoreCmd extends CommonCommand{
 9 |     private String userId;
10 | }
11 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/SharingMetricAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.SharingMetricCO;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotNull;
 7 | 
 8 | /**
 9 |  * SharingMetricAddCmd
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-01 10:12 AM
13 |  */
14 | @Data
15 | public class SharingMetricAddCmd extends CommonCommand{
16 |     @NotNull
17 |     private SharingMetricCO sharingMetricCO;
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/UserProfileAddCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.UserProfileCO;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotNull;
 7 | 
 8 | /**
 9 |  * UserProfileAddCmd
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-02-28 6:20 PM
13 |  */
14 | @Data
15 | public class UserProfileAddCmd extends CommonCommand {
16 | 
17 |     @NotNull
18 |     private UserProfileCO userProfileCO;
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/UserProfileGetQry.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class UserProfileGetQry extends CommonCommand {
 7 |     private String userId;
 8 |     private String id;
 9 | 
10 |     public UserProfileGetQry(){
11 | 
12 |     }
13 | 
14 | }


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/UserProfileListQry.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.craftsman.dto;
2 | 
3 | import lombok.Data;
4 | 
5 | @Data
6 | public class UserProfileListQry extends CommonCommand {
7 |     private String dep;
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/UserProfileUpdateCmd.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto;
 2 | 
 3 | import com.alibaba.craftsman.dto.clientobject.UserProfileCO;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotNull;
 7 | 
 8 | @Data
 9 | public class UserProfileUpdateCmd extends CommonCommand {
10 | 
11 |     @NotNull
12 |     private UserProfileCO userProfileCO;
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/clientobject/ATAMetricCO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.clientobject;
 2 | 
 3 | import com.alibaba.cola.dto.ClientObject;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotEmpty;
 7 | 
 8 | /**
 9 |  * ATAMetricCO
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-01 5:39 PM
13 |  */
14 | @Data
15 | public class ATAMetricCO extends AbstractMetricCO {
16 |     @NotEmpty
17 |     private String title;//文章标题
18 |     private String url;//文章链接
19 |     private long thumbsUpCount;//点赞数
20 |     private long hitCount;//点击数
21 |     private long commentCount;//评论数
22 |     private long favoriteCount;//收藏数
23 | }
24 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/clientobject/AbstractMetricCO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.clientobject;
 2 | 
 3 | import com.alibaba.cola.dto.ClientObject;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotEmpty;
 7 | 
 8 | /**
 9 |  * AbstractMetricCO
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-04 11:32 AM
13 |  */
14 | @Data
15 | public abstract class AbstractMetricCO extends ClientObject{
16 |     /**
17 |      * The ownerId of this Metric Item
18 |      */
19 |     @NotEmpty
20 |     private String ownerId;
21 | }
22 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/clientobject/MiscMetricCO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.clientobject;
 2 | 
 3 | import com.alibaba.cola.dto.ClientObject;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotEmpty;
 7 | 
 8 | /**
 9 |  * MiscMetricCO
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-04 10:58 AM
13 |  */
14 | @Data
15 | public class MiscMetricCO extends AbstractMetricCO {
16 | 
17 |     /**
18 |      * 名称
19 |      */
20 |     @NotEmpty
21 |     private String name;
22 | 
23 |     /**
24 |      * 内容
25 |      */
26 |     @NotEmpty
27 |     private String content;
28 | 
29 |     /**
30 |      * 文档链接
31 |      */
32 |     private String docUrl;
33 | 
34 |     /**
35 |      * 代码链接
36 |      */
37 |     private String codeUrl;
38 | }
39 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/clientobject/PaperMetricCO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.clientobject;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | import javax.validation.constraints.NotEmpty;
 6 | 
 7 | /**
 8 |  * PaperMetricCO
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2019-03-03 11:16 AM
12 |  */
13 | @Data
14 | public class PaperMetricCO extends AbstractMetricCO{
15 |     @NotEmpty
16 |     private String paperName;
17 |     private String paperDesc;
18 |     private String magazine;
19 |     private String paperLink;
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/clientobject/PatentMetricCO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.clientobject;
 2 | 
 3 | import com.alibaba.cola.dto.ClientObject;
 4 | import lombok.Data;
 5 | 
 6 | import javax.validation.constraints.NotEmpty;
 7 | 
 8 | /**
 9 |  * PatentMetricCO
10 |  *
11 |  * @author Frank Zhang
12 |  * @date 2019-03-03 11:16 AM
13 |  */
14 | @Data
15 | public class PatentMetricCO  extends AbstractMetricCO {
16 |     public static final String FIRST_AUTHOR_TYPE = "FIRST_AUTHOR";
17 |     public static final String OTHER_AUTHOR_TYPE = "OTHER_AUTHOR";
18 | 
19 |     @NotEmpty
20 |     private String patentName;
21 |     private String patentDesc;
22 |     private String patentNo;
23 |     private String patentUrl;
24 |     private String authorType;
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/domainevent/CustomerCreatedEvent.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.domainevent;
 2 | 
 3 | /**
 4 |  * CustomerCreatedEvent
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2019-01-04 10:32 AM
 8 |  */
 9 | public class CustomerCreatedEvent {
10 | 
11 |     private String customerId;
12 | 
13 |     public String getCustomerId() {
14 |         return customerId;
15 |     }
16 | 
17 |     public void setCustomerId(String customerId) {
18 |         this.customerId = customerId;
19 |     }
20 | }
21 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-client/src/main/java/com/alibaba/craftsman/dto/domainevent/MetricItemCreatedEvent.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.dto.domainevent;
 2 | 
 3 | import lombok.Data;
 4 | 
 5 | @Data
 6 | public class MetricItemCreatedEvent {
 7 | 
 8 |     private String id;
 9 | 
10 |     private String userId;
11 | 
12 |     private String mainMetricType;
13 | }
14 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/DomainFactory.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain;
 2 | 
 3 | import com.alibaba.craftsman.domain.user.UserProfile;
 4 | 
 5 | public class DomainFactory {
 6 | 
 7 |     public static UserProfile getUserProfile(){
 8 |         return new UserProfile();
 9 |     }
10 | 
11 | }
12 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/gateway/UserProfileGateway.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.gateway;
 2 | 
 3 | import com.alibaba.craftsman.domain.user.UserProfile;
 4 | 
 5 | /**
 6 |  * UserProfileGateway
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2020-07-02 12:16 PM
10 |  */
11 | public interface UserProfileGateway {
12 |     void create(UserProfile userProfile);
13 |     void update(UserProfile userProfile);
14 |     UserProfile getByUserId(String userId);
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/JSONPropertyFilter.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics;
 2 | 
 3 | import com.alibaba.fastjson.serializer.PropertyFilter;
 4 | 
 5 | /**
 6 |  * JSONPropertyFilter
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2019-03-02 10:53 PM
10 |  */
11 | public class JSONPropertyFilter implements PropertyFilter {
12 | 
13 |     public static JSONPropertyFilter singleton = new JSONPropertyFilter();
14 | 
15 |     @Override
16 |     public boolean apply(Object object, String name, Object value) {
17 |         if(name.equalsIgnoreCase("context")){
18 |             return false;
19 |         }
20 |         if(name.equalsIgnoreCase("extValues")){
21 |             return false;
22 |         }
23 |         return true;
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/Measurable.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics;
 2 | 
 3 | import java.io.Serializable;
 4 | 
 5 | /**
 6 |  * Measurable
 7 |  * 可度量的
 8 |  * @author Frank Zhang
 9 |  * @date 2018-07-04 1:32 PM
10 |  */
11 | public interface Measurable extends Serializable{
12 | 
13 |     /**
14 |      * 计算分数
15 |      * @return
16 |      */
17 |     public double calculateScore();
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/devquality/BugMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.devquality;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | import com.alibaba.craftsman.domain.user.Role;
 5 | 
 6 | 
 7 | /**
 8 |  * BUG数指标
 9 |  */
10 | public class BugMetric extends SubMetric {
11 | 
12 |     public BugMetric(){
13 |         this.subMetricType = SubMetricType.Bug;
14 |     }
15 | 
16 |     @Override
17 |     public double getWeight() {
18 |         return metricOwner.getWeight().getUnanimousWeight();
19 |     }
20 | 
21 |     @Override
22 |     public double calculateScore() {
23 |         if(metricOwner.getRole() == Role.OTHER){
24 |             return 0;
25 |         }
26 |         return super.calculateScore();
27 |     }
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techcontribution/CodeReviewMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techcontribution;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * CodeReview指标
 7 |  * @author xueliang.sxl, alisa.hsh, xiangning.lxn
 8 |  */
 9 | public class CodeReviewMetric extends SubMetric {
10 | 
11 |     public CodeReviewMetric(){
12 |         this.subMetricType = SubMetricType.CodeReview;
13 |     }
14 | 
15 |     public CodeReviewMetric(MainMetric parent) {
16 |         this.parent = parent;
17 |         parent.addSubMetric(this);
18 |         this.subMetricType = SubMetricType.CodeReview;
19 |     }
20 | 
21 |     @Override
22 |     public double getWeight() {
23 |         return metricOwner.getWeight().getUnanimousWeight();
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techcontribution/MiscMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techcontribution;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * Miscellaneous,其他度量,任何的技术亮点都可以添加
 7 |  * @author frankzhang
 8 |  */
 9 | public class MiscMetric extends SubMetric {
10 | 
11 |     public MiscMetric(){
12 |         this.subMetricType = SubMetricType.Misc;
13 |     }
14 | 
15 |     public MiscMetric(MainMetric parent) {
16 |         this.parent = parent;
17 |         parent.addSubMetric(this);
18 |         this.subMetricType = SubMetricType.Misc;
19 |     }
20 | 
21 |     @Override
22 |     public double getWeight() {
23 |         return metricOwner.getWeight().getUnanimousWeight();
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techcontribution/RefactoringLevel.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techcontribution;
 2 | 
 3 | import lombok.Getter;
 4 | 
 5 | /**
 6 |  * RefactoringLevel
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2018-09-20 3:37 PM
10 |  */
11 | public enum RefactoringLevel {
12 | 
13 |     METHOD(2, "方法级别的重构"),
14 |     MODULE( 4, "模块级别的重构(多个方法和类的重构)"),
15 |     PROJECT(10, "项目级别的重构(超过3个人日的重构项目)");
16 | 
17 | 
18 |     @Getter
19 |     private double score;
20 | 
21 |     private String desc;
22 | 
23 |     RefactoringLevel(double score, String desc) {
24 |         this.score = score;
25 |         this.desc = desc;
26 |     }
27 | 
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techcontribution/RefactoringMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techcontribution;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * 重构指标
 7 |  * @author xueliang.sxl, alisa.hsh, xiangning.lxn
 8 |  */
 9 | public class RefactoringMetric extends SubMetric {
10 | 
11 |     public RefactoringMetric(){
12 |         this.subMetricType = SubMetricType.Refactoring;
13 |     }
14 | 
15 |     public RefactoringMetric(MainMetric parent) {
16 |         this.parent = parent;
17 |         parent.addSubMetric(this);
18 |         this.subMetricType = SubMetricType.Refactoring;
19 |     }
20 | 
21 |     @Override
22 |     public double getWeight() {
23 |         return  metricOwner.getWeight().getUnanimousWeight();
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/ATAMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * ATAMetric
 7 |  * ATA文章指标
 8 |  * @author Frank Zhang
 9 |  * @date 2018-07-04 1:24 PM
10 |  */
11 | public class ATAMetric extends SubMetric {
12 | 
13 |     public ATAMetric(){
14 |         this.subMetricType = SubMetricType.ATA;
15 |     }
16 | 
17 |     public ATAMetric(MainMetric parent) {
18 |         this.parent = parent;
19 |         parent.addSubMetric(this);
20 |         this.subMetricType = SubMetricType.ATA;
21 |     }
22 | 
23 |     @Override
24 |     public double getWeight() {
25 |         return  parent.getMetricOwner().getWeight().getUnanimousWeight();
26 |     }
27 | }
28 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/AuthorType.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import lombok.Getter;
 4 | 
 5 | /**
 6 |  * 论文专利作者类型枚举
 7 |  *
 8 |  * @author Frank Zhang
 9 |  * @date 2018-09-20 3:28 PM
10 |  */
11 | public enum AuthorType {
12 | 
13 |     FIRST_AUTHOR(AuthorType.FIRST_AUTHOR_PATENT_SCORE, "专利或者论文的第一作者"),
14 |     OTHER_AUTHOR(AuthorType.OTHER_AUTHOR_PATENT_SCORE, "专利或论文的其他作者");
15 | 
16 |     private static final double FIRST_AUTHOR_PATENT_SCORE = 20;
17 |     private static final double OTHER_AUTHOR_PATENT_SCORE = 5;
18 | 
19 |     @Getter
20 |     private double score;
21 |     private String desc;
22 | 
23 |     private AuthorType(double score, String desc) {
24 |         this.score = score;
25 |         this.desc = desc;
26 |     }
27 | 
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/PaperMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * 论文子度量
 7 |  * PaperMetric
 8 |  *
 9 |  * @author Frank Zhang
10 |  * @date 2018-09-20 3:26 PM
11 |  */
12 | public class PaperMetric extends SubMetric {
13 | 
14 | 	public PaperMetric(){
15 | 		this.subMetricType = SubMetricType.Paper;
16 | 	}
17 | 
18 | 	public PaperMetric(MainMetric parent) {
19 | 		this.parent = parent;
20 | 		parent.addSubMetric(this);
21 | 		this.subMetricType = SubMetricType.Paper;
22 | 	}
23 | 
24 | 	@Override
25 | 	public double getWeight() {
26 | 		return parent.getMetricOwner().getWeight().getUnanimousWeight();
27 | 	}
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/PatentMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * 技术专利指标
 7 |  * @author xueliang.sxl
 8 |  */
 9 | public class PatentMetric extends SubMetric {
10 | 
11 |     public PatentMetric(){
12 |         this.subMetricType = SubMetricType.Patent;
13 |     }
14 | 
15 |     public PatentMetric(MainMetric parent) {
16 |         this.parent = parent;
17 |         parent.addSubMetric(this);
18 |         this.subMetricType = SubMetricType.Patent;
19 |     }
20 | 
21 |     @Override
22 |     public double getWeight() {
23 |         return parent.getMetricOwner().getWeight().getUnanimousWeight();
24 |     }
25 | }
26 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/SharingMetric.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import com.alibaba.craftsman.domain.metrics.*;
 4 | 
 5 | /**
 6 |  * SharingMetric
 7 |  * 线下技术分享指标
 8 |  * @author Frank Zhang
 9 |  * @date 2018-07-04 1:25 PM
10 |  */
11 | public class SharingMetric extends SubMetric {
12 | 
13 |     public SharingMetric(){
14 |         this.subMetricType = SubMetricType.Sharing;
15 |     }
16 | 
17 |     public SharingMetric(MainMetric parent) {
18 |         this.parent = parent;
19 |         parent.addSubMetric(this);
20 |         this.subMetricType = SubMetricType.Sharing;
21 |     }
22 | 
23 |     @Override
24 |     public double getWeight() {
25 |         return  parent.getMetricOwner().getWeight().getUnanimousWeight();
26 |     }
27 | }
28 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/techinfluence/SharingScope.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.techinfluence;
 2 | 
 3 | import lombok.Getter;
 4 | 
 5 | /**
 6 |  * SharingScope
 7 |  * 线下分享的范围,范围不同,分值不同
 8 |  * @author Frank Zhang
 9 |  * @date 2018-07-04 3:25 PM
10 |  */
11 | public enum SharingScope {
12 |     TEAM(2, "团队内分享"),
13 |     BU(20, "BU内部分享"),
14 |     ALIBABA(30, "集团内部分享"),
15 |     COMMUNITY(40, "公众外部分享");
16 | 
17 | 
18 |     @Getter
19 |     private double score;
20 |     private String desc;
21 | 
22 |     private SharingScope(double score, String desc) {
23 |         this.score = score;
24 |         this.desc = desc;
25 |     }
26 | 
27 | }
28 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/weight/DevWeight.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.weight;
 2 | 
 3 | /**
 4 |  * 开发的总分计算权重
 5 |  */
 6 | public class DevWeight extends Weight{
 7 | 
 8 |     public static DevWeight singleton= new DevWeight();
 9 | 
10 |     @Override
11 |     public double getAppQualityWeight() {
12 |         return  20 / WEIGHT_PERCENTAGE;
13 |     }
14 | 
15 |     @Override
16 |     public double getTechInfluenceWeight() {
17 |         return 30 / WEIGHT_PERCENTAGE;
18 |     }
19 | 
20 |     @Override
21 |     public double getTechContributionWeight() {
22 |         return 30 / WEIGHT_PERCENTAGE;
23 |     }
24 | 
25 |     @Override
26 |     public double getDevQualityWeight() {
27 |         return 20 / WEIGHT_PERCENTAGE;
28 |     }
29 | }
30 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/weight/OtherWeight.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.weight;
 2 | 
 3 | /**
 4 |  * 非技术人员不需要考核
 5 |  */
 6 | public class OtherWeight extends Weight{
 7 | 
 8 |     public static OtherWeight singleton= new OtherWeight();
 9 | 
10 |     @Override
11 |     public double getAppQualityWeight() {
12 |         return 0;
13 |     }
14 | 
15 |     @Override
16 |     public double getTechInfluenceWeight() {
17 |         return 0;
18 |     }
19 | 
20 |     @Override
21 |     public double getTechContributionWeight() {
22 |         return 0;
23 |     }
24 | 
25 |     @Override
26 |     public double getDevQualityWeight() {
27 |         return 0;
28 |     }
29 | }
30 | 
31 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/weight/QAWeight.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.weight;
 2 | 
 3 | /**
 4 |  * 测试的分数权重占比
 5 |  */
 6 | public class QAWeight extends Weight{
 7 | 
 8 |     public static QAWeight singleton= new QAWeight();
 9 | 
10 |     @Override
11 |     public double getAppQualityWeight() {
12 |         return 10 / WEIGHT_PERCENTAGE;
13 |     }
14 | 
15 |     @Override
16 |     public double getTechInfluenceWeight() {
17 |         return 60 / WEIGHT_PERCENTAGE;
18 |     }
19 | 
20 |     @Override
21 |     public double getTechContributionWeight() {
22 |         return 20 / WEIGHT_PERCENTAGE;
23 |     }
24 | 
25 |     @Override
26 |     public double getDevQualityWeight() {
27 |         return 10 / WEIGHT_PERCENTAGE;
28 |     }
29 | }
30 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/weight/Weight.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.weight;
 2 | 
 3 | /**
 4 |  * Weight 权重
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2018-09-13 12:13 PM
 8 |  */
 9 | public abstract class Weight {
10 | 
11 |     public static double WEIGHT_PERCENTAGE = 100;
12 | 
13 |     public abstract double getAppQualityWeight();
14 |     public abstract double getTechInfluenceWeight();
15 |     public abstract double getTechContributionWeight();
16 |     public abstract double getDevQualityWeight();
17 | 
18 |     public double getUnanimousWeight(){
19 |         return 100/WEIGHT_PERCENTAGE;
20 |     }
21 | 
22 | }
23 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/metrics/weight/WeightFactory.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.metrics.weight;
 2 | 
 3 | import com.alibaba.craftsman.domain.user.Role;
 4 | 
 5 | public class WeightFactory {
 6 |     public static Weight get(Role role){
 7 |         if(role == Role.DEV){
 8 |             return DevWeight.singleton;
 9 |         }
10 |         if(role == Role.QA){
11 |             return QAWeight.singleton;
12 |         }
13 |         return OtherWeight.singleton;
14 |     }
15 | }
16 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 |  *
3 |  * This is the core Domain business which should be pure and clean, have no dependency over other layers.
4 |  *
5 |  * @author fulan.zjf
6 |  */
7 | package com.alibaba.craftsman.domain;


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-domain/src/main/java/com/alibaba/craftsman/domain/user/Role.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.domain.user;
 2 | 
 3 | /**
 4 |  * Role Enumeration
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2018-09-13 12:25 PM
 8 |  */
 9 | public enum Role {
10 |     DEV("开发"),
11 |     QA( "测试"),
12 |     OTHER("非技术岗");
13 | 
14 |     public String desc;
15 | 
16 |     Role(String desc){
17 |         this.desc = desc;
18 |     }
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/common/BizCode.java:
--------------------------------------------------------------------------------
1 | package com.alibaba.craftsman.common;
2 | 
3 | public class BizCode {
4 | 
5 |     public final static String BIZ_ONE = "ali.cola.demo.bizOne"; //biz one
6 | 
7 |     public final static String BIZ_TWO = "ali.cola.demo.bizTwo"; //biz two
8 | }
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/common/event/DomainEventPublisher.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.common.event;
 2 | 
 3 | import org.springframework.stereotype.Component;
 4 | 
 5 | /**
 6 |  * DomainEventPublisher, this is for demo purpose, the Event is sent to EventBus
 7 |  *
 8 |  * Normally DomainEvent should be sent to Messaging Middleware
 9 |  *
10 |  * @author Frank Zhang
11 |  * @date 2019-01-04 11:05 AM
12 |  */
13 | @Component
14 | public class DomainEventPublisher{
15 | 
16 |     public void publish(Object domainEvent) {
17 |         //eventBus.fire(domainEvent);
18 |     }
19 | }


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/config/CraftsmanConfig.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.config;
 2 | 
 3 | 
 4 | /**
 5 |  * Configuration for infrastructure
 6 |  */
 7 | public class CraftsmanConfig {
 8 | 
 9 | }
10 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/gatewayimpl/database/UserProfileMapper.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.gatewayimpl.database;
 2 | 
 3 | import com.alibaba.craftsman.gatewayimpl.database.dataobject.UserProfileDO;
 4 | import org.apache.ibatis.annotations.Mapper;
 5 | import org.apache.ibatis.annotations.Param;
 6 | 
 7 | import java.util.List;
 8 | 
 9 | /**
10 |  * UserProfileMapper
11 |  *
12 |  * @author Frank Zhang
13 |  * @date 2019-02-27 5:03 PM
14 |  */
15 | @Mapper
16 | public interface UserProfileMapper {
17 |     int create(UserProfileDO userProfileDO);
18 | 
19 |     int update(UserProfileDO userProfileDO);
20 | 
21 |     int delete(@Param("userId") String userId);
22 | 
23 |     UserProfileDO getByUserId(@Param("userId") String userId);
24 | 
25 |     List<UserProfileDO> listByDep(@Param("dep") String dep);
26 | }
27 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/gatewayimpl/database/dataobject/BaseDO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.gatewayimpl.database.dataobject;
 2 | 
 3 | /**
 4 |  * BaseDO
 5 |  *
 6 |  * @author Frank Zhang
 7 |  * @date 2020-07-02 10:03 AM
 8 |  */
 9 | public class BaseDO {
10 |     private String creator;
11 |     private String modifier;
12 | 
13 |     public String getCreator() {
14 |         return creator;
15 |     }
16 | 
17 |     public void setCreator(String creator) {
18 |         this.creator = creator;
19 |     }
20 | 
21 |     public String getModifier() {
22 |         return modifier;
23 |     }
24 | 
25 |     public void setModifier(String modifier) {
26 |         this.modifier = modifier;
27 |     }
28 | }
29 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/gatewayimpl/rpc/BugMetricMapper.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.gatewayimpl.rpc;
 2 | 
 3 | import com.alibaba.craftsman.gatewayimpl.rpc.dataobject.BugMetricDO;
 4 | import org.springframework.stereotype.Component;
 5 | 
 6 | /**
 7 |  * 模拟一个RPC的Tunnel,也是日常业务中非常常见的场景。
 8 |  *
 9 |  * 假设Bug数和代码checkin数再另外一个系统中,没有存在本地,需要通过RPC调用才能获取。
10 |  *
11 |  */
12 | @Component
13 | public class BugMetricMapper {
14 | 
15 |     /**
16 |      *  Dummy RPC Call
17 |      */
18 |     public BugMetricDO getByUserId(String userId){
19 |         BugMetricDO bugMetricDO = new BugMetricDO();
20 |         bugMetricDO.setBugCount(3);
21 |         bugMetricDO.setCheckInCodeCount(1500);
22 |         return bugMetricDO;
23 |     }
24 | }
25 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/java/com/alibaba/craftsman/gatewayimpl/rpc/dataobject/BugMetricDO.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman.gatewayimpl.rpc.dataobject;
 2 | 
 3 | 
 4 | public class BugMetricDO {
 5 |     private int bugCount; //缺陷数量
 6 |     private long checkInCodeCount; //check in的代码量
 7 | 
 8 |     public int getBugCount() {
 9 |         return bugCount;
10 |     }
11 | 
12 |     public void setBugCount(int bugCount) {
13 |         this.bugCount = bugCount;
14 |     }
15 | 
16 |     public long getCheckInCodeCount() {
17 |         return checkInCodeCount;
18 |     }
19 | 
20 |     public void setCheckInCodeCount(long checkInCodeCount) {
21 |         this.checkInCodeCount = checkInCodeCount;
22 |     }
23 | }
24 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/craftsman-infrastructure/src/main/resources/mybatis-config.xml:
--------------------------------------------------------------------------------
 1 | <?xml version="1.0" encoding="UTF-8" ?>
 2 | <!-- mybatis的配置文件 -->
 3 | <!DOCTYPE configuration
 4 |         PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
 5 |         "http://mybatis.org/dtd/mybatis-3-config.dtd">
 6 | <configuration>
 7 |     <!-- 开启驼峰映射 ,否则查询结果不能转成resultType-->
 8 |     <settings>
 9 |         <setting name="mapUnderscoreToCamelCase" value="true"/>
10 |     </settings>
11 |     <typeAliases>
12 |         <!--项目DataObject对应的包名-->
13 |         <package name="com.alibaba.craftsman.gatewayimpl.database.dataobject"/>
14 |     </typeAliases>
15 |     <mappers>
16 |         <mapper resource="mybatis/MetricMapper.xml" />
17 |         <mapper resource="mybatis/UserProfileMapper.xml" />
18 |     </mappers>
19 | </configuration>


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/main/resources/application.properties:
--------------------------------------------------------------------------------
 1 | project.name=start
 2 | 
 3 | 
 4 | # mysql configruation
 5 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 6 | spring.datasource.url=jdbc:mysql://localhost:3306/craftsman?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull
 7 | spring.datasource.username=root
 8 | spring.datasource.password=1983Root_2
 9 | 
10 | #mybatis
11 | mybatis.config-location=classpath:mybatis-config.xml
12 | 
13 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/java/com/alibaba/craftsman/TestApplication.java:
--------------------------------------------------------------------------------
 1 | package com.alibaba.craftsman;
 2 | 
 3 | import org.springframework.boot.SpringApplication;
 4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
 5 | import org.springframework.context.ApplicationContext;
 6 | import org.springframework.context.annotation.ComponentScan;
 7 | import org.springframework.context.annotation.FilterType;
 8 | 
 9 | @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {Application.class})})
10 | @SpringBootApplication(scanBasePackages = {"com.alibaba.craftsman"})
11 | public class TestApplication {
12 | 
13 |     public static void main(String[] args) {
14 |         //这里填的是TestApplication
15 |         ApplicationContext context = SpringApplication.run(Application.class, args);
16 |     }
17 | 
18 | }
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.ATAMetricAddCmdExeTest_testATAMetricAddSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.CodeReviewMetricAddCmdExeTest_testSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.CodeReviewMetricAddCmdExeTest_testSuccess_inputParams:
--------------------------------------------------------------------------------
 1 | {"initialized":true,"version":"1.0.0"}
 2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
 3 | =================method_params_separator================
 4 | [
 5 | 	[
 6 | 		{
 7 | 			"@type":"com.alibaba.craftsman.gatewayimpl.database.dataobject.MetricDO",
 8 | 			"creator":"System",
 9 | 			"id":"1074",
10 | 			"mainMetric":"tech-contribution",
11 | 			"metricItem":"{\"noteCount\":8,\"reviewDocLink\":\"http://www.alibaba.com \",\"reviewId\":\"72376263\"}",
12 | 			"modifier":"System",
13 | 			"subMetric":"CodeReview",
14 | 			"userId":"CodeReviewMetricAddCmdExeTest_098873"
15 | 		}
16 | 	]
17 | ]
18 | =======================different_method_separator=============================
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.MetricDeleteCmdExeTest_testSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_delete
3 | ---------------------------
4 | [
5 | 	0
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.MetricDeleteCmdExeTest_testSuccess_inputParams:
--------------------------------------------------------------------------------
 1 | {"initialized":true,"version":"1.0.0"}
 2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_delete
 3 | =================method_params_separator================
 4 | [
 5 | 	[
 6 | 		"1013",
 7 | 		"MetricDeleteCmdExeTest"
 8 | 	]
 9 | ]
10 | =======================different_method_separator=============================
11 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.MiscMetricAddCmdExeTest_testSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.MiscMetricAddCmdExeTest_testSuccess_inputParams:
--------------------------------------------------------------------------------
 1 | {"initialized":true,"version":"1.0.0"}
 2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
 3 | =================method_params_separator================
 4 | [
 5 | 	[
 6 | 		{
 7 | 			"@type":"com.alibaba.craftsman.gatewayimpl.database.dataobject.MetricDO",
 8 | 			"creator":"System",
 9 | 			"id":"1075",
10 | 			"mainMetric":"tech-contribution",
11 | 			"metricItem":"{\"codeUrl\":\"codeUrl\",\"content\":\"Highlight content\",\"docUrl\":\"docUrl\",\"name\":\"Tech highlight\"}",
12 | 			"modifier":"System",
13 | 			"subMetric":"Misc",
14 | 			"userId":"MiscMetricAddCmdExeTest_09888"
15 | 		}
16 | 	]
17 | ]
18 | =======================different_method_separator=============================
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.PaperMetricAddCmdExeTest_testPaperMetricAddSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.PaperMetricAddCmdExeTest_testPaperMetricAddSuccess_inputParams:
--------------------------------------------------------------------------------
 1 | {"initialized":true,"version":"1.0.0"}
 2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
 3 | =================method_params_separator================
 4 | [
 5 | 	[
 6 | 		{
 7 | 			"@type":"com.alibaba.craftsman.gatewayimpl.database.dataobject.MetricDO",
 8 | 			"creator":"System",
 9 | 			"id":"1076",
10 | 			"mainMetric":"tech-influence",
11 | 			"metricItem":"{\"magazine\":\"IEEE\",\"paperDesc\":\"paper Description\",\"paperLink\":\"http://www.alibaba.com\",\"paperName\":\"paperName\"}",
12 | 			"modifier":"System",
13 | 			"subMetric":"Paper",
14 | 			"userId":"PaperMetricAddCmdExeTest_098872"
15 | 		}
16 | 	]
17 | ]
18 | =======================different_method_separator=============================
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.PatentMetricAddCmdExeTest_testPatentMetricAddSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.RefactoringMetricAddCmdExeTest_testSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.SharingMetricAddCmdExeTest_testSharingMetricAddSuccess:
--------------------------------------------------------------------------------
1 | {"initialized":true,"version":"1.0.0"}
2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
3 | ---------------------------
4 | [
5 | 	1
6 | ]
7 | ===========================
8 | 
9 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/resources/mockfile/com.alibaba.craftsman.app.SharingMetricAddCmdExeTest_testSharingMetricAddSuccess_inputParams:
--------------------------------------------------------------------------------
 1 | {"initialized":true,"version":"1.0.0"}
 2 | com.alibaba.craftsman.gatewayimpl.database.MetricTunnel_create
 3 | =================method_params_separator================
 4 | [
 5 | 	[
 6 | 		{
 7 | 			"@type":"com.alibaba.craftsman.gatewayimpl.database.dataobject.MetricDO",
 8 | 			"creator":"System",
 9 | 			"id":"1079",
10 | 			"mainMetric":"tech-influence",
11 | 			"metricItem":"{\"sharingLink\":\"sharing.com\",\"sharingName\":\"Structured thinking\",\"sharingScope\":\"TEAM\"}",
12 | 			"modifier":"System",
13 | 			"subMetric":"Sharing",
14 | 			"userId":"testSharingMetricAddSuccess_089765"
15 | 		}
16 | 	]
17 | ]
18 | =======================different_method_separator=============================
19 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/testAddCmd.http:
--------------------------------------------------------------------------------
 1 | POST http://localhost:8080/metrics/ata
 2 | Content-Type: application/json
 3 | Cache-Control: no-cache
 4 | 
 5 | {
 6 |     "ataMetricCO": {
 7 |         "ownerId": 12345,
 8 |         "title": "testAdd",
 9 |         "url": "testAdd",
10 |         "thumbsUpCount": 100,
11 |         "hitCount": 10,
12 |         "commentCount": 10,
13 |         "favoriteCount": 10
14 |     },
15 |     "needsOperator": true,
16 |     "operater": "system"
17 | 
18 | 
19 | }
20 | 


--------------------------------------------------------------------------------
/cola-samples/craftsman/start/src/test/testQry.http:
--------------------------------------------------------------------------------
1 | GET http://localhost:8080/metrics/ata?ownerId=12345
2 | Content-Type: application/json
3 | Cache-Control: no-cache
4 | 


--------------------------------------------------------------------------------