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