aboutsummaryrefslogtreecommitdiffstats
path: root/sample-apps/http-api-using-searcher/src/test/java/com/yahoo/example/ApplicationMain.java
blob: 0fcc176620a9fabc1cf2b27c9c03e9004c9a5f90 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.example;

import com.yahoo.application.Networking;
import org.junit.Test;

import java.nio.file.FileSystems;

import static org.junit.Assume.assumeTrue;

public class ApplicationMain {

    @Test
    public void runFromMaven() throws Exception {
        assumeTrue(Boolean.valueOf(System.getProperty("isMavenSurefirePlugin")));
        main(null);
    }

    public static void main(String[] args) throws Exception {
        try (com.yahoo.application.Application app = com.yahoo.application.Application.fromApplicationPackage(
                FileSystems.getDefault().getPath("src/main/application"),
                Networking.enable)) {
            app.getClass(); // throws NullPointerException
            Thread.sleep(Long.MAX_VALUE);
        }
    }
}