blob: 0d4ae4c78ea15d2f33ce386d72b53f14064d279b [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() {
Jian Lic35415d2016-01-14 17:22:31 -080035 return new DefaultApplication(APP_ID, VER, DESC, ORIGIN, CATEGORY,
36 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}