Search in sources :

Example 1 with ITestConfig

use of org.apache.camel.itest.springboot.ITestConfig in project camel by apache.

the class AbstractTestCommand method execute.

// needs to run on a spring background thread
@Async
@Override
public Future<Object> execute(Object[] parameters) throws Exception {
    Assert.assertNotNull("Parameters cannot be null", parameters);
    Assert.assertEquals("Parameters should contain two elements", 2, parameters.length);
    Object configObj = parameters[0];
    Assert.assertNotNull("The first parameter cannot be null", configObj);
    Assert.assertTrue("First parameter should be of type ITestConfig, found type " + configObj.getClass().getName(), configObj instanceof ITestConfig);
    Object compNameObj = parameters[1];
    Assert.assertNotNull("The second parameter cannot be null", compNameObj);
    Assert.assertTrue("Second parameter should be of type String, found type " + compNameObj.getClass().getName(), compNameObj instanceof String);
    String compName = (String) compNameObj;
    ITestConfig config = (ITestConfig) configObj;
    Object result = this.executeTest(config, compName);
    return new AsyncResult<>(result);
}
Also used : ITestConfig(org.apache.camel.itest.springboot.ITestConfig) AsyncResult(org.springframework.scheduling.annotation.AsyncResult) Async(org.springframework.scheduling.annotation.Async)

Aggregations

ITestConfig (org.apache.camel.itest.springboot.ITestConfig)1 Async (org.springframework.scheduling.annotation.Async)1 AsyncResult (org.springframework.scheduling.annotation.AsyncResult)1