org.jboss.arquillian.test.spi.TestMethodExecutor Java Examples

The following examples show how to use org.jboss.arquillian.test.spi.TestMethodExecutor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FurnaceProtocol.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public ContainerMethodExecutor getExecutor(FurnaceProtocolConfiguration protocolConfiguration,
         ProtocolMetaData metaData, CommandCallback callback)
{
   if (metaData == null)
   {
      return new ContainerMethodExecutor()
      {
         @Override
         public TestResult invoke(TestMethodExecutor arg0)
         {
            return TestResult.skipped();
         }
      };
   }

   Collection<FurnaceHolder> contexts = metaData.getContexts(FurnaceHolder.class);
   if (contexts.size() == 0)
   {
      throw new IllegalArgumentException(
               "No " + Furnace.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
                        "Furnace protocol can not be used");
   }
   return new FurnaceTestMethodExecutor(protocolConfiguration, contexts.iterator().next());
}
 
Example #2
Source File: DaemonMethodExecutor.java    From thorntail with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.jboss.arquillian.container.test.spi.ContainerMethodExecutor#invoke(org.jboss.arquillian.test.spi.TestMethodExecutor)
 */
@Override
public TestResult invoke(final TestMethodExecutor testMethodExecutor) {

    assert testMethodExecutor != null : "Test method executor is required";

    // Build the String request according to the wire protocol
    final StringBuilder builder = new StringBuilder();
    builder.append(WireProtocol.COMMAND_TEST_PREFIX);
    builder.append(testMethodExecutor.getInstance().getClass().getName());
    builder.append(SPACE);
    builder.append(testMethodExecutor.getMethod().getName());
    builder.append(WireProtocol.COMMAND_EOF_DELIMITER);
    final String testCommand = builder.toString();
    final PrintWriter writer = this.context.getWriter();

    // Request
    writer.write(testCommand);
    writer.flush();

    try {
        // Read response
        final ObjectInputStream response = new ObjectInputStream(
                new NoCloseInputStream(context.getSocketInstream()));
        final TestResult testResult = (TestResult) response.readObject();
        response.close();
        return testResult;

    } catch (final IOException ioe) {
        throw new RuntimeException("Could not get test results", ioe);
    } catch (final ClassNotFoundException cnfe) {
        throw new RuntimeException("test result not on the client classpath", cnfe);
    }
}
 
Example #3
Source File: DaemonMethodExecutor.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.jboss.arquillian.container.test.spi.ContainerMethodExecutor#invoke(org.jboss.arquillian.test.spi.TestMethodExecutor)
 */
@Override
public TestResult invoke(final TestMethodExecutor testMethodExecutor) {

    assert testMethodExecutor != null : "Test method executor is required";

    // Build the String request according to the wire protocol
    final StringBuilder builder = new StringBuilder();
    builder.append(WireProtocol.COMMAND_TEST_PREFIX);
    builder.append(testMethodExecutor.getInstance().getClass().getName());
    builder.append(SPACE);
    builder.append(testMethodExecutor.getMethod().getName());
    builder.append(WireProtocol.COMMAND_EOF_DELIMITER);
    final String testCommand = builder.toString();
    final PrintWriter writer = this.context.getWriter();

    // Request
    writer.write(testCommand);
    writer.flush();

    try {
        // Read response
        final ObjectInputStream response = new ObjectInputStream(
                new NoCloseInputStream(context.getSocketInstream()));
        final TestResult testResult = (TestResult) response.readObject();
        response.close();
        return testResult;

    } catch (final IOException ioe) {
        throw new RuntimeException("Could not get test results", ioe);
    } catch (final ClassNotFoundException cnfe) {
        throw new RuntimeException("test result not on the client classpath", cnfe);
    }
}
 
Example #4
Source File: IgnoreObserver.java    From arquillian-governor with Apache License 2.0 4 votes vote down vote up
private String toFqn(ExecutionEvent event) {
    final TestMethodExecutor executor = event.getExecutor();
    final Object test = executor.getInstance();
    final Method method = executor.getMethod();
    return test.getClass().getName() + "#" + method.getName();
}