summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshentao <shentao@chinamobile.com>2018-03-19 17:58:26 +0800
committershentao <shentao@chinamobile.com>2018-03-19 17:58:33 +0800
commit8a00d8251ba80b684696effdcde5fa49b3df124c (patch)
tree50f8c41ee15e3462cf6af5542384d7e3e89dd560
parentb9ac826911f9c20d4da6c736409fb5e2a45e0d3f (diff)
improve code test coverage of usecase-ui server
Change-Id: Ia8e8602ef59801c56e5fdad217ad0e4ca00fde91 Issue-ID: USECASEUI-103 Signed-off-by: shentao <shentao@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java31
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java46
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java7
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java57
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java1
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java17
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java62
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java5
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java5
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java307
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java117
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java241
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java128
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java258
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java143
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java63
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java176
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java171
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/util/DateUtilsTest.java18
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/util/ResponseUtilTest.java54
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/util/RestfulServicesTest.java86
21 files changed, 1067 insertions, 926 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
index b0ed3ae3..c9ebcf78 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
@@ -74,6 +74,15 @@ public class AlarmsHeader implements Serializable{
@Column(name = "lastEpochMicroSec")
private String lastEpochMicroSec;
+
+
+
+ @Column(name = "startEpochMicrosecCleared")
+ private String startEpochMicrosecCleared;
+
+ @Column(name = "lastEpochMicroSecCleared")
+ private String lastEpochMicroSecCleared;
+
@Column(name = "sequence")
private String sequence;
@@ -111,6 +120,8 @@ public class AlarmsHeader implements Serializable{
@Column(name = "updateTime")
private Date updateTime;
+
+
public AlarmsHeader() {
}
@@ -120,7 +131,7 @@ public class AlarmsHeader implements Serializable{
- public AlarmsHeader(String version, String eventName, String domain, String eventId, String eventType, String nfcNamingCode, String nfNamingCode, String sourceId, String sourceName, String reportingEntityId, String reportingEntityName, String priority, String startEpochMicrosec, String lastEpochMicroSec, String sequence, String faultFieldsVersion, String eventServrity, String eventSourceType, String eventCategory, String alarmCondition, String specificProblem, String vfStatus, String alarmInterfaceA, String status, Date createTime, Date updateTime) {
+ public AlarmsHeader(String version, String eventName, String domain, String eventId, String eventType, String nfcNamingCode, String nfNamingCode, String sourceId, String sourceName, String reportingEntityId, String reportingEntityName, String priority, String startEpochMicrosec, String lastEpochMicroSec, String startEpochMicrosecCleared, String lastEpochMicroSecCleared, String sequence, String faultFieldsVersion, String eventServrity, String eventSourceType, String eventCategory, String alarmCondition, String specificProblem, String vfStatus, String alarmInterfaceA, String status, Date createTime, Date updateTime) {
this.version = version;
this.eventName = eventName;
this.domain = domain;
@@ -135,6 +146,8 @@ public class AlarmsHeader implements Serializable{
this.priority = priority;
this.startEpochMicrosec = startEpochMicrosec;
this.lastEpochMicroSec = lastEpochMicroSec;
+ this.startEpochMicrosecCleared = startEpochMicrosecCleared;
+ this.lastEpochMicroSecCleared = lastEpochMicroSecCleared;
this.sequence = sequence;
this.faultFieldsVersion = faultFieldsVersion;
this.eventServrity = eventServrity;
@@ -253,6 +266,22 @@ public class AlarmsHeader implements Serializable{
this.startEpochMicrosec = startEpochMicrosec;
}
+ public String getStartEpochMicrosecCleared() {
+ return startEpochMicrosecCleared;
+ }
+
+ public void setStartEpochMicrosecCleared(String startEpochMicrosecCleared) {
+ this.startEpochMicrosecCleared = startEpochMicrosecCleared;
+ }
+
+ public String getLastEpochMicroSecCleared() {
+ return lastEpochMicroSecCleared;
+ }
+
+ public void setLastEpochMicroSecCleared(String lastEpochMicroSecCleared) {
+ this.lastEpochMicroSecCleared = lastEpochMicroSecCleared;
+ }
+
public String getLastEpochMicroSec() {
return lastEpochMicroSec;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
index 2a4a562a..38a488e6 100755
--- a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
@@ -65,27 +65,6 @@ public class AlarmController {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-
-
- @RequestMapping("test")
- public String test(){
-
-
-/*
- SocketClient socketClient = new SocketClient();
-
- SocketServer socketServer = new SocketServer();
- socketServer.onServer();
- socketClient.onSocketClient();*/
-
- return null;
-
- }
-
-
-
-
-
@RequestMapping(value = {"/alarm/{currentPage}/{pageSize}",
"/alarm/{currentPage}/{pageSize}/{sourceId}/{sourceName}/{priority}/{startTime}/{endTime}/{vfStatus}"},
method = RequestMethod.GET, produces = "application/json")
@@ -151,9 +130,6 @@ public class AlarmController {
return omAlarm.writeValueAsString(map);
}
-
-
-
/*public String getAlarmData(@PathVariable(required = false) String sourceId, @PathVariable(required = false) String sourceName,
@PathVariable(required = false) String priority, @PathVariable(required = false) String startTime,
@PathVariable(required = false) String endTime, @PathVariable(required = false) String vfStatus,
@@ -250,7 +226,6 @@ public class AlarmController {
List<Map<String,Object>> networkServices = (List<Map<String, Object>>) getAllVNFS().get("networkServices");
List<Map<String,Object>> VNFS = (List<Map<String, Object>>) getAllVNFS().get("VNFS");
-
List<Map<String,Object>> children = new ArrayList<>();
networkServices.forEach( i -> {
Map<String,Object> childrenMap = new HashMap<>();
@@ -336,20 +311,16 @@ public class AlarmController {
return map;
}
-
public Map<String,Object> getAllVNFS() throws IOException {
String data="";
try {
String str=null;
BufferedReader br = new BufferedReader(new FileReader("/home/uui/resources/topologyD_data.json"));
- while ((str=br.readLine())!=null){
+ while ((str=br.readLine())!=null) {
data += str;
-
-
- }
+ }
br.close();
-
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e){
@@ -361,27 +332,22 @@ public class AlarmController {
for(int a=0;a<jsonArray.size();a++){
JSONObject jsonObject1 = jsonArray.getJSONObject(a);
String vnfName = jsonObject1.getString("vnfName");
- Boolean name = alarmsHeaderService.getStatusBySourceName(vnfName);
+
+ Boolean name = false;
+ name = alarmsHeaderService.getStatusBySourceName(vnfName);
jsonObject1.put("isAlarm",name);
System.out.print("vnfName===="+vnfName+"name====="+name);
-
-
}
String jsonS = jsonObject.toJSONString();
System.out.print("toJSONString===="+jsonS);
-
-
- // return jsonS;
-
Map<String,Object> map = omAlarm.readValue(jsonS, Map.class);
return map;
}
-
@RequestMapping(value = {"/alarm/sourceId"}, method = RequestMethod.GET)
public String getSourceId() throws JsonProcessingException {
List<String> sourceIds = new ArrayList<>();
@@ -423,7 +389,6 @@ public class AlarmController {
} catch (ParseException e) {
e.printStackTrace();
}
-
});
startTimeL += timeIteraPlusVal;
tmpEndTimeL += timeIteraPlusVal;
@@ -475,4 +440,5 @@ public class AlarmController {
return null;
}
+
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
index 8d488d1f..580fdfdf 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service;
+import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
@@ -28,9 +29,11 @@ public interface AlarmsHeaderService {
String updateAlarmsHeader(AlarmsHeader alarmsHeader);
- public String updateAlarmsHeader2018(String status, String date, String eventNameCleared,String eventName, String reportingEntityName,String specificProblem);
-
+ public String updateAlarmsHeader2018(String status, Timestamp date, String startEpochMicrosecCleared, String lastEpochMicroSecCleared, String eventName, String reportingEntityName, String specificProblem);
public Boolean getStatusBySourceName(String sourceName);
+ public AlarmsHeader getIdByStatusSourceName(String sourceName);
+
+
int getAllCount(AlarmsHeader alarmsHeader, int currentPage, int pageSize);
Page<AlarmsHeader> queryAlarmsHeader(AlarmsHeader alarmsHeader, int currentPage, int pageSize);
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 07ca2958..e21102ec 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
@@ -16,20 +16,16 @@
package org.onap.usecaseui.server.service.impl;
-import java.text.SimpleDateFormat;
+import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
-
import javax.transaction.Transactional;
-
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.onap.usecaseui.server.bean.AlarmsHeader;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
-import org.onap.usecaseui.server.util.DateUtils;
import org.onap.usecaseui.server.util.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,29 +65,26 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
}
@Override
- public String updateAlarmsHeader2018(String status, String date,String eventNameCleared,String eventName, String reportingEntityName,String specificProblem) {
+ public String updateAlarmsHeader2018(String status, Timestamp date, String startEpochMicrosecCleared, String lastEpochMicroSecCleared, String eventName, String reportingEntityName, String specificProblem) {
- try(Session session = sessionFactory.getCurrentSession();){
- //String sql = "update AlarmsInformation set status='"+status+"' where eventName='"+eventName+"'";
- //String sql = "update AlarmsInformation set status=:status where eventName=:eventName";
- //StringBuffer sql = new StringBuffer("update AlarmsInformation set status='"+status+"' where eventName='"+eventName+"'");
- /*if (null == alarmsInformation) {
- logger.error("alarmsInformation updateAlarmsInformation alarmsInformation is null!");
- }*/
- //logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}", alarmsInformation);
+ try(Session session = sessionFactory.openSession();){
logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}");
- //Transaction tx = session.beginTransaction();
session.beginTransaction();
- //session.update(alarmsInformation);
- //session.createSQLQuery(sql).setParameter("status",status).setParameter("eventName",eventName).executeUpdate();
- //session.createSQLQuery(sql).executeUpdate();
- //session.update(sql);
- //Query q=session.createQuery("update AlarmsHeader set status='"+status+"', eventName='"+eventNameCleared+"',updateTime='"+date+"' where eventName='"+eventName+"' and reportingEntityName='"+reportingEntityName+"' and specificProblem ='"+specificProblem+"' ");
- Query q=session.createQuery("update AlarmsHeader set status='"+status+"', updateTime='"+date+"' where eventName='"+eventName+"' and reportingEntityName='"+reportingEntityName+"' and specificProblem ='"+specificProblem+"' ");
+ Query q=session.createQuery("update AlarmsHeader set status=:status, updateTime=:date, startEpochMicrosecCleared=:startEpochMicrosecCleared ,lastEpochMicroSecCleared=:lastEpochMicroSecCleared where eventName=:eventName and reportingEntityName=:reportingEntityName and specificProblem =:specificProblem");
+
+ q.setString("status",status);
+ q.setDate("date",date);
+
+ q.setString("startEpochMicrosecCleared",startEpochMicrosecCleared);
+ q.setString("lastEpochMicroSecCleared",lastEpochMicroSecCleared);
+ q.setString("eventName",eventName);
+ q.setString("reportingEntityName",reportingEntityName);
+ q.setString("specificProblem",specificProblem);
+
+
q.executeUpdate();
session.getTransaction().commit();
- //tx.commit();
session.flush();
return "1";
} catch (Exception e) {
@@ -123,7 +116,25 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
logger.error("exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());
return false;
}
- //return null;
+ }
+
+
+ @Override
+ public AlarmsHeader getIdByStatusSourceName(String sourceName) {
+ AlarmsHeader s = new AlarmsHeader();
+ try(Session session = sessionFactory.openSession()){
+ logger.info("AlarmsInformationServiceImpl updateAlarmsInformation: alarmsInformation={}");
+ Query q=session.createQuery("from AlarmsHeader where sourceName='"+sourceName+"' and status='active' order by createTime desc");
+
+ q.setMaxResults(1);
+ s = (AlarmsHeader)q.uniqueResult();
+
+ session.flush();
+ return s;
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());
+ return s;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java b/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
index 6d5532a8..8c850795 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/CSVUtils.java
@@ -19,7 +19,6 @@ import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.csv.CSVRecord;
-import org.aspectj.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
index ee726c74..3b43202c 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
@@ -222,30 +222,21 @@ public class DmaapSubscriber implements Runnable {
ai.setUpdateTime(new Date());
});
- Long startEpochMicrosec_s = Long.parseLong(alarm_header.getStartEpochMicrosec());
- String date_get = new DateUtils().getYearMonthDayHourMinuteSecond(startEpochMicrosec_s);
- Timestamp timestamp = new Timestamp(startEpochMicrosec_s);
+ Long l = System.currentTimeMillis();
+ Timestamp date_get = new Timestamp(l);
if (alarm_header.getEventName().contains("Cleared")) {
alarm_header.setStatus("close");
logger.info("alarmCleared data header insert is starting......");
- alarmsHeaderService.updateAlarmsHeader2018("close",date_get,alarm_header.getEventName(),alarm_header.getEventName().replace("Cleared",""),alarm_header.getReportingEntityName(),alarm_header.getSpecificProblem());
+ alarmsHeaderService.updateAlarmsHeader2018("close",date_get,alarm_header.getStartEpochMicrosec(),alarm_header.getLastEpochMicroSec(),alarm_header.getEventName().replace("Cleared",""),alarm_header.getReportingEntityName(),alarm_header.getSpecificProblem());
logger.info("alarmCleared data header insert has finished.");
logger.info("alarmCleared data detail insert is starting......");
alarm_informations.forEach(information ->
alarmsInformationService.saveAlarmsInformation(information));
logger.info("alarmCleared data detail insert has finished. " + alarm_informations.size() + " records have been inserted.");
- AlarmsHeader header1 = new AlarmsHeader();
- header1.setEventName(alarm_header.getEventName().substring(0, alarm_header.getEventName().indexOf("Cleared")));
- List<AlarmsHeader> alarmsHeaders = alarmsHeaderService.queryAlarmsHeader(header1, 1, 10).getList();
- alarmsHeaders.forEach(alarms -> {
- alarms.setStatus("2");
- alarms.setUpdateTime(alarm_header.getCreateTime());
- alarmsHeaderService.updateAlarmsHeader(alarms);
- });
} else {
- alarm_header.setCreateTime(timestamp);
+ alarm_header.setCreateTime(new Date());
alarm_header.setStatus("active");
logger.info("alarm data header insert is starting......");
alarmsHeaderService.saveAlarmsHeader(alarm_header);
diff --git a/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java b/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
index 8cc6d17f..f130ef98 100644
--- a/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
+++ b/server/src/test/java/org/onap/usecaseui/server/UsecaseuiServerApplicationTests.java
@@ -19,14 +19,15 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.usecaseui.server.util.DateUtils;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.io.IOException;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,31 +35,36 @@ import java.util.Map;
@SpringBootTest
public class UsecaseuiServerApplicationTests {
-
-
-
@Test
- public void contextLoads() throws IOException, ParseException {
- /*ObjectMapper objectMapper = new ObjectMapper();
- AlarmsHeader alarmsHeader = new AlarmsHeader();
- alarmsHeader.setAlarmCondition("send to my phone");
- alarmsHeader.setAlarmInterfaceA("Baby have no fear");
- alarmsHeader.setCreateTime(new Date());
- alarmsHeader.setDomain("Hope they ready");
- List<AlarmsHeader> alarmsHeaders = new ArrayList<>();
- alarmsHeaders.add(alarmsHeader);
- alarmsHeaders.add(alarmsHeader);
- alarmsHeaders.add(alarmsHeader);
- Map<String,Object> map = new HashMap<>();
- map.put("alarms",alarmsHeaders);
- map.put("asd",alarmsHeader);
- String jsonStr = objectMapper.writeValueAsString(map);
- System.out.println(jsonStr);*/
- //System.out.println(alarmsInformationService.saveAlarmsInformation(new AlarmsInformation("11","22","123",new Date(),new Date())));
- long interval = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-11-18 11:00").getTime() - new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-11-18 12:00").getTime();
- long hour = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-11-18 11:00").getTime() - (1000 * 60 * 15);
- System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(hour)));
- //System.out.println(ss.replaceAll("\"\\{\"","{\""));
+ public void contextLoads() {
+ String data = "";
+ try {
+ BufferedReader br = new BufferedReader(new FileReader("src/main/resources/topologyD_data.json"));
+ String tmpStr = "";
+ while ((tmpStr=br.readLine()) != null){
+ data += tmpStr;
+ }
+ br.close();
+ //System.out.println(data);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ ObjectMapper om = new ObjectMapper();
+ try {
+ Map<String,Object> map = om.readValue(data, Map.class);
+ List<Map<String,Object>> list = (List<Map<String, Object>>) map.get("services");
+ list.forEach( i -> {
+ i.forEach( (k,v) ->{
+ System.out.println(k+"_"+v);
+ } );
+ });
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- }
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
index 5148ac43..df243c8b 100755
--- a/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/AlarmControllerTest.java
@@ -68,6 +68,11 @@ public class AlarmControllerTest {
.accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print());
+ mvc.perform(MockMvcRequestBuilders.get("/alarm/1/100/502fe15c-aa07-ed26-3f87-4d5c1784bc5b/management-server-backup/High/123/456/1")
+ .contentType(MediaType.APPLICATION_JSON_UTF8)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(MockMvcResultMatchers.status().isOk())
+ .andDo(MockMvcResultHandlers.print());
}
@Test
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
index f6649327..21b1aeb7 100755
--- a/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
@@ -67,6 +67,11 @@ public class PerformanceControllerTest {
.accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print());
+ mvc.perform(MockMvcRequestBuilders.get("/performance/1/100/1101ZTHX1MMEGJM1W1/1101ZTHX1MMEGJM1W1/Normal/123/456")
+ .contentType(MediaType.APPLICATION_JSON_UTF8)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(MockMvcResultMatchers.status().isOk())
+ .andDo(MockMvcResultHandlers.print());
}
@Test
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 100755
index 7e080d03..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
+++ /dev/null
@@ -1,307 +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 static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.usecaseui.server.UsecaseuiServerApplication;
-import org.onap.usecaseui.server.bean.AlarmsHeader;
-import org.onap.usecaseui.server.util.DateUtils;
-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.junit4.SpringRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = UsecaseuiServerApplication.class)
-@WebAppConfiguration
-public class AlarmsHeaderServiceTest {
-
- @Autowired
- 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 100755
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 100755
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 100755
index 5d8d52b4..00000000
--- a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java
+++ /dev/null
@@ -1,128 +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));
- }
-
-
-}
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..da690f4a
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
@@ -0,0 +1,258 @@
+/*
+ * 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.AlarmsHeaderService;
+import org.onap.usecaseui.server.util.DateUtils;
+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.Date;
+
+/**
+* AlarmsHeaderServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre>8, 2018</pre>
+* @version 1.0
+*/
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = UsecaseuiServerApplication.class)
+@WebAppConfiguration
+public class AlarmsHeaderServiceImplTest {
+ @Autowired
+ private AlarmsHeaderService alarmsHeaderService;
+
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: saveAlarmsHeader(AlarmsHeader alarmsHeader)
+*
+*/
+@Test
+public void testSaveAlarmsHeader() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: updateAlarmsHeader2018(String status, String date, String eventNameCleared, String eventName, String reportingEntityName, String specificProblem)
+*
+*/
+@Test
+public void testUpdateAlarmsHeader2018() throws Exception {
+//TODO: Test goes here...
+ //Date date = new Date();
+ // Date date = new Date("2018-02-28 15:25:39");
+ //Date date = new Date();
+ //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // String date_gets = dateFormat.format( new Date() );
+ //Date date_get = new Date();
+ //Date date_get = dateFormat.parse(date_gets);
+ Long l = System.currentTimeMillis();
+
+ Timestamp date_get = new Timestamp(l); //2013-01-14 22:45:36.484
+ alarmsHeaderService.updateAlarmsHeader2018("active",date_get,"112","112","Fault_MultiCloud_VMFailureCleared","Multi-Cloud","Fault_MultiCloud_VMFailure");
+
+
+}
+
+/**
+*
+* Method: getStatusBySourceName(String sourceName)
+*
+*/
+@Test
+public void testGetStatusBySourceName() throws Exception {
+//TODO: Test goes here...
+ Boolean bl = alarmsHeaderService.getStatusBySourceName("vnf_a_3");
+ System.out.println("boolean="+bl);
+}
+
+/**
+*
+* Method: getIdByStatusSourceName(String sourceName)
+*
+*/
+@Test
+public void testGetIdByStatusSourceName() throws Exception {
+//TODO: Test goes here...
+ alarmsHeaderService.getIdByStatusSourceName("vnf_a_3");
+}
+
+/**
+*
+* Method: updateAlarmsHeader(AlarmsHeader alarmsHeader)
+*
+*/
+@Test
+public void testUpdateAlarmsHeader() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: getAllCount(AlarmsHeader alarmsHeader, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testGetAllCount() throws Exception {
+//TODO: Test goes here...
+ AlarmsHeader alarmsHeader = new AlarmsHeader();
+ alarmsHeader.setSourceName("vnf_a_3");
+ alarmsHeader.setEventName("Fault_MultiCloud_VMFailureCleared");
+ alarmsHeader.setEventId("ab305d54-85b4-a31b-7db2-fb6b9e546015");
+ alarmsHeader.setSourceId("shentao-test-3004");
+ alarmsHeader.setLastEpochMicroSec("1516784364860");
+ alarmsHeader.setStartEpochMicrosec("1516784364860");
+ alarmsHeader.setEventType("");
+ alarmsHeader.setStatus("active");
+ /*Date dateC = new Date("2018-01-25 15:00:40");
+ Date dateE = new Date("2018-01-26 16:59:24");
+ alarmsHeader.setCreateTime(dateC);
+ alarmsHeader.setUpdateTime(dateE);*/
+
+
+ alarmsHeaderService.getAllCount(alarmsHeader,0,12);
+}
+
+/**
+*
+* Method: queryAlarmsHeader(AlarmsHeader alarmsHeader, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testQueryAlarmsHeader() throws Exception {
+//TODO: Test goes here...
+
+ AlarmsHeader alarmsHeader=new AlarmsHeader();
+ alarmsHeader.setEventId("110");
+ alarmsHeader.setEventName("asdasds");
+ alarmsHeader.setSourceName("vnf_a_3");
+ alarmsHeader.setEventName("Fault_MultiCloud_VMFailureCleared");
+ alarmsHeader.setEventId("ab305d54-85b4-a31b-7db2-fb6b9e546015");
+ alarmsHeader.setSourceId("shentao-test-3004");
+ alarmsHeader.setLastEpochMicroSec("1516784364860");
+ alarmsHeader.setStartEpochMicrosec("1516784364860");
+ alarmsHeader.setEventType("");
+ alarmsHeader.setStatus("active");
+ /* Date dateC = new Date("2018-01-25 15:00:40");
+ Date dateE = new Date("2018-01-26 16:59:24");
+ alarmsHeader.setCreateTime(dateC);
+ alarmsHeader.setUpdateTime(dateE);*/
+ //System.out.println(alarmsHeaderService.queryAlarmsHeader(alarmsHeader,1,100).getList().size());
+ alarmsHeaderService.queryAlarmsHeader(alarmsHeader,1,100).getList().forEach( as->System.out.println(as.toString()));
+
+}
+
+/**
+*
+* Method: queryId(String[] id)
+*
+*/
+@Test
+public void testQueryId() throws Exception {
+//TODO: Test goes here...
+ alarmsHeaderService.queryId(new String[]{"1101"}).forEach( a -> System.out.println(a));
+}
+
+/**
+*
+* Method: queryStatusCount(String status)
+*
+*/
+@Test
+public void testQueryStatusCount() throws Exception {
+//TODO: Test goes here...
+ String str =alarmsHeaderService.queryStatusCount("close");
+ System.out.println("str ="+str);
+}
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java
new file mode 100644
index 00000000..e3cf50ff
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImplTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.AlarmsInformation;
+import org.onap.usecaseui.server.service.AlarmsInformationService;
+import org.onap.usecaseui.server.util.DateUtils;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import javax.annotation.Resource;
+
+/**
+* AlarmsInformationServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre> 8, 2018</pre>
+* @version 1.0
+*/
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = UsecaseuiServerApplication.class)
+@WebAppConfiguration
+public class AlarmsInformationServiceImplTest {
+
+ @Resource(name = "AlarmsInformationService")
+ AlarmsInformationService alarmsInformationService;
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: saveAlarmsInformation(AlarmsInformation alarmsInformation)
+*
+*/
+@Test
+public void testSaveAlarmsInformation() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: updateAlarmsInformation(AlarmsInformation alarmsInformation)
+*
+*/
+@Test
+public void testUpdateAlarmsInformation() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: getAllCount(AlarmsInformation alarmsInformation, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testGetAllCount() throws Exception {
+//TODO: Test goes here...
+ AlarmsInformation larmsInformation = new AlarmsInformation();
+ larmsInformation.setName("vnf_a_3");
+
+
+ alarmsInformationService.getAllCount(larmsInformation,0,12);
+}
+
+/**
+*
+* Method: queryAlarmsInformation(AlarmsInformation alarmsInformation, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testQueryAlarmsInformation() throws Exception {
+//TODO: Test goes here...
+ AlarmsInformation a = new AlarmsInformation();
+ a.setEventId("110");
+ alarmsInformationService.queryAlarmsInformation(a,1,100)
+ .getList().forEach( al -> System.out.println(al.getEventId()));
+}
+
+/**
+*
+* Method: queryId(String[] id)
+*
+*/
+@Test
+public void testQueryId() throws Exception {
+//TODO: Test goes here...
+ alarmsInformationService.queryId(new String[]{"110"}).forEach(ai -> System.out.println(ai));
+}
+
+/**
+*
+* Method: queryDateBetween(String sourceId, String startTime, String endTime)
+*
+*/
+@Test
+public void testQueryDateBetween() throws Exception {
+//TODO: Test goes here...
+ alarmsInformationService.queryDateBetween("MME40","","").forEach( in -> {
+ // System.out.println(in);
+ });
+}
+
+
+}
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..f243e07a
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/InitializationServiceImplTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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;
+
+/**
+* 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...
+ initializationService.initialize();
+}
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java
new file mode 100644
index 00000000..68a27361
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImplTest.java
@@ -0,0 +1,176 @@
+/*
+ * 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.PerformanceHeader;
+import org.onap.usecaseui.server.service.PerformanceHeaderService;
+import org.onap.usecaseui.server.util.DateUtils;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import javax.annotation.Resource;
+
+/**
+* PerformanceHeaderServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre> 8, 2018</pre>
+* @version 1.0
+*/
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = UsecaseuiServerApplication.class)
+@WebAppConfiguration
+public class PerformanceHeaderServiceImplTest {
+ @Resource(name = "PerformanceHeaderService")
+ PerformanceHeaderService performanceHeaderService;
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: savePerformanceHeader(PerformanceHeader performanceHeder)
+*
+*/
+@Test
+public void testSavePerformanceHeader() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: updatePerformanceHeader(PerformanceHeader performanceHeder)
+*
+*/
+@Test
+public void testUpdatePerformanceHeader() throws Exception {
+//TODO: Test goes here...
+ 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));
+}
+
+/**
+*
+* Method: getAllCount(PerformanceHeader performanceHeder, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testGetAllCount() throws Exception {
+//TODO: Test goes here...
+
+ PerformanceHeader performanceHeader = new PerformanceHeader();
+ performanceHeader.setSourceName("vnf_a_3");
+
+
+ performanceHeaderService.getAllCount(performanceHeader,0,12);
+
+}
+
+/**
+*
+* Method: queryPerformanceHeader(PerformanceHeader performanceHeder, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testQueryPerformanceHeader() throws Exception {
+//TODO: Test goes here...
+ PerformanceHeader p = new PerformanceHeader();
+ p.setEventId("110");
+ performanceHeaderService.queryPerformanceHeader(p,1,100)
+ .getList().forEach(per -> System.out.println(per));
+}
+
+/**
+*
+* Method: queryId(String[] id)
+*
+*/
+@Test
+public void testQueryId() throws Exception {
+//TODO: Test goes here...
+ performanceHeaderService.queryId(new String[]{"110"})
+ .forEach(pe -> System.out.println(pe.getCreateTime()));
+}
+
+/**
+*
+* Method: queryAllSourceId()
+*
+*/
+@Test
+public void testQueryAllSourceId() throws Exception {
+//TODO: Test goes here...
+ PerformanceHeader p = new PerformanceHeader();
+ p.setSourceId("123");
+ performanceHeaderService.queryPerformanceHeader(p,1,100)
+ .getList().forEach(per -> System.out.println(per));
+}
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java
new file mode 100644
index 00000000..e6540fcf
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImplTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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.PerformanceInformation;
+import org.onap.usecaseui.server.service.PerformanceInformationService;
+import org.onap.usecaseui.server.util.DateUtils;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+/**
+* PerformanceInformationServiceImpl Tester.
+*
+* @author <Authors name>
+* @since <pre> 8, 2018</pre>
+* @version 1.0
+*/
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = UsecaseuiServerApplication.class)
+@WebAppConfiguration
+public class PerformanceInformationServiceImplTest {
+ @Resource(name = "PerformanceInformationService")
+ PerformanceInformationService performanceInformationService;
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: savePerformanceInformation(PerformanceInformation performanceInformation)
+*
+*/
+@Test
+public void testSavePerformanceInformation() throws Exception {
+//TODO: Test goes here...
+
+ 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));
+
+}
+
+/**
+*
+* Method: updatePerformanceInformation(PerformanceInformation performanceInformation)
+*
+*/
+@Test
+public void testUpdatePerformanceInformation() throws Exception {
+//TODO: Test goes here...
+
+ 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));
+}
+
+/**
+*
+* Method: getAllCount(PerformanceInformation performanceInformation, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testGetAllCount() throws Exception {
+//TODO: Test goes here...
+
+ PerformanceInformation performanceInformation = new PerformanceInformation();
+ performanceInformation.setName("vnf_a_3");
+
+
+ performanceInformationService.getAllCount(performanceInformation,0,12);
+
+}
+
+/**
+*
+* Method: queryPerformanceInformation(PerformanceInformation performanceInformation, int currentPage, int pageSize)
+*
+*/
+@Test
+public void testQueryPerformanceInformation() throws Exception {
+//TODO: Test goes here...
+ PerformanceInformation a = new PerformanceInformation();
+ // a.setEventId("2202");
+ performanceInformationService.queryPerformanceInformation(a, 1, 100)
+ .getList().forEach(al -> System.out.println(al.getValue()));
+}
+
+/**
+*
+* Method: queryId(String[] id)
+*
+*/
+@Test
+public void testQueryId() throws Exception {
+//TODO: Test goes here...
+ performanceInformationService.queryId(new String[]{"2202"})
+ .forEach(ai -> System.out.println(ai.getCreateTime()));
+}
+
+/**
+*
+* Method: queryDateBetween(String eventId, Date startDate, Date endDate)
+*
+*/
+@Test
+public void testQueryDateBetweenForEventIdStartDateEndDate() throws Exception {
+//TODO: Test goes here...
+ performanceInformationService.queryDateBetween("1101ZTHX1MMEGJM1W1",new Date("2017-11-15 06:30:00"),new Date("2017-11-15 14:45:10"));
+}
+
+/**
+*
+* Method: queryDateBetween(String resourceId, String name, String startTime, String endTime)
+*
+*/
+@Test
+public void testQueryDateBetweenForResourceIdNameStartTimeEndTime() throws Exception {
+//TODO: Test goes here...
+ performanceInformationService.queryDateBetween("1101ZTHX1MMEGJM1W1",new Date("2017-11-15 06:30:00"),new Date("2017-11-15 14:45:10"));
+
+}
+
+/**
+*
+* Method: queryMaxValueByBetweenDate(String sourceId, String name, String startTime, String endTime)
+*
+*/
+@Test
+public void testQueryMaxValueByBetweenDate() throws Exception {
+//TODO: Test goes here...
+ 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));
+
+}
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/util/DateUtilsTest.java b/server/src/test/java/org/onap/usecaseui/server/util/DateUtilsTest.java
index 3c3ff813..a7aba26f 100755
--- a/server/src/test/java/org/onap/usecaseui/server/util/DateUtilsTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/util/DateUtilsTest.java
@@ -20,11 +20,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.usecaseui.server.constant.Constant;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
@@ -56,6 +52,14 @@ public class DateUtilsTest {
}
@Test
+ public void testGetYearMonthDayHourMinuteSecond(){
+ DateUtils dateUtils = new DateUtils();
+ String str = dateUtils.getYearMonthDayHourMinuteSecond(System.currentTimeMillis());
+
+
+ }
+
+ @Test
public void addDate() throws ParseException {
Assert.assertNotNull(DateUtils.addDate(new Date(),"year",1));
Assert.assertNotNull(DateUtils.addDate(new Date(),"month",1));
@@ -66,8 +70,4 @@ public class DateUtilsTest {
Assert.assertNotNull(DateUtils.addDate(new Date(),"hour",24));
Assert.assertNotNull(DateUtils.addDate(new Date(),"minute",1));
}
-
-
-
-
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/util/ResponseUtilTest.java b/server/src/test/java/org/onap/usecaseui/server/util/ResponseUtilTest.java
new file mode 100644
index 00000000..00374903
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/util/ResponseUtilTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.util;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* ResponseUtil Tester.
+*
+* @author <Authors name>
+* @since <pre>���� 14, 2018</pre>
+* @version 1.0
+*/
+public class ResponseUtilTest {
+
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: responseDownload(String filePath, HttpServletResponse response)
+*
+*/
+@Test
+public void testResponseDownload() throws Exception {
+//TODO: Test goes here...
+ HttpServletResponse httpServletResponse = null;
+ ResponseUtil.responseDownload("D:/topology.csv", httpServletResponse);
+}
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/util/RestfulServicesTest.java b/server/src/test/java/org/onap/usecaseui/server/util/RestfulServicesTest.java
index d229c275..7946d69f 100644
--- a/server/src/test/java/org/onap/usecaseui/server/util/RestfulServicesTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/util/RestfulServicesTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2016-2017 ZTE Corporation.
+/*
+ * 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.
@@ -13,21 +13,75 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.usecaseui.server.util;
+package org.onap.usecaseui.server.util;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
-public class RestfulServicesTest {
- @Test
- public void testCreateServiceImpl() throws Exception {
- Object aaiService = createService(AAIService.class);
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
- Assert.assertTrue(aaiService instanceof AAIService);
- }
+/**
+* RestfulServices Tester.
+*
+* @author <Authors name>
+* @since <pre>���� 14, 2018</pre>
+* @version 1.0
+*/
+public class RestfulServicesTest {
- private <T> Object createService(Class<T> clazz) {
- return RestfulServices.create(clazz);
- }
-} \ No newline at end of file
+@Before
+public void before() throws Exception {
+}
+
+@After
+public void after() throws Exception {
+}
+
+/**
+*
+* Method: create(String baseUrl, Class<T> clazz)
+*
+*/
+@Test
+public void testCreateForBaseUrlClazz() throws Exception {
+//TODO: Test goes here...
+}
+
+/**
+*
+* Method: create(Class<T> clazz)
+*
+*/
+@Test
+public void testCreateClazz() throws Exception {
+//TODO: Test goes here...
+ RestfulServices.create(RestfulServicesTest.class);
+}
+
+/**
+*
+* Method: getMsbAddress()
+*
+*/
+@Test
+public void testGetMsbAddress() throws Exception {
+//TODO: Test goes here...
+ RestfulServices.getMsbAddress();
+}
+
+/**
+*
+* Method: extractBody(HttpServletRequest request)
+*
+*/
+@Test
+public void testExtractBody() throws Exception {
+//TODO: Test goes here...
+ HttpServletRequest request = null;
+ RestfulServices.extractBody(request);
+}
+
+
+}