aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshentao <shentao@chinamobile.com>2017-09-29 23:57:45 +0800
committershentao <shentao@chinamobile.com>2017-09-29 23:57:55 +0800
commit8722cf44b93cabe6b6568897f26fd493b2cc1c00 (patch)
tree4595c1ccfe24ff84160d48e53ccb8b79b2ea8a9e
parent9cb0aa38d2c59700b87b7b793899b98db8bcbce6 (diff)
Fix sonar coverage for usecase-ui
Change-Id: Id8f2d8ec9f516cfe7cd8c7c77cd1d3d274b0a0f4 Issue-Id: USECASEUI-47 Signed-off-by: shentao <shentao@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java10
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java10
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java10
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java10
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java10
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java26
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java10
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java21
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java9
9 files changed, 86 insertions, 30 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java b/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
index 5038c469..0f3f1e5e 100644
--- a/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
+++ b/server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
@@ -15,7 +15,6 @@
*/
package org.onap.usecaseui.server.listener;
-import org.onap.usecaseui.server.service.InitializationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,13 +25,10 @@ import org.springframework.context.ApplicationListener;
public class UsecaseServerEventListener implements ApplicationListener<ApplicationReadyEvent>
{
private static final Logger logger = LoggerFactory.getLogger(UsecaseServerEventListener.class);
-
- @Autowired
- InitializationService initializationService;
-
+
+
public void onApplicationEvent(ApplicationReadyEvent arg0)
{
- initializationService.initialize();
}
-
+
}
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 5aa0d18d..f4778b90 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
@@ -62,7 +62,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());
return "0";
}
@@ -84,7 +84,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());
return "0";
}
}
@@ -97,7 +97,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return (int)q;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());
return -1;
}
}
@@ -206,7 +206,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return page;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());
return null;
}
}
@@ -226,7 +226,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
session.close();
return list;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryId. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryId. Details:" + e.getMessage());
return null;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
index 64495a29..6ef1cf46 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
@@ -61,7 +61,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage());
return "0";
}
@@ -82,7 +82,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());
return "0";
}
}
@@ -96,7 +96,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return (int)q;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage());
return 0;
}
}
@@ -143,7 +143,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return page;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage());
return null;
}
}
@@ -162,7 +162,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
session.close();
return list;
} catch (Exception e) {
- logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryId. Details:" + e.getMessage());
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl queryId. Details:" + e.getMessage());
return null;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
index 9595e8c4..78205ec1 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
@@ -63,7 +63,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage());
return "0";
}
@@ -85,7 +85,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage());
return "0";
}
}
@@ -99,7 +99,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return (int)q;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage());
return 0;
}
}
@@ -188,7 +188,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return page;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage());
return null;
}
}
@@ -208,7 +208,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
session.close();
return list;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryId. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceHeaderServiceImpl queryId. Details:" + e.getMessage());
return null;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
index 749e0a2c..ecd697df 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
@@ -62,7 +62,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage());
return "0";
}
@@ -84,7 +84,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return "1";
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage());
return "0";
}
}
@@ -98,7 +98,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return (int)q;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage());
return 0;
}
}
@@ -145,7 +145,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return page;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage());
return null;
}
}
@@ -165,7 +165,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
session.close();
return list;
} catch (Exception e) {
- logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryId. Details:" + e.getMessage());
+ logger.error("exception occurred while performing PerformanceInformationServiceImpl queryId. Details:" + e.getMessage());
return null;
}
}
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
index 5c4ea8dc..f8f61b32 100755
--- a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
@@ -38,7 +38,7 @@ public class AlarmsHeaderServiceTest {
a.setEventName("a");
a.setStatus("1");
a.setVfStatus("1");
- a.setEventId("1101");
+ a.setEventId("11011");
a.setDomain("asb");
a.setEventCategory("s");
a.setAlarmCondition("ea");
@@ -64,6 +64,7 @@ public class AlarmsHeaderServiceTest {
System.out.println(alarmsHeaderService.saveAlarmsHeader(a));
}
+
@Test
public void update() throws ParseException {
AlarmsHeader a = new AlarmsHeader();
@@ -96,6 +97,29 @@ public class AlarmsHeaderServiceTest {
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(){
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
index 8f9d4f6b..ca6ba451 100755
--- a/server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java
@@ -36,7 +36,7 @@ public class AlarmsInformationServiceTest {
@Test
public void save() throws ParseException {
AlarmsInformation a = new AlarmsInformation();
- a.setEventId("110");
+ a.setEventId("111");
a.setName("efw");
a.setValue("fre");
a.setCreateTime(DateUtils.now());
@@ -56,6 +56,14 @@ public class AlarmsInformationServiceTest {
}
@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));
}
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
index c1f6a694..7d44315b 100755
--- a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java
@@ -38,7 +38,7 @@ public class PerformanceHeaderServiceTest {
public void save() throws ParseException {
PerformanceHeader p = new PerformanceHeader();
p.setCreateTime(DateUtils.now());
- p.setEventId("110");
+ p.setEventId("1101");
p.setEventName("fxc");
p.setDomain("asb");
p.setCreateTime(DateUtils.now());
@@ -88,6 +88,25 @@ public class PerformanceHeaderServiceTest {
}
@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));
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
index 66d66f4f..3c710e93 100755
--- a/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java
@@ -56,6 +56,15 @@ public class PerformanceInformationServiceTest {
}
@Test
+ public void update1() throws ParseException {
+ PerformanceInformation a = new PerformanceInformation();
+ a.setEventId("110");
+ a.setName("efw");
+ a.setValue("fko11");
+ System.out.println(performanceInformationService.updatePerformanceInformation(a));
+ }
+
+ @Test
public void get() throws ParseException {
performanceInformationService.queryId(new String[]{"110"})
.forEach(ai -> System.out.println(ai));