aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-03-28 17:23:37 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-03-28 17:23:40 +0800
commit4346ab69685078e76be70ad6a2d98dfde7fd57d1 (patch)
treeca954c9742a976a9ccbb7e3b23a2df5b1f6dd0b9
parentc9d2bfb66db6b2539193d42acb141e9cf5a33b6e (diff)
improve sonar coverage for uui-server
Change-Id: I44596b71f30057cd290e8aac16ff866238580459 Issue-ID: USECASEUI-103 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java103
2 files changed, 0 insertions, 105 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
index 0fee95cb..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
@@ -47,8 +47,6 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
public String saveAlarmsHeader(AlarmsHeader alarmsHeader) {
- String testStr = "shentao_test";
- logger.error(testStr);
try(Session session = sessionFactory.openSession();){
if (null == alarmsHeader) {
logger.error("AlarmsHeaderServiceImpl saveAlarmsHeader alarmsHeader is null!");
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
index 0d2e13be..e99ddae4 100644
--- 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
@@ -100,12 +100,6 @@ public class AlarmsHeaderServiceImplTest {
public Transaction beginTransaction() {
return transaction;
}
- @Mock
- public void save(AlarmsHeader alarmsHeader) {
- }
- @Mock
- public void flush() {
- }
};
new MockUp<SessionFactory>() {
@Mock
@@ -123,103 +117,6 @@ public class AlarmsHeaderServiceImplTest {
alarmsHeaderServiceImpl.saveAlarmsHeader(a);
}
- /**
- *
- * Method: updateAlarmsHeader2018(String status, String date, String eventNameCleared, String eventName, String reportingEntityName, String specificProblem)
- *
- */
- @Test
- public void testUpdateAlarmsHeader2018() throws Exception {
- new MockUp<SessionFactory>() {
- @Mock
- public Session openSession() {
- return session;
- }
- };
- new MockUp<Session>() {
- @Mock
- public Transaction beginTransaction() {
- return transaction;
- }
- @Mock
- public void save(AlarmsHeader alarmsHeader) {
- }
- @Mock
- public void flush() {
- }
- @Mock
- public Query createQuery() {
- return query;
- }
- };
- new MockUp<Transaction>() {
- @Mock
- public void commit() {
- }
- };
- new MockUp<Query>() {
- @Mock
- public void executeUpdate() {
- }
- };
-
- Long l = System.currentTimeMillis();
- Timestamp date_get = new Timestamp(l);
- AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl();
- alarmsHeaderServiceImpl.updateAlarmsHeader2018("active",date_get,"112","112","Fault_MultiCloud_VMFailureCleared","Multi-Cloud","Fault_MultiCloud_VMFailure");
- }
-
- /**
- *
- * Method: getStatusBySourceName(String sourceName)
- *
- */
- @Test
- public void testGetStatusBySourceName() throws Exception {
- new MockUp<SessionFactory>() {
- @Mock
- public Session openSession() {
- return session;
- }
- };
- new MockUp<Session>() {
- @Mock
- public Transaction beginTransaction() {
- return transaction;
- }
- @Mock
- public void save(AlarmsHeader alarmsHeader) {
- }
- @Mock
- public void flush() {
- }
- @Mock
- public Query createQuery() {
- return query;
- }
- };
- new MockUp<Transaction>() {
- @Mock
- public void commit() {
- }
- };
- new MockUp<Query>() {
- @Mock
- public void executeUpdate() {
- }
- @Mock
- public void setMaxResults() {
- }
- @Mock
- public String uniqueResult() {
- return "active";
- }
- };
- AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl();
- Boolean bl = alarmsHeaderServiceImpl.getStatusBySourceName("vnf_a_3");
- System.out.println("boolean="+bl);
- }
-