Search in sources :

Example 86 with Platform

use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.

the class SimpleJUnitTestRunTest method fireEvent.

public void fireEvent(JUnitTestListener.Event event, JUnitTestListener... listeners) throws Exception {
    Platform platform = mock(Platform.class);
    JavaApplicationProcess process = mock(JavaApplicationProcess.class);
    OptionsByType optionsByType = OptionsByType.empty();
    for (JUnitTestListener listener : listeners) {
        optionsByType.add(Decoration.of(listener));
    }
    try (SimpleJUnitTestRun application = new SimpleJUnitTestRun(platform, process, optionsByType)) {
        ArgumentCaptor<RemoteEventListener> captorListener = ArgumentCaptor.forClass(RemoteEventListener.class);
        ArgumentCaptor<Option> captorOptions = ArgumentCaptor.forClass(Option.class);
        verify(process).addListener(captorListener.capture(), captorOptions.capture());
        RemoteEventListener eventListener = captorListener.getValue();
        List<Option> listenerOpts = captorOptions.getAllValues();
        assertThat(eventListener, is(notNullValue()));
        assertThat(listenerOpts, containsInAnyOrder(JUnitTestRunner.STREAM_NAME));
        eventListener.onEvent(event);
    }
}
Also used : Platform(com.oracle.bedrock.runtime.Platform) JUnitTestListener(com.oracle.bedrock.testsupport.junit.JUnitTestListener) SimpleJUnitTestListener(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener) JavaApplicationProcess(com.oracle.bedrock.runtime.java.JavaApplicationProcess) Option(com.oracle.bedrock.Option) SimpleJUnitTestRun(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestRun) OptionsByType(com.oracle.bedrock.OptionsByType) RemoteEventListener(com.oracle.bedrock.runtime.concurrent.RemoteEventListener)

Aggregations

Platform (com.oracle.bedrock.runtime.Platform)86 Test (org.junit.Test)69 OptionsByType (com.oracle.bedrock.OptionsByType)55 LocalPlatform (com.oracle.bedrock.runtime.LocalPlatform)49 MetaClass (com.oracle.bedrock.runtime.MetaClass)23 Arguments (com.oracle.bedrock.runtime.options.Arguments)18 Application (com.oracle.bedrock.runtime.Application)16 File (java.io.File)15 RemotePlatform (com.oracle.bedrock.runtime.remote.RemotePlatform)14 AbstractTest (com.oracle.bedrock.testsupport.junit.AbstractTest)12 DeploymentArtifact (com.oracle.bedrock.runtime.remote.DeploymentArtifact)11 JavaApplication (com.oracle.bedrock.runtime.java.JavaApplication)10 AbstractRemoteTest (com.oracle.bedrock.runtime.remote.AbstractRemoteTest)10 ArrayList (java.util.ArrayList)8 Option (com.oracle.bedrock.Option)7 GetClusterSize (com.oracle.bedrock.runtime.coherence.callables.GetClusterSize)7 GetLocalMemberId (com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId)7 Properties (java.util.Properties)7 Matchers.anyString (org.mockito.Matchers.anyString)7 EnvironmentVariables (com.oracle.bedrock.runtime.options.EnvironmentVariables)6