aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java
blob: 123491cf8a78efb9c8ad17b4688c9edafb625aa2 (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
39
40
41
// Copyright Vespa.ai. 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.jupiter.api.Test;
import org.osgi.framework.BundleException;

import static org.junit.jupiter.api.Assertions.fail;


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

    @Test
    void requireThatLifecycleWorks() throws BundleException {
        FelixFramework felix = TestDriver.newOsgiFramework();
        felix.start();
        felix.stop();
    }

    @Test
    void requireThatStopWithoutStartDoesNotThrowException() throws BundleException {
        FelixFramework felix = TestDriver.newOsgiFramework();
        felix.stop();
    }

    @Test
    void requireThatInstallCanThrowException() throws BundleException {
        FelixFramework felix = TestDriver.newOsgiFramework();
        felix.start();
        try {
            felix.installBundle("file:notfound.jar");
            fail();
        } catch (BundleException e) {

        }
        felix.stop();
    }
}