blob: 34c593c450bc843d428cb631235dbd2c1abf01f4 [file] [log] [blame]
Thomas Vachuska02aeb032015-01-06 22:36:30 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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 */
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() {
Changhoon Yoonbdeb88a2015-05-12 20:35:31 +090035 return new DefaultApplication(APP_ID, VER, DESC, ORIGIN, ROLE,
Thomas Vachuska761f0042015-11-11 19:10:17 -080036 PERMS, Optional.of(FURL), FEATURES, APPS);
Thomas Vachuska02aeb032015-01-06 22:36:30 -080037 }
38
39 @Test
40 public void withoutTime() {
41 Application app = createApp();
42 ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app, 123L);
43 validateEvent(event, APP_ACTIVATED, app, 123L);
44 }
45
46 @Test
47 public void withTime() {
48 Application app = createApp();
49 long before = System.currentTimeMillis();
50 ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app);
51 long after = System.currentTimeMillis();
52 validateEvent(event, APP_ACTIVATED, app, before, after);
53 }
54
55}