aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java
blob: 9727400c2969c3e427ceb7a217e349718d272834 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;

import com.yahoo.jdisc.test.TestDriver;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;

import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;


/**
 * @author Simon Thoresen Hult
 */
public class ExportPackagesIntegrationTest {

    @Ignore // jdisc_core.jar cannot be installed as a bundle since Felix 6.0, due to exporting java.* packages.
    @Test
    public void requireThatManifestContainsExportPackage() throws BundleException {
        FelixFramework felix = TestDriver.newOsgiFramework();
        felix.start();
        List<Bundle> bundles = felix.installBundle("jdisc_core.jar");
        assertEquals(1, bundles.size());
        Object obj = bundles.get(0).getHeaders().get("Export-Package");
        assertTrue(obj instanceof String);
        String str = (String)obj;
        assertTrue(str.contains(ExportPackages.getSystemPackages()));
        assertTrue(str.contains("com.yahoo.jdisc"));
        assertTrue(str.contains("com.yahoo.jdisc.application"));
        assertTrue(str.contains("com.yahoo.jdisc.handler"));
        assertTrue(str.contains("com.yahoo.jdisc.service"));
        felix.stop();
    }
}