├── .github └── workflows │ └── cloud_code_scan.yml ├── .gitignore ├── .travis.yml ├── Formatter.xml ├── HEADER ├── LICENSE ├── README.md ├── acts-bom └── pom.xml ├── acts-common-dto ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── alipay │ └── test │ └── acts │ ├── constants │ ├── ActsArragementConstant.java │ └── DBFlagConstant.java │ ├── model │ ├── PrepareData.java │ ├── TestNode.java │ ├── TestUnit.java │ ├── VirtualArgs.java │ ├── VirtualDataSet.java │ ├── VirtualEventObject.java │ ├── VirtualEventSet.java │ ├── VirtualException.java │ ├── VirtualList.java │ ├── VirtualMap.java │ ├── VirtualObject.java │ ├── VirtualParams.java │ ├── VirtualResult.java │ └── VirtualTable.java │ └── setter │ └── FlagSetter.java ├── acts-common-util ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── alipay │ │ ├── test │ │ └── acts │ │ │ ├── api │ │ │ ├── CSVApis.java │ │ │ └── LogApis.java │ │ │ ├── cache │ │ │ └── ActsCacheData.java │ │ │ ├── constant │ │ │ ├── ActsConfigConstants.java │ │ │ ├── ActsConstants.java │ │ │ ├── ActsDBConstants.java │ │ │ ├── ActsPathConstants.java │ │ │ ├── ActsSpecialMapConstants.java │ │ │ ├── ActsYamlConstants.java │ │ │ ├── AnsiColorConstants.java │ │ │ └── VelocityExtendProperties.java │ │ │ ├── context │ │ │ ├── ActsCaseContext.java │ │ │ ├── ActsCaseContextHolder.java │ │ │ ├── ActsSuiteContext.java │ │ │ └── ActsSuiteContextHolder.java │ │ │ ├── db │ │ │ └── enums │ │ │ │ └── CSVColEnum.java │ │ │ ├── driver │ │ │ ├── ActsConfiguration.java │ │ │ └── enums │ │ │ │ └── SuiteFlag.java │ │ │ ├── exception │ │ │ ├── ActsException.java │ │ │ └── ModleFileException.java │ │ │ ├── helper │ │ │ └── CSVHelper.java │ │ │ ├── log │ │ │ └── ActsLogUtil.java │ │ │ ├── object │ │ │ ├── ActsObjectUtil.java │ │ │ ├── comparer │ │ │ │ ├── UnitComparer.java │ │ │ │ └── impl │ │ │ │ │ ├── AvailableComparer.java │ │ │ │ │ ├── ConditionComparer.java │ │ │ │ │ ├── CustomComparer.java │ │ │ │ │ ├── DateComparer.java │ │ │ │ │ ├── FileComparer.java │ │ │ │ │ ├── MapComparer.java │ │ │ │ │ ├── NoCheckComparer.java │ │ │ │ │ ├── RegexComparer.java │ │ │ │ │ └── SimpleComparer.java │ │ │ ├── enums │ │ │ │ └── UnitFlagEnum.java │ │ │ ├── generator │ │ │ │ ├── CustomGenerator.java │ │ │ │ ├── ObjectGenerator.java │ │ │ │ └── impl │ │ │ │ │ ├── ArrayListTypeGenerator.java │ │ │ │ │ ├── ArrayTypeGenerator.java │ │ │ │ │ ├── BigDecimalTypeGenerator.java │ │ │ │ │ ├── CurrencyTypeGenerator.java │ │ │ │ │ ├── DateTypeGenerator.java │ │ │ │ │ ├── EnumTypeGenerator.java │ │ │ │ │ ├── ListTypeGenerator.java │ │ │ │ │ ├── MapTypeGenerator.java │ │ │ │ │ ├── MoneyTypeGenerator.java │ │ │ │ │ ├── SetTypeGenerator.java │ │ │ │ │ └── StringTypeGenerator.java │ │ │ ├── manager │ │ │ │ ├── ObjectCompareManager.java │ │ │ │ └── ObjectTypeManager.java │ │ │ ├── processor │ │ │ │ ├── FlagProcessor.java │ │ │ │ ├── ObjHandUtil.java │ │ │ │ └── ObjectProcessor.java │ │ │ └── result │ │ │ │ └── Result.java │ │ │ ├── util │ │ │ ├── BaseDataUtil.java │ │ │ ├── CSVApisUtil.java │ │ │ ├── ContainerUtils.java │ │ │ ├── DalConfigAnalysisHandler.java │ │ │ ├── DateUtil.java │ │ │ ├── DbTableModelUtil.java │ │ │ ├── DeepCopyUtils.java │ │ │ ├── FileOperateUtils.java │ │ │ ├── FileUtil.java │ │ │ ├── FullTableAnalysis.java │ │ │ ├── JsonUtil.java │ │ │ ├── LogApis.java │ │ │ ├── LogUtil.java │ │ │ ├── ReflectUtil.java │ │ │ ├── VelocityUtil.java │ │ │ └── XMLParserUtil.java │ │ │ └── yaml │ │ │ ├── YamlCheckPoint.java │ │ │ ├── YamlTestCase.java │ │ │ ├── YamlTestData.java │ │ │ ├── cpUnit │ │ │ ├── BaseCPUnit.java │ │ │ ├── DataBaseCPUnit.java │ │ │ ├── GroupDataBaseCPUnit.java │ │ │ ├── ListDataBaseCPUnit.java │ │ │ ├── ListObjectCPUnit.java │ │ │ ├── MessageCPUnit.java │ │ │ ├── ObjectCPUnit.java │ │ │ └── property │ │ │ │ ├── BaseUnitProperty.java │ │ │ │ ├── ListObjectUnitProperty.java │ │ │ │ ├── MapObjectUnitProperty.java │ │ │ │ └── ObjectUnitProperty.java │ │ │ └── enums │ │ │ ├── CPUnitTypeEnum.java │ │ │ └── CheckPointActionEnum.java │ │ └── yaml │ │ ├── Dumper.java │ │ ├── DumperOptions.java │ │ ├── JavaBeanDumper.java │ │ ├── JavaBeanLoader.java │ │ ├── Loader.java │ │ ├── LoaderOptions.java │ │ ├── TypeDescription.java │ │ ├── Yaml.java │ │ ├── composer │ │ ├── Composer.java │ │ └── ComposerException.java │ │ ├── constructor │ │ ├── emitter │ │ ├── Emitable.java │ │ ├── Emitter.java │ │ ├── EmitterException.java │ │ ├── EmitterState.java │ │ └── ScalarAnalysis.java │ │ ├── error │ │ ├── Mark.java │ │ ├── MarkedYAMLException.java │ │ └── YAMLException.java │ │ ├── events │ │ ├── AliasEvent.java │ │ ├── CollectionEndEvent.java │ │ ├── CollectionStartEvent.java │ │ ├── DocumentEndEvent.java │ │ ├── DocumentStartEvent.java │ │ ├── Event.java │ │ ├── ImplicitTuple.java │ │ ├── MappingEndEvent.java │ │ ├── MappingStartEvent.java │ │ ├── NodeEvent.java │ │ ├── ScalarEvent.java │ │ ├── SequenceEndEvent.java │ │ ├── SequenceStartEvent.java │ │ ├── StreamEndEvent.java │ │ └── StreamStartEvent.java │ │ ├── extensions │ │ └── compactnotation │ │ │ ├── CompactConstructor.java │ │ │ ├── CompactData.java │ │ │ └── PackageCompactConstructor.java │ │ ├── introspector │ │ ├── BeanAccess.java │ │ ├── FieldProperty.java │ │ ├── GenericProperty.java │ │ ├── MethodProperty.java │ │ ├── MissingProperty.java │ │ ├── Property.java │ │ └── PropertyUtils.java │ │ ├── nodes │ │ ├── AnchorNode.java │ │ ├── CollectionNode.java │ │ ├── MappingNode.java │ │ ├── Node.java │ │ ├── NodeId.java │ │ ├── NodeTuple.java │ │ ├── ScalarNode.java │ │ ├── SequenceNode.java │ │ └── Tag.java │ │ ├── parser │ │ ├── Parser.java │ │ ├── ParserException.java │ │ ├── ParserImpl.java │ │ ├── Production.java │ │ └── VersionTagsTuple.java │ │ ├── reader │ │ ├── ReaderException.java │ │ ├── StreamReader.java │ │ └── UnicodeReader.java │ │ ├── representer │ │ ├── BaseRepresenter.java │ │ ├── Represent.java │ │ ├── Representer.java │ │ └── SafeRepresenter.java │ │ ├── resolver │ │ ├── RagelMachine.rl │ │ ├── Resolver.java │ │ └── ResolverTuple.java │ │ ├── scanner │ │ ├── Constant.java │ │ ├── Scanner.java │ │ ├── ScannerException.java │ │ ├── ScannerImpl.java │ │ └── SimpleKey.java │ │ ├── serializer │ │ ├── Serializer.java │ │ └── SerializerException.java │ │ ├── tokens │ │ ├── AliasToken.java │ │ ├── AnchorToken.java │ │ ├── BlockEndToken.java │ │ ├── BlockEntryToken.java │ │ ├── BlockMappingStartToken.java │ │ ├── BlockSequenceStartToken.java │ │ ├── DirectiveToken.java │ │ ├── DocumentEndToken.java │ │ ├── DocumentStartToken.java │ │ ├── FlowEntryToken.java │ │ ├── FlowMappingEndToken.java │ │ ├── FlowMappingStartToken.java │ │ ├── FlowSequenceEndToken.java │ │ ├── FlowSequenceStartToken.java │ │ ├── KeyToken.java │ │ ├── ScalarToken.java │ │ ├── StreamEndToken.java │ │ ├── StreamStartToken.java │ │ ├── TagToken.java │ │ ├── TagTuple.java │ │ ├── Token.java │ │ └── ValueToken.java │ │ └── util │ │ ├── ArrayStack.java │ │ ├── ClassUtils.java │ │ ├── DefaultValues.java │ │ └── UriEncoder.java │ └── test │ ├── java │ └── com │ │ └── alipay │ │ └── test │ │ └── acts │ │ ├── helper │ │ └── CSVHelperTest.java │ │ ├── object │ │ ├── comparer │ │ │ └── impl │ │ │ │ ├── AvailableComparerTest.java │ │ │ │ ├── DateComparerTest.java │ │ │ │ ├── FileComparerTest.java │ │ │ │ ├── MapComparerTest.java │ │ │ │ ├── RegexComparerTest.java │ │ │ │ └── SimpleComparerTest.java │ │ ├── generator │ │ │ └── impl │ │ │ │ ├── ArrayListTypeGeneratorTest.java │ │ │ │ ├── ArrayTypeGeneratorTest.java │ │ │ │ ├── BigDecimalTypeGeneratorTest.java │ │ │ │ ├── CurrencyTypeGeneratorTest.java │ │ │ │ ├── DateTypeGeneratorTest.java │ │ │ │ ├── EnumTypeGeneratorTest.java │ │ │ │ ├── ListTypeGeneratorTest.java │ │ │ │ ├── MapTypeGeneratorTest.java │ │ │ │ ├── MoneyTypeGeneratorTest.java │ │ │ │ └── StringTypeGeneratorTest.java │ │ ├── manager │ │ │ └── ObjectCompareManagerTest.java │ │ └── processor │ │ │ ├── FlagProcessorTest.java │ │ │ ├── ObjHandUtilTest.java │ │ │ └── ObjectProcessorTest.java │ │ └── util │ │ ├── CSVApisUtilTest.java │ │ ├── DateUtilTest.java │ │ ├── DeepCopyUtilsTest.java │ │ ├── FileOperateUtilsTest.java │ │ ├── FileUtilTest.java │ │ ├── FullTableAnalysisTest.java │ │ ├── JsonUtilTest.java │ │ ├── ReflectUtilTest.java │ │ └── VelocityUtilTest.java │ └── resources │ ├── BusinessActionContext │ ├── BusinessActionContext.csv │ ├── BusinessActivityContext.csv │ ├── List_Object.csv │ └── Map_Object.csv │ ├── List_VirtualObject │ ├── List_VirtualObject.csv │ └── VirtualObject.csv │ ├── Map_Object │ ├── Map_Object.csv │ └── VirtualObject.csv │ ├── PrepareData │ ├── Map_Map.csv │ ├── Map_Object.csv │ ├── Map_String.csv │ ├── Map_VirtualObject.csv │ ├── PrepareData.csv │ ├── VirtualArgs.csv │ ├── VirtualDataSet.csv │ ├── VirtualEventObject.csv │ ├── VirtualEventSet.csv │ ├── VirtualException.csv │ ├── VirtualObject.csv │ ├── VirtualParams.csv │ ├── VirtualResult.csv │ ├── VirtualTable.csv │ └── tmp.csv │ └── yaml │ └── DeleteMessageActsTest.deleteMessage.yaml ├── acts-core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── alipay │ │ │ └── test │ │ │ └── acts │ │ │ ├── annotation │ │ │ ├── ActsAnnotationFactory.java │ │ │ ├── ActsExecutorMethod.java │ │ │ ├── ActsMethodBuilder.java │ │ │ ├── ActsMethodImpl.java │ │ │ ├── IActsMethod.java │ │ │ ├── IVTableGroupCmdMethod.java │ │ │ ├── IVTableGroupCmdMethodImpl.java │ │ │ ├── TestBase.java │ │ │ ├── TestBean.java │ │ │ ├── TestCase.java │ │ │ ├── TestComponent.java │ │ │ └── acts │ │ │ │ ├── AfterCheck.java │ │ │ │ ├── AfterClean.java │ │ │ │ ├── AfterPrepare.java │ │ │ │ ├── AfterTable.java │ │ │ │ ├── BeforeCheck.java │ │ │ │ ├── BeforeClean.java │ │ │ │ ├── BeforePrepare.java │ │ │ │ ├── BeforeTable.java │ │ │ │ └── Executor.java │ │ │ ├── collector │ │ │ ├── CaseResultCollector.java │ │ │ └── sqllog │ │ │ │ ├── InsertSqlLogParser.java │ │ │ │ ├── SqlLogCollector.java │ │ │ │ ├── SqlLogParseFactory.java │ │ │ │ ├── SqlLogParser.java │ │ │ │ ├── SqlTypeEnum.java │ │ │ │ └── UpdateSqlLogParser.java │ │ │ ├── component │ │ │ ├── components │ │ │ │ ├── ActsComponentInvoker.java │ │ │ │ └── ActsComponentUtil.java │ │ │ ├── db │ │ │ │ ├── ActsDBUtils.java │ │ │ │ └── DBDatasProcessor.java │ │ │ ├── event │ │ │ │ └── EventContextHolder.java │ │ │ └── handler │ │ │ │ └── TestUnitHandler.java │ │ │ ├── config │ │ │ ├── DataAccessConfig.java │ │ │ └── DataAccessConfigManager.java │ │ │ ├── exception │ │ │ └── ActsTestException.java │ │ │ ├── runtime │ │ │ ├── ActsRuntimeContext.java │ │ │ ├── ActsRuntimeContextThreadHold.java │ │ │ └── ComponentsActsRuntimeContextThreadHold.java │ │ │ ├── template │ │ │ ├── ActsTestBase.java │ │ │ ├── PrepareCallBack.java │ │ │ ├── PrepareCallBackWithEvent.java │ │ │ ├── PrepareTemplate.java │ │ │ └── PrepareTemplateImpl.java │ │ │ └── utils │ │ │ ├── AnnotationUtils.java │ │ │ ├── CaseResultCollectUtil.java │ │ │ ├── DateUtil.java │ │ │ ├── DetailCollectUtils.java │ │ │ ├── MethodUtils.java │ │ │ ├── ObjectCompareUtil.java │ │ │ ├── ObjectUtil.java │ │ │ ├── PropertiesUtil.java │ │ │ └── config │ │ │ ├── Configration.java │ │ │ ├── ConfigrationFactory.java │ │ │ ├── PropertyConfig.java │ │ │ └── impl │ │ │ └── ConfigrationImpl.java │ └── resources │ │ └── META-INF │ │ └── spring │ │ └── acts-core.xml │ └── test │ └── java │ └── com │ └── alipay │ └── test │ └── acts │ ├── collector │ └── sqllog │ │ ├── InsertSqlLogParserTest.java │ │ ├── SqlLogParseFactoryTest.java │ │ └── UpdateSqlLogParserTest.java │ ├── component │ ├── MyTestComponent.java │ └── components │ │ ├── ActsComponentInvokerTest.java │ │ ├── ActsComponentUtilTest.java │ │ └── MethodModel.java │ ├── config │ └── DataAccessConfigManagerTest.java │ ├── runtime │ ├── ActsRuntimeContextTest.java │ ├── ActsRuntimeContextThreadHoldTest.java │ └── ComponentsActsRuntimeContextThreadHoldTest.java │ └── utils │ ├── AnnotationUtilTest.java │ ├── CaseResultCollectUtilTest.java │ ├── DateUtilTest.java │ ├── MethodUtilsTest.java │ ├── ObjectCompareUtilTest.java │ ├── ObjectUtilTest.java │ ├── PropertiesUtilTest.java │ └── TradeException.java ├── acts-sample ├── pom.xml ├── sample-test │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── alipay │ │ │ ├── sample │ │ │ └── servicetest │ │ │ │ └── base │ │ │ │ ├── ApplicationTestRun.java │ │ │ │ └── SampleActsBaseUtils.java │ │ │ └── sofa │ │ │ └── acts │ │ │ ├── component │ │ │ └── MyComponent.java │ │ │ └── test │ │ │ ├── sampleservice │ │ │ └── message │ │ │ │ ├── MessageActsTest.java │ │ │ │ └── MessageActsTest │ │ │ │ └── SampleService_message_caseID_001.yaml │ │ │ └── sampleserviceimpl │ │ │ └── deletemessage │ │ │ ├── DeleteMessageActsTest.java │ │ │ └── DeleteMessageActsTest │ │ │ ├── SampleService_deleteMessage_caseID_001.yaml │ │ │ └── SampleService_deleteMessage_caseID_002.yaml │ │ └── resources │ │ ├── META-INF │ │ └── spring │ │ │ └── test.xml │ │ ├── actsSuite │ │ └── sample-testng-all.xml │ │ └── config │ │ ├── acts-config.properties │ │ ├── application.properties │ │ └── dbConf │ │ ├── devdb.conf │ │ └── testdb.conf ├── service-consumer │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── alipay │ │ │ └── sofa │ │ │ └── isle │ │ │ └── sample │ │ │ └── JvmServiceConsumer.java │ │ └── resources │ │ ├── META-INF │ │ └── spring │ │ │ └── service-consumer.xml │ │ └── sofa-module.properties ├── service-facade │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── alipay │ │ └── sofa │ │ └── isle │ │ └── sample │ │ ├── SampleJvmService.java │ │ ├── SampleService.java │ │ └── model │ │ ├── Request.java │ │ └── Result.java ├── service-provider │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── alipay │ │ │ └── sofa │ │ │ └── isle │ │ │ └── sample │ │ │ ├── PublishServiceWithClient.java │ │ │ ├── SampleJvmServiceAnnotationImpl.java │ │ │ ├── SampleJvmServiceImpl.java │ │ │ └── SampleServiceImpl.java │ │ └── resources │ │ ├── META-INF │ │ └── spring │ │ │ └── service-provide.xml │ │ └── sofa-module.properties └── sofa-boot-run │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── alipay │ │ │ └── sofa │ │ │ └── isle │ │ │ └── sample │ │ │ ├── ApplicationRun.java │ │ │ └── controller │ │ │ └── TestController.java │ └── resources │ │ └── config │ │ └── application.properties │ └── test │ └── java │ └── com │ └── alipay │ └── sofa │ └── isle │ └── sample │ └── test │ └── SofaBootWithModulesTest.java ├── pom.xml └── tools ├── check_format.sh ├── mvn-clean.sh ├── mvn-install.sh └── mvn-test.sh /.github/workflows/cloud_code_scan.yml: -------------------------------------------------------------------------------- 1 | name: Alipay Cloud Devops Codescan 2 | on: 3 | pull_request_target: 4 | jobs: 5 | stc: # Code security scanning 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: codeScan 9 | uses: layotto/alipay-cloud-devops-codescan@main 10 | with: 11 | parent_uid: ${{ secrets.ALI_PID }} 12 | private_key: ${{ secrets.ALI_PK }} 13 | scan_type: stc 14 | sca: # Open source compliance scanning 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: codeScan 18 | uses: layotto/alipay-cloud-devops-codescan@main 19 | with: 20 | parent_uid: ${{ secrets.ALI_PID }} 21 | private_key: ${{ secrets.ALI_PK }} 22 | scan_type: sca 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /target 3 | *.iml 4 | bak 5 | .pmd 6 | .project 7 | .settings 8 | .classpath 9 | .idea.xml 10 | .idea 11 | *.class 12 | *.bak 13 | *.iml 14 | *.ipr 15 | *.iws 16 | bak 17 | null/ 18 | tree.log 19 | tmp/ 20 | velocity.log 21 | .DS_Store 22 | logs 23 | .m2 24 | *.html 25 | *.gif 26 | *.css 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | #.travis.yml 2 | language: java 3 | 4 | jdk: 5 | - oraclejdk8 6 | - openjdk7 7 | 8 | 9 | install: 10 | - mvn clean install -DskipTests -B -V 11 | - mvn test 12 | 13 | script: 14 | - sh ./tools/check_format.sh 15 | 16 | after_success: 17 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /HEADER: -------------------------------------------------------------------------------- 1 | Licensed to the Apache Software Foundation (ASF) under one or more 2 | contributor license agreements. See the NOTICE file distributed with 3 | this work for additional information regarding copyright ownership. 4 | The ASF licenses this file to You under the Apache License, Version 2.0 5 | (the "License"); you may not use this file except in compliance with 6 | the License. You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ACTS 2 | [![Build Status](https://travis-ci.org/alipay/sofa-acts.svg?branch=master)](https://travis-ci.org/alipay/sofa-acts) 3 | [![codecov](https://codecov.io/gh/alipay/sofa-acts/branch/master/graph/badge.svg)](https://codecov.io/gh/alipay/sofa-acts) 4 | ![License](https://img.shields.io/badge/license-Apache--2.0-green.svg) 5 | 6 | ACTS 是基于数据模型驱动测试引擎的的新一代测试框架,它的数据以 YAML 为载体,在此上构建基于数据模型的驱动引擎,适配 TestNg+SOFABoot 的测试上下文环境;支持高效、标准化构建用例,可视化编辑测试数据,精细化校验结果数据和自动清理 DB 数据,可以有效降低人工录入用例数据的成本,同时支持 API 重写提高测试代码的可扩展可复用性,提供特有注解提高测试代码编排的灵活性。 7 | # 一、背景 8 | 保证代码质量、提高测试效率一直以来是测试人员关注的重点。目前现有测试框架依赖人工编写大量代码来组织测试数据、调度业务、控制校验点和清理DB数据,使得数据和代码耦合在一起,难以达到精细化校验,同时测试代码体积膨胀过快,可复用性降低,开发测试人员编写测试用例的效率难以提升。 9 | 为了提高测试用例编写效率和数据校验的完整、准确和精细化,蚂蚁金服基于 TestNg 研发了 ACTS 测试框架来解决上述问题。 10 | # 二、功能简介 11 | ACTS 提供了下面的能力: 12 | ## 2.1 数据可视化编辑 13 | 框架实现了测试数据与测试代码的分离,同时配套提供可视化编辑器 ACTS IDE,通过 ACTS IDE 可以快速地录入、查看和管理用例数据,有效减少重复性的数据准备代码。 14 | ## 2.2 精细化校验 15 | 为了提高方法返回值、DB 变更数据等期望数据值的填写效率和减少检验点遗漏,框架提供了预跑返填功能;在 ACTS 规则标签的标记下,实现期望 DB 数据、期望结果等精细化校验。 16 | ## 2.3 丰富的数据API 17 | ACTS 数据自定义 API 接口封装于 ActsRuntimeContext 类里,可快速获取和设置自定义参数、用例入参、期望结果等,满足用户对用例数据的自定义操作; 18 | ## 2.4 自定义引擎各阶段 19 | 为了提高 ACTS 的灵活可扩展性,框架的 ActsTestBase 测试基类对外暴露各个执行阶段方法,包括 prepare,execute,check,clear 等,例如在测试类中,通过重写 process 方法可将整个测试脚本重新编排。 20 | ## 2.5 统一配置能力 21 | 配置文件中提供丰富的配置能力以定制化框架的个性需求。 22 | # 三、快速开始 23 | 请查看文档中的[快速开始](https://www.sofastack.tech/sofa-acts/docs/GettingStarted)来了解如何快速上手使用 ACTS。 24 | # 四、如何贡献 25 | 在贡献代码之前,请阅读[参与贡献](https://www.sofastack.tech/sofa-acts/docs/Contributing)来了解如何向 ACTS 贡献代码。 26 | ACTS 的编译环境的要求为 JDK7 或者 JDK8,需要采用 Apache Maven 3.2.5 或者更高的版本进行编译。 27 | # 五、感谢 28 | ACTS 源于蚂蚁金服内部众多测试技术人员的经验总结,同时汲取了蚂蚁内部其他优秀白盒测试产品的设计优点,感谢这些工作者们的辛勤付出。 29 | # 六、示例 30 | ACTS 入门[使用示例](https://github.com/alipay/sofa-acts/tree/master/acts-sample)。 31 | # 七、文档 32 | 请参考 ACTS [用户使用手册](https://www.sofastack.tech/sofa-acts/docs/Usage-Ready)。 -------------------------------------------------------------------------------- /acts-common-dto/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.alipay.sofa.acts 6 | acts-parent 7 | 1.0.0 8 | ../pom.xml 9 | 10 | com.alipay.sofa.acts 11 | acts-common-dto 12 | jar 13 | 14 | acts-common-dto 15 | http://www.antfin.com 16 | 17 | UTF-8 18 | 19 | 20 | 21 | src/main/java 22 | 23 | 24 | src/main/resources 25 | false 26 | 27 | **/** 28 | 29 | 30 | 31 | src/test/java 32 | 33 | 34 | src/test/resources 35 | false 36 | 37 | **/** 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /acts-common-dto/src/main/java/com/alipay/test/acts/constants/ActsArragementConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constants; 18 | 19 | /** 20 | * Run stages 21 | * @author tantian.wc 22 | * @version $Id: ActsArragementConstant.java, v 0.1 2015-10-13 10:32:05 a.m tantian.wc Exp $ 23 | */ 24 | public class ActsArragementConstant { 25 | 26 | public static final String PREPARE = "prepare"; 27 | public static final String EXECUTE = "execute"; 28 | public static final String CHECK = "check"; 29 | public static final String CLEAR = "clear"; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /acts-common-dto/src/main/java/com/alipay/test/acts/constants/DBFlagConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constants; 18 | 19 | public class DBFlagConstant { 20 | 21 | /** Do check */ 22 | public static final String Y = "Y"; 23 | /** Do not check */ 24 | public static final String N = "N"; 25 | /** query with this condition */ 26 | public static final String C = "C"; 27 | /** should not exist */ 28 | public static final String CN = "CN"; 29 | /** check with regex */ 30 | public static final String R = "R"; 31 | } 32 | -------------------------------------------------------------------------------- /acts-common-dto/src/main/java/com/alipay/test/acts/model/TestUnit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.model; 18 | 19 | public class TestUnit { 20 | 21 | /** description */ 22 | String description; 23 | 24 | /** 25 | * Gets description. 26 | * 27 | * @return the description 28 | */ 29 | public String getDescription() { 30 | return description; 31 | } 32 | 33 | /** 34 | * Sets description. 35 | * 36 | * @param description the description 37 | */ 38 | public void setDescription(String description) { 39 | this.description = description; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-dto/src/main/java/com/alipay/test/acts/model/VirtualList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.model; 18 | 19 | public class VirtualList { 20 | 21 | private Object virtualList; 22 | 23 | /** 24 | * Getter method for property virtualList. 25 | * 26 | * @return property value of virtualList 27 | */ 28 | public Object getVirtualList() { 29 | return virtualList; 30 | } 31 | 32 | /** 33 | * Setter method for property virtualList. 34 | * 35 | * @param virtualList value to be assigned to property virtualList 36 | */ 37 | public void setVirtualList(Object virtualList) { 38 | this.virtualList = virtualList; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/constant/ActsConfigConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constant; 18 | 19 | /** 20 | * 21 | * @author baishuo.lp 22 | * @version $Id: ActsConfigConstants.java, v 0.1 2015年8月28日 下午5:10:28 baishuo.lp Exp $ 23 | */ 24 | public class ActsConfigConstants { 25 | 26 | public final static String SKIP_COMPARE_DB_LENGTH_KEY = "acts_skip_db_length_compare"; 27 | 28 | public final static String IGNORE_STRING_LIST_KEY = "acts_string_compare_ignore_list"; 29 | 30 | public final static String IS_SINGLE_YAML = "acts_is_single_yaml"; 31 | } 32 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/constant/ActsDBConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constant; 18 | 19 | /** 20 | * database connect config 21 | * 22 | * @author hongling.xiang 23 | * @version $Id: ActsDBConstants.java, v 0.1 2015年10月10日 下午10:35:09 hongling.xiang Exp $ 24 | */ 25 | public class ActsDBConstants { 26 | 27 | /** db url */ 28 | public static final String DB_URL = "jdbc:mysql://localhost:3306/acts?characterEncoding=UTF-8"; 29 | 30 | /** db name */ 31 | public static final String DB_USER_NAME = "acts"; 32 | 33 | /** db pass */ 34 | public static final String DB_PASSWORD = "acts"; 35 | 36 | /** db schema */ 37 | public static final String DB_SCHEMA = "acts"; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/constant/ActsYamlConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constant; 18 | 19 | /** 20 | * some constants in Yaml 21 | * 22 | * @author baishuo.lp 23 | * @version $Id: ActsYamlConstants.java, v 0.1 2015年8月26日 下午3:31:30 baishuo.lp Exp $ 24 | */ 25 | public class ActsYamlConstants { 26 | 27 | public final static String COMMONKEY = "COMMON"; 28 | 29 | public final static String GROUPKEY = "group_"; 30 | 31 | public final static String LINESEPARATOR = "\\n"; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/constant/AnsiColorConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constant; 18 | 19 | /** 20 | * ANSI COLOR 21 | * @author yuanzhen.chen 22 | * @version $Id: AnsiColorConstants.java, v 0.1 2016年10月27日 上午10:41:36 yuanzhen.chen Exp $ 23 | */ 24 | public class AnsiColorConstants { 25 | 26 | public static final String ANSI_BLACK_BEGIN = "\u001B[90m"; 27 | public static final String ANSI_RED_BEGIN = "\u001B[91m"; 28 | public static final String ANSI_GREEN_BEGIN = "\u001B[92m"; 29 | public static final String ANSI_YELLOW_BEGIN = "\u001B[93m"; 30 | public static final String ANSI_BLUE_BEGIN = "\u001B[94m"; 31 | public static final String ANSI_PURPLE_BEGIN = "\u001B[95m"; 32 | public static final String ANSI_CYAN_BEGIN = "\u001B[96m"; 33 | public static final String ANSI_WHITE_BEGIN = "\u001B[97m"; 34 | 35 | public static final String ANSI_COLOR_END = "\u001B[0m"; 36 | } 37 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/constant/VelocityExtendProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.constant; 18 | 19 | /** 20 | * Extended properties of velocity 21 | *

22 | * Rich velocity default processing capabilities 23 | * 24 | * @author dasong.jds 25 | * @version $Id: VelocityVariableConstants.java, v 0.1 2015年6月7日 下午6:16:07 dasong.jds Exp $ 26 | */ 27 | public class VelocityExtendProperties { 28 | 29 | /** 30 | * millisecond 31 | */ 32 | public static final String CUR_TIME_MILLIS_STR = "curTimeMillis"; 33 | 34 | /** 35 | * yyyy-MM-dd 36 | */ 37 | public static final String CUR_DATE = "curDate"; 38 | 39 | /** 40 | * yyyy-MM-dd HH:mm:ss 41 | */ 42 | public static final String CUR_DATE_TIME = "curDateTime"; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/context/ActsCaseContextHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.context; 18 | 19 | public class ActsCaseContextHolder { 20 | 21 | private static ThreadLocal actsCaseContextLocal = new ThreadLocal(); 22 | 23 | public static ActsCaseContext get() { 24 | return actsCaseContextLocal.get(); 25 | } 26 | 27 | public static boolean exists() { 28 | return actsCaseContextLocal.get() != null; 29 | } 30 | 31 | public static void set(ActsCaseContext context) { 32 | actsCaseContextLocal.set(context); 33 | } 34 | 35 | public static void clear() { 36 | actsCaseContextLocal.remove(); 37 | } 38 | 39 | public static void addUniqueMap(String key, Object value) { 40 | actsCaseContextLocal.get().getUniqueMap().put(key, value); 41 | } 42 | 43 | public static void clearUniqueMap() { 44 | actsCaseContextLocal.get().getUniqueMap().clear(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/exception/ModleFileException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.exception; 18 | 19 | /** 20 | * modle csv file 21 | * 22 | * @author mokong 23 | * @version $Id: ModleFileException.java, v 0.1 2015年11月13日 下午11:18:44 mokong Exp $ 24 | */ 25 | public class ModleFileException extends ActsException { 26 | 27 | /** */ 28 | private static final long serialVersionUID = -8485466662105298618L; 29 | 30 | /** 31 | * @param modleFilePath 32 | */ 33 | public ModleFileException(String modleFilePath) { 34 | 35 | super(modleFilePath + " is error!"); 36 | 37 | } 38 | 39 | public ModleFileException(String modleFilePath, Exception e) { 40 | 41 | super(modleFilePath + " can't be loaded.", e); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/UnitComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer; 18 | 19 | /** 20 | * 21 | * @author baishuo.lp 22 | * @version $Id: UnitComparer.java,v 0.1 2015-8-11 上午11:55:40 baishuo.lp Exp $ 23 | */ 24 | public interface UnitComparer { 25 | 26 | /** 27 | * 28 | * @param expect 29 | * @param actual 30 | * @return 31 | */ 32 | public boolean compare(Object expect, Object actual, String comparerFlagCode); 33 | } 34 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/AvailableComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.apache.commons.lang.StringUtils; 20 | import com.alipay.test.acts.object.comparer.UnitComparer; 21 | 22 | public class AvailableComparer implements UnitComparer { 23 | 24 | @Override 25 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 26 | return StringUtils.isNotBlank(String.valueOf(actual)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/ConditionComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import com.alipay.test.acts.object.comparer.UnitComparer; 20 | 21 | /** 22 | * "C" flag 23 | * 24 | * @author midang 25 | * 26 | * @version $Id: ConditionComparer.java,v 0.1 2010-8-12 上午11:52:43 midang Exp $ 27 | */ 28 | public class ConditionComparer implements UnitComparer { 29 | 30 | /** 31 | * 32 | * @param expect 33 | * @param actual 34 | * @return 35 | */ 36 | @Override 37 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/CustomComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import com.alipay.test.acts.cache.ActsCacheData; 20 | import com.alipay.test.acts.object.comparer.UnitComparer; 21 | 22 | /** 23 | * 24 | * @author baishuo.lp 25 | * @version $Id: CustomComparer.java,v 0.1 2010-8-12 上午11:26:37 baishuo.lp Exp $ 26 | */ 27 | public class CustomComparer implements UnitComparer { 28 | 29 | @Override 30 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 31 | UnitComparer comparer = ActsCacheData.getCustomComparer(comparerFlagCode); 32 | return comparer.compare(expect, actual, comparerFlagCode); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/FileComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.apache.commons.lang.StringUtils; 20 | import com.alipay.test.acts.log.ActsLogUtil; 21 | import com.alipay.test.acts.object.comparer.UnitComparer; 22 | import com.alipay.test.acts.util.FileUtil; 23 | 24 | public class FileComparer implements UnitComparer { 25 | 26 | @Override 27 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 28 | if (actual == null && StringUtils.isBlank(String.valueOf(expect))) { 29 | return true; 30 | } 31 | String expectStr = FileUtil.readFile(String.valueOf(expect)); 32 | if (!StringUtils.equals(expectStr, String.valueOf(actual))) { 33 | ActsLogUtil.addProcessLog("Check failure!"); 34 | ActsLogUtil.addProcessLog("expect:" + expectStr); 35 | ActsLogUtil.addProcessLog("actual:" + actual); 36 | return false; 37 | } 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/NoCheckComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import com.alipay.test.acts.object.comparer.UnitComparer; 20 | 21 | /** 22 | * 23 | * "N" flag 24 | * 25 | * @author midang 26 | * 27 | * @version $Id: NoCheckComparer.java,v 0.1 2010-8-12 上午11:15:28 midang Exp $ 28 | */ 29 | public class NoCheckComparer implements UnitComparer { 30 | 31 | /** 32 | * 33 | * @param expect 34 | * @param actual 35 | * @return 36 | */ 37 | @Override 38 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/comparer/impl/RegexComparer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import com.alipay.test.acts.object.comparer.UnitComparer; 20 | 21 | import java.util.regex.Matcher; 22 | import java.util.regex.Pattern; 23 | 24 | /** 25 | * 26 | * "R" flag 27 | * 28 | * @author midang 29 | * 30 | * @version $Id: RegexComparer.java,v 0.1 2010-8-12 上午11:35:45 midang Exp $ 31 | */ 32 | public class RegexComparer implements UnitComparer { 33 | 34 | /** 35 | * 36 | * @param expect 37 | * @param actual 38 | * @return 39 | */ 40 | @Override 41 | public boolean compare(Object expect, Object actual, String comparerFlagCode) { 42 | Pattern p = Pattern.compile(String.valueOf(expect)); 43 | Matcher m = p.matcher(String.valueOf(actual)); 44 | if (!m.find()) { 45 | return false; 46 | } 47 | return true; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/generator/CustomGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.generator; 18 | 19 | /** 20 | * 21 | * @author baishuo.lp 22 | * @version $Id: CustomGenerator.java, v 0.1 2015年8月12日 下午4:50:23 baishuo.lp Exp $ 23 | */ 24 | public abstract class CustomGenerator implements ObjectGenerator { 25 | 26 | /** 27 | * generate object by attribute 28 | * 29 | * @param keyPath 30 | * @param originValue 31 | * @param type 32 | * @return 33 | */ 34 | public abstract Object generater(String keyPath, Object originValue, String type); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/object/generator/ObjectGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.generator; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | /** 22 | * 23 | * @author baishuo.lp 24 | * @version $Id: ObjectTypeHandler.java, v 0.1 2015年8月14日 下午4:49:16 baishuo.lp Exp $ 25 | */ 26 | public interface ObjectGenerator { 27 | 28 | boolean isSimpleType(); 29 | 30 | Object generateFieldObject(Class clz, String fieldName, String referedCSVValue); 31 | 32 | String generateObjectValue(Object obj, String csvPath, boolean isSimple); 33 | 34 | Class getItemClass(Type collectionItemType, Class clz); 35 | 36 | void setObjectValue(Object collectionObject, Object value, String originalValue, int index); 37 | } 38 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/util/DeepCopyUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.util; 18 | 19 | import com.rits.cloning.Cloner; 20 | 21 | /** 22 | * Deep copy 23 | * @author zhiyuan.lzy 24 | * @version $Id: DeepCopyUtils.java, v 0.1 2015年10月21日 下午3:57:52 zhiyuan.lzy Exp $ 25 | */ 26 | public class DeepCopyUtils { 27 | 28 | public static T deepCopy(T obj) { 29 | 30 | T copyResult = getClonerInstance().deepClone(obj); 31 | return copyResult; 32 | } 33 | 34 | private static Cloner getClonerInstance() { 35 | Cloner cloner = Cloner.shared(); 36 | return cloner; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/test/acts/util/XMLParserUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.util; 18 | 19 | import java.io.File; 20 | 21 | import javax.xml.parsers.SAXParser; 22 | import javax.xml.parsers.SAXParserFactory; 23 | 24 | import org.xml.sax.helpers.DefaultHandler; 25 | 26 | /** 27 | * xml parser 28 | * @author xiaoleicxl 29 | * @version $Id: XMLParserUtil.java, v 0.1 2016年1月4日 上午10:38:53 xiaoleicxl Exp $ 30 | */ 31 | public class XMLParserUtil { 32 | 33 | public static void parseXML(File xml, DefaultHandler handler) throws Exception { 34 | 35 | SAXParserFactory factory = SAXParserFactory.newInstance(); 36 | 37 | SAXParser parser = factory.newSAXParser(); 38 | 39 | parser.parse(xml, handler); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/Dumper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml; 17 | 18 | import com.alipay.yaml.representer.Representer; 19 | 20 | /** 21 | * @deprecated Dumper's functionality was moved to Yaml 22 | */ 23 | public final class Dumper { 24 | protected final Representer representer; 25 | protected final DumperOptions options; 26 | 27 | public Dumper(Representer representer, DumperOptions options) { 28 | this.representer = representer; 29 | this.options = options; 30 | } 31 | 32 | public Dumper(DumperOptions options) { 33 | this(new Representer(), options); 34 | } 35 | 36 | public Dumper(Representer representer) { 37 | this(representer, new DumperOptions()); 38 | } 39 | 40 | public Dumper() { 41 | this(new Representer(), new DumperOptions()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/Loader.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml; 17 | 18 | import com.alipay.yaml.constructor.BaseConstructor; 19 | import com.alipay.yaml.constructor.Constructor; 20 | import com.alipay.yaml.resolver.Resolver; 21 | 22 | /** 23 | * @deprecated Loader's functionality was moved to Yaml 24 | */ 25 | public final class Loader { 26 | protected final BaseConstructor constructor; 27 | protected Resolver resolver; 28 | 29 | public Loader(BaseConstructor constructor) { 30 | super(); 31 | this.constructor = constructor; 32 | } 33 | 34 | public Loader() { 35 | this(new Constructor()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/LoaderOptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml; 17 | 18 | /** 19 | * @deprecated 20 | */ 21 | public class LoaderOptions { 22 | private TypeDescription rootTypeDescription; 23 | 24 | public LoaderOptions() { 25 | this(new TypeDescription(Object.class)); 26 | } 27 | 28 | public LoaderOptions(TypeDescription rootTypeDescription) { 29 | this.rootTypeDescription = rootTypeDescription; 30 | } 31 | 32 | public TypeDescription getRootTypeDescription() { 33 | return rootTypeDescription; 34 | } 35 | 36 | public void setRootTypeDescription(TypeDescription rootTypeDescription) { 37 | this.rootTypeDescription = rootTypeDescription; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/composer/ComposerException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.composer; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | import com.alipay.yaml.error.MarkedYAMLException; 20 | 21 | public class ComposerException extends MarkedYAMLException { 22 | private static final long serialVersionUID = 2146314636913113935L; 23 | 24 | protected ComposerException(String context, Mark contextMark, String problem, Mark problemMark) { 25 | super(context, contextMark, problem, problemMark); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/constructor/AbstractConstruct.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.constructor; 17 | 18 | import com.alipay.yaml.error.YAMLException; 19 | import com.alipay.yaml.nodes.Node; 20 | 21 | /** 22 | * Because recursive structures are not very common we provide a way to save 23 | * some typing when extending a constructor 24 | */ 25 | public abstract class AbstractConstruct implements Construct { 26 | 27 | /** 28 | * Fail with a reminder to provide the seconds step for a recursive 29 | * structure 30 | * 31 | * @see com.alipay.yaml.constructor.Construct#construct2ndStep(com.alipay.yaml.nodes.Node, 32 | * java.lang.Object) 33 | */ 34 | public void construct2ndStep(Node node, Object data) { 35 | if (node.isTwoStepsConstruction()) { 36 | throw new IllegalStateException("Not Implemented in " + getClass().getName()); 37 | } else { 38 | throw new YAMLException("Unexpected recursive structure for Node: " + node); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/constructor/ConstructorException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.constructor; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | import com.alipay.yaml.error.MarkedYAMLException; 20 | 21 | public class ConstructorException extends MarkedYAMLException { 22 | private static final long serialVersionUID = -8816339931365239910L; 23 | 24 | protected ConstructorException(String context, Mark contextMark, String problem, 25 | Mark problemMark, Throwable cause) { 26 | super(context, contextMark, problem, problemMark, cause); 27 | } 28 | 29 | protected ConstructorException(String context, Mark contextMark, String problem, 30 | Mark problemMark) { 31 | this(context, contextMark, problem, problemMark, null); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/constructor/CustomClassLoaderConstructor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.constructor; 17 | 18 | /** 19 | * Construct instances with a custom Class Loader. 20 | */ 21 | public class CustomClassLoaderConstructor extends Constructor { 22 | private ClassLoader loader = CustomClassLoaderConstructor.class.getClassLoader(); 23 | 24 | public CustomClassLoaderConstructor(ClassLoader cLoader) { 25 | this(Object.class, cLoader); 26 | } 27 | 28 | public CustomClassLoaderConstructor(Class theRoot, ClassLoader theLoader) { 29 | super(theRoot); 30 | if (theLoader == null) { 31 | throw new NullPointerException("Loader must be provided."); 32 | } 33 | this.loader = theLoader; 34 | } 35 | 36 | @Override 37 | protected Class getClassForName(String name) throws ClassNotFoundException { 38 | return Class.forName(name, true, loader); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/emitter/Emitable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.emitter; 17 | 18 | import java.io.IOException; 19 | 20 | import com.alipay.yaml.events.Event; 21 | 22 | public interface Emitable { 23 | void emit(Event event) throws IOException; 24 | } 25 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/emitter/EmitterException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.emitter; 17 | 18 | import com.alipay.yaml.error.YAMLException; 19 | 20 | public class EmitterException extends YAMLException { 21 | private static final long serialVersionUID = -8280070025452995908L; 22 | 23 | public EmitterException(String msg) { 24 | super(msg); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/emitter/EmitterState.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.emitter; 17 | 18 | import java.io.IOException; 19 | 20 | /** 21 | * Python's methods are first class object. Java needs a class. 22 | */ 23 | interface EmitterState { 24 | void expect() throws IOException; 25 | } -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/emitter/ScalarAnalysis.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.emitter; 17 | 18 | public final class ScalarAnalysis { 19 | public String scalar; 20 | public boolean empty; 21 | public boolean multiline; 22 | public boolean allowFlowPlain; 23 | public boolean allowBlockPlain; 24 | public boolean allowSingleQuoted; 25 | public boolean allowBlock; 26 | 27 | public ScalarAnalysis(String scalar, boolean empty, boolean multiline, boolean allowFlowPlain, 28 | boolean allowBlockPlain, boolean allowSingleQuoted, boolean allowBlock) { 29 | this.scalar = scalar; 30 | this.empty = empty; 31 | this.multiline = multiline; 32 | this.allowFlowPlain = allowFlowPlain; 33 | this.allowBlockPlain = allowBlockPlain; 34 | this.allowSingleQuoted = allowSingleQuoted; 35 | this.allowBlock = allowBlock; 36 | } 37 | } -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/error/YAMLException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.error; 17 | 18 | public class YAMLException extends RuntimeException { 19 | private static final long serialVersionUID = -4738336175050337570L; 20 | 21 | public YAMLException(String message) { 22 | super(message); 23 | } 24 | 25 | public YAMLException(Throwable cause) { 26 | super(cause); 27 | } 28 | 29 | public YAMLException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/AliasEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the inclusion of a previously anchored node. 22 | */ 23 | public final class AliasEvent extends NodeEvent { 24 | public AliasEvent(String anchor, Mark startMark, Mark endMark) { 25 | super(anchor, startMark, endMark); 26 | } 27 | 28 | @Override 29 | public boolean is(Event.ID id) { 30 | return ID.Alias == id; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/CollectionEndEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Base class for the end events of the collection nodes. 22 | */ 23 | public abstract class CollectionEndEvent extends Event { 24 | 25 | public CollectionEndEvent(Mark startMark, Mark endMark) { 26 | super(startMark, endMark); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/DocumentEndEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the end of a document. 22 | *

23 | * This event follows the document's content. 24 | *

25 | */ 26 | public final class DocumentEndEvent extends Event { 27 | private final boolean explicit; 28 | 29 | public DocumentEndEvent(Mark startMark, Mark endMark, boolean explicit) { 30 | super(startMark, endMark); 31 | this.explicit = explicit; 32 | } 33 | 34 | public boolean getExplicit() { 35 | return explicit; 36 | } 37 | 38 | @Override 39 | public boolean is(Event.ID id) { 40 | return ID.DocumentEnd == id; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/MappingEndEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the end of a mapping node. 22 | * 23 | * @see MappingStartEvent 24 | */ 25 | public final class MappingEndEvent extends CollectionEndEvent { 26 | 27 | public MappingEndEvent(Mark startMark, Mark endMark) { 28 | super(startMark, endMark); 29 | } 30 | 31 | @Override 32 | public boolean is(Event.ID id) { 33 | return ID.MappingEnd == id; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/MappingStartEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the beginning of a mapping node. 22 | *

23 | * This event is followed by a number of key value pairs.
24 | * The pairs are not in any particular order. However, the value always directly 25 | * follows the corresponding key.
26 | * After the key value pairs follows a {@link MappingEndEvent}. 27 | *

28 | *

29 | * There must be an even number of node events between the start and end event. 30 | *

31 | * 32 | * @see MappingEndEvent 33 | */ 34 | public final class MappingStartEvent extends CollectionStartEvent { 35 | public MappingStartEvent(String anchor, String tag, boolean implicit, Mark startMark, 36 | Mark endMark, Boolean flowStyle) { 37 | super(anchor, tag, implicit, startMark, endMark, flowStyle); 38 | } 39 | 40 | @Override 41 | public boolean is(Event.ID id) { 42 | return ID.MappingStart == id; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/NodeEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Base class for all events that mark the beginning of a node. 22 | */ 23 | public abstract class NodeEvent extends Event { 24 | 25 | private final String anchor; 26 | 27 | public NodeEvent(String anchor, Mark startMark, Mark endMark) { 28 | super(startMark, endMark); 29 | this.anchor = anchor; 30 | } 31 | 32 | /** 33 | * Node anchor by which this node might later be referenced by a 34 | * {@link AliasEvent}. 35 | *

36 | * Note that {@link AliasEvent}s are by it self NodeEvents and 37 | * use this property to indicate the referenced anchor. 38 | * 39 | * @return Anchor of this node or null if no anchor is defined. 40 | */ 41 | public String getAnchor() { 42 | return this.anchor; 43 | } 44 | 45 | @Override 46 | protected String getArguments() { 47 | return "anchor=" + anchor; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/SequenceEndEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the end of a sequence. 22 | * 23 | * @see SequenceStartEvent 24 | */ 25 | public final class SequenceEndEvent extends CollectionEndEvent { 26 | 27 | public SequenceEndEvent(Mark startMark, Mark endMark) { 28 | super(startMark, endMark); 29 | } 30 | 31 | @Override 32 | public boolean is(Event.ID id) { 33 | return ID.SequenceEnd == id; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/SequenceStartEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the beginning of a sequence node. 22 | *

23 | * This event is followed by the elements contained in the sequence, and a 24 | * {@link SequenceEndEvent}. 25 | *

26 | * 27 | * @see SequenceEndEvent 28 | */ 29 | public final class SequenceStartEvent extends CollectionStartEvent { 30 | public SequenceStartEvent(String anchor, String tag, boolean implicit, Mark startMark, 31 | Mark endMark, Boolean flowStyle) { 32 | super(anchor, tag, implicit, startMark, endMark, flowStyle); 33 | } 34 | 35 | @Override 36 | public boolean is(Event.ID id) { 37 | return ID.SequenceStart == id; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/StreamEndEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the end of a stream that might have contained multiple documents. 22 | *

23 | * This event is the last event that a parser emits. Together with 24 | * {@link StreamStartEvent} (which is the first event a parser emits) they mark 25 | * the beginning and the end of a stream of documents. 26 | *

27 | *

28 | * See {@link Event} for an exemplary output. 29 | *

30 | */ 31 | public final class StreamEndEvent extends Event { 32 | public StreamEndEvent(Mark startMark, Mark endMark) { 33 | super(startMark, endMark); 34 | } 35 | 36 | @Override 37 | public boolean is(Event.ID id) { 38 | return ID.StreamEnd == id; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/events/StreamStartEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.events; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Marks the start of a stream that might contain multiple documents. 22 | *

23 | * This event is the first event that a parser emits. Together with 24 | * {@link StreamEndEvent} (which is the last event a parser emits) they mark the 25 | * beginning and the end of a stream of documents. 26 | *

27 | *

28 | * See {@link Event} for an exemplary output. 29 | *

30 | */ 31 | public final class StreamStartEvent extends Event { 32 | 33 | public StreamStartEvent(Mark startMark, Mark endMark) { 34 | super(startMark, endMark); 35 | } 36 | 37 | @Override 38 | public boolean is(Event.ID id) { 39 | return ID.StreamStart == id; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/extensions/compactnotation/PackageCompactConstructor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.extensions.compactnotation; 17 | 18 | public class PackageCompactConstructor extends CompactConstructor { 19 | private String packageName; 20 | 21 | public PackageCompactConstructor(String packageName) { 22 | this.packageName = packageName; 23 | } 24 | 25 | @Override 26 | protected Class getClassForName(String name) throws ClassNotFoundException { 27 | if (name.indexOf('.') < 0) { 28 | try { 29 | Class clazz = Class.forName(packageName + "." + name); 30 | return clazz; 31 | } catch (ClassNotFoundException e) { 32 | // use super implementation 33 | } 34 | } 35 | return super.getClassForName(name); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/introspector/BeanAccess.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.introspector; 17 | 18 | /** 19 | * Control instance variables. 20 | */ 21 | public enum BeanAccess { 22 | /** use JavaBean properties and public fields */ 23 | DEFAULT, 24 | 25 | /** use all declared fields (including inherited) */ 26 | FIELD, 27 | 28 | /** reserved */ 29 | PROPERTY; 30 | } -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/introspector/MissingProperty.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.introspector; 17 | 18 | /** 19 | * A property that does not map to a real property; this is used when {@link 20 | * PropertyUtils.setSkipMissingProperties(boolean)} is set to true. 21 | */ 22 | public class MissingProperty extends Property { 23 | 24 | public MissingProperty(String name) { 25 | super(name, Object.class); 26 | } 27 | 28 | @Override 29 | public Class[] getActualTypeArguments() { 30 | return new Class[0]; 31 | } 32 | 33 | /** 34 | * Setter does nothing. 35 | */ 36 | @Override 37 | public void set(Object object, Object value) throws Exception { 38 | } 39 | 40 | @Override 41 | public Object get(Object object) { 42 | return object; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/nodes/AnchorNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.nodes; 17 | 18 | public class AnchorNode extends Node { 19 | 20 | private Node realNode; 21 | 22 | public AnchorNode(Node realNode) { 23 | super(realNode.getTag(), realNode.getStartMark(), realNode.getEndMark()); 24 | this.realNode = realNode; 25 | } 26 | 27 | @Override 28 | public NodeId getNodeId() { 29 | return NodeId.anchor; 30 | } 31 | 32 | public Node getRealNode() { 33 | return realNode; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/nodes/CollectionNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.nodes; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | /** 21 | * Base class for the two collection types {@link MappingNode mapping} and 22 | * {@link SequenceNode collection}. 23 | */ 24 | public abstract class CollectionNode extends Node { 25 | private Boolean flowStyle; 26 | 27 | public CollectionNode(Tag tag, Mark startMark, Mark endMark, Boolean flowStyle) { 28 | super(tag, startMark, endMark); 29 | this.flowStyle = flowStyle; 30 | } 31 | 32 | /** 33 | * Serialization style of this collection. 34 | * 35 | * @return true for flow style, false for block 36 | * style. 37 | */ 38 | public Boolean getFlowStyle() { 39 | return flowStyle; 40 | } 41 | 42 | public void setFlowStyle(Boolean flowStyle) { 43 | this.flowStyle = flowStyle; 44 | } 45 | 46 | public void setEndMark(Mark endMark) { 47 | this.endMark = endMark; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/nodes/NodeId.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.nodes; 17 | 18 | /** 19 | * Enum for the three basic YAML types: scalar, sequence and mapping. 20 | */ 21 | public enum NodeId { 22 | scalar, sequence, mapping, anchor; 23 | } 24 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/nodes/NodeTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.nodes; 17 | 18 | /** 19 | * Stores one key value pair used in a map. 20 | */ 21 | public final class NodeTuple { 22 | 23 | private Node keyNode; 24 | private Node valueNode; 25 | 26 | public NodeTuple(Node keyNode, Node valueNode) { 27 | if (keyNode == null || valueNode == null) { 28 | throw new NullPointerException("Nodes must be provided."); 29 | } 30 | this.keyNode = keyNode; 31 | this.valueNode = valueNode; 32 | } 33 | 34 | /** 35 | * Key node. 36 | */ 37 | final public Node getKeyNode() { 38 | return keyNode; 39 | } 40 | 41 | /** 42 | * Value node. 43 | * 44 | * @return value 45 | */ 46 | final public Node getValueNode() { 47 | return valueNode; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return ""; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/parser/ParserException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.parser; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | import com.alipay.yaml.error.MarkedYAMLException; 20 | 21 | /** 22 | * Exception thrown by the {@link Parser} implementations in case of malformed 23 | * input. 24 | */ 25 | public class ParserException extends MarkedYAMLException { 26 | private static final long serialVersionUID = -2349253802798398038L; 27 | 28 | /** 29 | * Constructs an instance. 30 | * 31 | * @param context 32 | * Part of the input document in which vicinity the problem 33 | * occurred. 34 | * @param contextMark 35 | * Position of the context within the document. 36 | * @param problem 37 | * Part of the input document that caused the problem. 38 | * @param problemMark 39 | * Position of the problem. within the document. 40 | */ 41 | public ParserException(String context, Mark contextMark, String problem, Mark problemMark) { 42 | super(context, contextMark, problem, problemMark, null, null); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/parser/Production.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.parser; 17 | 18 | import com.alipay.yaml.events.Event; 19 | 20 | /** 21 | * Helper for {@link ParserImpl}. A grammar rule to apply given the symbols on 22 | * top of its stack and the next input token 23 | * 24 | * @see http://en.wikipedia.org/wiki/LL_parser 25 | */ 26 | interface Production { 27 | public Event produce(); 28 | } 29 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/parser/VersionTagsTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.parser; 17 | 18 | import java.util.Map; 19 | 20 | import com.alipay.yaml.DumperOptions.Version; 21 | 22 | /** 23 | * Store the internal state for directives 24 | */ 25 | class VersionTagsTuple { 26 | private Version version; 27 | private Map tags; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param version the version 33 | * @param tags the tags 34 | */ 35 | public VersionTagsTuple(Version version, Map tags) { 36 | this.version = version; 37 | this.tags = tags; 38 | } 39 | 40 | /** 41 | * Gets version. 42 | * 43 | * @return the version 44 | */ 45 | public Version getVersion() { 46 | return version; 47 | } 48 | 49 | /** 50 | * Gets tags. 51 | * 52 | * @return the tags 53 | */ 54 | public Map getTags() { 55 | return tags; 56 | } 57 | 58 | /** 59 | * To string string. 60 | * 61 | * @return the string 62 | */ 63 | @Override 64 | public String toString() { 65 | return String.format("VersionTagsTuple<%s, %s>", version, tags); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/representer/Represent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.representer; 17 | 18 | import com.alipay.yaml.nodes.Node; 19 | 20 | /** 21 | * Create a Node Graph out of the provided Native Data Structure (Java 22 | * instance). 23 | * 24 | * @see Chapter 3. Processing YAML 25 | * Information 26 | */ 27 | public interface Represent { 28 | /** 29 | * Create a Node 30 | * 31 | * @param data 32 | * the instance to represent 33 | * @return Node to dump 34 | */ 35 | Node representData(Object data); 36 | } 37 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/resolver/ResolverTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.resolver; 17 | 18 | import java.util.regex.Pattern; 19 | 20 | import com.alipay.yaml.nodes.Tag; 21 | 22 | final class ResolverTuple { 23 | private final Tag tag; 24 | private final Pattern regexp; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param tag the tag 30 | * @param regexp the regexp 31 | */ 32 | public ResolverTuple(Tag tag, Pattern regexp) { 33 | this.tag = tag; 34 | this.regexp = regexp; 35 | } 36 | 37 | /** 38 | * Gets tag. 39 | * 40 | * @return the tag 41 | */ 42 | public Tag getTag() { 43 | return tag; 44 | } 45 | 46 | /** 47 | * Gets regexp. 48 | * 49 | * @return the regexp 50 | */ 51 | public Pattern getRegexp() { 52 | return regexp; 53 | } 54 | 55 | /** 56 | * To string string. 57 | * 58 | * @return the string 59 | */ 60 | @Override 61 | public String toString() { 62 | return "Tuple tag=" + tag + " regexp=" + regexp; 63 | } 64 | } -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/serializer/SerializerException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.serializer; 17 | 18 | import com.alipay.yaml.error.YAMLException; 19 | 20 | public class SerializerException extends YAMLException { 21 | private static final long serialVersionUID = 2632638197498912433L; 22 | 23 | public SerializerException(String message) { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/AliasToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class AliasToken extends Token { 21 | private final String value; 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param value the value 27 | * @param startMark the start mark 28 | * @param endMark the end mark 29 | */ 30 | public AliasToken(String value, Mark startMark, Mark endMark) { 31 | super(startMark, endMark); 32 | this.value = value; 33 | } 34 | 35 | /** 36 | * Gets value. 37 | * 38 | * @return the value 39 | */ 40 | public String getValue() { 41 | return this.value; 42 | } 43 | 44 | @Override 45 | protected String getArguments() { 46 | return "value=" + value; 47 | } 48 | 49 | /** 50 | * Gets token id. 51 | * 52 | * @return the token id 53 | */ 54 | @Override 55 | public Token.ID getTokenId() { 56 | return ID.Alias; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/AnchorToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class AnchorToken extends Token { 21 | private final String value; 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param value the value 27 | * @param startMark the start mark 28 | * @param endMark the end mark 29 | */ 30 | public AnchorToken(String value, Mark startMark, Mark endMark) { 31 | super(startMark, endMark); 32 | this.value = value; 33 | } 34 | 35 | /** 36 | * Gets value. 37 | * 38 | * @return the value 39 | */ 40 | public String getValue() { 41 | return this.value; 42 | } 43 | 44 | @Override 45 | protected String getArguments() { 46 | return "value=" + value; 47 | } 48 | 49 | /** 50 | * Gets token id. 51 | * 52 | * @return the token id 53 | */ 54 | @Override 55 | public Token.ID getTokenId() { 56 | return ID.Anchor; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/BlockEndToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class BlockEndToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public BlockEndToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.BlockEnd; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/BlockEntryToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class BlockEntryToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public BlockEntryToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.BlockEntry; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/BlockMappingStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class BlockMappingStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public BlockMappingStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.BlockMappingStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/BlockSequenceStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class BlockSequenceStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public BlockSequenceStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.BlockSequenceStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/DocumentEndToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class DocumentEndToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public DocumentEndToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.DocumentEnd; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/DocumentStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class DocumentStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public DocumentStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.DocumentStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/FlowEntryToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class FlowEntryToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public FlowEntryToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.FlowEntry; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/FlowMappingEndToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class FlowMappingEndToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public FlowMappingEndToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.FlowMappingEnd; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/FlowMappingStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class FlowMappingStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public FlowMappingStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.FlowMappingStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/FlowSequenceEndToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class FlowSequenceEndToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public FlowSequenceEndToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.FlowSequenceEnd; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/FlowSequenceStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class FlowSequenceStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public FlowSequenceStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.FlowSequenceStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/KeyToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class KeyToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public KeyToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.Key; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/StreamEndToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class StreamEndToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public StreamEndToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.StreamEnd; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/StreamStartToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class StreamStartToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public StreamStartToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.StreamStart; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/TagToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class TagToken extends Token { 21 | private final TagTuple value; 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param value the value 27 | * @param startMark the start mark 28 | * @param endMark the end mark 29 | */ 30 | public TagToken(TagTuple value, Mark startMark, Mark endMark) { 31 | super(startMark, endMark); 32 | this.value = value; 33 | } 34 | 35 | /** 36 | * Gets value. 37 | * 38 | * @return the value 39 | */ 40 | public TagTuple getValue() { 41 | return this.value; 42 | } 43 | 44 | @Override 45 | protected String getArguments() { 46 | return "value=[" + value.getHandle() + ", " + value.getSuffix() + "]"; 47 | } 48 | 49 | /** 50 | * Gets token id. 51 | * 52 | * @return the token id 53 | */ 54 | @Override 55 | public Token.ID getTokenId() { 56 | return ID.Tag; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/TagTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | public final class TagTuple { 19 | private final String handle; 20 | private final String suffix; 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param handle the handle 26 | * @param suffix the suffix 27 | */ 28 | public TagTuple(String handle, String suffix) { 29 | if (suffix == null) { 30 | throw new NullPointerException("Suffix must be provided."); 31 | } 32 | this.handle = handle; 33 | this.suffix = suffix; 34 | } 35 | 36 | /** 37 | * Gets handle. 38 | * 39 | * @return the handle 40 | */ 41 | public String getHandle() { 42 | return handle; 43 | } 44 | 45 | /** 46 | * Gets suffix. 47 | * 48 | * @return the suffix 49 | */ 50 | public String getSuffix() { 51 | return suffix; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/tokens/ValueToken.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.tokens; 17 | 18 | import com.alipay.yaml.error.Mark; 19 | 20 | public final class ValueToken extends Token { 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param startMark the start mark 26 | * @param endMark the end mark 27 | */ 28 | public ValueToken(Mark startMark, Mark endMark) { 29 | super(startMark, endMark); 30 | } 31 | 32 | /** 33 | * Gets token id. 34 | * 35 | * @return the token id 36 | */ 37 | @Override 38 | public Token.ID getTokenId() { 39 | return ID.Value; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /acts-common-util/src/main/java/com/alipay/yaml/util/ArrayStack.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2008-2013, http://www.snakeyaml.org 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alipay.yaml.util; 17 | 18 | import java.util.ArrayList; 19 | 20 | public class ArrayStack { 21 | private ArrayList stack; 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param initSize the init size 27 | */ 28 | public ArrayStack(int initSize) { 29 | stack = new ArrayList(initSize); 30 | } 31 | 32 | /** 33 | * Push. 34 | * 35 | * @param obj the obj 36 | */ 37 | public void push(T obj) { 38 | stack.add(obj); 39 | } 40 | 41 | /** 42 | * Pop t. 43 | * 44 | * @return the t 45 | */ 46 | public T pop() { 47 | return stack.remove(stack.size() - 1); 48 | } 49 | 50 | /** 51 | * Is empty boolean. 52 | * 53 | * @return the boolean 54 | */ 55 | public boolean isEmpty() { 56 | return stack.isEmpty(); 57 | } 58 | 59 | /** 60 | * Clear. 61 | */ 62 | public void clear() { 63 | stack.clear(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/comparer/impl/AvailableComparerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.springframework.util.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * Created by yanzhu on 2019/1/13. 24 | */ 25 | public class AvailableComparerTest { 26 | 27 | @Test 28 | public void test() { 29 | AvailableComparer availableComparer = new AvailableComparer(); 30 | Assert.isTrue(availableComparer.compare("", "test", "")); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/comparer/impl/DateComparerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.springframework.util.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.Date; 23 | 24 | /** 25 | * Created by yanzhu on 2019/1/13. 26 | */ 27 | public class DateComparerTest { 28 | 29 | @Test 30 | public void test() { 31 | DateComparer availableComparer = new DateComparer(); 32 | Date start = new Date(); 33 | Assert.isTrue(availableComparer.compare("now", start, "")); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/comparer/impl/FileComparerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * 24 | * @author qingqin 25 | * @version $Id: FileComparerTest.java, v 0.1 2019年01月19日 下午3:51 qingqin Exp $ 26 | */ 27 | public class FileComparerTest { 28 | 29 | @Test 30 | public void test() { 31 | FileComparer fileComparer = new FileComparer(); 32 | boolean res = fileComparer.compare("", null, ""); 33 | Assert.assertEquals(res, true); 34 | } 35 | } -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/comparer/impl/RegexComparerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * Created by yanzhu on 2019/1/15. 24 | */ 25 | public class RegexComparerTest { 26 | 27 | @Test 28 | public void test() { 29 | RegexComparer regexComparer = new RegexComparer(); 30 | String expect = "runoo+b"; 31 | String actual = "runoob"; 32 | Assert.assertTrue(regexComparer.compare(expect, actual, null)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/comparer/impl/SimpleComparerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.comparer.impl; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.ArrayList; 23 | 24 | /** 25 | * 26 | * @author qingqin 27 | * @version $Id: SimpleComparerTest.java, v 0.1 2019年01月19日 下午3:25 qingqin Exp $ 28 | */ 29 | public class SimpleComparerTest { 30 | 31 | @Test 32 | public void testCompare() { 33 | SimpleComparer simpleComparer = new SimpleComparer(); 34 | 35 | SimpleComparer.ignoreList = new ArrayList(); 36 | 37 | Assert.assertEquals(simpleComparer.compare("null", null, ""), true); 38 | 39 | Assert.assertEquals(simpleComparer.compare(null, "null", ""), true); 40 | 41 | Assert.assertEquals(simpleComparer.compare(null, null, ""), true); 42 | 43 | Assert.assertEquals(simpleComparer.compare("abc", "abc", ""), true); 44 | 45 | Assert.assertEquals(simpleComparer.compare("adv", "abc", ""), false); 46 | } 47 | } -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/generator/impl/CurrencyTypeGeneratorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.generator.impl; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.Currency; 23 | 24 | /** 25 | * Created by yanzhu on 2019/1/15. 26 | */ 27 | public class CurrencyTypeGeneratorTest { 28 | 29 | @Test 30 | public void testGenerateObjectValue() { 31 | CurrencyTypeGenerator currencyTypeGenerator = new CurrencyTypeGenerator(); 32 | Currency curr = Currency.getInstance("EUR"); 33 | Assert.assertEquals("EUR", currencyTypeGenerator.generateObjectValue(curr, null, false)); 34 | } 35 | 36 | @Test 37 | public void testGetItemClass() { 38 | CurrencyTypeGenerator stringTypeGenerator = new CurrencyTypeGenerator(); 39 | Object o = stringTypeGenerator.getItemClass(null, null); 40 | Assert.assertEquals(o, null); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/generator/impl/MoneyTypeGeneratorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.generator.impl; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * Created by yanzhu on 2019/1/15. 24 | */ 25 | public class MoneyTypeGeneratorTest { 26 | 27 | @Test 28 | public void testGenerateObjectValue() { 29 | MoneyTypeGenerator moneyTypeGenerator = new MoneyTypeGenerator(); 30 | Assert.assertEquals("12", moneyTypeGenerator.generateObjectValue("12", null, false)); 31 | 32 | } 33 | 34 | @Test 35 | public void testGetItemClass() { 36 | MoneyTypeGenerator stringTypeGenerator = new MoneyTypeGenerator(); 37 | Object o = stringTypeGenerator.getItemClass(null, null); 38 | Assert.assertEquals(o, null); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/object/manager/ObjectCompareManagerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.object.manager; 18 | 19 | import com.alipay.test.acts.object.comparer.UnitComparer; 20 | import com.alipay.test.acts.object.enums.UnitFlagEnum; 21 | import org.testng.Assert; 22 | import org.testng.annotations.Test; 23 | 24 | import java.util.Map; 25 | 26 | /** 27 | * 28 | * @author qingqin 29 | * @version $Id: ObjectCompareManagerTest.java, v 0.1 2019年01月19日 下午3:39 qingqin Exp $ 30 | */ 31 | public class ObjectCompareManagerTest { 32 | 33 | @Test 34 | public void test() { 35 | Map map = ObjectCompareManager.getComparerManager(); 36 | Assert.assertEquals(map.size(), 9); 37 | } 38 | } -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/util/DeepCopyUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.util; 18 | 19 | import org.testng.annotations.Test; 20 | import org.testng.Assert; 21 | 22 | /** 23 | * Created by yanzhu on 2019/1/13. 24 | */ 25 | public class DeepCopyUtilsTest { 26 | 27 | @Test 28 | public void test() { 29 | DeepCopyUtils DeepCopyUtils = new DeepCopyUtils(); 30 | Assert.assertEquals(DeepCopyUtils.deepCopy(DeepCopyUtils).getClass().getSimpleName(), 31 | "DeepCopyUtils"); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/util/FullTableAnalysisTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.util; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.io.File; 23 | 24 | /** 25 | * Created by yanzhu on 2019/1/13. 26 | */ 27 | public class FullTableAnalysisTest { 28 | 29 | @Test 30 | public void testetFullTableByDalConfigG() { 31 | 32 | File dalConfigXml = new File("pom.xml"); 33 | Assert.assertTrue(FullTableAnalysis.getFullTableByDalConfig(dalConfigXml).size() == 1); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /acts-common-util/src/test/java/com/alipay/test/acts/util/JsonUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.util; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.HashMap; 23 | 24 | /** 25 | * Created by yanzhu on 2019/1/13. 26 | */ 27 | public class JsonUtilTest { 28 | 29 | @Test 30 | public void testToPrettyString() { 31 | HashMap test = new HashMap(); 32 | test.put("test", "test"); 33 | Assert.assertEquals(JsonUtil.toPrettyString(test), "{\n" + "\t\"test\":\"test\"\n" + "}"); 34 | } 35 | 36 | @Test 37 | public void testGenObjectFromJsonString() { 38 | Assert.assertEquals( 39 | JsonUtil.genObjectFromJsonString("{\n" + "\t\"test\":\"test\"\n" + "}", Object.class) 40 | .toString(), "{\"test\":\"test\"}"); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/BusinessActionContext/BusinessActionContext.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.dtx.client.core.api.domain.BusinessActionContext","actionId","java.lang.String","","Y","null" 3 | "","txId","java.lang.String","","Y","null" 4 | "","activityContext","com.alipay.dtx.client.core.api.domain.BusinessActivityContext","","Y","BusinessActivityContext.csv@1" 5 | "","actionContext","java.util.Map","","M","Map_Object.csv@1" 6 | "","actionName","java.lang.String","","Y","null" 7 | "","systemTxId","java.lang.String","","Y","null" 8 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/BusinessActionContext/BusinessActivityContext.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.dtx.client.core.api.domain.BusinessActivityContext","context","java.util.Map","","M","Map_Object.csv@1" 3 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/BusinessActionContext/List_Object.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualList","virtualList","java.util.List","","Y","1" -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/BusinessActionContext/Map_Object.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue","java.lang.Object","","N","" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/List_VirtualObject/List_VirtualObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualList","virtualList",java.util.List,"","Y",VirtualObject.csv@1 -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/List_VirtualObject/VirtualObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualObject","flags","java.util.Map","","M","Map_Map.csv@1" 3 | "","objClass","java.lang.String","","Y","null" 4 | "","description","java.lang.String","","Y","null" 5 | "","nodeDesc","java.lang.String","","Y","null" 6 | "","objBaseDesc","java.lang.String","","Y","null" 7 | "","objBaseName","java.lang.String","","Y","null" 8 | "","nodeGroup","java.lang.String","","Y","null" 9 | "","object","java.lang.Object","","N","" 10 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/Map_Object/Map_Object.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue",com.alipay.test.acts.model.VirtualMap,"",Y,VirtualObject@csv1 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/Map_Object/VirtualObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualObject","flags","java.util.Map","","M","Map_Map.csv@1" 3 | "","objClass","java.lang.String","","Y","null" 4 | "","description","java.lang.String","","Y","null" 5 | "","nodeDesc","java.lang.String","","Y","null" 6 | "","objBaseDesc","java.lang.String","","Y","null" 7 | "","objBaseName","java.lang.String","","Y","null" 8 | "","nodeGroup","java.lang.String","","Y","null" 9 | "","object","java.lang.Object","","N","" 10 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/Map_Map.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue","java.util.Map","","Y","Map_String.csv@1" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/Map_Object.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue","java.lang.Object","","N","" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/Map_String.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue","java.lang.String","","Y","1" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/Map_VirtualObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualMap","mapKey","java.lang.String","","Y","1" 3 | ,"mapValue","com.alipay.test.acts.model.VirtualObject","","Y","VirtualObject.csv@1" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/PrepareData.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.PrepareData","args","com.alipay.test.acts.model.VirtualArgs","","Y","VirtualArgs.csv@1" 3 | "","expectDataSet","com.alipay.test.acts.model.VirtualDataSet","","Y","VirtualDataSet.csv@1" 4 | "","expectResult","com.alipay.test.acts.model.VirtualResult","","Y","VirtualResult.csv@1" 5 | "","expectEventSet","com.alipay.test.acts.model.VirtualEventSet","","Y","VirtualEventSet.csv@1" 6 | "","depDataSet","com.alipay.test.acts.model.VirtualDataSet","","Y","VirtualDataSet.csv@1" 7 | "","description","java.lang.String","","Y","null" 8 | "","virtualParams","com.alipay.test.acts.model.VirtualParams","","Y","VirtualParams.csv@1" 9 | "","expectException","com.alipay.test.acts.model.VirtualException","","Y","VirtualException.csv@1" 10 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualArgs.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualArgs","inputArgs","java.util.List","","Y","VirtualObject.csv@1" 3 | "","description","java.lang.String","","Y","null" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualDataSet.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualDataSet","virtualTables","java.util.List","","Y","VirtualTable.csv@1" 3 | "","description","java.lang.String","","Y","null" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualEventObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualEventObject","eventCode","java.lang.String","","Y","null" 3 | "","topicId","java.lang.String","","Y","null" 4 | "","eventObject","com.alipay.test.acts.model.VirtualObject","","Y","VirtualObject.csv@1" 5 | "","nodeDesc","java.lang.String","","Y","null" 6 | "","isExist","java.lang.String","","Y","null" 7 | "","nodeGroup","java.lang.String","","Y","null" 8 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualEventSet.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualEventSet","virtualEventObjects","java.util.List","","Y","VirtualEventObject.csv@1" 3 | "","description","java.lang.String","","Y","null" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualException.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualException","description","java.lang.String","","Y","null" 3 | "","expectException","com.alipay.test.acts.model.VirtualObject","","Y","VirtualObject.csv@1" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualObject.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualObject","flags","java.util.Map","","M","Map_Map.csv@1" 3 | "","objClass","java.lang.String","","Y","null" 4 | "","description","java.lang.String","","Y","null" 5 | "","nodeDesc","java.lang.String","","Y","null" 6 | "","objBaseDesc","java.lang.String","","Y","null" 7 | "","objBaseName","java.lang.String","","Y","null" 8 | "","nodeGroup","java.lang.String","","Y","null" 9 | "","object","java.lang.Object","","N","" 10 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualParams.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualParams","description","java.lang.String","","Y","null" 3 | "","params","java.util.Map","","M","Map_VirtualObject.csv@1" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualResult.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualResult","result","com.alipay.test.acts.model.VirtualObject","","Y","VirtualObject.csv@1" 3 | "","description","java.lang.String","","Y","null" 4 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/VirtualTable.csv: -------------------------------------------------------------------------------- 1 | "class","property","type","rule","flag","value" 2 | "com.alipay.test.acts.model.VirtualTable","flags","java.util.Map","","M","Map_String.csv@1" 3 | "","nodeDesc","java.lang.String","","Y","null" 4 | "","tableData","java.util.List","","Y","Map_Object.csv@1" 5 | "","nodeGroup","java.lang.String","","Y","null" 6 | "","tableBaseDesc","java.lang.String","","Y","null" 7 | "","dataObjClazz","java.lang.String","","Y","null" 8 | "","tableName","java.lang.String","","Y","null" 9 | -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/PrepareData/tmp.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sofastack/sofa-acts/a84724be46c7a410967c503fbd378c22d7afa7dc/acts-common-util/src/test/resources/PrepareData/tmp.csv -------------------------------------------------------------------------------- /acts-common-util/src/test/resources/yaml/DeleteMessageActsTest.deleteMessage.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | SampleService_deleteMessage_caseID_001: 1 -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/IActsMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation; 18 | 19 | import com.alipay.test.acts.runtime.ActsRuntimeContext; 20 | 21 | /** 22 | * Extension method and implementation of Acts 23 | * @author xiuzhu.hp 24 | * 25 | */ 26 | public interface IActsMethod { 27 | 28 | /** 29 | * Invoke. 30 | * 31 | * @param actsRuntimeContext the acts runtime context 32 | */ 33 | void invoke(ActsRuntimeContext actsRuntimeContext); 34 | 35 | /** 36 | * Gets order. 37 | * 38 | * @return the order 39 | */ 40 | int getOrder(); 41 | 42 | /** 43 | * Gets group. 44 | * 45 | * @return the group 46 | */ 47 | String getGroup(); 48 | } 49 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/IVTableGroupCmdMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation; 18 | 19 | /** 20 | * Marking execution method of Virtual Table 21 | * @author xiuzhu.hp 22 | */ 23 | public interface IVTableGroupCmdMethod { 24 | 25 | /** 26 | * execution methods 27 | * @param tableName 28 | * @param groupId 29 | */ 30 | void invoke(String tableName, String groupId); 31 | } 32 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/TestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * 26 | * @author yuanren.syr 27 | * @version $Id: TestBase.java, v 0.1 2015-8-19 12:11:58 a.m yuanren.syr Exp $ 28 | */ 29 | @Target(ElementType.METHOD) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | public @interface TestBase { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/TestBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Test target bean Annotation for ACTS 26 | * 27 | * @author yuanren.syr 28 | * @version $Id: TestBean.java, v 0.1 2015-8-17- 9:54:27 p.m yuanren.syr Exp $ 29 | */ 30 | @Target(ElementType.FIELD) 31 | @Retention(RetentionPolicy.RUNTIME) 32 | public @interface TestBean { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/TestComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * 26 | * @modify qingqin 27 | * @version $Id: TestComponent.java, v 0.1 2018年12月07日 上午1:21 qingqin Exp $ 28 | */ 29 | @Target(ElementType.METHOD) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | public @interface TestComponent { 32 | 33 | /** id */ 34 | public String id(); 35 | 36 | /** desc */ 37 | public String description() default ""; 38 | } -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/AfterCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * after check dosomething 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: AfterCheck.java, v 0.1 2016年5月12日 上午11:18:08 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface AfterCheck { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/AfterClean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * after clean do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: AfterClean.java, v 0.1 2016年5月12日 上午11:18:38 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface AfterClean { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/AfterPrepare.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * after prepare dosomething 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: AfterPrepare.java, v 0.1 2016年5月12日 上午11:19:17 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface AfterPrepare { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/AfterTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * after table do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: AfterTable.java, v 0.1 2016年5月12日 上午11:20:05 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface AfterTable { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/BeforeCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * before check do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: BeforeCheck.java, v 0.1 2016年5月12日 上午11:20:24 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface BeforeCheck { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/BeforeClean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * before clean do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: BeforeClean.java, v 0.1 2016年5月12日 上午11:20:44 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface BeforeClean { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/BeforePrepare.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * before prepare do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: BeforePrepare.java, v 0.1 2016年5月12日 上午11:21:08 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface BeforePrepare { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/BeforeTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * before table do something 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: BeforeTable.java, v 0.1 2016年5月12日 上午11:21:30 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface BeforeTable { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/annotation/acts/Executor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.annotation.acts; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * group executor 24 | * 25 | * @author tianzhu.wtzh 26 | * @version $Id: Executor.java, v 0.1 2016年5月12日 上午11:21:49 tianzhu.wtzh Exp $ 27 | */ 28 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 29 | @Target(java.lang.annotation.ElementType.METHOD) 30 | public @interface Executor { 31 | 32 | /** the groupId in the acts */ 33 | String group() default ""; 34 | 35 | /** the executor order */ 36 | int Order() default 0; 37 | } 38 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/exception/ActsTestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.exception; 18 | 19 | public class ActsTestException extends RuntimeException { 20 | /** */ 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * Constructor. 25 | */ 26 | public ActsTestException() { 27 | super(); 28 | } 29 | 30 | /** 31 | * Constructor. 32 | * 33 | * @param arg0 the arg 0 34 | * @param arg1 the arg 1 35 | */ 36 | public ActsTestException(String arg0, Throwable arg1) { 37 | super(arg0, arg1); 38 | } 39 | 40 | /** 41 | * Constructor. 42 | * 43 | * @param arg0 the arg 0 44 | */ 45 | public ActsTestException(String arg0) { 46 | super(arg0); 47 | } 48 | 49 | /** 50 | * Constructor. 51 | * 52 | * @param arg0 the arg 0 53 | */ 54 | public ActsTestException(Throwable arg0) { 55 | super(arg0); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/runtime/ActsRuntimeContextThreadHold.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.runtime; 18 | 19 | public class ActsRuntimeContextThreadHold { 20 | 21 | public static ThreadLocal context = new ThreadLocal(); 22 | 23 | /** 24 | * Gets context. 25 | * 26 | * @return the context 27 | */ 28 | public static ActsRuntimeContext getContext() { 29 | return context.get(); 30 | } 31 | 32 | /** 33 | * Sets context. 34 | * 35 | * @param actsRuntimeContext the acts runtime context 36 | */ 37 | public static void setContext(ActsRuntimeContext actsRuntimeContext) { 38 | context.set(actsRuntimeContext); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/runtime/ComponentsActsRuntimeContextThreadHold.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.runtime; 18 | 19 | /** 20 | * 21 | * @author tianzhu.wtzh 22 | * @version $Id: ComponentsActsRuntimeContextThreadHold.java, v 0.1 2016年7月29日 下午7:04:00 tianzhu.wtzh Exp $ 23 | */ 24 | public class ComponentsActsRuntimeContextThreadHold { 25 | 26 | public static ThreadLocal context = new ThreadLocal(); 27 | 28 | /** 29 | * Gets context. 30 | * 31 | * @return the context 32 | */ 33 | public static ActsRuntimeContext getContext() { 34 | return context.get(); 35 | } 36 | 37 | /** 38 | * Sets context. 39 | * 40 | * @param actsRuntimeContext the acts runtime context 41 | */ 42 | public static void setContext(ActsRuntimeContext actsRuntimeContext) { 43 | context.set(actsRuntimeContext); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/template/PrepareCallBack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.template; 18 | 19 | import com.alipay.test.acts.model.VirtualArgs; 20 | import com.alipay.test.acts.model.VirtualDataSet; 21 | 22 | public interface PrepareCallBack { 23 | 24 | /** 25 | * 26 | * @return 27 | */ 28 | VirtualDataSet prepareDepDataSet(); 29 | 30 | /** 31 | * 32 | * @param depDataSet 33 | * @return 34 | */ 35 | VirtualArgs prepareArgs(VirtualDataSet depDataSet); 36 | 37 | /** 38 | * 39 | * @param args 40 | * @param depDataSet 41 | * @return 42 | */ 43 | VirtualDataSet prepareExpectDataSet(VirtualArgs args, VirtualDataSet depDataSet); 44 | 45 | /** 46 | * 47 | * @param args 48 | * @param depDataSet 49 | * @return 50 | */ 51 | Object prepareExpectResult(VirtualArgs args, VirtualDataSet depDataSet); 52 | 53 | /** 54 | * 55 | * @return 56 | */ 57 | VirtualArgs prepareExpectInvokeOutArgs(); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /acts-core/src/main/java/com/alipay/test/acts/template/PrepareTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.template; 18 | 19 | import com.alipay.test.acts.model.PrepareData; 20 | 21 | public interface PrepareTemplate { 22 | 23 | /** 24 | * Prepare prepare data. 25 | * 26 | * @param callback the callback 27 | * @return the prepare data 28 | */ 29 | PrepareData prepare(PrepareCallBack callback); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /acts-core/src/main/resources/META-INF/spring/acts-core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/component/MyTestComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.component; 18 | 19 | import com.alipay.test.acts.annotation.TestComponent; 20 | 21 | /** 22 | * 23 | * @author qingqin 24 | * @version $Id: MyTestComponent.java, v 0.1 2019年01月14日 上午11:48 qingqin Exp $ 25 | */ 26 | public class MyTestComponent { 27 | @TestComponent(id = "test") 28 | public String test(String param) { 29 | return param; 30 | } 31 | } -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/component/components/ActsComponentUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.component.components; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | /** 23 | * 24 | * @author qingqin 25 | * @version $Id: ActsComponentUtilTest.java, v 0.1 2019年01月14日 上午11:42 qingqin Exp $ 26 | */ 27 | public class ActsComponentUtilTest { 28 | 29 | /*** 30 | * Test method for {@link ActsComponentUtil#init(String, ClassLoader)} 31 | */ 32 | @Test 33 | public void testInit_Run_Clear() { 34 | 35 | ActsComponentUtil.init("com.alipay.test.acts.component", this.getClass().getClassLoader()); 36 | 37 | String object = (String) ActsComponentUtil.run("@test?param=123"); 38 | Assert.assertEquals(object, "123"); 39 | 40 | ActsComponentUtil.clear(); 41 | } 42 | } -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/component/components/MethodModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.component.components; 18 | 19 | /** 20 | * 21 | * @author zhiyuan.lzy 22 | * @version $Id: MethodModel.java, v 0.1 2016年1月25日 下午2:47:30 zhiyuan.lzy Exp $ 23 | */ 24 | public class MethodModel { 25 | 26 | public int method(String a) { 27 | return 1; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/runtime/ActsRuntimeContextThreadHoldTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.runtime; 18 | 19 | import org.testng.annotations.Test; 20 | 21 | /** 22 | * 23 | * @author qingqin 24 | * @version $Id: ActsRuntimeContextThreadHoldTest.java, v 0.1 2019年01月13日 下午2:23 qingqin Exp $ 25 | */ 26 | public class ActsRuntimeContextThreadHoldTest { 27 | 28 | @Test 29 | public void testGetContext() { 30 | ActsRuntimeContextThreadHold.getContext(); 31 | } 32 | 33 | @Test 34 | public void testSetContext() { 35 | ActsRuntimeContext actsRuntimeContext = new ActsRuntimeContext(); 36 | ActsRuntimeContextThreadHold.setContext(actsRuntimeContext); 37 | } 38 | } -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/runtime/ComponentsActsRuntimeContextThreadHoldTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.runtime; 18 | 19 | import org.testng.annotations.Test; 20 | 21 | /** 22 | * 23 | * @author qingqin 24 | * @version $Id: ComponentsActsRuntimeContextThreadHoldTest.java, v 0.1 2019年01月13日 下午2:23 qingqin Exp $ 25 | */ 26 | public class ComponentsActsRuntimeContextThreadHoldTest { 27 | 28 | @Test 29 | public void testGetContext() { 30 | 31 | ComponentsActsRuntimeContextThreadHold.getContext(); 32 | 33 | } 34 | 35 | @Test 36 | public void testSetContext() { 37 | ActsRuntimeContext actsRuntimeContext = new ActsRuntimeContext(); 38 | 39 | ComponentsActsRuntimeContextThreadHold.setContext(actsRuntimeContext); 40 | } 41 | } -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/utils/AnnotationUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.utils; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.lang.reflect.Field; 23 | import java.lang.reflect.Method; 24 | import java.util.List; 25 | 26 | /** 27 | * 28 | * @author qingqin 29 | * @version $Id: AnnotationUtilTest.java, v 0.1 2019年01月08日 下午2:41 qingqin Exp $ 30 | */ 31 | public class AnnotationUtilTest { 32 | 33 | @Deprecated 34 | private String unuseless; 35 | 36 | @Test 37 | public void testFindMethods() { 38 | List list = AnnotationUtils.findMethods(AnnotationUtilTest.class, Test.class); 39 | Assert.assertEquals(list.size(), 2); 40 | } 41 | 42 | @Test 43 | public void testFindFields() { 44 | List list = AnnotationUtils.findFields(AnnotationUtilTest.class, Deprecated.class); 45 | Assert.assertEquals(list.size(), 1); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /acts-core/src/test/java/com/alipay/test/acts/utils/MethodUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.test.acts.utils; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.lang.reflect.Method; 23 | import java.util.Arrays; 24 | import java.util.List; 25 | 26 | /** 27 | * 28 | * @author qingqin 29 | * @version $Id: MethodUtilsTest.java, v 0.1 2019年01月08日 下午3:13 qingqin Exp $ 30 | */ 31 | public class MethodUtilsTest { 32 | 33 | @Test 34 | public void testFilterMethod() { 35 | List list = MethodUtils.filterMethod( 36 | Arrays.asList(MethodUtilsTest.class.getMethods()), new Class[] {}, void.class); 37 | Assert.assertEquals(list.size(), 5); 38 | } 39 | 40 | @Test 41 | public void testFindMethodsByName() { 42 | 43 | List list = MethodUtils.findMethodsByName(MethodUtilsTest.class, "testFindMethodsByName"); 44 | Assert.assertEquals(list.size(), 1); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /acts-sample/sample-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | acts-samples 7 | com.alipay.sofa 8 | 1.0 9 | 10 | 4.0.0 11 | 12 | sample-test 13 | 14 | 15 | 16 | 17 | com.alipay.sofa.acts 18 | acts-bom 19 | 1.0.0 20 | pom 21 | 22 | 23 | 24 | com.alipay.sofa 25 | service-provider 26 | 27 | 28 | 29 | com.alipay.sofa 30 | service-consumer 31 | ${project.version} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-test 44 | test 45 | 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-web 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/java/com/alipay/sample/servicetest/base/ApplicationTestRun.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sample.servicetest.base; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 23 | import org.springframework.context.annotation.ImportResource; 24 | 25 | /** 26 | * @author xuanbei 18/5/5 27 | */ 28 | @ImportResource({ "classpath*:META-INF/spring/*.xml" }) 29 | @SpringBootApplication 30 | @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) 31 | public class ApplicationTestRun { 32 | public static void main(String[] args) { 33 | SpringApplication springApplication = new SpringApplication(ApplicationTestRun.class); 34 | springApplication.run(args); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/java/com/alipay/sofa/acts/component/MyComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.acts.component; 18 | 19 | import com.alipay.test.acts.annotation.TestComponent; 20 | 21 | /** 22 | * 23 | * @author qingqin 24 | * @version $Id: MyComponent.java, v 0.1 2019年03月07日 下午1:16 qingqin Exp $ 25 | */ 26 | public class MyComponent { 27 | 28 | @TestComponent(id = "test") 29 | public String test(String param) { 30 | return param + "123"; 31 | } 32 | } -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/META-INF/spring/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/actsSuite/sample-testng-all.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/config/acts-config.properties: -------------------------------------------------------------------------------- 1 | ######################################################### 2 | # acts-config # 3 | ######################################################### 4 | #db connection config 5 | 6 | dbconf_file = devdb.conf 7 | 8 | dbmode=dev 9 | 10 | #test_only = ^T 11 | 12 | datasource_bundle_name =com.xxx.sample.common.dal 13 | #ds_dataSource = tableName 14 | 15 | collect_case_result=true 16 | 17 | spilt_yaml_by_case=true 18 | 19 | param_components=com.alipay.sofa.acts.component.MyComponent -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | # can't be deleted 2 | spring.application.name=demo 3 | 4 | logging.path=./logs 5 | 6 | com.alipay.sofa.boot.bean-load-cost=100 7 | com.alipay.sofa.boot.allow-bean-definition-overriding=false 8 | com.alipay.sofa.boot.module-start-up-parallel=true 9 | com.alipay.sofa.boot.publish-event-to-parent=false 10 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/config/dbConf/devdb.conf: -------------------------------------------------------------------------------- 1 | 2 | ######################################################### 3 | # devdb connection # 4 | ######################################################### 5 | 6 | 7 | #example for mysql 8 | db1_url = jdbc:mysql://localhost:3306/share_clearing?useUnicode=true&characterEncoding=utf-8 9 | db1_username = xxx 10 | db1_password = xxx 11 | 12 | #example for oracle 13 | db2_url = jdbc:oracle:thin:@localhost:1521:tstpay5 14 | db2_username = xxx 15 | db2_password = xxx 16 | 17 | #example for oceanbase 18 | db3_url = jdbc:mysql://localhost:2828?useUnicode=true&characterEncoding=utf8 19 | db3_username = xxx 20 | db3_password = xxx 21 | 22 | 23 | -------------------------------------------------------------------------------- /acts-sample/sample-test/src/test/resources/config/dbConf/testdb.conf: -------------------------------------------------------------------------------- 1 | 2 | ######################################################### 3 | # testdb connection # 4 | ######################################################### 5 | 6 | 7 | #example for mysql 8 | db1_url = jdbc:mysql://localhost:3306/share_clearing?useUnicode=true&characterEncoding=utf-8 9 | db1_username = xxx 10 | db1_password = xxx 11 | 12 | #example for oracle 13 | db2_url = jdbc:oracle:thin:@localhost:1521:tstpay5 14 | db2_username = xxx 15 | db2_password = xxx 16 | 17 | #example for oceanbase 18 | db3_url = jdbc:mysql://localhost:2828?useUnicode=true&characterEncoding=utf8 19 | db3_username = xxx 20 | db3_password = xxx 21 | 22 | 23 | -------------------------------------------------------------------------------- /acts-sample/service-consumer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | acts-samples 7 | com.alipay.sofa 8 | 1.0 9 | 10 | 4.0.0 11 | 12 | service-consumer 13 | 14 | 15 | 16 | com.alipay.sofa 17 | service-facade 18 | 19 | 20 | com.alipay.sofa 21 | runtime-sofa-boot-starter 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /acts-sample/service-consumer/src/main/resources/META-INF/spring/service-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /acts-sample/service-consumer/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.alipay.sofa.service-consumer 2 | Require-Module=com.alipay.sofa.service-provider -------------------------------------------------------------------------------- /acts-sample/service-facade/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | acts-samples 7 | com.alipay.sofa 8 | 1.0 9 | 10 | 4.0.0 11 | 12 | service-facade 13 | 14 | -------------------------------------------------------------------------------- /acts-sample/service-facade/src/main/java/com/alipay/sofa/isle/sample/SampleJvmService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample; 18 | 19 | /** 20 | * @author xuanbei 18/5/5 21 | */ 22 | public interface SampleJvmService { 23 | String message(); 24 | } 25 | -------------------------------------------------------------------------------- /acts-sample/service-facade/src/main/java/com/alipay/sofa/isle/sample/SampleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample; 18 | 19 | import com.alipay.sofa.isle.sample.model.Request; 20 | import com.alipay.sofa.isle.sample.model.Result; 21 | 22 | import java.util.Date; 23 | import java.util.List; 24 | import java.util.Map; 25 | 26 | /** 27 | * 28 | * @author qingqin 29 | * @version $Id: SampleService.java, v 0.1 2019年03月07日 上午11:33 qingqin Exp $ 30 | */ 31 | public interface SampleService { 32 | 33 | String message(); 34 | 35 | String message(int i); 36 | 37 | 38 | Map messages(List list); 39 | 40 | Result getMessage(Request request); 41 | 42 | void postMessage(Date date); 43 | 44 | String deleteMessage(String str); 45 | } -------------------------------------------------------------------------------- /acts-sample/service-facade/src/main/java/com/alipay/sofa/isle/sample/model/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample.model; 18 | 19 | /** 20 | * 21 | * @author qingqin 22 | * @version $Id: Request.java, v 0.1 2019年03月07日 上午11:34 qingqin Exp $ 23 | */ 24 | public class Request { 25 | 26 | /*** 27 | * 必须是标准的java bean,即每个属性有getter,setter和默认构造方法才行,否则acts会赋值失败 28 | */ 29 | String id; 30 | 31 | String context; 32 | 33 | public String getContext() { 34 | return context; 35 | } 36 | 37 | public void setContext(String context) { 38 | this.context = context; 39 | } 40 | 41 | public String getId() { 42 | return id; 43 | } 44 | 45 | public void setId(String id) { 46 | this.id = id; 47 | } 48 | } -------------------------------------------------------------------------------- /acts-sample/service-facade/src/main/java/com/alipay/sofa/isle/sample/model/Result.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample.model; 18 | 19 | /** 20 | * 21 | * @author qingqin 22 | * @version $Id: Result.java, v 0.1 2019年03月07日 上午11:34 qingqin Exp $ 23 | */ 24 | public class Result { 25 | 26 | String code; 27 | String msg; 28 | 29 | public String getCode() { 30 | return code; 31 | } 32 | 33 | public void setCode(String code) { 34 | this.code = code; 35 | } 36 | 37 | public String getMsg() { 38 | return msg; 39 | } 40 | 41 | public void setMsg(String msg) { 42 | this.msg = msg; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /acts-sample/service-provider/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | acts-samples 7 | com.alipay.sofa 8 | 1.0 9 | 10 | 4.0.0 11 | 12 | service-provider 13 | 14 | 15 | 16 | com.alipay.sofa 17 | service-facade 18 | 19 | 20 | com.alipay.sofa 21 | runtime-sofa-boot-starter 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /acts-sample/service-provider/src/main/java/com/alipay/sofa/isle/sample/SampleJvmServiceAnnotationImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample; 18 | 19 | import com.alipay.sofa.runtime.api.annotation.SofaService; 20 | 21 | /** 22 | * @author xuanbei 18/5/5 23 | */ 24 | @SofaService(uniqueId = "annotationImpl") 25 | public class SampleJvmServiceAnnotationImpl implements SampleJvmService { 26 | @Override 27 | public String message() { 28 | String message = "Hello, jvm service annotation implementation."; 29 | System.out.println(message); 30 | return message; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /acts-sample/service-provider/src/main/java/com/alipay/sofa/isle/sample/SampleJvmServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample; 18 | 19 | /** 20 | * @author xuanbei 18/5/5 21 | */ 22 | public class SampleJvmServiceImpl implements SampleJvmService { 23 | private String message; 24 | 25 | public SampleJvmServiceImpl(String message) { 26 | this.message = message; 27 | } 28 | 29 | public SampleJvmServiceImpl() { 30 | } 31 | 32 | @Override 33 | public String message() { 34 | System.out.println(message); 35 | return message; 36 | } 37 | 38 | public String getMessage() { 39 | return message; 40 | } 41 | 42 | public void setMessage(String message) { 43 | this.message = message; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /acts-sample/service-provider/src/main/resources/META-INF/spring/service-provide.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /acts-sample/service-provider/src/main/resources/sofa-module.properties: -------------------------------------------------------------------------------- 1 | Module-Name=com.alipay.sofa.service-provider -------------------------------------------------------------------------------- /acts-sample/sofa-boot-run/src/main/java/com/alipay/sofa/isle/sample/ApplicationRun.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alipay.sofa.isle.sample; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author xuanbei 18/5/5 24 | */ 25 | @SpringBootApplication 26 | public class ApplicationRun { 27 | public static void main(String[] args) { 28 | SpringApplication springApplication = new SpringApplication(ApplicationRun.class); 29 | springApplication.run(args); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /acts-sample/sofa-boot-run/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | # can't be deleted 2 | spring.application.name=demo 3 | 4 | logging.path=./logs 5 | 6 | com.alipay.sofa.boot.bean-load-cost=100 7 | com.alipay.sofa.boot.allow-bean-definition-overriding=false 8 | com.alipay.sofa.boot.module-start-up-parallel=true 9 | com.alipay.sofa.boot.publish-event-to-parent=false 10 | -------------------------------------------------------------------------------- /tools/check_format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BASEDIR=$(dirname $0) 4 | 5 | cd ${BASEDIR} 6 | 7 | # make sure git has no un commit files 8 | if [ -n "$(git status --untracked-files=no --porcelain)" ]; then 9 | echo "Please commit your change before run this shell, un commit files:" 10 | git status --untracked-files=no --porcelain 11 | exit -1 12 | fi -------------------------------------------------------------------------------- /tools/mvn-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd .. && mvn clean -------------------------------------------------------------------------------- /tools/mvn-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd .. && mvn install -DskipTests=false -Dmaven.test.skip=false -Djacoco.skip=false -DtestPhrase=install -------------------------------------------------------------------------------- /tools/mvn-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd .. && mvn test -DskipTests=false -Dmaven.test.skip=false -Djacoco.skip=false -DtestPhrase=install --------------------------------------------------------------------------------