alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (BaseUiServerTest.java)

This example Java source code file (BaseUiServerTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

afterclass, baseuiservertest, beforeclass, bufferedoutputstream, classpathresource, client, exception, file, fileoutputstream, inputstream, objectmapperprovider, uiserver

The BaseUiServerTest.java Java example source code

package org.deeplearning4j.ui;

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import org.apache.commons.io.IOUtils;
import org.canova.api.util.ClassPathResource;
import org.deeplearning4j.ui.providers.ObjectMapperProvider;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;

/**
 * @author Adam Gibson
 */
public abstract class BaseUiServerTest {
    protected static UiServer uiServer;
    protected static Client client = ClientBuilder.newClient().register(JacksonJsonProvider.class).register(new ObjectMapperProvider());

    @BeforeClass
    public static void before() throws Exception {
        ClassPathResource resource = new ClassPathResource("dropwizard.yml");
        InputStream is = resource.getInputStream();
        final File tmpConfig = new File("dropwizard-render.yml");
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(tmpConfig));
        IOUtils.copy(is, bos);
        bos.flush();
        bos.close();
        is.close();
        tmpConfig.deleteOnExit();
        uiServer = new UiServer();
        try {
            uiServer.run("server", tmpConfig.getAbsolutePath());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @AfterClass
    public static void after() {

    }

}

Other Java examples (source code examples)

Here is a short list of links related to this Java BaseUiServerTest.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.