Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Added some junit tests to increase coverage of ONAP-logger.
Many classes still need test cases.
Also fixed some sonar issues:
Returned interface instead of ConcurrentHashMap.
Used EnumMap instead of HashMap.
Used StringBuilder instead of StringBuffer.
Replaced literals with constants.
Replaced enum1.toString().equals(enum2.toString()) with enum1 == enum2
Updated license dates.
Updated another license date.
Change-Id: I777b6a913d7d03187a29dfeb817800b386ee23aa
Issue-ID: POLICY-582
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
|
|
This is the first sweep to organize the dependencies. I did upgrade
the JUnit in this repo to 4.12 as I thought this would be harmless.
Issue-ID: POLICY-626
Change-Id: I4dc120d2d48830b282d9a173ab69cc553a4d5e78
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
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>
|
|
|
|
|
|
Replace this use of System.out or System.err by a logger
Main.java:L610
Sonar Link:
https://sonar.onap.org/project/issues?assignees=swapnalipode&id=org.onap.policy.common%3Acommon-modules&resolved=false
Location:
src\main\java\org\onap\policy\common\sitemanager\Main.java
Change-Id: If40b049f2458a381e79168824caeb68bad4bc26f
Issue-ID: POLICY-636
Signed-off-by: Swapnali Pode <SP00501638@techmahindra.com>
|
|
Replace this use of System.out or System.err by a logger
Main.java:L605
Sonar Link:
https://sonar.onap.org/project/issues?assignees=swapnalipode&id=org.onap.policy.common%3Acommon-modules&resolved=false
Location:
src\main\java\org\onap\policy\common\sitemanager\Main.java
Change-Id: I6f39ee886e4d3caf8e9a1ae9ab57dd8e4847e3bd
Issue-ID: POLICY-635
Signed-off-by: Swapnali Pode <SP00501638@techmahindra.com>
|
|
Fixed a few more generic exceptions in integrity-audit and
integrity-monitor.
Fixed license dates.
Change-Id: Ibbc21ae5f853896e0d3e416e33b5ea2a13672f62
Issue-ID: POLICY-246
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
|
|
We are now including all the sub-modules coverage into one file.
This will now reflect correct statistics for any sub-module that
tests code located in another sub-module.
Issue-ID: POLICY-634
Change-Id: I37f1f02fa1763bd02adb425b8a6f5ddbb760a9f0
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
|
|
Replace this use of System.out or System.err by a logger
Main.java:L600
Sonar Link:
https://sonar.onap.org/project/issues?assignees=swapnalipode&id=org.onap.policy.common%3Acommon-modules&resolved=false
Location:
src\main\java\org\onap\policy\common\sitemanager\Main.java
Change-Id: I3e2461e7a49d8e480e4ce4692e625284811a0e02
Issue-ID: POLICY-630
Signed-off-by: Swapnali Pode <SP00501638@techmahindra.com>
|
|
Removed "test" from package name.
Refactored tests, creating common IntegrityMonitorTestBase.
Turned log/print statements into assertEquals in StateTransitionTest.
Turned log/print statements into assertEquals in StateManagementTest.
Modified AllSeemsWellTest to use IntegrityMonitorTestBase.
Modified IntegrityMonitorTest to use IntegrityMonitorTestBase.
Added several hooks to IntegrityMonitor to control timers at a
finer granularity.
Added hooks to IntegrityMonitor to control the FPManager thread.
Remove hooks for refresh timer, as property suffices.
Added assertException() and assertNoException() methods to
IntegrityMonitorTestBase, and then replaced most "try/catch" blocks
with calls to those methods.
Updated StateManagement to close EntityManagers.
Modify pom to remove scope from utils dependency.
Fix some comments and remove an unneeded EntityTransaction variable.
Change-Id: Ic0789d26f985a40a35f618343fa4e88aa473b2b3
Issue-ID: POLICY-582
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Added additional DbDAO constructors to facilitate JUnit testing.
Added DbDAO destroy() method to close the EntityManagerFactory.
Pulled out common code into IntegrityAuditTestBase and subclassed
the tests from there.
Added hooks to IntegrityAudit so that the AuditThread timers could
be set to smaller values so that all of the junit tests could be
run in much less time.
Added similar hooks to DbAudit.
Modified integrity-audit tests to use new utility classes to auto-close
JPA managers.
Modified integrity-audit tests to use new utility class to scan logger
items without the need to scan the actual log file.
Added code to new test superclass to truncate the four ONAP logs.
Modified hooks in IntegrityAuditEntity to adjust serialization
so that dates are not serialized/de-serialized when used in junit
tests.
Deleted TestingUtils.
Added a test for invalid nodeType property.
Fixed issue wherein AuditThread doesn't stop when interrupted.
Change-Id: I5101995b6b68655b2810777bc4d2ec80c7cbc363
Issue-ID: POLICY-582
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
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>
|
|
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>
|
|
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>
|
|
* Useless assignments
* Commented out code
* Unused imports
* Add simple JUnit for exception classes
Issue-ID: POLICY-456
Change-Id: I012c2b6bdaf1b5803b2f1c37fd4d9514055e4ef0
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Issue-ID: POLICY-457
Change-Id: I6e4bc00bc85f73bcb4c58c54378f062d98e6876d
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
IntegrityMonitor.java:
Renamed variables, Ex: dep_groups => depGroups.
Renamed enum constants, Ex: pdp_xacml => PDP_XACML.
Merged "if" tests.
Cast values to "long" before multiplying.
Re-throw interrupt().
Write exception via logger instead of e.printStackTrace().
Moved constructor to top of the file.
Removed most logger.isDebugEnabled() checks.
Returned generic List instead of ArrayList.
Used entrySet() instead of keySet().
Removed useless parentheses.
Removed superfluous exceptions from "throws" declaration.
DbAudit.java:
Modified DbAudit to throw DbAuditException.
Replaced references to HashSet and HashMap with generic Set and Map.
Modified DbAudit to iterate over entrySet() instead of keySet().
ComponentAdminException:
Created ComponentAdminException class.
Modified ComponentAdmin methods to throw new exception class.
Extracted "stateManager" String constant.
Eliminated logger.isDebugEnabled() calls.
Updated the license data.
Eliminated double-checked locking problem from PropertyUtil:
Modified code to use Initialization On Demand Holder idiom.
Change-Id: Ic01288542041da26df483ce85ecaf292ac138f85
Issue-ID: POLICY-246
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Patch 1:
This change modifies StateManagement methods that use transactions so
that an EntityManager is created each time the method is called. This
eliminates issues with EntityManager transactions being shared across
threads causing errors when multiple threads are active.
Issue-ID: POLICY-518
Change-Id: I071660a530de610ec56af82347b92496f87bf4e1
Signed-off-by: Kevin McKiou <km097d@att.com>
|
|
Patch 1:
This bug tracks the AT&T bug 355533. The symptom was that drools pdps
that were backing each other up were becoming stuck in a standby state.
The cause was that the election handler thread was being hung by a call
to PolicyEngine.manager.deactivate which shuts down the topic endpoints
when the drools pdp operational state transitions to disabled. Related
problems were that the election handler heartbeat was NOT blocked when
the main thread was blocked and the IntegrityMonitor forward progress
counter was NOT blocked from incrementing when the election handler
thread was blocked. This prevented the correct failover of the drools
pdp to another healthy one. This change fixes the two causes of the
thread blockage, moves the election handler heartbeat to the main
thread and adds an interface (AllSeemsWell) which is called when
the election handler has stalled/resumed. The AllSeemsWell interface
will block forward progress counter increments when ALLNOTWELL and will
resume forward progress counter increments when ALLSEEMSWELL. In
addition, it reduces the run time of the StandbyStateManagementTest
from approximately 8 minutes to approximately 2 minutes. Since this
changes classes also changed by POLICY-444, this change must be merged
before POLICY-444 can be merged.
Patch 2: Extended sleep times in AllSeemsWellTest.
Patch 3: Commented out asserts that are keeping it from building.
Note: It builds just fine in local environment.
Patch 4: Moved the check of allNotWellMap from testTransaction to
endTransaction so it will cover calls to endTransaction from application
code rather than just calls from testTransaction.
Patch 5: Fixed potential Sonar issue in initialization of HashMaps
allSeemsWellMap and allNotWellMap
Patch 6: Changes to IntegrityMonitorTest to make it run faster and
more deterministically. This satisfies POLICY-444.
Issue-ID: POLICY-501
Change-Id: I8fbbdc481839ec6066f26392d30e230d6b1293f2
Signed-off-by: Kevin McKiou <km097d@att.com>
|
|
Address technical debt in policy/common integrity-audit submodule.
Implementation for empty constructors, remove useless assignment,
use <> on constructor, use @Override. Not all technical debt
addressed, only the ones specified by Pam in POLICY-336, except
the use Set instead of HashSet where a method signature would
change.
Issue-ID: POLICY-456
Change-Id: If8f9f4151503bdd22c8c405485538f8be779cabd
Signed-off-by: Temoc Rodriguez <cr056n@att.com>
|
|
|
|
|
|
Fixed the Sonar issues in ONAP-logging that required minimal refactoring
of the code. Many of the System.out and System.err issues I did not
fix, as I don't know what loggers to use.
Issue-ID: POLICY-458
Change-Id: I8eccb932b350a170b9cd680b90009e6612a0abcd
Signed-off-by: Charles Cole <cc847m@att.com>
|
|
Replaced the string parameter with a StringBuilder so that the modified
version can be accessed outside the method, since strings are immutable.
Added null check for properties. Removed trim on properties in case the
property is null. Added junit to test that the modified StringBuilder can
be read outside the paramsAreBad method.
Issue-ID: POLICY-492
Change-Id: I0550e9d639cbbcc876e6aafb84f6e9a363b653ff
Signed-off-by: Temoc Rodriguez <cr056n@att.com>
|
|
|
|
Under some conditions the JPA transaction may be already closed
when commit is called in StateManagement. Surround it with a
check to see if the transaction is active, so it will not
generate an error in the log.
Issue-ID: POLICY-484
Change-Id: Id54585e68361a0be9ae8afd7e9ccba2f7eadfe5f
Signed-off-by: Kevin McKiou <km097d@att.com>
|
|
Changed version of version.properties from 1.1.2 to 1.2.0
Change-Id: I4d8eb4bdd52ae7d98627f28f0bca72443bfd23eb
Issue-ID: CIMAN-120
Signed-off-by: Charles Cole <cc847m@att.com>
|
|
|
|
Bump minor version in preparation for Amsterdam
branching.
Change-Id: Id33c61586582d008ecede4cd31ed6b046a5bafc0
Issue-ID: CIMAN-120
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
|
|
We release 1.1.1, now move up to 1.1.2
Issue-ID: POLICY-436
Change-Id: I5d2c79ac5f7a2561e79a6644785238465180c59c
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Missing staging repo
Issue-ID: POLICY-441
Change-Id: I7b74861d774685c5d0418fcde68fd0992dd58198
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Remove the line where password get stored in variable
Issue-ID: POLICY-442
Change-Id: I5d474c7a27dfbdcf49b5f1578be75bd2cb627afe
Signed-off-by: Joseph Chou <jc2555@att.com>
|
|
Releasing version 1.1.0 so we need to update to 1.1.1
Issue-ID: POLICY-436
Change-Id: Ie8979e618b49ebd50d0527275cb70cc3824cde1f
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Changes to dependencyCheck to correctly take into account subsystemTest on the first pass through dependencies. Allows for status of repo to remain failed in the case that it fails.
Issue-ID: POLICY-431
Change-Id: I23ce43ce41c546edad73ec8055e513ccc61933b0
Signed-off-by: Temoc Rodriguez <cr056n@att.com>
|
|
Remove startTransaction from testTransaction since it does
nothing functionally and causes exceptions which are logged.
Issue-ID: POLICY-369
Change-Id: Idd064b49e1d68832d14039870414626ca56c779b
Signed-off-by: Kevin McKiou <km097d@att.com>
|
|
|
|
Issue-Id:POLICY-252
Change-Id: I839811ba15d0c478c83c03818087d3153b77ddb1
Signed-off-by: Bharat saraswal <bharat.saraswal@huawei.com>
|
|
Following independent release and versioning process guidelines.
Issue-ID: POLICY-225
Change-Id: I3dad2abc5040255c9271c45eae99394dfd4208b5
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Issue-Id:POLICY-252
Change-Id: Ibf8b6790cbf9f65f1d3b3fc4476f686ff8981a10
Signed-off-by: Bharat saraswal <bharat.saraswal@huawei.com>
|
|
I think that making these private and using accessor functions
we can remove the sonar critical for them.
Issue-ID: POLICY-237
Change-Id: I4edbf909935fe17b0ef087b5cd0e384d78d104d6
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Focused on hard coded passwords. I believe they are only
used for JUnit tests so I moved them into a file for use.
If they still show up on sonar then I will move into a properties
file and/or mark as not going to fix.
Issue-ID: POLICY-237
Change-Id: I6fa561714091043a2ea5e2edfb0441c2dfc8b044
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Changed all instances of Sys.out or PolicyLogger to
slf4j.
Issue-ID: POLICY-178
Change-Id: Ia91af1deb18a9b5c466f6f8a6c546c17c54e14ad
Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
|
|
Just logging the exceptions anyway and remove e.printstack since
that goes to stdout/stderr.
Issue-ID: POLICY-195
Change-Id: I60616bd6ce633e2fcae266bb37eb735c6e6bb4c4
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
Addressing the following sonar critical:
Use a logger to log this exception
Either log or rethrow this exception
It does not hurt to simply do these as well as clean out
lines of code that dump to Sys.out via e.printStackTrace.
Issue-ID: POLICY-195
Change-Id: Ibc328094a0653b7baa04778298e4a69955105ea3
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
|
|
|