4fc3e7470d22a60e464f2986d3830738f4165971
[usecase-ui/server.git] / src / test / java / org / onap / usecaseui / server / UsecaseuiServerApplicationTests.java
1 /*
2  * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.usecaseui.server;
17
18 import java.text.ParseException;
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
21
22 import org.junit.Assert;
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.onap.usecaseui.server.bean.AlarmsHeader;
26 import org.onap.usecaseui.server.bean.AlarmsInformation;
27 import org.onap.usecaseui.server.service.AlarmsHeaderService;
28 import org.onap.usecaseui.server.service.AlarmsInformationService;
29 import org.onap.usecaseui.server.service.impl.AlarmsHeaderServiceImpl;
30 import org.onap.usecaseui.server.service.impl.AlarmsInformationServiceImpl;
31 import org.onap.usecaseui.server.util.Page;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.boot.test.context.SpringBootTest;
34 import org.springframework.test.context.junit4.SpringRunner;
35
36 @RunWith(SpringRunner.class)
37 @SpringBootTest
38 public class UsecaseuiServerApplicationTests {
39         
40 //      @Autowired
41 //      AlarmsInformationService info;
42         
43         @Autowired
44         AlarmsHeaderService alarm;
45         
46         @Test
47         public void contextLoads() throws ParseException {
48 //              AlarmsInformation in= new AlarmsInformation();
49 //              Date date =new Date();
50 //              in.setName("name");
51 //              in.setEventId("eventId");
52 //              in.setValue("value");
53 //              in.setCreateTime(date);
54 //              in.setUpdateTime(date);
55 //              String d=info.saveAlarmsInformation(in);
56 //              String d=info.updateAlarmsInformation(in);
57                 
58 //              int c=alarm.getAllCount();
59                 
60                 AlarmsHeader a = new AlarmsHeader();
61 //              a.setVersion("1");
62                 a.setDomain("3");
63 //              SimpleDateFormat e =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
64 //              a.setCreateTime(e.parse("2017-09-03 15:25:11"));
65                 Page<AlarmsHeader> b = alarm.queryAlarmsHeader(a, 1, 5);
66                 String c =b.getList().get(0).getEventName();
67                 System.out.println("============"+c);
68                 Assert.assertEquals("2", c);
69                 
70         }
71 }