2 * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onap.usecaseui.server;
18 import java.text.ParseException;
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
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;
36 @RunWith(SpringRunner.class)
38 public class UsecaseuiServerApplicationTests {
41 // AlarmsInformationService info;
44 AlarmsHeaderService alarm;
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);
58 // int c=alarm.getAllCount();
60 AlarmsHeader a = new AlarmsHeader();
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);