Package org.springframework.context

Examples of org.springframework.context.ConfigurableApplicationContext


  public void testWithConnectionBulkInsert(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testWithConnectionBulkInsert");
    final int NUMB = 50;
    final ConfigurableApplicationContext context = createContext(dsContext);
    final DataSource ds = context.getBean(DataSource.class);
    cleanDB(ds);
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    engine.startup();
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
    try {
      assertEquals(EngineState.STARTED,engine.getEngineState());

      final List<Workflow<?>> list = new ArrayList<Workflow<?>>();
      for (int i=0; i<NUMB; i++) {
View Full Code Here


  public void testTimeouts(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testTimeouts");
    final int NUMB = 10;
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    engine.startup();
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
    try {
      assertEquals(EngineState.STARTED,engine.getEngineState());

      for (int i=0; i<NUMB; i++) {
        engine.run("de.scoopgmbh.copper.test.persistent.TimingOutPersistentUnitTestWorkflow", null);
View Full Code Here

  }


  public void testErrorHandlingInCoreEngine(String dsContext) throws Exception {
    assumeFalse(skipTests());
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    try {
      engine.startup();
      final WorkflowInstanceDescr<Serializable> wfInstanceDescr = new WorkflowInstanceDescr<Serializable>("de.scoopgmbh.copper.test.persistent.ExceptionThrowingPersistentUnitTestWorkflow");
      wfInstanceDescr.setId(engine.createUUID());
      engine.run(wfInstanceDescr);
      Thread.sleep(5000);
      //check
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select * from cop_workflow_instance_error");
          assertTrue(rs.next());
          assertEquals(wfInstanceDescr.getId(), rs.getString("WORKFLOW_INSTANCE_ID"));
          assertNotNull(rs.getString("EXCEPTION"));
          assertFalse(rs.next());
          rs.close();
          stmt.close();
          return null;
        }
      }.run();
      engine.restart(wfInstanceDescr.getId());
      Thread.sleep(5000);
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select * from cop_workflow_instance_error");
          assertTrue(rs.next());
View Full Code Here

  }


  public void testErrorHandlingInCoreEngine_restartAll(String dsContext) throws Exception {
    assumeFalse(skipTests());
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    try {
      engine.startup();
      final WorkflowInstanceDescr<Serializable> wfInstanceDescr = new WorkflowInstanceDescr<Serializable>("de.scoopgmbh.copper.test.persistent.ExceptionThrowingPersistentUnitTestWorkflow");
      wfInstanceDescr.setId(engine.createUUID());
      engine.run(wfInstanceDescr);
      Thread.sleep(5000);
      //check
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select * from cop_workflow_instance_error");
          assertTrue(rs.next());
          assertEquals(wfInstanceDescr.getId(), rs.getString("WORKFLOW_INSTANCE_ID"));
          assertNotNull(rs.getString("EXCEPTION"));
          assertFalse(rs.next());
          rs.close();
          stmt.close();
          return null;
        }
      }.run();
      engine.restartAll();
      Thread.sleep(5000);
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select * from cop_workflow_instance_error");
          assertTrue(rs.next());
View Full Code Here

  public void testParentChildWorkflow(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testParentChildWorkflow");
    final int NUMB = 20;
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    engine.startup();
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
    try {
      assertEquals(EngineState.STARTED,engine.getEngineState());

      for (int i=0; i<NUMB; i++) {
        engine.run("de.scoopgmbh.copper.test.persistent.subworkflow.TestParentWorkflow",null);
View Full Code Here

  public void testErrorKeepWorkflowInstanceInDB(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testErrorKeepWorkflowInstanceInDB");
    final int NUMB = 20;
    final String DATA = createTestData(50);
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    final ScottyDBStorageInterface dbStorageInterface = context.getBean(ScottyDBStorageInterface.class);
    dbStorageInterface.setRemoveWhenFinished(false);
    engine.startup();
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
    try {
      assertEquals(EngineState.STARTED,engine.getEngineState());

      for (int i=0; i<NUMB; i++) {
        engine.run(PersistentUnitTestWorkflow_NAME, DATA);
      }

      for (int i=0; i<NUMB; i++) {
        WorkflowResult x = backChannelQueue.dequeue(60, TimeUnit.SECONDS);
        assertNotNull(x);
        assertNotNull(x.getResult());
        assertNotNull(x.getResult().toString().length() == DATA.length());
        assertNull(x.getException());
      }

      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select count(*) from cop_workflow_instance");
          assertTrue(rs.next());
View Full Code Here

  public void testCompressedAuditTrail(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testCompressedAuditTrail");
    final int NUMB = 20;
    final String DATA = createTestData(50);
    final ConfigurableApplicationContext context = createContext(dsContext);
    context.getBean(BatchingAuditTrail.class).setMessagePostProcessor(new CompressedBase64PostProcessor());
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    engine.startup();
    final BackChannelQueue backChannelQueue = context.getBean(BackChannelQueue.class);
    try {
      assertEquals(EngineState.STARTED,engine.getEngineState());

      for (int i=0; i<NUMB; i++) {
        engine.run(PersistentUnitTestWorkflow_NAME, DATA);
      }

      for (int i=0; i<NUMB; i++) {
        WorkflowResult x = backChannelQueue.dequeue(60, TimeUnit.SECONDS);
        assertNotNull(x);
        assertNotNull(x.getResult());
        assertNotNull(x.getResult().toString().length() == DATA.length());
        assertNull(x.getException());
      }
      Thread.sleep(1000);
     
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select unique message from (select dbms_lob.substr(long_message, 4000, 1 ) message from cop_audit_trail_event) order by 1 asc");
          assertTrue(rs.next());
View Full Code Here


  public void testAutoCommit(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testAutoCommit");
    final ConfigurableApplicationContext context = createContext(dsContext);
    try {
      DataSource ds = context.getBean(DataSource.class);
      new RetryingTransaction<Void>(ds) {
        @Override
        protected Void execute() throws Exception {
          assertFalse(getConnection().getAutoCommit());
          return null;
View Full Code Here

  }

  public void testAuditTrailUncompressed(String dsContext) throws Exception {
    assumeFalse(skipTests());
    logger.info("running testAuditTrailSmallData");
    final ConfigurableApplicationContext context = createContext(dsContext);
    try {
      de.scoopgmbh.copper.audit.BatchingAuditTrail auditTrail = context.getBean(de.scoopgmbh.copper.audit.BatchingAuditTrail.class);
      auditTrail.setMessagePostProcessor(new DummyPostProcessor());
      auditTrail.synchLog(1, new Date(), "4711", dsContext, "4711", "4711", "4711", null, "TEXT");
      auditTrail.synchLog(1, new Date(), "4711", dsContext, "4711", "4711", "4711", createTestMessage(500), "TEXT");
      auditTrail.synchLog(1, new Date(), "4711", dsContext, "4711", "4711", "4711", createTestMessage(5000), "TEXT");
      auditTrail.synchLog(1, new Date(), "4711", dsContext, "4711", "4711", "4711", createTestMessage(50000), "TEXT");
View Full Code Here

    }
  }

  public void testErrorHandlingWithWaitHook(String dsContext) throws Exception {
    assumeFalse(skipTests());
    final ConfigurableApplicationContext context = createContext(dsContext);
    cleanDB(context.getBean(DataSource.class));
    final PersistentScottyEngine engine = context.getBean(PersistentScottyEngine.class);
    try {
      engine.startup();
      final WorkflowInstanceDescr<Serializable> wfInstanceDescr = new WorkflowInstanceDescr<Serializable>("de.scoopgmbh.copper.test.persistent.ErrorWaitHookUnitTestWorkflow");
      wfInstanceDescr.setId(engine.createUUID());
      engine.run(wfInstanceDescr, null);
      Thread.sleep(2500);
      //check
      new RetryingTransaction<Void>(context.getBean(DataSource.class)) {
        @Override
        protected Void execute() throws Exception {
          Statement stmt = createStatement(getConnection());
          ResultSet rs = stmt.executeQuery("select * from cop_workflow_instance_error");
          assertTrue(rs.next());
View Full Code Here

TOP

Related Classes of org.springframework.context.ConfigurableApplicationContext

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.