aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-04-15 11:17:43 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-04-15 11:17:47 +0800
commit021f2935bf4182b35a3aa7fbc560f2612f92473d (patch)
tree97e8f672aad83423345c05cc1f0523abb48f333d
parent53aac91804a550effcfa1e1bc9b7520efcdea184 (diff)
improve sonar coverage for uui-server
Change-Id: Idfb7a45bc15a4edda6d250188550c63ef141c487 Issue-ID: USECASEUI-103 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java537
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java118
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java290
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java117
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java241
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java131
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java294
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java67
8 files changed, 745 insertions, 1050 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
index a627f1f3..b85ff546 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
@@ -43,168 +43,169 @@ import org.springframework.stereotype.Service;
@org.springframework.context.annotation.Configuration
@EnableAspectJAutoProxy
public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
-
- private static final Logger logger = LoggerFactory.getLogger(AlarmsHeaderServiceImpl.class);
- @Autowired
- private SessionFactory sessionFactory;
-
-
+ private static final Logger logger = LoggerFactory.getLogger(AlarmsHeaderServiceImpl.class);
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ private Session getSession() {
+ return sessionFactory.openSession();
+ }
+
public String saveAlarmsHeader(AlarmsHeader alarmsHeader) {
- try(Session session = sessionFactory.openSession();){
- if (null == alarmsHeader) {
- logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!");
- }
- logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader);
- Transaction tx = session.beginTransaction();
- session.save(alarmsHeader);
- tx.commit();
- session.flush();
- return "1";
- } catch (Exception e) {
- logger.error("exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());
- return "0";
- }
-
+ try(Session session = getSession()){
+ if (null == alarmsHeader) {
+ logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!");
+ }
+ logger.info("AlarmsHeaderServiceImpl saveAlarmsHeader: alarmsHeader={}", alarmsHeader);
+ Transaction tx = session.beginTransaction();
+ session.save(alarmsHeader);
+ tx.commit();
+ session.flush();
+ return "1";
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());
+ return "0";
+ }
}
-
@Override
public String updateAlarmsHeader(AlarmsHeader alarmsHeader) {
- try(Session session = sessionFactory.openSession();){
- if (null == alarmsHeader){
- logger.error("AlarmsHeaderServiceImpl updateAlarmsHeader alarmsHeader is null!");
- }
- logger.info("AlarmsHeaderServiceImpl updateAlarmsHeader: alarmsHeader={}", alarmsHeader);
- Transaction tx = session.beginTransaction();
- session.update(alarmsHeader);
- tx.commit();
- session.flush();
- return "1";
- } catch (Exception e) {
- logger.error("exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());
- return "0";
- }
+ try(Session session = getSession()){
+ if (null == alarmsHeader){
+ logger.error("AlarmsHeaderServiceImpl updateAlarmsHeader alarmsHeader is null!");
+ }
+ logger.info("AlarmsHeaderServiceImpl updateAlarmsHeader: alarmsHeader={}", alarmsHeader);
+ Transaction tx = session.beginTransaction();
+ session.update(alarmsHeader);
+ tx.commit();
+ session.flush();
+ return "1";
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());
+ return "0";
+ }
}
public int getAllCount(AlarmsHeader alarmsHeader,int currentPage,int pageSize) {
- try(Session session = sessionFactory.openSession();){
+ try(Session session = getSession()){
StringBuffer count=new StringBuffer("select count(*) from AlarmsHeader a where 1=1");
if (null == alarmsHeader) {
- //logger.error("AlarmsHeaderServiceImpl getAllCount alarmsHeader is null!");
- }else {
- if(null!=alarmsHeader.getVersion()) {
- String ver=alarmsHeader.getVersion();
- count.append(" and a.version like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventName()) {
- String ver=alarmsHeader.getEventName();
- count.append(" and a.eventName like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getAlarmCondition()) {
- String ver=alarmsHeader.getAlarmCondition();
- count.append(" and a.alarmCondition like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getDomain()) {
- String ver=alarmsHeader.getDomain();
- count.append(" and a.domain like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventId()) {
- String ver=alarmsHeader.getEventId();
- count.append(" and a.eventId = '"+ver+"'");
- }
- if(null!=alarmsHeader.getNfcNamingCode()) {
- String ver=alarmsHeader.getNfcNamingCode();
- count.append(" and a.nfcNamingCode like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getNfNamingCode()) {
- String ver=alarmsHeader.getNfNamingCode();
- count.append(" and a.nfNamingCode like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSourceId()) {
- String ver =alarmsHeader.getSourceId();
- count.append(" and a.sourceId like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSourceName()) {
- String ver =alarmsHeader.getSourceName();
- count.append(" and a.sourceName like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getReportingEntityId()) {
- String ver =alarmsHeader.getReportingEntityId();
- count.append(" and a.reportingEntityId like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getReportingEntityName()) {
- String ver =alarmsHeader.getReportingEntityName();
- count.append(" and a.reportingEntityName like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getPriority()) {
- String ver =alarmsHeader.getPriority();
- count.append(" and a.priority like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getStartEpochMicrosec()) {
- String ver =alarmsHeader.getStartEpochMicrosec();
- count.append(" and a.startEpochMicrosec like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getLastEpochMicroSec()) {
- String ver =alarmsHeader.getLastEpochMicroSec();
- count.append(" and a.lastEpochMicroSec like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSequence()) {
- String ver =alarmsHeader.getSequence();
- count.append(" and a.sequence like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getFaultFieldsVersion()) {
- String ver =alarmsHeader.getFaultFieldsVersion();
- count.append(" and a.faultFieldsVersion like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventServrity()) {
- String ver =alarmsHeader.getEventServrity();
- count.append(" and a.eventServrity like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventType()) {
- String ver =alarmsHeader.getEventType();
- count.append(" and a.eventSourceType like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventCategory()) {
- String ver =alarmsHeader.getEventCategory();
- count.append(" and a.eventCategory like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getAlarmCondition()) {
- String ver =alarmsHeader.getAlarmCondition();
- count.append(" and a.alarmCondition like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSpecificProblem()) {
- String ver =alarmsHeader.getSpecificProblem();
- count.append(" and a.specificProblem like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getVfStatus()) {
- String ver =alarmsHeader.getVfStatus();
- count.append(" and a.vfStatus = '"+ver+"'");
- }
- if(null!=alarmsHeader.getAlarmInterfaceA()) {
- String ver =alarmsHeader.getAlarmInterfaceA();
- count.append(" and a.alarmInterfaceA like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getStatus()) {
- String ver =alarmsHeader.getStatus();
- count.append(" and a.status = '"+ver+"'");
- }
+ logger.error("AlarmsHeaderServiceImpl getAllCount alarmsHeader is null!");
+ }else {
+ if(null!=alarmsHeader.getVersion()) {
+ String ver=alarmsHeader.getVersion();
+ count.append(" and a.version like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventName()) {
+ String ver=alarmsHeader.getEventName();
+ count.append(" and a.eventName like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getAlarmCondition()) {
+ String ver=alarmsHeader.getAlarmCondition();
+ count.append(" and a.alarmCondition like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getDomain()) {
+ String ver=alarmsHeader.getDomain();
+ count.append(" and a.domain like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventId()) {
+ String ver=alarmsHeader.getEventId();
+ count.append(" and a.eventId = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getNfcNamingCode()) {
+ String ver=alarmsHeader.getNfcNamingCode();
+ count.append(" and a.nfcNamingCode like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getNfNamingCode()) {
+ String ver=alarmsHeader.getNfNamingCode();
+ count.append(" and a.nfNamingCode like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSourceId()) {
+ String ver =alarmsHeader.getSourceId();
+ count.append(" and a.sourceId like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSourceName()) {
+ String ver =alarmsHeader.getSourceName();
+ count.append(" and a.sourceName like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getReportingEntityId()) {
+ String ver =alarmsHeader.getReportingEntityId();
+ count.append(" and a.reportingEntityId like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getReportingEntityName()) {
+ String ver =alarmsHeader.getReportingEntityName();
+ count.append(" and a.reportingEntityName like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getPriority()) {
+ String ver =alarmsHeader.getPriority();
+ count.append(" and a.priority like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getStartEpochMicrosec()) {
+ String ver =alarmsHeader.getStartEpochMicrosec();
+ count.append(" and a.startEpochMicrosec like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getLastEpochMicroSec()) {
+ String ver =alarmsHeader.getLastEpochMicroSec();
+ count.append(" and a.lastEpochMicroSec like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSequence()) {
+ String ver =alarmsHeader.getSequence();
+ count.append(" and a.sequence like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getFaultFieldsVersion()) {
+ String ver =alarmsHeader.getFaultFieldsVersion();
+ count.append(" and a.faultFieldsVersion like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventServrity()) {
+ String ver =alarmsHeader.getEventServrity();
+ count.append(" and a.eventServrity like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventType()) {
+ String ver =alarmsHeader.getEventType();
+ count.append(" and a.eventSourceType like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventCategory()) {
+ String ver =alarmsHeader.getEventCategory();
+ count.append(" and a.eventCategory like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getAlarmCondition()) {
+ String ver =alarmsHeader.getAlarmCondition();
+ count.append(" and a.alarmCondition like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSpecificProblem()) {
+ String ver =alarmsHeader.getSpecificProblem();
+ count.append(" and a.specificProblem like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getVfStatus()) {
+ String ver =alarmsHeader.getVfStatus();
+ count.append(" and a.vfStatus = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getAlarmInterfaceA()) {
+ String ver =alarmsHeader.getAlarmInterfaceA();
+ count.append(" and a.alarmInterfaceA like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getStatus()) {
+ String ver =alarmsHeader.getStatus();
+ count.append(" and a.status = '"+ver+"'");
+ }
if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
count.append(" and a.createTime between :startTime and :endTime");
}
- }
- Query query = session.createQuery(count.toString());
+ }
+ Query query = session.createQuery(count.toString());
if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
query.setDate("startTime",alarmsHeader.getCreateTime());
query.setDate("endTime",alarmsHeader.getUpdateTime());
}
- long q=(long)query.uniqueResult();
- session.flush();
- return (int)q;
- } catch (Exception e) {
- logger.error("exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());
- return -1;
- }
+ long q=(long)query.uniqueResult();
+ session.flush();
+ return (int)q;
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());
+ return -1;
+ }
}
@SuppressWarnings("unchecked")
@@ -213,138 +214,137 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
Page<AlarmsHeader> page = new Page<AlarmsHeader>();
int allRow =this.getAllCount(alarmsHeader,currentPage,pageSize);
int offset = page.countOffset(currentPage, pageSize);
-
- try(Session session = sessionFactory.openSession();){
+
+ try(Session session = getSession()){
StringBuffer hql =new StringBuffer("from AlarmsHeader a where 1=1");
- if (null == alarmsHeader) {
- //logger.error("AlarmsHeaderServiceImpl queryAlarmsHeader alarmsHeader is null!");
- }else {
- if(null!=alarmsHeader.getVersion()) {
- String ver=alarmsHeader.getVersion();
- hql.append(" and a.version like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventName()) {
- String ver=alarmsHeader.getEventName();
- hql.append(" and a.eventName = '"+ver+"'");
- }
- if(null!=alarmsHeader.getAlarmCondition()) {
- String ver=alarmsHeader.getAlarmCondition();
- hql.append(" and a.alarmCondition like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getDomain()) {
- String ver=alarmsHeader.getDomain();
- hql.append(" and a.domain like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventId()) {
- String ver=alarmsHeader.getEventId();
- hql.append(" and a.eventId = '"+ver+"'");
- }
- if(null!=alarmsHeader.getNfcNamingCode()) {
- String ver=alarmsHeader.getNfcNamingCode();
- hql.append(" and a.nfcNamingCode like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getNfNamingCode()) {
- String ver=alarmsHeader.getNfNamingCode();
- hql.append(" and a.nfNamingCode like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSourceId()) {
- String ver =alarmsHeader.getSourceId();
- hql.append(" and a.sourceId like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSourceName()) {
- String ver =alarmsHeader.getSourceName();
- hql.append(" and a.sourceName like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getReportingEntityId()) {
- String ver =alarmsHeader.getReportingEntityId();
- hql.append(" and a.reportingEntityId like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getReportingEntityName()) {
- String ver =alarmsHeader.getReportingEntityName();
- hql.append(" and a.reportingEntityName like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getPriority()) {
- String ver =alarmsHeader.getPriority();
- hql.append(" and a.priority like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getStartEpochMicrosec()) {
- String ver =alarmsHeader.getStartEpochMicrosec();
- hql.append(" and a.startEpochMicrosec like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getLastEpochMicroSec()) {
- String ver =alarmsHeader.getLastEpochMicroSec();
- hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSequence()) {
- String ver =alarmsHeader.getSequence();
- hql.append(" and a.sequence like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getFaultFieldsVersion()) {
- String ver =alarmsHeader.getFaultFieldsVersion();
- hql.append(" and a.faultFieldsVersion like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventServrity()) {
- String ver =alarmsHeader.getEventServrity();
- hql.append(" and a.eventServrity like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventType()) {
- String ver =alarmsHeader.getEventType();
- hql.append(" and a.eventSourceType like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getEventCategory()) {
- String ver =alarmsHeader.getEventCategory();
- hql.append(" and a.eventCategory like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getAlarmCondition()) {
- String ver =alarmsHeader.getAlarmCondition();
- hql.append(" and a.alarmCondition like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getSpecificProblem()) {
- String ver =alarmsHeader.getSpecificProblem();
- hql.append(" and a.specificProblem like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getVfStatus()) {
- String ver =alarmsHeader.getVfStatus();
- hql.append(" and a.vfStatus = '"+ver+"'");
- }
- if(null!=alarmsHeader.getAlarmInterfaceA()) {
- String ver =alarmsHeader.getAlarmInterfaceA();
- hql.append(" and a.alarmInterfaceA like '%"+ver+"%'");
- }
- if(null!=alarmsHeader.getStatus()) {
- String ver =alarmsHeader.getStatus();
- hql.append(" and a.status = '"+ver+"'");
- }
- if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
- hql.append(" and a.createTime between :startTime and :endTime");
- }
- }
- logger.info("AlarmsHeaderServiceImpl queryAlarmsHeader: alarmsHeader={}", alarmsHeader);
- Query query = session.createQuery(hql.toString());
+ if (null == alarmsHeader) {
+ //logger.error("AlarmsHeaderServiceImpl queryAlarmsHeader alarmsHeader is null!");
+ }else {
+ if(null!=alarmsHeader.getVersion()) {
+ String ver=alarmsHeader.getVersion();
+ hql.append(" and a.version like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventName()) {
+ String ver=alarmsHeader.getEventName();
+ hql.append(" and a.eventName = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getAlarmCondition()) {
+ String ver=alarmsHeader.getAlarmCondition();
+ hql.append(" and a.alarmCondition like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getDomain()) {
+ String ver=alarmsHeader.getDomain();
+ hql.append(" and a.domain like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventId()) {
+ String ver=alarmsHeader.getEventId();
+ hql.append(" and a.eventId = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getNfcNamingCode()) {
+ String ver=alarmsHeader.getNfcNamingCode();
+ hql.append(" and a.nfcNamingCode like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getNfNamingCode()) {
+ String ver=alarmsHeader.getNfNamingCode();
+ hql.append(" and a.nfNamingCode like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSourceId()) {
+ String ver =alarmsHeader.getSourceId();
+ hql.append(" and a.sourceId like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSourceName()) {
+ String ver =alarmsHeader.getSourceName();
+ hql.append(" and a.sourceName like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getReportingEntityId()) {
+ String ver =alarmsHeader.getReportingEntityId();
+ hql.append(" and a.reportingEntityId like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getReportingEntityName()) {
+ String ver =alarmsHeader.getReportingEntityName();
+ hql.append(" and a.reportingEntityName like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getPriority()) {
+ String ver =alarmsHeader.getPriority();
+ hql.append(" and a.priority like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getStartEpochMicrosec()) {
+ String ver =alarmsHeader.getStartEpochMicrosec();
+ hql.append(" and a.startEpochMicrosec like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getLastEpochMicroSec()) {
+ String ver =alarmsHeader.getLastEpochMicroSec();
+ hql.append(" and a.lastEpochMicroSec like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSequence()) {
+ String ver =alarmsHeader.getSequence();
+ hql.append(" and a.sequence like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getFaultFieldsVersion()) {
+ String ver =alarmsHeader.getFaultFieldsVersion();
+ hql.append(" and a.faultFieldsVersion like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventServrity()) {
+ String ver =alarmsHeader.getEventServrity();
+ hql.append(" and a.eventServrity like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventType()) {
+ String ver =alarmsHeader.getEventType();
+ hql.append(" and a.eventSourceType like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getEventCategory()) {
+ String ver =alarmsHeader.getEventCategory();
+ hql.append(" and a.eventCategory like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getAlarmCondition()) {
+ String ver =alarmsHeader.getAlarmCondition();
+ hql.append(" and a.alarmCondition like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getSpecificProblem()) {
+ String ver =alarmsHeader.getSpecificProblem();
+ hql.append(" and a.specificProblem like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getVfStatus()) {
+ String ver =alarmsHeader.getVfStatus();
+ hql.append(" and a.vfStatus = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getAlarmInterfaceA()) {
+ String ver =alarmsHeader.getAlarmInterfaceA();
+ hql.append(" and a.alarmInterfaceA like '%"+ver+"%'");
+ }
+ if(null!=alarmsHeader.getStatus()) {
+ String ver =alarmsHeader.getStatus();
+ hql.append(" and a.status = '"+ver+"'");
+ }
+ if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
+ hql.append(" and a.createTime between :startTime and :endTime");
+ }
+ }
+ logger.info("AlarmsHeaderServiceImpl queryAlarmsHeader: alarmsHeader={}", alarmsHeader);
+ Query query = session.createQuery(hql.toString());
if(null!=alarmsHeader.getCreateTime() || alarmsHeader.getUpdateTime()!= null) {
query.setDate("startTime",alarmsHeader.getCreateTime());
query.setDate("endTime",alarmsHeader.getUpdateTime());
}
- query.setFirstResult(offset);
- query.setMaxResults(pageSize);
- List<AlarmsHeader> list= query.list();
- page.setPageNo(currentPage);
- page.setPageSize(pageSize);
- page.setTotalRecords(allRow);
- page.setList(list);
- session.flush();
- return page;
- } catch (Exception e) {
- logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());
- return null;
- }
+ query.setFirstResult(offset);
+ query.setMaxResults(pageSize);
+ List<AlarmsHeader> list= query.list();
+ page.setPageNo(currentPage);
+ page.setPageSize(pageSize);
+ page.setTotalRecords(allRow);
+ page.setList(list);
+ session.flush();
+ return page;
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());
+ return null;
+ }
}
-
@SuppressWarnings("unchecked")
@Override
public List<AlarmsHeader> queryId(String[] id) {
- try(Session session = sessionFactory.openSession();){
+ try(Session session = getSession()){
if(id.length==0) {
logger.error("AlarmsHeaderServiceImpl queryId is null!");
}
@@ -357,9 +357,4 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
return null;
}
}
-
-
-
-
-
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java
new file mode 100644
index 00000000..f4bf6e08
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/AlarmsHeaderTest.java
@@ -0,0 +1,118 @@
+/**
+ * Copyright (C) 2017 CMCC, Inc. and others. 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.impl;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.server.UsecaseuiServerApplication;
+import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.util.DateUtils;
+import org.onap.usecaseui.server.util.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.io.*;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class AlarmsHeaderTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetAlarmsHeader() throws Exception {
+ AlarmsHeader ah = new AlarmsHeader("version", "eventName", "domain", "eventId", "eventType", "nfcNamingCode",
+ "nfNamingCode", "sourceId", "sourceName", "reportingEntityId", "reportingEntityName",
+ "priority", "startEpochMicrosec", "lastEpochMicroSec", "sequence", "faultFieldsVersion",
+ "eventServrity", "eventSourceType", "eventCategory", "alarmCondition", "specificProblem",
+ "vfStatus", "alarmInterfaceA", "status", DateUtils.now(), DateUtils.now());
+ ah.getVersion();
+ ah.getEventName();
+ ah.getDomain();
+ ah.getEventId();
+ ah.getEventType();
+ ah.getNfcNamingCode();
+ ah.getNfNamingCode();
+ ah.getSourceId();
+ ah.getSourceName();
+ ah.getReportingEntityId();
+ ah.getReportingEntityName();
+ ah.getPriority();
+ ah.getStartEpochMicrosec();
+ ah.getLastEpochMicroSec();
+ ah.getSequence();
+ ah.getFaultFieldsVersion();
+ ah.getEventServrity();
+ ah.getEventSourceType();
+ ah.getEventCategory();
+ ah.getAlarmCondition();
+ ah.getSpecificProblem();
+ ah.getVfStatus();
+ ah.getAlarmInterfaceA();
+ ah.getStatus();
+ ah.getCreateTime();
+ ah.getUpdateTime();
+ }
+
+ @Test
+ public void testSetAlarmsHeader() throws Exception {
+ AlarmsHeader ah = new AlarmsHeader("sourceId");
+ ah.setVersion("");
+ ah.setEventName("");
+ ah.setDomain("");
+ ah.setEventId("");
+ ah.setEventType("");
+ ah.setNfcNamingCode("");
+ ah.setNfNamingCode("");
+ ah.setSourceId("");
+ ah.setSourceName("");
+ ah.setReportingEntityId("");
+ ah.setReportingEntityName("");
+ ah.setPriority("");
+ ah.setStartEpochMicrosec("");
+ ah.setLastEpochMicroSec("");
+ ah.setSequence("");
+ ah.setFaultFieldsVersion("");
+ ah.setEventServrity("");
+ ah.setEventSourceType("");
+ ah.setEventCategory("");
+ ah.setAlarmCondition("");
+ ah.setSpecificProblem("");
+ ah.setVfStatus("");
+ ah.setAlarmInterfaceA("");
+ ah.setStatus("");
+ ah.setCreateTime(DateUtils.now());
+ ah.setUpdateTime(DateUtils.now());
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
deleted file mode 100644
index 5616ef23..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2017 CMCC, Inc. and others. 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.server.service;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.usecaseui.server.bean.AlarmsHeader;
-import org.onap.usecaseui.server.util.DateUtils;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class AlarmsHeaderServiceTest {
-
- @Resource(name = "AlarmsHeaderService")
- private AlarmsHeaderService alarmsHeaderService;
-
- @Test
- public void save() throws ParseException {
- AlarmsHeader a = new AlarmsHeader();
- a.setEventName("a");
- a.setStatus("1");
- a.setVfStatus("1");
- a.setEventId("1119");
- a.setDomain("asb");
- a.setEventCategory("s");
- a.setAlarmCondition("ea");
- a.setAlarmInterfaceA("cs");
- a.setCreateTime(DateUtils.now());
- a.setEventServrity("s");
- a.setEventSourceType("q");
- a.setEventType("q");
- a.setFaultFieldsVersion("v1");
- a.setLastEpochMicroSec("csa");
- a.setNfcNamingCode("std");
- a.setNfNamingCode("cout");
- a.setPriority("cs");
- a.setReportingEntityId("112");
- a.setReportingEntityName("asfs");
- a.setSequence("cgg");
- a.setSourceId("123");
- a.setSourceName("eggs");
- a.setSpecificProblem("especially");
- a.setStartEpochMicrosec("wallet");
- a.setUpdateTime(DateUtils.now());
- a.setVersion("va2");
- System.out.println(alarmsHeaderService.saveAlarmsHeader(a));
-
- }
-
- @Test
- public void update() throws ParseException {
- AlarmsHeader a = new AlarmsHeader();
- a.setEventName("a1");
- a.setStatus("2");
- a.setVfStatus("3");
- a.setEventId("1101");
- a.setDomain("asb");
- a.setEventCategory("s");
- a.setAlarmCondition("ea");
- a.setAlarmInterfaceA("cs");
- a.setCreateTime(DateUtils.now());
- a.setEventServrity("s");
- a.setEventSourceType("q");
- a.setEventType("q");
- a.setFaultFieldsVersion("v1");
- a.setLastEpochMicroSec("csa");
- a.setNfcNamingCode("std");
- a.setNfNamingCode("cout");
- a.setPriority("cs");
- a.setReportingEntityId("112");
- a.setReportingEntityName("asfs");
- a.setSequence("cgg");
- a.setSourceId("123");
- a.setSourceName("eggs");
- a.setSpecificProblem("especially");
- a.setStartEpochMicrosec("wallet");
- a.setUpdateTime(DateUtils.now());
- a.setVersion("va2");
- System.out.println(alarmsHeaderService.updateAlarmsHeader(a));
- }
-
-
- @Test
- public void update1() throws ParseException {
- AlarmsHeader a = new AlarmsHeader();
- a.setEventName("a1");
- a.setStatus("2");
- a.setVfStatus("3");
- a.setEventId("1101");
- a.setDomain("asb");
- a.setEventCategory("s");
- a.setAlarmCondition("ea");
- a.setAlarmInterfaceA("cs");
- a.setCreateTime(DateUtils.now());
- a.setEventServrity("s");
- a.setEventSourceType("q");
- a.setEventType("q");
- a.setSpecificProblem("especially");
- a.setStartEpochMicrosec("wallet");
- a.setUpdateTime(DateUtils.now());
- a.setVersion("va2");
- System.out.println(alarmsHeaderService.updateAlarmsHeader(a));
- }
-
- @Test
- public void get(){
-
- alarmsHeaderService.queryId(new String[]{"1101"}).forEach( a -> System.out.println(a));
- }
-
- @Test
- public void queryEventName() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventId("110");
- a.setEventName("asdasds");
- // a.setVfStatus("2");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().forEach( as->System.out.println(as.toString()));
- }
-
- @Test
- public void queryStatus() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setStatus("1");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryEventId() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventId("1101");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryDomain() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setDomain("asb");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryEventCategory() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventCategory("s");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryAlarmCondition() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setAlarmCondition("ea");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryAlarmInterfaceA() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setAlarmInterfaceA("cs");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryEventServrity() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventServrity("s");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryEventSourceType() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventSourceType("q");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryEventType() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setEventType("q");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryFaultFieldsVersion() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setFaultFieldsVersion("v1");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryLastEpochMicroSec() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setLastEpochMicroSec("csa");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryNfcNamingCode() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setNfcNamingCode("std");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryNfNamingCode() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setNfNamingCode("cout");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryPriority() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setPriority("cs");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryReportingEntityId() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setReportingEntityId("112");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryReportingEntityName() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setReportingEntityName("asfs");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void querySequence() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setSequence("cgg");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void querySourceId() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setSourceId("123");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void querySourceName() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setSourceName("eggs");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void querySpecificProblem() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setSpecificProblem("especially");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryStartEpochMicrosec() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setStartEpochMicrosec("wallet");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryVersion() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setVersion("va2");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryVfStatus() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setVfStatus("1");
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryCreateTime() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setCreateTime(DateUtils.now());
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
- @Test
- public void queryUpdateTime() throws ParseException {
- AlarmsHeader a=new AlarmsHeader();
- a.setUpdateTime(DateUtils.now());
- System.out.println(alarmsHeaderService.queryAlarmsHeader(a,1,100).getList().size());
- }
-
-}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java
deleted file mode 100644
index 4fb9a387..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2017 CMCC, Inc. and others. 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.server.service;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.usecaseui.server.bean.AlarmsInformation;
-import org.onap.usecaseui.server.util.DateUtils;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-import java.util.Map;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class AlarmsInformationServiceTest {
-
-
- @Resource(name = "AlarmsInformationService")
- AlarmsInformationService alarmsInformationService;
-
- @Test
- public void save() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setEventId("1119");
- a.setName("efw");
- a.setValue("fre");
- a.setCreateTime(DateUtils.now());
- a.setUpdateTime(DateUtils.now());
- System.out.println(alarmsInformationService.saveAlarmsInformation(a));
- }
-
- @Test
- public void update() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setEventId("110");
- a.setName("1");
- a.setValue("fko");
- a.setUpdateTime(DateUtils.now());
- a.setCreateTime(DateUtils.now());
- System.out.println(alarmsInformationService.updateAlarmsInformation(a));
- }
-
- @Test
- public void update1() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setEventId("110");
- a.setValue("fko");
- System.out.println(alarmsInformationService.updateAlarmsInformation(a));
- }
-
- @Test
- public void get() throws ParseException {
- alarmsInformationService.queryId(new String[]{"110"}).forEach(ai -> System.out.println(ai));
- }
-
- @Test
- public void queryEventId() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setEventId("110");
- alarmsInformationService.queryAlarmsInformation(a,1,100)
- .getList().forEach( al -> System.out.println(al.getEventId()));
- }
- @Test
- public void queryName() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setName("efw");
- alarmsInformationService.queryAlarmsInformation(a,1,100)
- .getList().forEach( al -> System.out.println(al.getEventId()));
- }
- @Test
- public void queryValue() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setValue("fko");
- alarmsInformationService.queryAlarmsInformation(a,1,100)
- .getList().forEach( al -> System.out.println(al.getEventId()));
- }
-
- @Test
- public void queryCreateTime() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setCreateTime(DateUtils.now());
- alarmsInformationService.queryAlarmsInformation(a,1,100)
- .getList().forEach( al -> System.out.println(al.getEventId()));
- }
- @Test
- public void queryUpdateTime() throws ParseException {
- AlarmsInformation a = new AlarmsInformation();
- a.setUpdateTime(DateUtils.now());
- alarmsInformationService.queryAlarmsInformation(a,1,100)
- .getList().forEach( al -> System.out.println(al.getEventId()));
- }
-
- @Test
- public void queryData() throws ParseException {
- alarmsInformationService.queryDateBetween("MME40","","").forEach( in -> {
- System.out.println(in);
- });
- }
-}
-
-
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java
deleted file mode 100644
index bd4283d2..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2017 CMCC, Inc. and others. 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.server.service;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.usecaseui.server.bean.PerformanceHeader;
-import org.onap.usecaseui.server.util.DateUtils;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class PerformanceHeaderServiceTest {
-
-
- @Resource(name = "PerformanceHeaderService")
- PerformanceHeaderService performanceHeaderService;
-
- @Test
- public void save() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setCreateTime(DateUtils.now());
- p.setEventId("2202");
- p.setEventName("fxc");
- p.setDomain("asb");
- p.setCreateTime(DateUtils.now());
- p.setEventType("q");
- p.setLastEpochMicroSec("csa");
- p.setNfcNamingCode("std");
- p.setNfNamingCode("cout");
- p.setPriority("cs");
- p.setReportingEntityId("112");
- p.setReportingEntityName("asfs");
- p.setSequence("cgg");
- p.setSourceId("123");
- p.setSourceName("eggs");
- p.setStartEpochMicrosec("wallet");
- p.setUpdateTime(DateUtils.now());
- p.setVersion("va2");
- p.setMeasurementInterval("12");
- p.setMeasurementsForVfScalingVersion("12");
-
- System.out.println(performanceHeaderService.savePerformanceHeader(p));
- }
-
- @Test
- public void update() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setCreateTime(DateUtils.now());
- p.setEventId("110");
- p.setEventName("fxc");
- p.setDomain("asb");
- p.setCreateTime(DateUtils.now());
- p.setEventType("q");
- p.setLastEpochMicroSec("csa");
- p.setNfcNamingCode("std");
- p.setNfNamingCode("cout");
- p.setPriority("cs");
- p.setReportingEntityId("112");
- p.setReportingEntityName("asfs");
- p.setSequence("cgg");
- p.setSourceId("123");
- p.setSourceName("eggs");
- p.setStartEpochMicrosec("wallet");
- p.setUpdateTime(DateUtils.now());
- p.setVersion("va2");
- p.setMeasurementInterval("12");
- p.setMeasurementsForVfScalingVersion("12");
- System.out.println(performanceHeaderService.updatePerformanceHeader(p));
- }
-
- @Test
- public void update1() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setCreateTime(DateUtils.now());
- p.setEventId("110");
- p.setEventName("fxc");
- p.setDomain("asb");
- p.setCreateTime(DateUtils.now());
- p.setEventType("q");
- p.setLastEpochMicroSec("csa");
- p.setNfcNamingCode("std");
- p.setNfNamingCode("cout");
- p.setPriority("cs");
- p.setReportingEntityId("112");
- p.setMeasurementsForVfScalingVersion("12");
- System.out.println(performanceHeaderService.updatePerformanceHeader(p));
- }
-
-
- @Test
- public void get() throws ParseException {
- performanceHeaderService.queryId(new String[]{"110"})
- .forEach(pe -> System.out.println(pe.getCreateTime()));
- }
-
- @Test
- public void queryEventId() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setEventId("110");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryEventName() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setEventName("fxc");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryDomain() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setDomain("asb");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryEventType() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setEventType("q");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryLastEpochMicroSec() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setLastEpochMicroSec("csa");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryNfcNamingCode() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setNfcNamingCode("std");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryNfNamingCode() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setNfNamingCode("cout");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryPriority() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setPriority("cs");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryReportingEntityId() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setReportingEntityId("112");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryReportingEntityName() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setReportingEntityName("asfs");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void querySequence() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setSequence("cgg");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void querySourceId() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setSourceId("123");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void querySourceName() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setSourceName("eggs");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryStartEpochMicrosec() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setStartEpochMicrosec("wallet");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryVersion() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setVersion("va2");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryMeasurementInterval() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setMeasurementInterval("12");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
- @Test
- public void queryMeasurementsForVfScalingVersion() throws ParseException {
- PerformanceHeader p = new PerformanceHeader();
- p.setMeasurementsForVfScalingVersion("12");
- performanceHeaderService.queryPerformanceHeader(p,1,100)
- .getList().forEach(per -> System.out.println(per));
- }
-
- @Test
- public void queryAllSourceId(){
- performanceHeaderService.queryAllSourceId().forEach( a-> System.out.println(a) );
- }
-
-}
-
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java
deleted file mode 100644
index 1a8522ad..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2017 CMCC, Inc. and others. 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.server.service;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.usecaseui.server.bean.PerformanceInformation;
-import org.onap.usecaseui.server.util.DateUtils;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-import java.util.List;
-import java.util.Random;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class PerformanceInformationServiceTest {
-
-
- @Resource(name = "PerformanceInformationService")
- PerformanceInformationService performanceInformationService;
-
- @Test
- public void save() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
-
- a.setEventId("123");
- a.setName("SGS.UeUnreachable");
- a.setValue("40");
- a.setCreateTime(DateUtils.now());
- a.setUpdateTime(DateUtils.now());
- System.out.println(performanceInformationService.savePerformanceInformation(a));
-
-
- }
-
- @Test
- public void update() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- a.setEventId("110");
- a.setName("efw");
- a.setValue("fko11");
- a.setUpdateTime(DateUtils.now());
- a.setCreateTime(DateUtils.now());
- System.out.println(performanceInformationService.updatePerformanceInformation(a));
- }
-
- @Test
- public void update1() throws ParseException {
- List<PerformanceInformation> as = performanceInformationService.queryId(new String[]{"2202"});
- as.forEach(a -> {
- try {
- a.setCreateTime(DateUtils.stringToDate(DateUtils.addDate(a.getCreateTime(), "day", 1)));
- } catch (ParseException e) {
- e.printStackTrace();
- }
- System.out.println(performanceInformationService.updatePerformanceInformation(a));
- });
- }
-
- @Test
- public void get() throws ParseException {
- performanceInformationService.queryId(new String[]{"2202"})
- .forEach(ai -> System.out.println(ai.getCreateTime()));
- }
-
- @Test
- public void queryEventId() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- // a.setEventId("2202");
- performanceInformationService.queryPerformanceInformation(a, 1, 100)
- .getList().forEach(al -> System.out.println(al.getValue()));
- }
-
- @Test
- public void queryName() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- a.setName("kl");
- performanceInformationService.queryPerformanceInformation(a, 1, 100)
- .getList().forEach(al -> System.out.println(al));
- }
-
- @Test
- public void queryValue() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- a.setValue("yue");
- performanceInformationService.queryPerformanceInformation(a, 1, 100)
- .getList().forEach(al -> System.out.println(al));
- }
-
- @Test
- public void queryUpdateTime() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- a.setUpdateTime(DateUtils.now());
- performanceInformationService.queryPerformanceInformation(a, 1, 100)
- .getList().forEach(al -> System.out.println(al));
- }
-
- @Test
- public void queryCreateTime() throws ParseException {
- PerformanceInformation a = new PerformanceInformation();
- a.setCreateTime(DateUtils.now());
- performanceInformationService.queryPerformanceInformation(a, 1, 100)
- .getList().forEach(al -> System.out.println(al));
- }
-
- @Test
- public void between() throws ParseException {
- performanceInformationService.queryDateBetween("2202", DateUtils.stringToDate("2017-10-15 01:00:00"), DateUtils.stringToDate("2017-10-15 02:00:00")).forEach(p -> System.out.println(p));
- }
-
- @Test
- public void sum() throws ParseException {
- System.out.println(performanceInformationService.queryDataBetweenSum("2202", "cpu", DateUtils.stringToDate("2017-10-18 09:00:00"), DateUtils.stringToDate("2017-10-18 10:00:00")));
- }
-}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
new file mode 100644
index 00000000..647dbaaa
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
@@ -0,0 +1,294 @@
+/**
+ * Copyright (C) 2017 CMCC, Inc. and others. 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.impl;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.server.UsecaseuiServerApplication;
+import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.service.impl.AlarmsHeaderServiceImpl;
+import org.onap.usecaseui.server.util.DateUtils;
+import org.onap.usecaseui.server.util.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.io.*;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+/**
+* AlarmsHeaderServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre>8, 2018</pre>
+* @version 1.0
+*/
+public class AlarmsHeaderServiceImplTest {
+ AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = null;
+ private static final long serialVersionUID = 1L;
+
+ @Before
+ public void before() throws Exception {
+ alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl();
+
+ MockUp<Transaction> mockUpTransaction = new MockUp<Transaction>() {
+ @Mock
+ public void commit() {
+ }
+ };
+ MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ };
+ new MockUp<Query>() {
+ @Mock
+ public Query setString(String name, String value) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public Query setDate(String name, Date value) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public Query setInteger(String name, int value) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public int executeUpdate() {
+ return 0;
+ }
+ @Mock
+ public Query setMaxResults(int value) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public Query setFirstResult(int firstResult) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public Query setParameterList(String name, Object[] values) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public List<AlarmsHeader> list() {
+ AlarmsHeader ah = new AlarmsHeader();
+ return Arrays.asList(ah);
+ }
+ @Mock
+ public Object uniqueResult() {
+ return "0";
+ }
+ };
+ MockUp<Session> mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String sql) {
+ return mockUpQuery.getMockInstance();
+ }
+ @Mock
+ public Transaction beginTransaction() {
+ return mockUpTransaction.getMockInstance();
+ }
+ @Mock
+ public Transaction getTransaction() {
+ return mockUpTransaction.getMockInstance();
+ }
+ @Mock
+ public Serializable save(Object object) {
+ return (Serializable) serialVersionUID;
+ }
+ @Mock
+ public void flush() {
+ }
+ @Mock
+ public void update(Object object) {
+ }
+ };
+ new MockUp<SessionFactory>() {
+ @Mock
+ public Session openSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSaveAlarmsHeader() throws Exception {
+ AlarmsHeader ah = null;
+ alarmsHeaderServiceImpl.saveAlarmsHeader(ah);
+ }
+
+ @Test
+ public void testUpdateAlarmsHeader() throws Exception {
+ AlarmsHeader ah = null;
+ alarmsHeaderServiceImpl.updateAlarmsHeader(ah);
+ }
+
+ @Test
+ public void testGetAllCount() throws Exception {
+ new MockUp<Query>() {
+ @Mock
+ public Object uniqueResult() {
+ return "1";
+ }
+ };
+ AlarmsHeader ah = new AlarmsHeader();
+ ah.setVersion("va2");
+ ah.setEventName("a");
+ ah.setAlarmCondition("ea");
+ ah.setDomain("asb");
+ ah.setEventId("1119");
+ ah.setNfcNamingCode("std");
+ ah.setNfNamingCode("cout");
+ ah.setSourceId("123");
+ ah.setSourceName("eggs");
+ ah.setReportingEntityId("112");
+ ah.setReportingEntityName("asfs");
+ ah.setPriority("cs");
+ ah.setStartEpochMicrosec("wallet");
+ ah.setLastEpochMicroSec("csa");
+ ah.setSequence("cgg");
+ ah.setFaultFieldsVersion("v1");
+ ah.setEventServrity("s");
+ ah.setEventType("q");
+ ah.setEventCategory("s");
+ ah.setSpecificProblem("especially");
+ ah.setAlarmInterfaceA("cs");
+ ah.setStatus("1");
+ ah.setCreateTime(DateUtils.now());
+ ah.setUpdateTime(DateUtils.now());
+ ah.setVfStatus("1");
+ ah.setEventSourceType("q");
+ alarmsHeaderServiceImpl.getAllCount(ah, 1, 1);
+ }
+
+ @Test
+ public void testQueryAlarmsHeader() throws Exception {
+ AlarmsHeader ah = new AlarmsHeader();
+ ah.setVersion("va2");
+ ah.setEventName("a");
+ ah.setAlarmCondition("ea");
+ ah.setDomain("asb");
+ ah.setEventId("1119");
+ ah.setNfcNamingCode("std");
+ ah.setNfNamingCode("cout");
+ ah.setSourceId("123");
+ ah.setSourceName("eggs");
+ ah.setReportingEntityId("112");
+ ah.setReportingEntityName("asfs");
+ ah.setPriority("cs");
+ ah.setStartEpochMicrosec("wallet");
+ ah.setLastEpochMicroSec("csa");
+ ah.setSequence("cgg");
+ ah.setFaultFieldsVersion("v1");
+ ah.setEventServrity("s");
+ ah.setEventType("q");
+ ah.setEventCategory("s");
+ ah.setSpecificProblem("especially");
+ ah.setAlarmInterfaceA("cs");
+ ah.setStatus("1");
+ ah.setCreateTime(DateUtils.now());
+ ah.setUpdateTime(DateUtils.now());
+ ah.setVfStatus("1");
+ ah.setEventSourceType("q");
+ alarmsHeaderServiceImpl.queryAlarmsHeader(ah, 1, 1);
+ }
+
+ @Test
+ public void testQueryId() throws Exception {
+ String[] id = {"1", "2", "3"};
+ alarmsHeaderServiceImpl.queryId(id);
+ }
+
+ @Test(expected = Exception.class)
+ public void testSaveAlarmsHeaderException() {
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() throws Exception {
+ throw new Exception();
+ }
+ };
+ AlarmsHeader ah = new AlarmsHeader();
+ alarmsHeaderServiceImpl.saveAlarmsHeader(ah);
+ }
+
+ @Test(expected = Exception.class)
+ public void testUpdateAlarmsHeaderException() {
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() throws Exception {
+ throw new Exception();
+ }
+ };
+ AlarmsHeader ah = new AlarmsHeader();
+ alarmsHeaderServiceImpl.updateAlarmsHeader(ah);
+ }
+
+ @Test(expected = Exception.class)
+ public void testGetAllCountException() {
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() throws Exception {
+ throw new Exception();
+ }
+ };
+ AlarmsHeader ah = new AlarmsHeader();
+ alarmsHeaderServiceImpl.getAllCount(ah, 1, 1);
+ }
+
+ @Test(expected = Exception.class)
+ public void testQueryAlarmsHeaderException() {
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() throws Exception {
+ throw new Exception();
+ }
+ };
+ AlarmsHeader ah = new AlarmsHeader();
+ alarmsHeaderServiceImpl.queryAlarmsHeader(ah, 1, 1);
+ }
+
+ @Test(expected = Exception.class)
+ public void testQueryIdException() {
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() throws Exception {
+ throw new Exception();
+ }
+ };
+ String[] id = {"1", "2", "3"};
+ alarmsHeaderServiceImpl.queryId(id);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java
new file mode 100644
index 00000000..7362ac3f
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 CMCC, Inc. and others. 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.impl;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.server.UsecaseuiServerApplication;
+import org.onap.usecaseui.server.service.InitializationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import static org.mockito.Mockito.mock;
+
+/**
+* InitializationServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre>���� 15, 2018</pre>
+* @version 1.0
+*/
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = UsecaseuiServerApplication.class)
+@WebAppConfiguration
+public class InitializationServiceImplTest {
+
+ /* @Autowired
+ private InitializationService initializationService;*/
+
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: initialize()
+*
+*/
+@Test
+public void testInitialize() throws Exception {
+//TODO: Test goes here...
+ InitializationServiceImpl service = mock(InitializationServiceImpl.class);
+ service.initialize();
+}
+
+
+}