aboutsummaryrefslogtreecommitdiffstats
path: root/utils-test/src/test
AgeCommit message (Collapse)AuthorFilesLines
2024-02-07Remove Dmaap references from policy-commonrameshiyer271-21/+5
- updated dependencies for jakarta.* compabilities - other dependency updates for security fixes Issue-ID: POLICY-4881 Change-Id: I979d944fcd21279f618d1bcbfe12e914ba30077f Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
2023-09-21Java 17 Upgradeadheli.tavares1-0/+1
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-01-31Upgrade and clean up dependenciesliamfallon1-4/+5
- Upgrade Hibernate - Upgrade Mockito - Upgrade Mockserver - Remove Powermock (no longer supported) and replace with spring-test ReflectionTestUtils - Upgrade Spring Framework - Add spring-security to allow authentication on unit tests using MockMVC Minor clean-up - Replace deprecated authorization configuraiton on spring boot applications with SecurityFilterChain bean - Change @LocalPort include on tests to use test include rather than runtime include - Remove unused imports - Remove unused constants and variables - Add deprecation annotations where required Issue-ID: POLICY-4482 Change-Id: Iec5ba1283acd506c9f3c7fe7b5d7858db6abbaa7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-09-22Don't use keytool in test codeJim Hahn1-5/+4
Modified code to generate a self-signed certificate file programmatically instead of using keytool. Issue-ID: POLICY-3587 Change-Id: I53b6ffe65f33e5710eba633973e5d23b148f049f Signed-off-by: Jim Hahn <jrh3.lf@gmail.com>
2021-09-20Revert ignoring tests in commonRam Krishna Verma1-6/+0
Reverting the ignoring of tests in common as the staging jobs have been marked to skip tests. Issue-ID: POLICY-3587 Change-Id: Idcb9f432d1f563ba5e072c0c7511de7b650163fa Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2021-09-13Work around test failure in staging jobliamfallon1-2/+8
The "keytool" program does not exist in the Jenkins staging job environment, so the test case that checks for a keytool error message fails because an unexpected error message is received. Other tests also break so the tests are morked with @Ignore for now. Issue-ID: POLICY-3587 Change-Id: Iebdbce8f5e61fb209d65198d7f7e28f5ca70e589 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-09-13Fix test failure in staging jobliamfallon1-2/+2
The "keytool" program does not exist in the Jenkins staging job environment, so the test case that checks for a keytool error message fails because an unexpected error message is received. By changing the test case to expect "keytool" rather than "keytool exited with", then the test will pass when the error message "Cannot run program "keytool": error=2, No such file or directory" is returned. Issue-ID: POLICY-3587 Change-Id: I3a6b77fb571cfbf170f5f16bf93eece2d78a7bbb Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-05-21Enhance toString methods in factory classesJim Hahn1-6/+3
The factory classes in policy-endpoints have toString() methods that return "[]" for their list contents. Updated the code to provide a list of the keys rather than just an empty list. Also replaced some toString() methods with lombok. Also replace StringBuilder with concatenation in some cases. Issue-ID: POLICY-3298 Change-Id: I64fca21a4b009f7e09fcc482b5d156753fb7e680 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-18Add utility to generate keystore for testingJim Hahn1-0/+152
Added a class that will generate a keystore containing a self-signed certificate. Issue-ID: POLICY-3147 Change-Id: I25e7307c2e73dbacae24c8fce616bf2ada93df9f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-11Fix sonars from depeendency upgradeJim Hahn1-4/+4
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner. Issue-ID: POLICY-2914 Change-Id: Iaf10f676c380adb9785e836cb15792596b378e4e Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-29Fix issues in common for new sonar rulesJim Hahn3-15/+22
Addressed issues reported due to updates to the sonar rules: - invoke only one method in a junit lambda - complete the assertion - add DOCTYPE to html Issue-ID: POLICY-2650 Change-Id: Ib8b8a2e4736cc23849c0f7aef972ffa3365a3e00 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-18More sonar issues in policy-commonJim Hahn1-16/+21
Addressed the following sonar issues: - add parameters to types - ObjectInputStream.readObject() is unsafe Issue-ID: POLICY-2650 Change-Id: I41e1bd08643b04f409ce87c884cb0c28995e431b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-17Cleanup various sonar issues in policy-commonJim Hahn1-2/+0
Addressed the following issues: - unused imports - unused method parameters - use assertEquals, assertSame instead of assertTrue - provide the parametrized type for this generic Also fixed some checkstyle issues: - removed blank lines between "import" groups Issue-ID: POLICY-2650 Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-16/+1
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-27More sonar issues cleanupPamela Dragosh1-2/+3
Either log or rethrow Use boolean expression Add at least one test Remove commented out code Issue-ID: POLICY-2204 Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-17Add PseudoExecutor to utils-testJim Hahn1-0/+60
Moved MyExec from actors package to policy-common/utils-test, renaming it to PseudoExecutor. Updated per review comment(s): - declare "task" of type "Queue" instead of "LinkedList" Issue-ID: POLICY-2363 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I40049ca52defecc4f3f7479470c28da58521866d
2020-01-20Replace deprecated Nashorn javascript engineJim Hahn1-2/+2
Some test drivers use javascript to evaluate expected results. In java 8, the standard javascript engine was Nashorn, but that has been deprecated. As the test scripts use a simple xxx.yyy.zzz notation, decided to go with a small expression language, Apache JEXL, instead. Issue-ID: POLICY-2324 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Iffff468a880c612bdb31da84964dfa4132fa15e3
2020-01-10Address items deprecated by move to java 11Jim Hahn1-2/+4
Addressed the following deprecated items: - "new Integer(xxx)" - Observable/Observer - Mockito.anyObject() Added assertion to a junit test to address a sonar issue. Did not address deprecated Nashorn javascript interpreter; that will be done in a separate review. Updated licenses. Issue-ID: POLICY-1406 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I81fd158f831e01d5410d79898ced658285787d47
2019-08-21Enhance TestTimeMultiJim Hahn9-69/+1388
Enhance TestTimeMulti to support execution of tasks, whether submitted via Timers or via Executors. Change-Id: Ib5f216730b3b69028e9581052645370b827cd446 Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-12Apply simple sonar fixesJim Hahn5-68/+69
Note: A number of these were identified, by SonarLint, in the Test classes, which are not typically scanned by Sonar. Removed unnecessary imports. Removed unneeded "throws Xxx". Replaced lambda with method references. Replaced duplicate strings with constants. Replaced try-fail-catch with assert-j methods to eliminate sonar complaints about duplicate failure messages. Added missing @Override annotations. Use map.computeIfAbsent() where appropriate. Also fixed some minor checkstyle issues. Removed unneeded "volatile" declarations. Replaced some if-else constructs with "?:" construct, per sonar. Replaced Object.wait() with CountDownLatch.await(); according to sonar (and javadocs), Object.wait() can return due to "spurious wakeups". Fixed issue whereby CryptoUtilsTest wouldn't run in my Eclipse. Change-Id: Ib6b71ed65662cfd6209400dac57ed69279bf29ec Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-28Get proper message in test logger appenderJim Hahn1-7/+16
The logger appender that's used in junit tests was getting the raw message, which still had "{}" place-holders in it. Fixed that. Split a test method to avoid checkstyle error. Change-Id: I57571d8717aaee4adb7df186fe156501e9cc669e Issue-ID: POLICY-1444 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-15Fix sonar issues with gson codeJim Hahn1-2/+4
Fixed issues with GsonTestUtils: - don't set static from within a non-static method - don't throw generic RuntimeException Resolved checkstyle issue. Removed trailing spaces. Change-Id: If0c85733f62a24b56088dc90aadd4b95b3a6c91a Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-14Sonar fixesJim Hahn2-5/+40
Added test for Serializer to increase junit coverage. Added tests for TestTimeMulti to increase junit coverage. Sonar fixes for PropertyConfiguration: - use equalsIgnoreCase - use the exception Updated license dates. Some fixes for LoggerFactoryWrapper to address sonar issue - utility classes should typically have a private constructor. Change-Id: I8957e9673fe8371ecca7abbb7ece87b0d6f46c1a Issue-ID: POLICY-1519 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-13Add gson handler and testsJim Hahn4-0/+392
Added JacksonHandler which provides jackson behavior in gson. Also added classes to facilitate testing of gson serializations. Added compareGson(xxx, Class). Removed trailing spaces from some files. Updated license dates. Replaced incorrect constant with ${xxx} in json test file. Fixed typo in test method name. Change-Id: If05b654d76a4ffc88646f03334be82b32506f28f Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-08Replace PolicyAssert with assertjJim Hahn1-85/+0
Removed PolicyAssert from utils-test, as its functionality is superseded by assertj. Change-Id: Ie7620fea98cd368a8ce4f8511e8e88f291013cff Issue-ID: POLICY-1392 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-08Replace expectException with AssertJJim Hahn1-31/+10
Change-Id: I73c186f181960ac7ac8cd985e55db1831963910f Issue-ID: POLICY-1392 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-03Support Throwables in expectException()Jim Hahn1-10/+28
Also fixed some bugs in the junit tests. Renamed expectException() to assertThrows(). Added test cases. Change-Id: I13dff0007e35c2d2521a4ca40bb65e6820416ed1 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-02Add expectException to policy-commonJim Hahn1-0/+67
Also fixed new checkstyle error. Change-Id: I2d2c2518f3f7da1a0ace8c32e10b4151d941bb6f Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-21new sonar issues in policy/commonJim Hahn1-24/+49
Only throw one type of exception in Serializer. Try to increase test coverage in Serializer. Change-Id: I170de0ab727041aa42731c08d6cc454731d29a20 Issue-ID: POLICY-1130 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-14add more junit coverage to new Serializer classJim Hahn1-2/+278
Removed calls to superclass methods so that appropriate exceptions are thrown. Better comments for new tests. Removed @Ignore from tests. Removed tabs from pom. Change-Id: I97fa63951eed4c2ac5ce0a267d8da5134a2a1c71 Issue-ID: POLICY-1106 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-13add utility class to test serializable classesJim Hahn1-0/+95
Closed the ByteArrayXxxStreams. Closed byte output stream, even if exception in object stream. Change-Id: I3f779a5c0e6df3ac3496abe60a46e0696b4e261c Issue-ID: POLICY-1106 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-08-13Fix checkstyle in utilsPamela Dragosh3-14/+16
Cleared all the checkstyle in these 2 submodules. Issue-ID: POLICY-881 Change-Id: I248e1894aebf549d5a4f8669a6466ec227d40b55 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-10get time from correct timer objectJim Hahn1-1/+1
Change-Id: Ie060e45d2cda368ffbb5908b41594d7795bae40b Issue-ID: POLICY-1045 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-19Add CurrentTime utilitiesJim Hahn2-0/+182
Add some comments. Update license text. Change-Id: I4cee208378c44d9730274aee337feb95f9026add Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-15Removed checkstyle warningsmmis5-754/+742
Removed checkstyle warnings in policy/common/utils-test Issue-ID: POLICY-695 Change-Id: I9962b2f815d2c116f77475944bc17ea1cb0af539 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-19Rename utils-test testXxx() methodsJim Hahn3-13/+13
Fixed sonar complaints about the testXxx_Yyy() methods in the XxxTester classes. In most cases, they were renamed to testYyy(). The top-level method, test(), was not renamed so-as not to break existing tests that already depend on it. Renamed testStringConstuctor() to testString(). Change-Id: I00e8993c71fa9d9cb83bea82276d9706dd0e7c45 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-10Add AutoClose wrappers for JPA classesJim Hahn6-6/+6
Added EntityMgrCloser and EntityMgrTrans classes that will automatically close/rollback the wrapped JPA classes. As a result, these classes can be used in try-with-resource statements to ensure that the JPA EntityTransaction is rolled back and the EntityManager is closed. Add "build" section into pom to make it consistent with other poms in common. Changed scope to "provided" in utils pom for javax.persistence to prevent clashes with other projects that depend on the utils project. Changed scope to "test" in utils pom and to "provided" in utils-test pom for junit. Fixed license date in EntityTransCloser. Fixed license titles in utils & utils-test source files. Moved files from package xxx.test.jpa to package xxx.jpa, because they are not test-specific classes. Include exception when logging message in ThrowablesTester, hopefully eliminating sonar complaint. Change-Id: I531f20d93a679d4bb432c1d75c1feac0e334bc44 Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-08Add ExtractAppender to facilite junit testsJim Hahn6-104/+857
Added ExtractAppender to provide a way for junit tests to capture data sent to a logger. Changed logback.version to 1.2.3 and moved the property to the top-level pom. Updated license date in top-level pom. Refactored ExceptionsText, adding ErrorsTester and ThrowablesTester classes to reduce sonar issues. Change-Id: Ief7d08972bf4e7037b59c2afe4b77b252f2ad60a Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-05Add utils-test projectJim Hahn1-0/+207
Added utils-test project to policy/common. Modified integrity-audit and integrity-monitor to use the new utils-test project to test the Exception subclasses. Change-Id: If4a27cdb2351b7c49b084dbf287950172fa059cf Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>