summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db-repositories
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /mso-api-handlers/mso-requests-db-repositories
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db-repositories')
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java24
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java1
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java57
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java11
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java21
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java24
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java8
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java6
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java4
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java9
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java4
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java7
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java12
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java79
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java85
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java64
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java86
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java11
19 files changed, 250 insertions, 265 deletions
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
index 603f9bb494..8657892c34 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
@@ -26,6 +26,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "archivedInfraRequests", path = "archivedInfraRequests")
-public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
+public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
index cd25b122be..29be0ddc00 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
@@ -22,7 +22,6 @@ package org.onap.so.db.request.data.repository;
import java.util.Date;
import java.util.List;
-
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -30,12 +29,19 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "infraActiveRequests", path = "infraActiveRequests")
-public interface InfraActiveRequestsRepository extends JpaRepository<InfraActiveRequests, String>, InfraActiveRequestsRepositoryCustom {
-
- InfraActiveRequests findOneByRequestIdOrClientRequestId(String requestId, String clientRequestId);
- InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId,String clientRequestId, String requestType);
- InfraActiveRequests findOneByRequestId(String string);
- InfraActiveRequests findOneByRequestBody(String requestBody);
- List<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request);
- List<InfraActiveRequests> findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request);
+public interface InfraActiveRequestsRepository
+ extends JpaRepository<InfraActiveRequests, String>, InfraActiveRequestsRepositoryCustom {
+
+ InfraActiveRequests findOneByRequestIdOrClientRequestId(String requestId, String clientRequestId);
+
+ InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId, String clientRequestId,
+ String requestType);
+
+ InfraActiveRequests findOneByRequestId(String string);
+
+ InfraActiveRequests findOneByRequestBody(String requestBody);
+
+ List<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request);
+
+ List<InfraActiveRequests> findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
index 570861dfa1..47f8c6b50e 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -23,7 +23,6 @@ package org.onap.so.db.request.data.repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.stereotype.Repository;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index e3f15764d7..b3d57b0137 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -34,7 +34,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
-
import javax.persistence.EntityManager;
import javax.persistence.NonUniqueResultException;
import javax.persistence.Query;
@@ -44,7 +43,6 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Order;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
-
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -130,9 +128,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.
- * lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. lang.String)
*/
@Override
public InfraActiveRequests getRequestFromInfraActive(final String requestId) {
@@ -141,7 +137,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
InfraActiveRequests ar = null;
final Query query = entityManager
- .createQuery("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
+ .createQuery("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
query.setParameter(REQUEST_ID, requestId);
ar = this.getSingleResult(query);
return ar;
@@ -150,9 +146,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java.
- * util.HashMap, java.lang.String, java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java. util.HashMap,
+ * java.lang.String, java.lang.String)
*/
@Override
public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap,
@@ -383,9 +378,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java
- * .lang.String, java.lang.String, java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java .lang.String,
+ * java.lang.String, java.lang.String)
*/
@Override
public List<InfraActiveRequests> getRequestListFromInfraActive(final String queryAttributeName,
@@ -419,9 +413,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.
- * lang.String, java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. lang.String,
+ * java.lang.String)
*/
@Override
public InfraActiveRequests getRequestFromInfraActive(final String requestId, final String requestType) {
@@ -431,7 +424,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
InfraActiveRequests ar = null;
final Query query = entityManager.createQuery(
- "from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
+ "from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
query.setParameter(REQUEST_ID, requestId);
query.setParameter(REQUEST_TYPE, requestType);
ar = this.getSingleResult(query);
@@ -442,9 +435,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang.
- * String, java.lang.String, java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang. String,
+ * java.lang.String, java.lang.String)
*/
@Override
public InfraActiveRequests checkDuplicateByVnfName(final String vnfName, final String action,
@@ -452,16 +444,17 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final long startTime = System.currentTimeMillis();
logger.debug("Get infra request from DB for VNF {} and action {} and requestType {}", vnfName, action,
- requestType);
+ requestType);
InfraActiveRequests ar = null;
final Query query = entityManager.createQuery(
- "from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ "from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
query.setParameter("vnfName", vnfName);
query.setParameter("action", action);
query.setParameter(REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked") final List<InfraActiveRequests> results = query.getResultList();
+ @SuppressWarnings("unchecked")
+ final List<InfraActiveRequests> results = query.getResultList();
if (!results.isEmpty()) {
ar = results.get(0);
}
@@ -472,9 +465,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang.
- * String, java.lang.String, java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang. String,
+ * java.lang.String, java.lang.String)
*/
@Override
public InfraActiveRequests checkDuplicateByVnfId(final String vnfId, final String action,
@@ -486,11 +478,12 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
InfraActiveRequests ar = null;
final Query query = entityManager.createQuery(
- "from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ "from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
query.setParameter("vnfId", vnfId);
query.setParameter("action", action);
query.setParameter(REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked") final List<InfraActiveRequests> results = query.getResultList();
+ @SuppressWarnings("unchecked")
+ final List<InfraActiveRequests> results = query.getResultList();
if (!results.isEmpty()) {
ar = results.get(0);
}
@@ -501,8 +494,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
/*
* (non-Javadoc)
*
- * @see
- * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String)
*/
@Override
public InfraActiveRequests checkVnfIdStatus(final String operationalEnvironmentId) {
@@ -560,9 +552,10 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final Timestamp minTime = new Timestamp(startTime);
final Timestamp maxTime = new Timestamp(endTime);
final Predicate basePredicate = criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
- final Predicate additionalPredicate = criteriaBuilder.and(
- criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime),
- criteriaBuilder.or(tableRoot.get(END_TIME).isNull(), criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime)));
+ final Predicate additionalPredicate =
+ criteriaBuilder.and(criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime),
+ criteriaBuilder.or(tableRoot.get(END_TIME).isNull(),
+ criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime)));
criteriaQuery.where(criteriaBuilder.and(basePredicate, additionalPredicate));
if (maxResult != null) {
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
index 16e10e3d5b..1ef3b10e29 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
@@ -28,8 +28,11 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "operationStatus", path = "operationStatus")
public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> {
-
- OperationStatus findOneByServiceIdAndOperationId(@Param("SERVICE_ID") String serviceId, @Param("OPERATION_ID") String operationId);
- public OperationStatus findOneByServiceName(String serviceName);
- public OperationStatus findOneByServiceId(String serviceId);
+
+ OperationStatus findOneByServiceIdAndOperationId(@Param("SERVICE_ID") String serviceId,
+ @Param("OPERATION_ID") String operationId);
+
+ public OperationStatus findOneByServiceName(String serviceName);
+
+ public OperationStatus findOneByServiceId(String serviceId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
index e89755d565..09c926aef7 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
@@ -28,15 +28,16 @@ import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.transaction.annotation.Transactional;
-@RepositoryRestResource(collectionResourceRel = "operationalEnvDistributionStatus", path = "operationalEnvDistributionStatus")
-public interface OperationalEnvDistributionStatusRepository extends JpaRepository<OperationalEnvDistributionStatus, String> {
+@RepositoryRestResource(collectionResourceRel = "operationalEnvDistributionStatus",
+ path = "operationalEnvDistributionStatus")
+public interface OperationalEnvDistributionStatusRepository
+ extends JpaRepository<OperationalEnvDistributionStatus, String> {
- @Modifying
- @Transactional
- @Query("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus where "
- + "distributionId = :distributionId and operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
- public int setDistributionIdStatus(@Param("distributionIdStatus") String distributionIdStatus,
- @Param("distributionId") String distributionId,
- @Param("operationalEnvId") String operationalEnvId,
- @Param("serviceModelVersionId") String serviceModelVersionId);
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus where "
+ + "distributionId = :distributionId and operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
+ public int setDistributionIdStatus(@Param("distributionIdStatus") String distributionIdStatus,
+ @Param("distributionId") String distributionId, @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
index ecf1dcb183..65a7ca12cd 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
@@ -21,7 +21,6 @@
package org.onap.so.db.request.data.repository;
import java.util.List;
-
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatusId;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -31,14 +30,19 @@ import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.transaction.annotation.Transactional;
-@RepositoryRestResource(collectionResourceRel = "operationalEnvServiceModelStatus", path = "operationalEnvServiceModelStatus")
-public interface OperationalEnvServiceModelStatusRepository extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId>{
+@RepositoryRestResource(collectionResourceRel = "operationalEnvServiceModelStatus",
+ path = "operationalEnvServiceModelStatus")
+public interface OperationalEnvServiceModelStatusRepository
+ extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId> {
+
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId,
+ String requestId);
+
+ public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(
+ @Param("OPERATIONAL_ENV_ID") String operationalEnvId, @Param("REQUEST_ID") String requestId);
+
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(
+ @Param("OPERATIONAL_ENV_ID") String operationalEnvId,
+ @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId, @Param("REQUEST_ID") String requestId);
- public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
- public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
- @Param("REQUEST_ID") String requestId);
- public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
- @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId,
- @Param("REQUEST_ID") String requestId);
-
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
index f80be0525c..b1abda3b6f 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
@@ -21,7 +21,6 @@
package org.onap.so.db.request.data.repository;
import java.util.List;
-
import org.onap.so.db.request.beans.RequestProcessingData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
@@ -29,9 +28,8 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "requestProcessingData", path = "requestProcessingData")
public interface RequestProcessingDataRepository extends JpaRepository<RequestProcessingData, Integer> {
- RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag(
- @Param("SO_REQUEST_ID") String soRequestId, @Param("GROUPING_ID") String groupingId,
- @Param("NAME") String name, @Param("TAG") String tag);
+ RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag(@Param("SO_REQUEST_ID") String soRequestId,
+ @Param("GROUPING_ID") String groupingId, @Param("NAME") String name, @Param("TAG") String tag);
- List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId);
+ List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
index b93bf7840b..2ed2d7cb42 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
@@ -21,7 +21,6 @@
package org.onap.so.db.request.data.repository;
import java.util.List;
-
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatusId;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -29,7 +28,8 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "resourceOperationStatus", path = "resourceOperationStatus")
-public interface ResourceOperationStatusRepository extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> {
+public interface ResourceOperationStatusRepository
+ extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> {
- List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId);
+ List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
index 179d40ad23..ebae4a4cec 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
@@ -26,7 +26,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "siteStatus", path = "siteStatus")
-public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> {
- SiteStatus findOneBySiteName(String siteName);
+public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> {
+ SiteStatus findOneBySiteName(String siteName);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
index 138ec0fb4d..9a89cdf783 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
@@ -21,15 +21,16 @@
package org.onap.so.db.request.data.repository;
import java.util.List;
-
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@RepositoryRestResource(collectionResourceRel = "watchdogComponentDistributionStatus", path = "watchdogComponentDistributionStatus")
-public interface WatchdogComponentDistributionStatusRepository extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> {
+@RepositoryRestResource(collectionResourceRel = "watchdogComponentDistributionStatus",
+ path = "watchdogComponentDistributionStatus")
+public interface WatchdogComponentDistributionStatusRepository
+ extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> {
- public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId);
+ public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
index 6fddf8567c..7dfd61f8d0 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
@@ -27,7 +27,7 @@ import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "watchdogDistributionStatus", path = "watchdogDistributionStatus")
public interface WatchdogDistributionStatusRepository extends JpaRepository<WatchdogDistributionStatus, String> {
-
- public WatchdogDistributionStatus findOneByDistributionId(String distributionId);
+
+ public WatchdogDistributionStatus findOneByDistributionId(String distributionId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
index b9585d495e..cf36d0c6e6 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
@@ -27,8 +27,9 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "watchdogServiceModVerIdLookup", path = "watchdogServiceModVerIdLookup")
-public interface WatchdogServiceModVerIdLookupRepository extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> {
+public interface WatchdogServiceModVerIdLookupRepository
+ extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> {
+
+ public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId);
- public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId);
-
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java
index 9bb5cab9b5..1b8fc9755e 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java
@@ -27,12 +27,12 @@ import org.springframework.context.annotation.Profile;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
-@SpringBootApplication(scanBasePackages = { "org.onap.so" })
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
@Profile("test")
public class TestApplication {
- public static void main(String... args) {
- SpringApplication.run(TestApplication.class, args);
- System.getProperties().setProperty("mso.db", "MARIADB");
- System.getProperties().setProperty("server.name", "Springboot");
- }
+ public static void main(String... args) {
+ SpringApplication.run(TestApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+ }
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java
index f3be5a154b..09aa252309 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java
@@ -23,11 +23,8 @@ package org.onap.so.db.request;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.Date;
-
import javax.transaction.Transactional;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.TestApplication;
@@ -43,43 +40,43 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
-public class OperationStatusTest {
-
- @Autowired
- private OperationStatusRepository repository;
-
- @Test
- @Transactional
- public void timeStampCreated() throws InterruptedException, NoEntityFoundException {
-
- final String testServiceId = "test-service-id";
- final String testOperationId = "test-operation-id";
- final OperationStatusId id = new OperationStatusId(testServiceId, testOperationId);
- OperationStatus status = new OperationStatus();
-
- status.setServiceId(testServiceId);
- status.setOperationId(testOperationId);
-
- status = repository.saveAndFlush(status);
-
- OperationStatus found = repository.findById(id).
- orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
-
- Date operateAt = found.getOperateAt();
- assertNotNull(operateAt);
- assertEquals(testServiceId, found.getServiceId());
- Date finishedAt = found.getFinishedAt();
- status.setProgress("test-progress");
- //timestamps only set to save on 1 second changes
- Thread.sleep(1000);
- repository.saveAndFlush(status);
-
- OperationStatus foundUpdate = repository.findById(id).
- orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+public class OperationStatusTest {
+
+ @Autowired
+ private OperationStatusRepository repository;
+
+ @Test
+ @Transactional
+ public void timeStampCreated() throws InterruptedException, NoEntityFoundException {
+
+ final String testServiceId = "test-service-id";
+ final String testOperationId = "test-operation-id";
+ final OperationStatusId id = new OperationStatusId(testServiceId, testOperationId);
+ OperationStatus status = new OperationStatus();
+
+ status.setServiceId(testServiceId);
+ status.setOperationId(testOperationId);
+
+ status = repository.saveAndFlush(status);
+
+ OperationStatus found =
+ repository.findById(id).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+
+ Date operateAt = found.getOperateAt();
+ assertNotNull(operateAt);
+ assertEquals(testServiceId, found.getServiceId());
+ Date finishedAt = found.getFinishedAt();
+ status.setProgress("test-progress");
+ // timestamps only set to save on 1 second changes
+ Thread.sleep(1000);
+ repository.saveAndFlush(status);
+
+ OperationStatus foundUpdate =
+ repository.findById(id).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
- assertEquals(operateAt.toString(), foundUpdate.getOperateAt().toString());
- assertNotNull(foundUpdate.getFinishedAt());
- assertNotEquals(finishedAt.toString(), foundUpdate.getFinishedAt().toString());
- assertEquals("test-progress", foundUpdate.getProgress());
- }
+ assertEquals(operateAt.toString(), foundUpdate.getOperateAt().toString());
+ assertNotNull(foundUpdate.getFinishedAt());
+ assertNotEquals(finishedAt.toString(), foundUpdate.getFinishedAt().toString());
+ assertEquals("test-progress", foundUpdate.getProgress());
+ }
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
index f1f26fa7cc..94dc777763 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
@@ -21,7 +21,6 @@
package org.onap.so.db.request;
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.TestApplication;
@@ -40,47 +39,49 @@ import org.springframework.test.context.junit4.SpringRunner;
@ActiveProfiles("test")
public class OperationalEnvServiceModelStatusTest {
- @Autowired
- private OperationalEnvServiceModelStatusRepository repository;
-
-
- @Test
- public void updateWithoutAllKeys() throws Exception {
-
- OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus();
- status.setRequestId("request-id-1");
- status.setOperationalEnvId("oper-env-id-1");
- status.setServiceModelVersionId("service-model-ver-id-1");
- status.setVnfOperationalEnvId("vnf-oper-env-id-1");
- status.setRetryCount(0);
-
- repository.saveAndFlush(status);
- OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1", "service-model-ver-id-1", "request-id-1");
- status2.setRetryCount(1);
- assertEquals("request-id-1", status2.getRequestId());
- assertEquals("vnf-oper-env-id-1", status2.getVnfOperationalEnvId());
-
- repository.saveAndFlush(status2);
-
- OperationalEnvServiceModelStatus status3 = new OperationalEnvServiceModelStatus();
+ @Autowired
+ private OperationalEnvServiceModelStatusRepository repository;
+
+
+ @Test
+ public void updateWithoutAllKeys() throws Exception {
+
+ OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus();
+ status.setRequestId("request-id-1");
+ status.setOperationalEnvId("oper-env-id-1");
+ status.setServiceModelVersionId("service-model-ver-id-1");
+ status.setVnfOperationalEnvId("vnf-oper-env-id-1");
+ status.setRetryCount(0);
+
+ repository.saveAndFlush(status);
+ OperationalEnvServiceModelStatus status2 =
+ repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1",
+ "service-model-ver-id-1", "request-id-1");
+ status2.setRetryCount(1);
+ assertEquals("request-id-1", status2.getRequestId());
+ assertEquals("vnf-oper-env-id-1", status2.getVnfOperationalEnvId());
+
+ repository.saveAndFlush(status2);
+
+ OperationalEnvServiceModelStatus status3 = new OperationalEnvServiceModelStatus();
+
+ status3.setRequestId("request-id-2");
+ status3.setOperationalEnvId("oper-env-id-1");
+ status3.setServiceModelVersionId("service-model-ver-id-2");
+ status3.setVnfOperationalEnvId("vnf-oper-env-id-2");
+ status3.setRetryCount(2);
+
+ repository.saveAndFlush(status3);
- status3.setRequestId("request-id-2");
- status3.setOperationalEnvId("oper-env-id-1");
- status3.setServiceModelVersionId("service-model-ver-id-2");
- status3.setVnfOperationalEnvId("vnf-oper-env-id-2");
- status3.setRetryCount(2);
-
- repository.saveAndFlush(status3);
-
- OperationalEnvServiceModelStatus exampleObj = new OperationalEnvServiceModelStatus();
- exampleObj.setOperationalEnvId("oper-env-id-1");
- exampleObj.setServiceModelVersionId("service-model-ver-id-1");
- ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("requestId");
- OperationalEnvServiceModelStatus foundStatus = repository.findOne(Example.of(exampleObj,matcher))
- .orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
- if(foundStatus== null)
- throw new Exception("No status found");
+ OperationalEnvServiceModelStatus exampleObj = new OperationalEnvServiceModelStatus();
+ exampleObj.setOperationalEnvId("oper-env-id-1");
+ exampleObj.setServiceModelVersionId("service-model-ver-id-1");
+ ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("requestId");
+ OperationalEnvServiceModelStatus foundStatus = repository.findOne(Example.of(exampleObj, matcher))
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+ if (foundStatus == null)
+ throw new Exception("No status found");
- assertEquals(new Integer(1), foundStatus.getRetryCount());
- }
+ assertEquals(new Integer(1), foundStatus.getRetryCount());
+ }
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
index 9c270d619b..26ff25833f 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
@@ -22,11 +22,9 @@ package org.onap.so.db.request;
import java.util.TimeZone;
-
import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
-
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
@@ -42,45 +40,35 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
-@EnableJpaRepositories(
- entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
- basePackages = { "org.onap.so.db.request.data.repository" }
- )
+@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory",
+ transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
public class RequestDBConfig {
- @Primary
- @Bean(name = "requestDataSource")
- @ConfigurationProperties(prefix = "spring.datasource")
- public DataSource dataSource() {
- return DataSourceBuilder.create().build();
- }
+ @Primary
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Primary
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB")
+ .build();
+ }
- @Primary
- @Bean(name = "requestEntityManagerFactory")
- public LocalContainerEntityManagerFactoryBean
- entityManagerFactory(
- EntityManagerFactoryBuilder builder,
- @Qualifier("requestDataSource") DataSource dataSource
- ) {
- return builder
- .dataSource(dataSource)
- .packages("org.onap.so.db.request.beans")
- .persistenceUnit("requestDB")
- .build();
- }
+ @Primary
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
- @Primary
- @Bean(name = "requestTransactionManager")
- public PlatformTransactionManager transactionManager(
- @Qualifier("requestEntityManagerFactory") EntityManagerFactory
- entityManagerFactory
- ) {
- return new JpaTransactionManager(entityManagerFactory);
- }
-
- @PostConstruct
- public void started() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- }
+ @PostConstruct
+ public void started() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ }
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java
index 1f99e92d97..93218a2057 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java
@@ -22,9 +22,7 @@ package org.onap.so.db.request;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import javax.transaction.Transactional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,47 +43,45 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class SiteStatusTest {
-
- @Autowired
- private SiteStatusRepository repository;
-
- @Test
- @Transactional
- public void timeStampCreated() throws InterruptedException, NoEntityFoundException {
- SiteStatus found = repository.findById("test name4").
- orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
-
- assertNotNull(found.getCreated());
- assertEquals("test name4", found.getSiteName());
- }
-
- @Test
- public void sortByCreated() {
-
- final PageRequest page1 = new PageRequest(
- 0, 20, Direction.DESC, "created"
- );
-
- SiteStatus example = new SiteStatus();
- example.setStatus(true);
- Page<SiteStatus> found = repository.findAll(Example.of(example), page1);
-
- assertEquals("test name4", found.getContent().get(0).getSiteName());
-
- }
-
- @Test
- public void updateStatus() throws NoEntityFoundException {
-
- SiteStatus status = repository.findById("test name update").
- orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
- status.setStatus(false);
-
- repository.saveAndFlush(status);
- status = repository.findById("test name update").
- orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
- assertEquals(false, status.getStatus());
-
- }
-
+
+ @Autowired
+ private SiteStatusRepository repository;
+
+ @Test
+ @Transactional
+ public void timeStampCreated() throws InterruptedException, NoEntityFoundException {
+ SiteStatus found =
+ repository.findById("test name4").orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
+
+ assertNotNull(found.getCreated());
+ assertEquals("test name4", found.getSiteName());
+ }
+
+ @Test
+ public void sortByCreated() {
+
+ final PageRequest page1 = new PageRequest(0, 20, Direction.DESC, "created");
+
+ SiteStatus example = new SiteStatus();
+ example.setStatus(true);
+ Page<SiteStatus> found = repository.findAll(Example.of(example), page1);
+
+ assertEquals("test name4", found.getContent().get(0).getSiteName());
+
+ }
+
+ @Test
+ public void updateStatus() throws NoEntityFoundException {
+
+ SiteStatus status = repository.findById("test name update")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
+ status.setStatus(false);
+
+ repository.saveAndFlush(status);
+ status = repository.findById("test name update")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Site"));
+ assertEquals(false, status.getStatus());
+
+ }
+
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
index 4dd500d86d..ca30604e06 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
@@ -31,18 +31,15 @@ import static org.mockito.Mockito.mock;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID;
-
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.TestApplication;
@@ -94,8 +91,8 @@ public class InfraActiveRequestsRepositoryImplTest {
public void test_GetInfraActiveRequests_invalidFiltersMap() {
final Map<String, String[]> filters = new HashMap<>();
filters.put("OverTheMoon", new String[] {"Humpty Dumpty Sat On The Wall"});
- final List<Predicate> predicates =
- objUnderTest.getPredicates(filters, mock(CriteriaBuilder.class), (Root<InfraActiveRequests>)mock(Root.class));
+ final List<Predicate> predicates = objUnderTest.getPredicates(filters, mock(CriteriaBuilder.class),
+ (Root<InfraActiveRequests>) mock(Root.class));
assertTrue(predicates.isEmpty());
}
@@ -224,8 +221,8 @@ public class InfraActiveRequestsRepositoryImplTest {
assertFalse(actualRequests.isEmpty());
assertEquals(3, actualRequests.size());
- assertEquals("ShouldReturnInSearchQuery_1,ShouldReturnInSearchQuery_2,ShouldReturnInSearchQuery_3",
- actualRequests.stream().map(item -> item.getServiceInstanceName()).collect(Collectors.joining(",")));
+ assertEquals("ShouldReturnInSearchQuery_1,ShouldReturnInSearchQuery_2,ShouldReturnInSearchQuery_3",
+ actualRequests.stream().map(item -> item.getServiceInstanceName()).collect(Collectors.joining(",")));
}
}