I added the Quartz endpoint to a list of global endpoints.
In my flow, I then referred to that endpoint in a generic inbound-endpoint.
- I used a VM endpoint of the same name as the ref attribute of the inbound-endpoint.
- In the test, I just started the flow by sending an empty message to the VM endpoint.
Below is an example of what I did.
Global Connectors File
<quartz:connector name="quartz_connector" validateConnections="true" doc:name="Quartz"/>
Global Endpoints File
<quartz:endpoint name="QUARTZ_ENDPOINT_NAME" jobName="JOB_NAME" cronExpression="${cron.start}" repeatInterval="0" responseTimeout="10000" connector-ref="quartz_connector" doc:name="Scheduler">
<quartz:event-generator-job/>
</quartz:endpoint>
Flow
<flow name="some_flow" doc:name="some_flow">
<inbound-endpoint ref="QUARTZ_ENDPOINT_NAME" doc:name="QUARTZ_ENDPOINT_NAME_DOC"/>
</flow>
Global Test Endpoints and Connectors File
<vm:endpoint name="QUARTZ_ENDPOINT_NAME" path="VM_PATH_ATTRIBUTE_VALUE" exchange-pattern="request-response"/>
JUnit Test
@Test
public void testSend() throws Exception
{
MuleClient client = muleContext.getClient();
Map<String,Object> noMsg = new HashMap<String, Object>();
//Start the process by sending a message to the Quartz "Queue"
MuleMessage response = client.send("vm://VM_PATH_ATTRIBUTE_VALUE",new String(""), noMsg);
}