protected <T, U> void runFlowWithPayload(String flowName, T expect, U payload) throws Exception {
    Flow flow = lookupFlowConstruct(flowName);
    MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
    MuleEvent responseEvent = flow.process(event);

    assertEquals(expect, responseEvent.getMessage().getPayload());
  }
  protected <U> MuleEvent runFlowWithPayload(String flowName, U payload) throws Exception {
    Flow flow = lookupFlowConstruct(flowName);
    MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
    MuleEvent responseEvent = flow.process(event);

    return responseEvent;
  }
  /**
   * Run the flow specified by name and assert equality on the expected output
   *
   * @param flowName The name of the flow to run
   * @param expect The expected output
   */
  protected <T> void runFlowAndExpect(String flowName, T expect) throws Exception {
    Flow flow = lookupFlowConstruct(flowName);
    MuleEvent event = AbstractMuleTestCase.getTestEvent(null);
    MuleEvent responseEvent = flow.process(event);

    if (expect != null) {
      assertEquals(expect, responseEvent.getMessage().getPayload());
    }
  }
Beispiel #4
0
  protected void doSetUp() throws Exception {
    super.doSetUp();

    parser = new SimpleFilenameParser();

    adapter = new DefaultMessageAdapter("hello");
    adapter.setProperty("foo", "bar");
    adapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, "originalName");
    adapter.setProperty(FileConnector.PROPERTY_FILENAME, "newName");
  }
Beispiel #5
0
  protected void suitePreSetUp() throws Exception {
    if (!derbySetupDone) {
      String dbName = MuleDerbyUtils.loadDatabaseName("derby.properties", "database.name");

      MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name");
      EMBEDDED_CONNECTION_STRING = "jdbc:derby:" + dbName;
      CLIENT_CONNECTION_STRING = "jdbc:derby://localhost:1527/" + dbName + ";create=true";
      derbySetupDone = true;
    }
    super.suitePreSetUp();
  }
Beispiel #6
0
  // @Override
  protected void doSetUp() throws Exception {
    super.doSetUp();

    // allow 1 active & 1 queued Thread
    executor =
        new ThreadPoolExecutor(1, 1, 10000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(1));
    executor.prestartAllCoreThreads();

    // the lock must be fair to guarantee FIFO access to the executor;
    // 'synchronized' on a monitor is not good enough.
    executorLock = new ReentrantLock(true);

    // this is a Threadgroup that collects uncaught exceptions. Necessary for JDK
    // 1.4.x only.
    threadGroup = new ExceptionCollectingThreadGroup();

    // reset counter of active SleepyTasks
    SleepyTask.activeTasks.set(0);
  }
Beispiel #7
0
 // @Override
 protected void doTearDown() throws Exception {
   context.close();
   super.doTearDown();
 }
Beispiel #8
0
 // @Override
 protected void doSetUp() throws Exception {
   super.doSetUp();
   context = new ClassPathXmlApplicationContext(getConfigResources());
   eventCounter1 = new AtomicInteger(0);
   eventCounter2 = new AtomicInteger(0);
 }
Beispiel #9
0
 // @Override
 protected void doTearDown() throws Exception {
   executor.shutdown();
   threadGroup.destroy();
   super.doTearDown();
 }
 public void testMuleMessageAsParameter() throws Exception {
   Flow flow = lookupFlowConstruct("acceptMuleMessage");
   flow.process(AbstractMuleTestCase.getTestEvent(""));
 }
 protected <T> void runFlow(String flowName) throws Exception {
   String payload = EMPTY_PAYLOAD;
   Flow flow = lookupFlowConstruct(flowName);
   MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
   MuleEvent responseEvent = flow.process(event);
 }