Fix sonar coverage for usecase-ui 51/16651/1
authorshentao <shentao@chinamobile.com>
Fri, 29 Sep 2017 15:57:45 +0000 (23:57 +0800)
committershentao <shentao@chinamobile.com>
Fri, 29 Sep 2017 15:57:55 +0000 (23:57 +0800)
Change-Id: Id8f2d8ec9f516cfe7cd8c7c77cd1d3d274b0a0f4
Issue-Id: USECASEUI-47
Signed-off-by: shentao <shentao@chinamobile.com>
server/src/main/java/org/onap/usecaseui/server/listener/UsecaseServerEventListener.java
server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceHeaderServiceImpl.java
server/src/main/java/org/onap/usecaseui/server/service/impl/PerformanceInformationServiceImpl.java
server/src/test/java/org/onap/usecaseui/server/service/AlarmsHeaderServiceTest.java
server/src/test/java/org/onap/usecaseui/server/service/AlarmsInformationServiceTest.java
server/src/test/java/org/onap/usecaseui/server/service/PerformanceHeaderServiceTest.java
server/src/test/java/org/onap/usecaseui/server/service/PerformanceInformationServiceTest.java

index 5038c46..0f3f1e5 100644 (file)
@@ -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();
     }
-    
+
 }
index 5aa0d18..f4778b9 100755 (executable)
@@ -62,7 +62,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
                    session.close();\r
                    return "1";\r
                } catch (Exception e) {\r
-                   logger.error("Exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());\r
+                   logger.error("exception occurred while performing AlarmsHeaderServiceImpl saveAlarmsHeader. Details:" + e.getMessage());\r
                    return "0";\r
                }\r
                \r
@@ -84,7 +84,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
             session.close();\r
             return "1";\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsHeaderServiceImpl updateAlarmsHeader. Details:" + e.getMessage());\r
             return "0";\r
         }\r
        }\r
@@ -97,7 +97,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
             session.close();\r
             return (int)q;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsHeaderServiceImpl getAllCount. Details:" + e.getMessage());\r
             return -1;\r
         }\r
        }\r
@@ -206,7 +206,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
             session.close();\r
             return page;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryAlarmsHeader. Details:" + e.getMessage());\r
             return null;\r
         }\r
        }\r
@@ -226,7 +226,7 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
                        session.close();\r
                        return list;\r
                } catch (Exception e) {\r
-                       logger.error("Exception occurred while performing AlarmsHeaderServiceImpl queryId. Details:" + e.getMessage());\r
+                       logger.error("exception occurred while performing AlarmsHeaderServiceImpl queryId. Details:" + e.getMessage());\r
                        return null;\r
                }\r
        }\r
index 64495a2..6ef1cf4 100755 (executable)
@@ -61,7 +61,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
                    session.close();\r
                    return "1";\r
                } catch (Exception e) {\r
-                   logger.error("Exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage());\r
+                   logger.error("exception occurred while performing AlarmsInformationServiceImpl saveAlarmsInformation. Details:" + e.getMessage());\r
                    return "0";\r
                }\r
                \r
@@ -82,7 +82,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
             session.close();\r
             return "1";\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsInformationServiceImpl updateAlarmsInformation. Details:" + e.getMessage());\r
             return "0";\r
         }\r
        }\r
@@ -96,7 +96,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
             session.close();\r
             return (int)q;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsInformationServiceImpl getAllCount. Details:" + e.getMessage());\r
             return 0;\r
         }\r
        }\r
@@ -143,7 +143,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
             session.close();\r
             return page;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing AlarmsInformationServiceImpl queryAlarmsInformation. Details:" + e.getMessage());\r
             return null;\r
         }\r
        }\r
@@ -162,7 +162,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
                        session.close();\r
                        return list;\r
                } catch (Exception e) {\r
-                       logger.error("Exception occurred while performing AlarmsInformationServiceImpl queryId. Details:" + e.getMessage());\r
+                       logger.error("exception occurred while performing AlarmsInformationServiceImpl queryId. Details:" + e.getMessage());\r
                        return null;\r
                }\r
        }\r
index 9595e8c..78205ec 100755 (executable)
@@ -63,7 +63,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
                    session.close();\r
                    return "1";\r
                } catch (Exception e) {\r
-                   logger.error("Exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage());\r
+                   logger.error("exception occurred while performing PerformanceHeaderServiceImpl savePerformanceHeader. Details:" + e.getMessage());\r
                    return "0";\r
                }\r
                \r
@@ -85,7 +85,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
             session.close();\r
             return "1";\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceHeaderServiceImpl updatePerformanceHeader. Details:" + e.getMessage());\r
             return "0";\r
         }\r
        }\r
@@ -99,7 +99,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
             session.close();\r
             return (int)q;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceHeaderServiceImpl getAllCount. Details:" + e.getMessage());\r
             return 0;\r
         }\r
        }\r
@@ -188,7 +188,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
             session.close();\r
             return page;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceHeaderServiceImpl queryPerformanceHeader. Details:" + e.getMessage());\r
             return null;\r
         }\r
        }\r
@@ -208,7 +208,7 @@ public class PerformanceHeaderServiceImpl implements PerformanceHeaderService {
             session.close();\r
                        return list;\r
                } catch (Exception e) {\r
-                       logger.error("Exception occurred while performing PerformanceHeaderServiceImpl queryId. Details:" + e.getMessage());\r
+                       logger.error("exception occurred while performing PerformanceHeaderServiceImpl queryId. Details:" + e.getMessage());\r
                        return null;\r
                }\r
        }\r
index 749e0a2..ecd697d 100755 (executable)
@@ -62,7 +62,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
                    session.close();\r
                    return "1";\r
                } catch (Exception e) {\r
-                   logger.error("Exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage());\r
+                   logger.error("exception occurred while performing PerformanceInformationServiceImpl savePerformanceInformation. Details:" + e.getMessage());\r
                    return "0";\r
                }\r
                \r
@@ -84,7 +84,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
             session.close();\r
             return "1";\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceInformationServiceImpl updatePerformanceInformation. Details:" + e.getMessage());\r
             return "0";\r
         }\r
        }\r
@@ -98,7 +98,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
             session.close();\r
             return (int)q;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceInformationServiceImpl getAllCount. Details:" + e.getMessage());\r
             return 0;\r
         }\r
        }\r
@@ -145,7 +145,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
             session.close();\r
             return page;\r
         } catch (Exception e) {\r
-            logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage());\r
+            logger.error("exception occurred while performing PerformanceInformationServiceImpl queryPerformanceInformation. Details:" + e.getMessage());\r
             return null;\r
         }\r
        }\r
@@ -165,7 +165,7 @@ public class PerformanceInformationServiceImpl implements PerformanceInformation
             session.close();\r
                        return list;\r
                } catch (Exception e) {\r
-                       logger.error("Exception occurred while performing PerformanceInformationServiceImpl queryId. Details:" + e.getMessage());\r
+                       logger.error("exception occurred while performing PerformanceInformationServiceImpl queryId. Details:" + e.getMessage());\r
                        return null;\r
                }\r
        }\r
index 5c4ea8d..f8f61b3 100755 (executable)
@@ -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(){
 
index 8f9d4f6..ca6ba45 100755 (executable)
@@ -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());
@@ -55,6 +55,14 @@ public class AlarmsInformationServiceTest {
         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));
index c1f6a69..7d44315 100755 (executable)
@@ -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());
@@ -87,6 +87,25 @@ public class PerformanceHeaderServiceTest {
         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"})
index 66d66f4..3c710e9 100755 (executable)
@@ -55,6 +55,15 @@ public class PerformanceInformationServiceTest {
         System.out.println(performanceInformationService.updatePerformanceInformation(a));
     }
 
+    @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"})