]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootNoRuntimeTest.java
Improve RCP platform.
[lgpl/argeo-commons.git] / org.argeo.osgi.boot / ext / test / org / argeo / osgi / boot / OsgiBootNoRuntimeTest.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
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.argeo.osgi.boot;
17
18 import java.util.List;
19
20 import junit.framework.TestCase;
21
22 /** Tests which do not require a runtime. */
23 @SuppressWarnings("rawtypes")
24 public class OsgiBootNoRuntimeTest extends TestCase {
25 public final static String BUNDLES = "src/test/bundles/some;in=*;ex=excluded,"
26 + "src/test/bundles/others;in=**/org.argeo.*";
27
28 /** Tests that location lists are properly parsed. */
29 // public void testLocations() {
30 // String baseUrl = "file:";
31 // String locations = "/mydir/myfile" + File.pathSeparator
32 // + "/myotherdir/myotherfile";
33 //
34 // OsgiBoot osgiBoot = new OsgiBoot(null);
35 // osgiBoot.setExcludeSvn(true);
36 // List urls = osgiBoot.getLocationsUrls(baseUrl, locations);
37 // assertEquals(2, urls.size());
38 // assertEquals("file:/mydir/myfile", urls.get(0));
39 // assertEquals("file:/myotherdir/myotherfile", urls.get(1));
40 // }
41
42 /** Tests that bundle lists are properly parsed. */
43 public void testBundles() {
44 String baseUrl = "file:";
45 String bundles = BUNDLES;
46 OsgiBoot osgiBoot = new OsgiBoot(null);
47 // osgiBoot.setExcludeSvn(true);
48 List urls = osgiBoot.getBundlesUrls(baseUrl, bundles);
49 for (int i = 0; i < urls.size(); i++)
50 System.out.println(urls.get(i));
51 assertEquals(3, urls.size());
52
53 List jarUrls = osgiBoot.getBundlesUrls(baseUrl,
54 "src/test/bundles/jars;in=*.jar");
55 for (int i = 0; i < jarUrls.size(); i++)
56 System.out.println(jarUrls.get(i));
57 assertEquals(1, jarUrls.size());
58 }
59 }