Uploaded image for project: 'SwitchYard'
  1. SwitchYard
  2. SWITCHYARD-434

Update BPMMixIn to use the TestMixIn lifecycle methods (initialize() and uninitialize()) to start and stop the bpm task server

    Details

    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 0.2
    • Fix Version/s: 0.3
    • Component/s: None
    • Labels:
      None
    • Estimated Difficulty:
      Low

      Description

      Tests that currently look like...

      public class HelpDeskTests {
       
          private BPMMixIn bpm;
          private HTTPMixIn http;
       
          @Test
          public void testHelpDesk() throws Exception {
              if (bpm.startTaskServer("Developer", "User")) {
                  try {
                      http.postResourceAndTestXML("http://localhost:18001/HelpDeskService", "/xml/soap-request.xml", "/xml/soap-response.xml");
                      boolean keepWorking = true;
                      while (keepWorking) {
                          keepWorking = bpm.completeTasksForUsers("Developer", "User");
                      }
                  } finally {
                      bpm.stopTaskServer();
                  }
              }
          }
      }
      

      Would end up looking like...

      public class HelpDeskTests {
       
          private BPMMixIn bpm;
          private HTTPMixIn http;
       
          @Test
          public void testHelpDesk() throws Exception {
              http.postResourceAndTestXML("http://localhost:18001/HelpDeskService", "/xml/soap-request.xml", "/xml/soap-response.xml");
              boolean keepWorking = true;
              while (keepWorking) {
                  keepWorking = bpm.completeTasksForUsers("Developer", "User");
              }
          }
      }
      

        Gliffy Diagrams

          Activity

          Hide
          tfennelly Tom Fennelly added a comment -

          Actually ... I think maybe the way to support this type of thing might be to allow definition of MixIn factory methods on the test e.g.

          @RunWith(SwitchYardRunner.class)
          @SwitchYardTestCaseConfig(mixins = BPMMixIn.class)
          public class BlahTest {
           
              public BpmMixIn createBpmMixIn() {
                  BpmMixIn mixIn = new BpmMixIn();
                  mixIn.setPort(12123);
                  return mixIn;
              }
           
              // Test methods....
          }
          

          The SwitchYardRunner woud call these (if defined) when creating the MixIn instances.

          Show
          tfennelly Tom Fennelly added a comment - Actually ... I think maybe the way to support this type of thing might be to allow definition of MixIn factory methods on the test e.g. @RunWith(SwitchYardRunner.class) @SwitchYardTestCaseConfig(mixins = BPMMixIn.class) public class BlahTest {   public BpmMixIn createBpmMixIn() { BpmMixIn mixIn = new BpmMixIn(); mixIn.setPort(12123); return mixIn; }   // Test methods.... } The SwitchYardRunner woud call these (if defined) when creating the MixIn instances.
          Hide
          dward David Ward added a comment -

          Please join the discussion: http://community.jboss.org/thread/171619

          Show
          dward David Ward added a comment - Please join the discussion: http://community.jboss.org/thread/171619
          Hide
          tfennelly Tom Fennelly added a comment -

          I think there are 2 issues here...

          1. Dragging in external/global configurations.
          2. The ability (within the test class) to have some control over how MixIns are constructed.

          Lets say that this JIRA is about evolving the BPMMixIn to use the TestMixIn lifecycle methods + adding the ability to control MixIn construction via a factory method on the test class.

          Show
          tfennelly Tom Fennelly added a comment - I think there are 2 issues here... Dragging in external/global configurations. The ability (within the test class) to have some control over how MixIns are constructed. Lets say that this JIRA is about evolving the BPMMixIn to use the TestMixIn lifecycle methods + adding the ability to control MixIn construction via a factory method on the test class.
          Hide
          tfennelly Tom Fennelly added a comment -

          Dave... I'll take this JIRA. You guys are discussing the global config topic on the forums... there are other JIRAs for that.

          Show
          tfennelly Tom Fennelly added a comment - Dave... I'll take this JIRA. You guys are discussing the global config topic on the forums... there are other JIRAs for that.
          Hide
          dward David Ward added a comment -

          pushed.

          Show
          dward David Ward added a comment - pushed.

            People

            • Assignee:
              tfennelly Tom Fennelly
              Reporter:
              tfennelly Tom Fennelly
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development