diff options
author | Jim Hahn <jrh3@att.com> | 2020-06-17 08:37:15 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-06-17 11:45:16 -0400 |
commit | 611f63a4bb71d677cf2665b1794e91148ba42a51 (patch) | |
tree | c6f82e5ffcd10712e0279c40bf8e59ed49f2332e /integrity-audit/src/main | |
parent | 3bd6679bd7d8f67b4827a610c25ed9671b74d89c (diff) |
Cleanup various sonar issues in policy-common
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>
Diffstat (limited to 'integrity-audit/src/main')
-rw-r--r-- | integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java | 11 | ||||
-rw-r--r-- | integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java | 7 |
2 files changed, 8 insertions, 10 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java index 80177b30..28e8e387 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; * */ public class DbDao { - private static final Logger logger = FlexLogger.getLogger(DbDao.class.getName()); + private static final Logger logger = FlexLogger.getLogger(); private String resourceName; private String persistenceUnit; @@ -505,17 +505,16 @@ public class DbDao { // if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not // found, create a new entry - Query iaequery = em.createQuery(SELECT_STRING); + TypedQuery<IntegrityAuditEntity> iaequery = em.createQuery(SELECT_STRING, IntegrityAuditEntity.class); iaequery.setParameter("rn", resourceName); iaequery.setParameter("pu", persistenceUnit); - @SuppressWarnings("rawtypes") - List iaeList = iaequery.getResultList(); + List<IntegrityAuditEntity> iaeList = iaequery.getResultList(); IntegrityAuditEntity iae; if (!iaeList.isEmpty()) { // ignores multiple results - iae = (IntegrityAuditEntity) iaeList.get(0); + iae = iaeList.get(0); } else { // If it does not exist diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java index c1046828..a1d2116f 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; |