Package de.scoopgmbh.copper.tranzient

Examples of de.scoopgmbh.copper.tranzient.TransientScottyEngine


  private final int[] response = { -1 };

  @Test
  public void testWorkflow() throws Exception {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"transient-engine-application-context.xml", "SimpleTransientEngineTest-application-context.xml"});
    TransientScottyEngine engine = context.getBean("transientEngine", TransientScottyEngine.class);
    context.getBeanFactory().registerSingleton("OutputChannel4711",new TestResponseReceiver<String, Integer>() {
      @Override
      public void setResponse(Workflow<String> wf, Integer r) {
        synchronized (response) {
          response[0] = r.intValue();
          response.notifyAll();
        }
      }
    });

    assertEquals(EngineState.STARTED,engine.getEngineState());
   
    try {
      BlockingResponseReceiver<Integer> brr = new BlockingResponseReceiver<Integer>();
      engine.run("de.scoopgmbh.copper.test.tranzient.simple.SimpleTransientWorkflow", brr);
      synchronized (response) {
        if (response[0] == -1) {
          response.wait(30000);
        }
      }
      assertEquals(10, response[0]);
    }
    finally {
      context.close();
    }
    assertEquals(EngineState.STOPPED,engine.getEngineState());
   
  }
View Full Code Here


 
 
  @Test(expected=DuplicateIdException.class)
  public void testDuplicateIdException() throws Exception {
    final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"transient-engine-application-context.xml", "SimpleTransientEngineTest-application-context.xml"});
    final TransientScottyEngine engine = (TransientScottyEngine) context.getBean("transientEngine");
   
    assertEquals(EngineState.STARTED,engine.getEngineState());
   
    try {
      engine.run(new WorkflowInstanceDescr<String>("de.scoopgmbh.copper.test.tranzient.simple.VerySimpleTransientWorkflow", "data", "singleton", null,
          null));
      engine.run(new WorkflowInstanceDescr<String>("de.scoopgmbh.copper.test.tranzient.simple.VerySimpleTransientWorkflow", "data", "singleton", null,
          null));
    }
    finally {
      context.close();
    }
    assertEquals(EngineState.STOPPED,engine.getEngineState());
   
  }
View Full Code Here

  private final int[] response = { -1 };

  @Test
  public void testWorkflow() throws Exception {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"transient-engine-application-context.xml", "SimpleTransientEngineTest-application-context.xml"});
    TransientScottyEngine engine = (TransientScottyEngine) context.getBean("transientEngine");
    context.getBeanFactory().registerSingleton("OutputChannel4711",new TestResponseReceiver<String, Integer>() {
      @Override
      public void setResponse(Workflow<String> wf, Integer r) {
        synchronized (response) {
          response[0] = r.intValue();
          response.notifyAll();
        }
      }
    });

    assertEquals(EngineState.STARTED,engine.getEngineState());
   
    try {
      BlockingResponseReceiver<Integer> brr = new BlockingResponseReceiver<Integer>();
      engine.run("de.scoopgmbh.copper.test.tranzient.simple.VerySimpleTransientWorkflow", brr);
      brr.wait4response(5000L);
      assertEquals(1,brr.getResponse().intValue());
    }
    finally {
      context.close();
    }
    assertEquals(EngineState.STOPPED,engine.getEngineState());
   
  }
View Full Code Here

 

  @Test
  public void testWorkflow() throws Exception {
    final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"transient-engine-application-context.xml", "SimpleTransientEngineTest-application-context.xml"});
    final TransientScottyEngine engine = (TransientScottyEngine) context.getBean("transientEngine");
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
   
    assertEquals(EngineState.STARTED,engine.getEngineState());
   
    try {
      engine.run("de.scoopgmbh.copper.test.tranzient.simple.SimpleTestParentWorkflow","testData");
      WorkflowResult r = backChannelQueue.dequeue(2000, TimeUnit.MILLISECONDS);
      assertNotNull(r);
    }
    finally {
      context.close();
    }
    assertEquals(EngineState.STOPPED,engine.getEngineState());
   
  }
View Full Code Here

TOP

Related Classes of de.scoopgmbh.copper.tranzient.TransientScottyEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.