blob: cb928fd95c42cfa78d20d70f20f86545ebf1d7a6 [file] [log] [blame]
Thomas Vachuska02aeb032015-01-06 22:36:30 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuska02aeb032015-01-06 22:36:30 -08003 *
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 */
16package org.onosproject.app;
17
18import org.junit.Test;
19import org.onosproject.core.Application;
20import org.onosproject.core.DefaultApplication;
21import org.onosproject.event.AbstractEventTest;
22
23import java.util.Optional;
24
25import static org.onosproject.app.ApplicationEvent.Type.APP_ACTIVATED;
26import static org.onosproject.app.DefaultApplicationDescriptionTest.*;
27import static org.onosproject.core.DefaultApplicationTest.APP_ID;
28
29/**
30 * Test of the application event.
31 */
32public class ApplicationEventTest extends AbstractEventTest {
33
34 private Application createApp() {
Simon Huntafae2f72016-03-04 21:18:23 -080035 return new DefaultApplication(APP_ID, VER, TITLE, DESC, ORIGIN, CATEGORY,
Jian Lic35415d2016-01-14 17:22:31 -080036 URL, README, ICON, ROLE, PERMS,
37 Optional.of(FURL), FEATURES, APPS);
Thomas Vachuska02aeb032015-01-06 22:36:30 -080038 }
39
40 @Test
41 public void withoutTime() {
42 Application app = createApp();
43 ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app, 123L);
44 validateEvent(event, APP_ACTIVATED, app, 123L);
45 }
46
47 @Test
48 public void withTime() {
49 Application app = createApp();
50 long before = System.currentTimeMillis();
51 ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app);
52 long after = System.currentTimeMillis();
53 validateEvent(event, APP_ACTIVATED, app, before, after);
54 }
55
56}