Package io.apigee.trireme.samples.test

Source Code of io.apigee.trireme.samples.test.HelloTest

package io.apigee.trireme.samples.test;

import io.apigee.trireme.core.NodeEnvironment;
import io.apigee.trireme.core.NodeException;
import io.apigee.trireme.core.NodeScript;
import io.apigee.trireme.core.ScriptStatus;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.util.concurrent.ExecutionException;

import static org.junit.Assert.assertEquals;

/**
* This is a class that tests our new module by using JUnit to launch Trireme and run the script.
* The script will return zero on success and throw an exception (and therefore a non-zero
* exit status) on failure.
*/

public class HelloTest
{
    private static NodeEnvironment env;

    @BeforeClass
    public static void init()
    {
        env = new NodeEnvironment();
    }

    @Test
    public void testHello()
        throws NodeException, InterruptedException, ExecutionException
    {
        NodeScript script = env.createScript("hellotest.js",
                                             new File("target/test-classes/hellotest.js"),
                                             null);
        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }
}
TOP

Related Classes of io.apigee.trireme.samples.test.HelloTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.