blob: 70794273a2e8cb5ec92412290c3d75b829f4d240 [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 com.google.common.collect.ImmutableSet;
19import org.junit.Test;
20import org.onosproject.core.Permission;
21import org.onosproject.core.Version;
22
23import java.net.URI;
24import java.util.Set;
25
26import static org.junit.Assert.assertEquals;
27import static org.junit.Assert.assertTrue;
28
29/**
30 * Basic tests of the default app description.
31 */
32public class DefaultApplicationDescriptionTest {
33
34 public static final String APP_NAME = "org.foo.app";
35 public static final Version VER = Version.version(1, 2, "a", null);
36 public static final String DESC = "Awesome application from Circus";
37 public static final String ORIGIN = "Circus";
38 public static final Set<Permission> PERMS = ImmutableSet.of();
39 public static final URI FURL = URI.create("mvn:org.foo-features/1.2a/xml/features");
40 public static final Set<String> FEATURES = ImmutableSet.of("foo");
41
42 @Test
43 public void basics() {
44 ApplicationDescription app =
45 new DefaultApplicationDescription(APP_NAME, VER, DESC, ORIGIN,
46 PERMS, FURL, FEATURES);
47 assertEquals("incorrect id", APP_NAME, app.name());
48 assertEquals("incorrect version", VER, app.version());
49 assertEquals("incorrect description", DESC, app.description());
50 assertEquals("incorrect origin", ORIGIN, app.origin());
51 assertEquals("incorrect permissions", PERMS, app.permissions());
52 assertEquals("incorrect features repo", FURL, app.featuresRepo().get());
53 assertEquals("incorrect features", FEATURES, app.features());
54 assertTrue("incorrect toString", app.toString().contains(APP_NAME));
55 }
56
57}