├── .DS_Store
├── .gitignore
├── LICENSE.md
├── README.md
├── logo.png
├── pnx-test-bom
└── pom.xml
├── pnx-test-dependencies
└── pom.xml
├── pnx-test-starter-core
├── .DS_Store
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── .DS_Store
│ ├── java
│ │ └── com
│ │ │ └── pnxtest
│ │ │ └── core
│ │ │ ├── AppInfo.java
│ │ │ ├── ApplicationKeys.java
│ │ │ ├── CmdParser.java
│ │ │ ├── DefaultCrypto.java
│ │ │ ├── PnxTest.java
│ │ │ ├── api
│ │ │ ├── AfterAll.java
│ │ │ ├── AfterEach.java
│ │ │ ├── BeforeAll.java
│ │ │ ├── BeforeEach.java
│ │ │ ├── Configuration.java
│ │ │ ├── Controller.java
│ │ │ ├── DataDriven.java
│ │ │ ├── Description.java
│ │ │ ├── Disabled.java
│ │ │ ├── DisplayName.java
│ │ │ ├── ICryptoConfig.java
│ │ │ ├── IExecutionConfig.java
│ │ │ ├── IModConfig.java
│ │ │ ├── Issue.java
│ │ │ ├── Level.java
│ │ │ ├── Levels.java
│ │ │ ├── Order.java
│ │ │ ├── PnxTestApplication.java
│ │ │ ├── RepeatedCount.java
│ │ │ ├── Repository.java
│ │ │ ├── Status.java
│ │ │ └── Test.java
│ │ │ ├── assertions
│ │ │ ├── AbstractArrayAssert.java
│ │ │ ├── AbstractBaseAssert.java
│ │ │ ├── AbstractCollectionAssert.java
│ │ │ ├── AbstractComparableAssert.java
│ │ │ ├── AbstractEnumerableAssert.java
│ │ │ ├── BigDecimalAssert.java
│ │ │ ├── BooleanAssert.java
│ │ │ ├── ByteArrayAssert.java
│ │ │ ├── ByteAssert.java
│ │ │ ├── CharArrayAssert.java
│ │ │ ├── CharAssert.java
│ │ │ ├── CollectionAssert.java
│ │ │ ├── DoubleArrayAssert.java
│ │ │ ├── DoubleAssert.java
│ │ │ ├── FileAssert.java
│ │ │ ├── FloatArrayAssert.java
│ │ │ ├── FloatAssert.java
│ │ │ ├── IntegerArrayAssert.java
│ │ │ ├── IntegerAssert.java
│ │ │ ├── ListAssert.java
│ │ │ ├── LongArrayAssert.java
│ │ │ ├── LongAssert.java
│ │ │ ├── MapAssert.java
│ │ │ ├── ObjectArrayAssert.java
│ │ │ ├── ObjectAssert.java
│ │ │ ├── PnxAssert.java
│ │ │ ├── SetAssert.java
│ │ │ ├── ShortArrayAssert.java
│ │ │ ├── ShortAssert.java
│ │ │ ├── StringArrayAssert.java
│ │ │ ├── StringAssert.java
│ │ │ └── TextDescription.java
│ │ │ ├── environment
│ │ │ ├── Environment.java
│ │ │ ├── PnxContext.java
│ │ │ ├── Property.java
│ │ │ └── VariableResolver.java
│ │ │ ├── exceptions
│ │ │ ├── CmdArgsParseException.java
│ │ │ ├── DataProviderException.java
│ │ │ ├── PnxException.java
│ │ │ ├── PnxModuleException.java
│ │ │ ├── SkipException.java
│ │ │ └── StepException.java
│ │ │ ├── executors
│ │ │ ├── AbstractBaseResult.java
│ │ │ ├── Acronym.java
│ │ │ ├── ClassResult.java
│ │ │ ├── CurrentTestInfo.java
│ │ │ ├── DataProviderLog.java
│ │ │ ├── IExecutor.java
│ │ │ ├── MethodResult.java
│ │ │ ├── RepetitionLog.java
│ │ │ ├── ResultCollector.java
│ │ │ ├── RunResult.java
│ │ │ ├── Task.java
│ │ │ ├── TestCase.java
│ │ │ ├── TestCaseTask.java
│ │ │ ├── TestClass.java
│ │ │ ├── TestClassExecutor.java
│ │ │ ├── TestClassTask.java
│ │ │ ├── TestMethodExecutor.java
│ │ │ ├── TestRun.java
│ │ │ ├── TestRunExecutor.java
│ │ │ ├── TestRunTask.java
│ │ │ └── TestSuite.java
│ │ │ ├── helper
│ │ │ └── PnxHelper.java
│ │ │ ├── outputting
│ │ │ ├── ConsoleLog.java
│ │ │ ├── HtmlLog.java
│ │ │ ├── StatsInfo.java
│ │ │ ├── StepTree.java
│ │ │ ├── TestCaseInfo.java
│ │ │ ├── TestRunInfo.java
│ │ │ └── TestSuiteInfo.java
│ │ │ ├── steps
│ │ │ ├── PnxSteps.java
│ │ │ ├── Step.java
│ │ │ ├── StepInterceptor.java
│ │ │ ├── StepLog.java
│ │ │ ├── StepLogger.java
│ │ │ ├── StepMessage.java
│ │ │ ├── Steps.java
│ │ │ ├── StepsFactory.java
│ │ │ ├── StepsField.java
│ │ │ ├── StepsInjector.java
│ │ │ └── StepsModule.java
│ │ │ └── util
│ │ │ ├── ClassUtil.java
│ │ │ ├── CsvReader.java
│ │ │ ├── DateUtil.java
│ │ │ ├── ExceptionUtil.java
│ │ │ ├── FileUtil.java
│ │ │ ├── MethodUtil.java
│ │ │ └── StringUtil.java
│ └── resources
│ │ └── pnxtest.xsd
│ └── test
│ └── java
│ └── cn
│ └── pnxtestframework
│ └── .DS_Store
├── pnx-test-starter-db
├── .gitignore
├── pom.xml
└── src
│ └── main
│ ├── antlr4
│ └── lexer
│ │ ├── ColonStatementLexer.g4
│ │ └── DefineStatementLexer.g4
│ └── java
│ └── com
│ └── pnxtest
│ └── db
│ ├── DbConfig.java
│ ├── PnxSql.java
│ ├── api
│ ├── BatchQuery.java
│ ├── Column.java
│ ├── Entity.java
│ ├── Query.java
│ ├── SelectQuery.java
│ └── UpdateQuery.java
│ └── internal
│ ├── BaseQuery.java
│ ├── BatchQueryImpl.java
│ ├── ConnectionFactory.java
│ ├── DeleteQueryImpl.java
│ ├── InsertQueryImpl.java
│ ├── ParsedParameters.java
│ ├── ParsedSql.java
│ ├── PnxSqlException.java
│ ├── SelectQueryImpl.java
│ └── UpdateQueryImpl.java
├── pnx-test-starter-http
├── .gitignore
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── pnxtest
│ └── http
│ ├── HttpConfig.java
│ ├── PnxHttp.java
│ ├── api
│ ├── Body.java
│ ├── Client.java
│ ├── GetRequest.java
│ ├── Header.java
│ ├── HttpRequest.java
│ ├── HttpRequestWithBody.java
│ ├── HttpResponse.java
│ ├── IHttpConfig.java
│ ├── MultipartBody.java
│ ├── ObjectMapper.java
│ ├── RawResponse.java
│ ├── RequestBodyEntity.java
│ ├── RequestInterceptor.java
│ └── ResponseInterceptor.java
│ └── internal
│ ├── ApacheBodyMapper.java
│ ├── ApacheClient.java
│ ├── ApacheDeleteWithBody.java
│ ├── ApacheNoRedirectStrategy.java
│ ├── ApachePatchWithBody.java
│ ├── ApacheRequestWithBody.java
│ ├── ApacheResponse.java
│ ├── BaseApacheClient.java
│ ├── BaseRequest.java
│ ├── BaseResponse.java
│ ├── BasicResponse.java
│ ├── BodyPart.java
│ ├── BodyString.java
│ ├── ByteArrayBody.java
│ ├── ByteArrayPart.java
│ ├── ContentType.java
│ ├── Empty.java
│ ├── EmptyResponse.java
│ ├── FilePart.java
│ ├── FileResponse.java
│ ├── GenericType.java
│ ├── HeaderNames.java
│ ├── Headers.java
│ ├── HttpConfigException.java
│ ├── HttpException.java
│ ├── HttpGateway.java
│ ├── HttpMethod.java
│ ├── HttpParsingException.java
│ ├── HttpRequestBodyRaw.java
│ ├── HttpRequestImplWithBody.java
│ ├── HttpRequestImplWithoutBody.java
│ ├── HttpRequestMultiPart.java
│ ├── HttpUtil.java
│ ├── InputStreamPart.java
│ ├── JacksonObjectMapper.java
│ ├── MappedResponse.java
│ ├── MultipartMode.java
│ ├── ObjectResponse.java
│ ├── ParamPart.java
│ ├── Path.java
│ ├── PreparedRequest.java
│ ├── Proxy.java
│ ├── RawResponseBase.java
│ ├── RequestOptions.java
│ ├── SecurityConfig.java
│ ├── SimpleResponse.java
│ ├── StreamBody.java
│ ├── StringResponse.java
│ └── SyncIdleConnectionMonitorThread.java
├── pnx-test-starter-parent
└── pom.xml
└── pom.xml
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pengtech/pnxtest/ac2dd0fe1cb12a32845a5348cb50e146952f0f11/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #Intellij project files
2 | .idea
3 | *.iml
4 | target
5 | integrationTest
6 | index-origin.html
7 | pnx-test-starter-syncloud
8 | test-config
9 | test-outputting
10 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This program is offered under the AGPL license.
2 |
3 | AGPL licensing:
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU Affero General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero General Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PnxTest
2 |
3 | PnxTest is a Java-based test automation framework that unites all testing layers: Mobile applications, WEB applications, REST services.
4 | Due to fluent API design and rich ecosystem applications, PnxTest will make your automation test more efficient.
5 |
6 | **Current release version**: 1.0.2
7 |
8 | **User guide:** https://pnxtest.com/user-guide
9 |
10 | **Online Report Reference**: https://pnxtest.com/user-guide/demo/reporting.html
11 |
12 | **Demo/Scaffolding Project**: https://github.com/pengtech/integrationTest
13 |
14 | **Maven dependency:**
15 |
16 | ```xml
17 |
18 |
19 | pnx-test-starter-parent
20 | com.pnxtest
21 | 1.0.2
22 |
23 |
24 |
25 |
26 |
27 | com.pnxtest
28 | pnx-test-starter-core
29 |
30 |
31 |
32 | com.pnxtest
33 | pnx-test-starter-http
34 |
35 |
36 |
37 | com.pnxtest
38 | pnx-test-starter-db
39 |
40 |
41 | mysql
42 | mysql-connector-java
43 |
44 |
45 | ```
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pengtech/pnxtest/ac2dd0fe1cb12a32845a5348cb50e146952f0f11/logo.png
--------------------------------------------------------------------------------
/pnx-test-bom/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
25 | 4.0.0
26 |
27 |
28 | com.pnxtest
29 | pnx-test-projects
30 | 1.0.2
31 |
32 |
33 | pnx-test-bom
34 | pom
35 | pnx-test-bom
36 | Bill of materials to make sure a consistent set of versions is used for pnxtest modules
37 |
38 |
39 |
40 |
41 | com.pnxtest
42 | pnx-test-starter-core
43 | 1.0.2
44 |
45 |
46 | com.pnxtest
47 | pnx-test-starter-http
48 | 1.0.2
49 |
50 |
51 | com.pnxtest
52 | pnx-test-starter-db
53 | 1.0.2
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pengtech/pnxtest/ac2dd0fe1cb12a32845a5348cb50e146952f0f11/pnx-test-starter-core/.DS_Store
--------------------------------------------------------------------------------
/pnx-test-starter-core/.gitignore:
--------------------------------------------------------------------------------
1 | #Intellij project files
2 | .idea
3 | *.iml
4 | target
5 |
6 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pengtech/pnxtest/ac2dd0fe1cb12a32845a5348cb50e146952f0f11/pnx-test-starter-core/src/main/.DS_Store
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/AppInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core;
23 |
24 | public class AppInfo {
25 | public static final String version="1.0.2";
26 | public static final String name="PnxTest";
27 | public static final String owner="PNX";
28 | public static final String author="nicolas.chen";
29 | public static final String url="https://pnxtest.com";
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/ApplicationKeys.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | public final class ApplicationKeys {
28 | public static final String PNX_RUN_MODE = "pnx.run.mode";
29 | public static final String PNX_THREAD_COUNT = "pnx.thread.count";
30 | public static final String PNX_TARGET_FILE = "pnx.target.file";
31 | public static final String PNX_ENVIRONMENT_ID = "pnx.environment.id";
32 | public static final String PNX_ENVIRONMENT_PATH = "pnx.environment.path";
33 | public static final String PNX_CRYPTO_IMPL = "pnx.crypto.impl";
34 | public static final String PNX_OUTPUTTING_PATH = "pnx.outputting.path";
35 | public static final String PNX_CURRENT_METHOD_NAME = "pnx.current.method.name";
36 | public static final String PNX_CURRENT_STEP_NAME = "pnx.current.step.name";
37 |
38 | public static final String PNX_MODULE_CONFIG_BEANS = "pnx.module.config.beans";
39 |
40 |
41 |
42 | public static List listAll(){
43 | List allKeys = new ArrayList<>();
44 | allKeys.add(PNX_RUN_MODE);
45 | allKeys.add(PNX_THREAD_COUNT);
46 | allKeys.add(PNX_TARGET_FILE);
47 | allKeys.add(PNX_ENVIRONMENT_ID);
48 | allKeys.add(PNX_ENVIRONMENT_PATH);
49 | allKeys.add(PNX_CRYPTO_IMPL);
50 | allKeys.add(PNX_OUTPUTTING_PATH);
51 | allKeys.add(PNX_CURRENT_METHOD_NAME);
52 | allKeys.add(PNX_CURRENT_STEP_NAME);
53 | allKeys.add(PNX_MODULE_CONFIG_BEANS);
54 |
55 | return allKeys;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/DefaultCrypto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core;
23 |
24 | import com.pnxtest.core.api.ICryptoConfig;
25 | import com.pnxtest.core.util.StringUtil;
26 |
27 | class DefaultCrypto implements ICryptoConfig {
28 |
29 | DefaultCrypto(){
30 |
31 | }
32 |
33 | public String decrypt(String cipherText){
34 | if(StringUtil.isEmpty(cipherText)) return "";
35 | StringBuilder sb = new StringBuilder();
36 | int len = cipherText.length();
37 | for(int i=0; i.
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface AfterAll {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/AfterEach.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface AfterEach {
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/BeforeAll.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface BeforeAll {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/BeforeEach.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface BeforeEach {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Configuration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ElementType.TYPE})
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Configuration {
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Controller.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ ElementType.TYPE })
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Controller {
30 | String module();
31 | String maintainer() default "";
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/DataDriven.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 |
25 | import java.lang.annotation.*;
26 |
27 | @Target(ElementType.METHOD)
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Documented
30 | public @interface DataDriven {
31 |
32 | String value(); //data source
33 | String type() default "file"; //file, string
34 |
35 | String encoding() default "UTF-8";
36 | String lineSeparator() default "\n";
37 | char separator() default ',';
38 | boolean withHeader() default false;
39 | //boolean parallel() default false;
40 | }
41 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Description.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Description {
30 | String value();
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Disabled.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ ElementType.TYPE, ElementType.METHOD })
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Disabled {
30 | String value() default ""; //reason of a class or method is disabled
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/DisplayName.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface DisplayName {
30 | String value();
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/ICryptoConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | public interface ICryptoConfig {
25 | String decrypt(String cipherText);
26 | String encrypt(String plainText);
27 | }
28 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/IExecutionConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | public interface IExecutionConfig {
25 |
26 | void onExecuteStart();
27 | void onExecuteFinish();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/IModConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | public interface IModConfig {
25 | }
26 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Issue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Issue {
30 | String[] value();
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Level.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Level {
30 | Levels value();
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Levels.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | public enum Levels {
25 | L1, L2, L3, L4
26 | }
27 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Order.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.ElementType;
25 | import java.lang.annotation.Retention;
26 | import java.lang.annotation.RetentionPolicy;
27 | import java.lang.annotation.Target;
28 |
29 | @Target(ElementType.METHOD)
30 | @Retention(RetentionPolicy.RUNTIME)
31 | public @interface Order {
32 | int value();
33 | }
34 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/PnxTestApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ ElementType.TYPE })
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface PnxTestApplication {
30 | String envID() default ""; //for IDE debug
31 | String suiteFile() default ""; //for IDE debug
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/RepeatedCount.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface RepeatedCount {
30 | int value();
31 | float successPercentage() default 100.00f;
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Repository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ ElementType.TYPE })
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Repository {
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Status.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | public enum Status {
25 | PASSED(1),
26 | FAILED(2),
27 | SKIPPED(3),
28 | BLOCKED(4),
29 | NT(0);
30 |
31 | private final int value;
32 | Status(int value){
33 | this.value = value;
34 | }
35 |
36 | public int getValue() {
37 | return value;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/api/Test.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.api;
23 |
24 | import java.lang.annotation.*;
25 |
26 |
27 | /**
28 | * the definition of a testcase
29 | * @author nicolas.chen
30 | */
31 |
32 | @Target({ElementType.METHOD})
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Documented
35 | public @interface Test {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/AbstractComparableAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | /**
27 | * comparable assertions
28 | * @param
29 | * @param
30 | */
31 | public abstract class AbstractComparableAssert> extends AbstractBaseAssert{
32 | public AbstractComparableAssert(A actual, Class myself){
33 | super(actual, myself);
34 | }
35 |
36 |
37 | public S isGreaterThan(A other){
38 | setKeywords("isGreaterThan");
39 | assertThat(Matchers.greaterThan(other));
40 | return myself;
41 | }
42 |
43 | public S isGreaterThanOrEqualTo(A other){
44 | setKeywords("isGreaterThanOrEqualTo");
45 | assertThat(Matchers.greaterThanOrEqualTo(other));
46 | return myself;
47 | }
48 |
49 | public S isLessThan(A other){
50 | setKeywords("isLessThan");
51 | assertThat(Matchers.lessThan(other));
52 | return myself;
53 | }
54 |
55 | public S isLessThanOrEqualTo(A other){
56 | setKeywords("lessThanOrEqualTo");
57 | assertThat(Matchers.lessThanOrEqualTo(other));
58 | return myself;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/BigDecimalAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | import java.math.BigDecimal;
27 |
28 | public class BigDecimalAssert extends AbstractComparableAssert {
29 |
30 | public BigDecimalAssert(BigDecimal actual) {
31 | super(actual, BigDecimalAssert.class);
32 | }
33 |
34 |
35 | public BigDecimalAssert isCloseTo(BigDecimal expected, BigDecimal delta) {
36 | setKeywords("bigDecimalIsCloseTo");
37 | assertThat(Matchers.closeTo(expected, delta));
38 | return this;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/BooleanAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | /**
27 | * Boolean Assertion
28 | *
29 | */
30 | public class BooleanAssert extends AbstractBaseAssert{
31 |
32 | BooleanAssert(boolean actual){
33 | super(actual, BooleanAssert.class);
34 | }
35 |
36 | public BooleanAssert isTrue(){
37 | setKeywords("isTrue");
38 | assertThat(Matchers.equalTo(true));
39 | return this;
40 | }
41 |
42 | public BooleanAssert isFalse(){
43 | setKeywords("isFalse");
44 | assertThat(Matchers.equalTo(false));
45 | return this;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ByteArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class ByteArrayAssert extends AbstractArrayAssert{
25 |
26 | public ByteArrayAssert(Byte[] actual) {
27 | super(actual, ByteArrayAssert.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ByteAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class ByteAssert extends AbstractComparableAssert{
25 | public ByteAssert(Byte actual) {
26 | super(actual, ByteAssert.class);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/CharArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class CharArrayAssert extends AbstractArrayAssert {
25 |
26 |
27 | public CharArrayAssert(Character[] actual) {
28 | super(actual, CharArrayAssert.class);
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/CharAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | public class CharAssert extends AbstractBaseAssert{
27 | private char actual;
28 |
29 | public CharAssert(char actual){
30 | super(actual, CharAssert.class);
31 | this.actual = actual;
32 | }
33 |
34 | public CharAssert isUpperCase(){
35 | setKeywords("isUpperCase");
36 | assertThat(Character.isUpperCase(actual), Matchers.equalTo(true));
37 | return this;
38 | }
39 |
40 | public CharAssert isLowerCase(){
41 | setKeywords("isLowerCase");
42 | assertThat(Character.isLowerCase(actual), Matchers.equalTo(true));
43 | return this;
44 | }
45 | }
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/CollectionAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import java.util.Collection;
25 |
26 | public class CollectionAssert extends AbstractCollectionAssert> {
27 |
28 |
29 | CollectionAssert(Collection> actual) {
30 | super(actual, CollectionAssert.class);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/DoubleArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class DoubleArrayAssert extends AbstractArrayAssert{
25 |
26 | public DoubleArrayAssert(Double[] actual) {
27 | super(actual, DoubleArrayAssert.class);
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/DoubleAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | public class DoubleAssert extends AbstractComparableAssert{
27 |
28 | public DoubleAssert(Double actual) {
29 | super(actual, DoubleAssert.class);
30 | }
31 |
32 |
33 | public DoubleAssert isCloseTo(double expected, double delta){
34 | setKeywords("doubleIsCloseTo");
35 | assertThat(Matchers.closeTo(expected, delta));
36 | return this;
37 | }
38 |
39 | public DoubleAssert isCloseTo(Double expected, Double delta){
40 | setKeywords("doubleIsCloseTo");
41 | assertThat(Matchers.closeTo(expected, delta));
42 | return this;
43 | }
44 |
45 | public DoubleAssert isNotANumber(){
46 | setKeywords("doubleIsNotANumber");
47 | assertThat(Matchers.notANumber());
48 | return this;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/FileAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 | import org.hamcrest.io.FileMatchers;
26 |
27 | import java.io.File;
28 |
29 | public class FileAssert extends AbstractBaseAssert{
30 |
31 |
32 | FileAssert(File actual) {
33 | super(actual, FileAssert.class);
34 | }
35 |
36 | public FileAssert isDirectory(){
37 | setKeywords("isDirectory");
38 | assertThat(FileMatchers.anExistingDirectory());
39 | return this;
40 | }
41 |
42 | public FileAssert isFile(){
43 | setKeywords("isFile");
44 | assertThat(FileMatchers.anExistingFile());
45 | return this;
46 | }
47 |
48 | public FileAssert isFileOrDirectory(){
49 | setKeywords("IsFileOrDirectory");
50 | assertThat(FileMatchers.anExistingFileOrDirectory());
51 | return this;
52 | }
53 |
54 | public FileAssert isNamed(String fileName){
55 | setKeywords("fileIsNamed");
56 | assertThat(FileMatchers.aFileNamed(Matchers.equalTo(fileName)));
57 | return this;
58 | }
59 |
60 | public FileAssert hasSize(long fileSize){
61 | setKeywords("fileHasSize");
62 | assertThat(FileMatchers.aFileWithSize(fileSize));
63 | return this;
64 | }
65 |
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/FloatArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class FloatArrayAssert extends AbstractArrayAssert{
25 |
26 | public FloatArrayAssert(Float[] actual) {
27 | super(actual, FloatArrayAssert.class);
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/FloatAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | public class FloatAssert extends AbstractComparableAssert{
27 |
28 | public FloatAssert(float actual) {
29 | super(actual, FloatAssert.class);
30 | }
31 |
32 |
33 | public FloatAssert isCloseTo(float expected, float delta){
34 | setKeywords("floatIsCloseTo");
35 | assertThat(Matchers.closeTo(expected, delta));
36 | return this;
37 | }
38 |
39 | public FloatAssert isCloseTo(Float expected, Float delta){
40 | setKeywords("floatIsCloseTo");
41 | assertThat(Matchers.closeTo(expected, delta));
42 | return this;
43 | }
44 |
45 | public FloatAssert isNotANumber(){
46 | setKeywords("floatIsNotANumber");
47 | assertThat(Matchers.notANumber());
48 | return this;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/IntegerArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class IntegerArrayAssert extends AbstractArrayAssert{
25 |
26 | public IntegerArrayAssert(Integer[] actual) {
27 | super(actual, IntegerArrayAssert.class);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/IntegerAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class IntegerAssert extends AbstractComparableAssert{
25 |
26 | public IntegerAssert(Integer actual) {
27 | super(actual, IntegerAssert.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ListAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import java.util.List;
25 |
26 | public class ListAssert extends AbstractCollectionAssert>{
27 |
28 | ListAssert(List> actual) {
29 | super(actual, ListAssert.class);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/LongArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class LongArrayAssert extends AbstractArrayAssert{
25 |
26 | public LongArrayAssert(Long[] actual) {
27 | super(actual, LongArrayAssert.class);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/LongAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class LongAssert extends AbstractComparableAssert{
25 | public LongAssert(long actual) {
26 | super(actual, LongAssert.class);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/MapAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import java.util.Map;
25 |
26 | public class MapAssert extends AbstractEnumerableAssert>{
27 | MapAssert(Map,?> actual) {
28 | super(actual, MapAssert.class);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ObjectArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | class ObjectArrayAssert extends AbstractArrayAssert{
25 |
26 | public ObjectArrayAssert(Object[] actual) {
27 | super(actual, ObjectArrayAssert.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ObjectAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import org.hamcrest.Matchers;
25 |
26 | public class ObjectAssert extends AbstractBaseAssert{
27 |
28 | ObjectAssert(Object actual) {
29 | super(actual, ObjectAssert.class);
30 | }
31 |
32 | public ObjectAssert hasProperty(String propertyName){
33 | setKeywords("objectHasProperty");
34 | assertThat(Matchers.hasProperty(propertyName));
35 | return this;
36 | }
37 |
38 | public ObjectAssert hasPropertyWithValue(String propertyName, E value){
39 | setKeywords("objectHasPropertyWithValue");
40 | assertThat(Matchers.hasProperty(propertyName, Matchers.equalTo(value)));
41 | return this;
42 | }
43 |
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/SetAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import java.util.Set;
25 |
26 | public class SetAssert extends AbstractCollectionAssert>{
27 |
28 | public SetAssert(Set> actual) {
29 | super(actual, SetAssert.class);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ShortArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class ShortArrayAssert extends AbstractArrayAssert{
25 |
26 | public ShortArrayAssert(Short[] actual) {
27 | super(actual, ShortArrayAssert.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/ShortAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class ShortAssert extends AbstractComparableAssert{
25 |
26 | public ShortAssert(Short actual) {
27 | super(actual, ShortAssert.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/StringArrayAssert.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | public class StringArrayAssert extends AbstractArrayAssert {
25 |
26 | public StringArrayAssert(String[] actual){
27 | super(actual, StringArrayAssert.class);
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/assertions/TextDescription.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.assertions;
23 |
24 | import java.util.Objects;
25 |
26 | public final class TextDescription {
27 | private final String value;
28 | private final Object[] args;
29 |
30 | public TextDescription(String value, Object... args) {
31 | this.value = value == null ? "" : value;
32 | this.args = (args == null || args.length == 0) ? null : (Object[])args.clone();
33 | }
34 |
35 | public String value() {
36 | if(value == null || value.isEmpty()) return null;
37 | if(args == null || args.length == 0){
38 | return (value.replace("%", "%%")).replace("%%n", "%n"); //escape percent
39 | }else{
40 | return String.format(this.value, this.args);
41 | }
42 | }
43 |
44 | public int hashCode() {
45 | return Objects.hash(new Object[]{this.value, this.args});
46 | }
47 |
48 | public boolean equals(Object obj) {
49 | if (this == obj) {
50 | return true;
51 | } else if (obj == null) {
52 | return false;
53 | } else if (this.getClass() != obj.getClass()) {
54 | return false;
55 | } else {
56 | TextDescription other = (TextDescription)obj;
57 | return Objects.deepEquals(this.value, other.value) && java.util.Arrays.deepEquals(this.args, other.args);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/CmdArgsParseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class CmdArgsParseException extends RuntimeException{
25 |
26 |
27 | private static final long serialVersionUID = 7454074003048425394L;
28 |
29 | public CmdArgsParseException(String message){
30 | super(message);
31 | }
32 |
33 | public CmdArgsParseException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 |
37 | public CmdArgsParseException(Throwable cause) {
38 | super(cause);
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/DataProviderException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class DataProviderException extends RuntimeException{
25 | private static final long serialVersionUID = -4935553156746662723L;
26 | public DataProviderException(String message){
27 | super(message);
28 | }
29 |
30 | public DataProviderException(String message, Throwable cause) {
31 | super(message, cause);
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/PnxException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class PnxException extends RuntimeException{
25 | private static final long serialVersionUID = -3082300531471863907L;
26 |
27 | public PnxException(String message){
28 | super(message);
29 | }
30 |
31 | public PnxException(String message, Throwable cause) {
32 | super(message, cause);
33 | }
34 |
35 | public PnxException(Throwable cause) {
36 | super(cause);
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/PnxModuleException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class PnxModuleException extends RuntimeException{
25 |
26 |
27 | private static final long serialVersionUID = 6342609091196817888L;
28 |
29 | public PnxModuleException(String message){
30 | super(message);
31 | }
32 |
33 | public PnxModuleException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 |
37 | public PnxModuleException(Throwable cause) {
38 | super(cause);
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/SkipException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class SkipException extends RuntimeException{
25 |
26 | private static final long serialVersionUID = -5619155390244757271L;
27 |
28 | public SkipException(String message){
29 | super(message);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/exceptions/StepException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.exceptions;
23 |
24 | public class StepException extends RuntimeException{
25 |
26 |
27 | private static final long serialVersionUID = -4140552191549749862L;
28 |
29 | public StepException(String message){
30 | super(message);
31 | }
32 |
33 | public StepException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 |
37 | public StepException(Throwable cause) {
38 | super(cause);
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/ClassResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import com.pnxtest.core.api.Status;
25 |
26 | import java.util.ArrayList;
27 | import java.util.List;
28 |
29 | /**
30 | * Result DTO of class level
31 | * @author nicolas.chen
32 | */
33 | public class ClassResult extends AbstractBaseResult {
34 |
35 | private final List results = new ArrayList<>();
36 | private final TestClass testClass;
37 |
38 |
39 | public ClassResult(TestClass testClass) {
40 | super();
41 | this.testClass = testClass;
42 | }
43 |
44 | public List getResults() {
45 | return results;
46 | }
47 |
48 | public TestClass getTestClass() {
49 | return testClass;
50 | }
51 |
52 | public void addResult(MethodResult methodResult) {
53 | this.results.add(methodResult);
54 | this.incrementTotal();
55 | this.incrementDuration(methodResult.getDuration());
56 | if(methodResult.getStatus() == Status.PASSED){
57 | this.incrementPassed();
58 | }
59 |
60 | if(methodResult.getStatus() == Status.FAILED){
61 | this.incrementFailed();
62 | }
63 |
64 | if(methodResult.getStatus() == Status.SKIPPED){
65 | this.incrementSkipped();
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/DataProviderLog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 |
25 | import com.pnxtest.core.api.Status;
26 |
27 | public class DataProviderLog {
28 | private int index;
29 | private long startTime;
30 | private long duration;
31 | private Status status;
32 | private String args;
33 | private String remark;
34 |
35 | DataProviderLog(){
36 | this.startTime = System.nanoTime();
37 | }
38 |
39 | public int getIndex() {
40 | return index;
41 | }
42 |
43 | public void setIndex(int index) {
44 | this.index = index;
45 | }
46 |
47 | public long getStartTime() {
48 | return startTime;
49 | }
50 |
51 | public void setStartTime(long startTime) {
52 | this.startTime = startTime;
53 | }
54 |
55 | public long getDuration() {
56 | return duration;
57 | }
58 |
59 | public void setDuration(long duration) {
60 | this.duration = duration;
61 | }
62 |
63 | public Status getStatus() {
64 | return status;
65 | }
66 |
67 | public void setStatus(Status status) {
68 | this.status = status;
69 | }
70 |
71 | public String getArgs() {
72 | return args;
73 | }
74 |
75 | public void setArgs(String args) {
76 | this.args = args;
77 | }
78 |
79 | public String getRemark() {
80 | return remark;
81 | }
82 |
83 | public void setRemark(String remark) {
84 | this.remark = remark;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/IExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import java.util.concurrent.ExecutionException;
25 |
26 | public interface IExecutor {
27 | void execute() throws InterruptedException, ExecutionException;
28 | }
29 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/ResultCollector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import java.util.Collections;
25 | import java.util.LinkedHashMap;
26 | import java.util.Map;
27 |
28 | public class ResultCollector extends AbstractBaseResult {
29 | private Map runsResult = Collections.synchronizedMap(new LinkedHashMap<>());
30 | private final TestSuite testSuite;
31 |
32 | public ResultCollector(TestSuite testSuite){
33 | super();
34 | this.testSuite = testSuite;
35 | }
36 |
37 | public Map getRunsResult() {
38 | return runsResult;
39 | }
40 |
41 | public void addRunResult(RunResult runResult) {
42 | this.runsResult.put(runResult.getTestRun(), runResult );
43 |
44 | this.duration.getAndAdd(runResult.getDuration());
45 | this.totalCount.getAndAdd(runResult.getTotalCount());
46 | this.passedCount.getAndAdd(runResult.getPassedCount());
47 | this.failedCount.getAndAdd(runResult.getFailedCount());
48 | this.skippedCount.getAndAdd(runResult.getSkippedCount());
49 | }
50 |
51 | public TestSuite getTestSuite() {
52 | return testSuite;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/RunResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import java.util.Collections;
25 | import java.util.LinkedHashMap;
26 | import java.util.Map;
27 |
28 | public class RunResult extends AbstractBaseResult {
29 | private final Map results = Collections.synchronizedMap(new LinkedHashMap<>());
30 | private final TestRun testRun;
31 |
32 |
33 | public RunResult(TestRun testRun) {
34 | super();
35 | this.testRun = testRun;
36 | }
37 |
38 | public Map getResults() {
39 | return results;
40 | }
41 |
42 | public void addResult(TestClass testClass, ClassResult classResult){
43 | this.results.put(testClass, classResult);
44 | this.duration.getAndAdd(classResult.getDuration());
45 | this.totalCount.getAndAdd(classResult.getTotalCount());
46 | this.passedCount.getAndAdd(classResult.getPassedCount());
47 | this.failedCount.getAndAdd(classResult.getFailedCount());
48 | this.skippedCount.getAndAdd(classResult.getSkippedCount());
49 | }
50 |
51 | public TestRun getTestRun() {
52 | return testRun;
53 | }
54 |
55 | @Override
56 | public String toString() {
57 | return "RunResult{" +
58 | ", result='" + totalCount + '\'' +
59 | ", duration=" + duration +
60 | '}';
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/Task.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import java.util.concurrent.Callable;
25 |
26 | /**
27 | * task in parallel
28 | * @author nicolas.chen
29 | */
30 | public interface Task extends Callable{
31 | T run();
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/TestCaseTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | public class TestCaseTask implements Task {
25 | private final TestCase testCase;
26 |
27 | TestCaseTask(TestCase testCase){
28 | this.testCase = testCase;
29 | }
30 |
31 |
32 | @Override
33 | public MethodResult run() {
34 | return testCase.run();
35 | }
36 |
37 | @Override
38 | public MethodResult call() throws Exception {
39 | return null;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/TestMethodExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import java.util.Collection;
25 | import java.util.List;
26 | import java.util.concurrent.ExecutionException;
27 | import java.util.concurrent.ExecutorService;
28 | import java.util.concurrent.Executors;
29 | import java.util.concurrent.Future;
30 |
31 | public class TestMethodExecutor implements IExecutor{
32 | private final Collection testMethods;
33 |
34 | public TestMethodExecutor(List testMethods) {
35 | this.testMethods = testMethods;
36 | }
37 |
38 |
39 | //Report the results only when all have completed.
40 | @Override
41 | public void execute() throws InterruptedException, ExecutionException {
42 | int numThreads = Math.min(testMethods.size(), 100);
43 | ExecutorService executor = Executors.newFixedThreadPool(numThreads);
44 | List> results = executor.invokeAll(testMethods);
45 | for(Future result : results){
46 | MethodResult methodResult = result.get();
47 | //System.out.println("Result:" + methodResult.getResult());
48 | }
49 |
50 | executor.shutdown(); //always reclaim resources
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/executors/TestRunTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.executors;
23 |
24 | import com.pnxtest.core.outputting.ConsoleLog;
25 |
26 | public class TestRunTask implements Task {
27 | private final TestRun testRun;
28 |
29 | public TestRunTask(TestRun testRun){
30 | this.testRun = testRun;
31 | }
32 |
33 | @Override
34 | public RunResult run() {
35 | RunResult runResult = new RunResult(testRun);
36 | ConsoleLog.printTestRunOnStart(runResult);
37 | for(TestClass testClass: testRun.getTestClasses()){
38 | ClassResult classResult = new TestClassTask(testClass).run();
39 | runResult.addResult(testClass, classResult);
40 | }
41 |
42 | ConsoleLog.printTestRunOnFinish(runResult);
43 | return runResult;
44 | }
45 |
46 | @Override
47 | public RunResult call() throws Exception {
48 | return run();
49 | }
50 |
51 | public TestRun getTestRun() {
52 | return testRun;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/helper/PnxHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.helper;
23 |
24 | import com.pnxtest.core.exceptions.PnxException;
25 | import com.pnxtest.core.steps.Step;
26 |
27 | import java.util.concurrent.TimeUnit;
28 |
29 | /**
30 | * general helpers
31 | * author: nicolas.chen
32 | */
33 | public class PnxHelper {
34 | private PnxHelper(){}
35 |
36 | public static void await(long timeOut){
37 | await(timeOut, TimeUnit.MILLISECONDS);
38 | }
39 |
40 | @Step("程序等待{0} {1}")
41 | public static void await(long timeOut, TimeUnit timeUnit){
42 | try {
43 | if (timeUnit == TimeUnit.DAYS) {
44 | TimeUnit.DAYS.sleep(timeOut);
45 | }
46 |
47 | if (timeUnit == TimeUnit.HOURS) {
48 | TimeUnit.HOURS.sleep(timeOut);
49 | }
50 |
51 | if(timeUnit == TimeUnit.MINUTES){
52 | TimeUnit.MINUTES.sleep(timeOut);
53 | }
54 | if(timeUnit == TimeUnit.SECONDS){
55 | TimeUnit.SECONDS.sleep(timeOut);
56 | }
57 |
58 | if(timeUnit == TimeUnit.MILLISECONDS){
59 | TimeUnit.MILLISECONDS.sleep(timeOut);
60 | }
61 |
62 | if(timeUnit == TimeUnit.MICROSECONDS){
63 | TimeUnit.MICROSECONDS.sleep(timeOut);
64 | }
65 |
66 | }catch (InterruptedException e){
67 | throw new PnxException(String.format("%d %s await timeout", timeOut, timeUnit.name()), e);
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/outputting/StatsInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.outputting;
23 |
24 | import java.io.Serializable;
25 |
26 | public class StatsInfo implements Serializable {
27 | private static final long serialVersionUID = 8639556483861835518L;
28 |
29 | private int totalCount;
30 | private int passedCount;
31 | private int failedCount;
32 | private int skippedCount;
33 |
34 | public StatsInfo() {
35 | }
36 |
37 | public int getTotalCount() {
38 | return totalCount;
39 | }
40 |
41 | public void setTotalCount(int totalCount) {
42 | this.totalCount = totalCount;
43 | }
44 |
45 | public int getPassedCount() {
46 | return passedCount;
47 | }
48 |
49 | public void setPassedCount(int passedCount) {
50 | this.passedCount = passedCount;
51 | }
52 |
53 | public int getFailedCount() {
54 | return failedCount;
55 | }
56 |
57 | public void setFailedCount(int failedCount) {
58 | this.failedCount = failedCount;
59 | }
60 |
61 | public int getSkippedCount() {
62 | return skippedCount;
63 | }
64 |
65 | public void setSkippedCount(int skippedCount) {
66 | this.skippedCount = skippedCount;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/outputting/TestCaseInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.outputting;
23 |
24 | import java.io.Serializable;
25 |
26 | public class TestCaseInfo implements Serializable {
27 | private static final long serialVersionUID = 357886840938102531L;
28 | }
29 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/outputting/TestRunInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.outputting;
23 |
24 | import com.pnxtest.core.executors.MethodResult;
25 | import com.pnxtest.core.executors.RunResult;
26 |
27 | import java.io.Serializable;
28 | import java.util.LinkedList;
29 | import java.util.List;
30 |
31 | public class TestRunInfo implements Serializable {
32 | private static final long serialVersionUID = -559041460211896831L;
33 |
34 | private final String title;
35 | private List testCases = new LinkedList<>();
36 | private StatsInfo stats = new StatsInfo();
37 |
38 |
39 | public TestRunInfo(String title, RunResult runResult) {
40 | this.title = title;
41 | this.stats.setTotalCount(runResult.getTotalCount());
42 | this.stats.setPassedCount(runResult.getPassedCount());
43 | this.stats.setFailedCount(runResult.getFailedCount());
44 | this.stats.setSkippedCount(runResult.getSkippedCount());
45 | }
46 |
47 | public String getTitle() {
48 | return title;
49 | }
50 |
51 | public List getTestCases() {
52 | return testCases;
53 | }
54 |
55 | public void addTestCase(MethodResult methodResult) {
56 | testCases.add(methodResult);
57 | }
58 |
59 | public void setTestCases(List testCases) {
60 | this.testCases = testCases;
61 | }
62 |
63 | public StatsInfo getStats() {
64 | return stats;
65 | }
66 |
67 | public void setStats(StatsInfo stats) {
68 | this.stats = stats;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/outputting/TestSuiteInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.outputting;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | public class TestSuiteInfo {
28 | private List runs = new ArrayList<>();
29 | private StatsInfo stats = new StatsInfo();
30 |
31 | public List getRuns() {
32 | return runs;
33 | }
34 |
35 | public void setRuns(List runs) {
36 | this.runs = runs;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/steps/Step.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.steps;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target(ElementType.METHOD)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Step {
30 | String value();
31 | int timeThreshold() default 0; //seconds
32 | }
33 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/steps/StepMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.steps;
23 |
24 | public class StepMessage {
25 | private final String content;
26 | private final Type type;
27 |
28 | private StepMessage(String content, Type type) {
29 | this.content = content;
30 | this.type = type;
31 | }
32 |
33 | public String getContent() {
34 | return content;
35 | }
36 |
37 | public Type getType() {
38 | return type;
39 | }
40 |
41 | public enum Type{SUCCESS, INFO, WARNING, ERROR};
42 |
43 |
44 | public static StepMessage success(String content){
45 | return new StepMessage(content, Type.SUCCESS);
46 | }
47 |
48 | public static StepMessage warning(String content){
49 | return new StepMessage(content, Type.WARNING);
50 | }
51 |
52 | public static StepMessage error(String content){
53 | return new StepMessage(content, Type.ERROR);
54 | }
55 | public static StepMessage info(String content){
56 | return new StepMessage(content, Type.INFO);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/steps/Steps.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.steps;
23 |
24 | import java.lang.annotation.*;
25 |
26 | @Target({ElementType.FIELD})
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface Steps {
30 | boolean shared() default false;
31 | }
32 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/steps/StepsModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.steps;
23 |
24 | import com.pnxtest.core.api.Repository;
25 | import com.google.inject.AbstractModule;
26 | import com.google.inject.matcher.Matchers;
27 |
28 | class StepsModule extends AbstractModule {
29 | @Override
30 | protected void configure(){
31 | bindInterceptor(Matchers.annotatedWith(Repository.class), Matchers.any(), new StepInterceptor());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/util/FileUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.util;
23 |
24 | import java.io.File;
25 |
26 | public class FileUtil {
27 | private FileUtil(){}
28 |
29 | public static boolean checkAndCreateDir(String dir) {
30 | File tdir = new File(dir);
31 | boolean dirExists = tdir.exists();
32 | if (!dirExists) {
33 | dirExists = tdir.mkdirs();
34 | }
35 | return dirExists;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/main/java/com/pnxtest/core/util/MethodUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021
3 | * This file is part of PnxTest framework.
4 | *
5 | * PnxTest is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Affero Public License version 3 as
7 | * published by the Free Software Foundation
8 | *
9 | * PnxTest is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero Public License
15 | * along with PnxTest. If not, see .
16 | *
17 | * For more information, please contact the author at this address:
18 | * chen.baker@gmail.com
19 | *
20 | */
21 |
22 | package com.pnxtest.core.util;
23 |
24 | import java.lang.reflect.InvocationTargetException;
25 | import java.lang.reflect.Method;
26 |
27 | public class MethodUtil {
28 | private MethodUtil(){}
29 |
30 | public static Object invokeJvmMethod(final Object obj, final Object[] args, final Method method) throws Throwable{
31 | try {
32 | method.setAccessible(true);
33 | return method.invoke(obj, args);
34 | } catch(InvocationTargetException | IllegalAccessException ie) {
35 | throw ie.getCause();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/pnx-test-starter-core/src/test/java/cn/pnxtestframework/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pengtech/pnxtest/ac2dd0fe1cb12a32845a5348cb50e146952f0f11/pnx-test-starter-core/src/test/java/cn/pnxtestframework/.DS_Store
--------------------------------------------------------------------------------
/pnx-test-starter-db/.gitignore:
--------------------------------------------------------------------------------
1 | #Intellij project files
2 | .idea
3 | *.iml
4 | target
5 |
6 |
--------------------------------------------------------------------------------
/pnx-test-starter-db/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | pnx-test-starter-parent
8 | com.pnxtest
9 | 1.0.2
10 | ../pnx-test-starter-parent
11 |
12 |
13 |
14 | pnx-test-starter-db
15 | pnx-test-starter-db
16 |
17 |
18 |
19 | com.pnxtest
20 | pnx-test-starter-core
21 |
22 |
23 | org.antlr
24 | antlr4-runtime
25 |
26 |
27 | com.zaxxer
28 | HikariCP
29 |
30 |
31 |
32 |
33 |
34 | org.antlr
35 | antlr4-maven-plugin
36 |
37 |
38 |
39 | antlr4
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/pnx-test-starter-db/src/main/antlr4/lexer/ColonStatementLexer.g4:
--------------------------------------------------------------------------------
1 | lexer grammar ColonStatementLexer;
2 |
3 | fragment QUOTE: '\'';
4 | fragment ESCAPE: '\\';
5 | fragment ESCAPE_QUOTE: ESCAPE QUOTE;
6 | fragment DOUBLE_QUOTE: '"';
7 | fragment COLON: {_input.LA(2) != ':'}? ':';
8 | fragment DOUBLE_COLON: {_input.LA(2) == ':'}? '::';
9 | fragment QUESTION: {_input.LA(2) != '?'}? '?';
10 | fragment DOUBLE_QUESTION: {_input.LA(2) == '?'}? '??';
11 | fragment NAME: JAVA_LETTER | [0-9] | '.' | '?.';
12 |
13 | /* Lovingly lifted from https://github.com/antlr/grammars-v4/blob/master/java/JavaLexer.g4 */
14 | fragment JAVA_LETTER : [a-zA-Z$_] | ~[\u0000-\u007F\uD800-\uDBFF] | [\uD800-\uDBFF] [\uDC00-\uDFFF];
15 |
16 | COMMENT: '/*' .*? '*/' | '--' ~('\r' | '\n')* | '//' ~('\r' | '\n')*;
17 | QUOTED_TEXT: QUOTE (ESCAPE_QUOTE | ~'\'')* QUOTE;
18 | DOUBLE_QUOTED_TEXT: DOUBLE_QUOTE (~'"')+ DOUBLE_QUOTE;
19 | ESCAPED_TEXT : ESCAPE . ;
20 |
21 | NAMED_PARAM: COLON (NAME)+;
22 | POSITIONAL_PARAM: QUESTION;
23 |
24 | LITERAL: DOUBLE_COLON | DOUBLE_QUESTION | .;
--------------------------------------------------------------------------------
/pnx-test-starter-db/src/main/antlr4/lexer/DefineStatementLexer.g4:
--------------------------------------------------------------------------------
1 | lexer grammar DefineStatementLexer;
2 |
3 | fragment QUOTE: '\'' ;
4 | fragment ESCAPE: '\\' ;
5 | fragment ESCAPE_QUOTE: ESCAPE QUOTE ;
6 | fragment DOUBLE_QUOTE: '"' ;
7 | fragment LT: '<' ;
8 | fragment GT: '>' ;
9 | fragment NAME: JAVA_LETTER | [0-9];
10 |
11 | /* Lovingly lifted from https://github.com/antlr/grammars-v4/blob/master/java/JavaLexer.g4 */
12 | fragment JAVA_LETTER : [a-zA-Z$_] | ~[\u0000-\u007F\uD800-\uDBFF] | [\uD800-\uDBFF] [\uDC00-\uDFFF];
13 |
14 | COMMENT: '/*' .*? '*/' | '--' ~('\r' | '\n')* | '//' ~('\r' | '\n')*;
15 | QUOTED_TEXT: QUOTE (ESCAPE_QUOTE | ~'\'')* QUOTE;
16 | DOUBLE_QUOTED_TEXT: DOUBLE_QUOTE (~'"')+ DOUBLE_QUOTE;
17 | ESCAPED_TEXT : ESCAPE . ;
18 |
19 | DEFINE: LT (NAME)+ GT;
20 |
21 | LITERAL: .;
--------------------------------------------------------------------------------
/pnx-test-starter-db/src/main/java/com/pnxtest/db/PnxSql.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2021-2022
3 | This file is part of PnxTest framework.
4 |
5 | PnxTest is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero Public License version 3 as
7 | published by the Free Software Foundation
8 |
9 | PnxTest is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero Public License
15 | along with PnxTest. If not, see .
16 |
17 | For more information, please contact the author at this address:
18 | chen.baker@gmail.com
19 | */
20 | package com.pnxtest.db;
21 |
22 | import com.pnxtest.db.api.BatchQuery;
23 | import com.pnxtest.db.api.SelectQuery;
24 | import com.pnxtest.db.api.UpdateQuery;
25 | import com.pnxtest.db.internal.*;
26 |
27 | public class PnxSql {
28 |
29 | private PnxSql(){}
30 |
31 | public static SelectQuery select(String sql){
32 | return new SelectQueryImpl(sql);
33 | }
34 |
35 | public static SelectQuery select(String sql, DbConfig dbConfig){
36 | return new SelectQueryImpl(sql, dbConfig);
37 | }
38 |
39 |
40 | public static UpdateQuery update(String sql){
41 | return new UpdateQueryImpl(sql);
42 | }
43 |
44 | public static UpdateQuery update(String sql, DbConfig dbConfig){
45 | return new UpdateQueryImpl(sql, dbConfig);
46 | }
47 |
48 | public static UpdateQuery insert(String sql){
49 | return new InsertQueryImpl(sql);
50 | }
51 |
52 | public static UpdateQuery insert(String sql, DbConfig dbConfig){
53 | return new InsertQueryImpl(sql, dbConfig);
54 | }
55 |
56 | public static UpdateQuery delete(String sql){
57 | return new DeleteQueryImpl(sql);
58 | }
59 |
60 | public static UpdateQuery delete(String sql, DbConfig dbConfig){
61 | return new DeleteQueryImpl(sql, dbConfig);
62 | }
63 |
64 | public static BatchQuery batch(String sql){
65 | return new BatchQueryImpl(sql);
66 | }
67 |
68 | public static BatchQuery batch(String sql, DbConfig dbConfig){
69 | return new BatchQueryImpl(sql, dbConfig);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/pnx-test-starter-db/src/main/java/com/pnxtest/db/api/BatchQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2021-2022
3 | This file is part of PnxTest framework.
4 |
5 | PnxTest is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero Public License version 3 as
7 | published by the Free Software Foundation
8 |
9 | PnxTest is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero Public License
15 | along with PnxTest. If not, see .
16 |
17 | For more information, please contact the author at this address:
18 | chen.baker@gmail.com
19 | */
20 | package com.pnxtest.db.api;
21 |
22 | import java.util.Iterator;
23 | import java.util.List;
24 | import java.util.Map;
25 |
26 | //batch insert or update
27 | public interface BatchQuery {
28 | BatchQuery values(Iterator> values);
29 | BatchQuery values(Iterable> values);
30 |
31 | BatchQuery namedValues(Iterator