Examples of Lifecycle


Examples of org.apache.tuscany.core.context.Lifecycle

        }
        // shutdown destroyable instances in reverse instantiation order
        ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size());
        synchronized (destroyQueue) {
            while (iter.hasPrevious()) {
                Lifecycle context = iter.previous();
                if (context.getLifecycleState() == RUNNING) {
                    try {
                        if (context instanceof AtomicContext) {
                            ((AtomicContext) context).destroy();
                        }
                    } catch (TargetException e) {
                        // TODO send a monitoring event
                    }
                }
            }
        }
        // shutdown contexts
        Map<String, Context> currentContexts = contexts.remove(Thread.currentThread());
        if (currentContexts == null) {
            return;
        }
        for (Lifecycle context : currentContexts.values()) {
            if (context.getLifecycleState() == RUNNING) {
                context.stop();
            }
        }
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.Lifecycle

          }
          synchronized(destroyQueue){
              // shutdown destroyable instances in reverse instantiation order
              ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size());
              while(iter.hasPrevious()){
                  Lifecycle context = iter.previous();
                  if (context.getLifecycleState() == RUNNING) {
                      try {
                          if (context instanceof AtomicContext){
                              ((AtomicContext)context).destroy();
                          }
                      } catch (TargetException e) {
                          // TODO send a monitoring event
                      }
                  }
              }
          }
          // shutdown contexts
          Map<String,Context> currentContexts = contexts.remove(Thread.currentThread());
          if (currentContexts == null){
             return;
          }
          for (Lifecycle context: currentContexts.values()){
              if (context.getLifecycleState() == RUNNING) {
                  context.stop();
              }
          }

      }
View Full Code Here

Examples of org.eclipse.emf.transaction.TransactionalEditingDomain.Lifecycle

      if (editingDomain==null) {
        return null;
      }
      editingDomainListener = new BPMN2EditingDomainListener(this);

      Lifecycle domainLifeCycle = (Lifecycle) editingDomain.getAdapter(Lifecycle.class);
      domainLifeCycle.addTransactionalEditingDomainListener(editingDomainListener);
    }
    return editingDomainListener;
  }
View Full Code Here

Examples of org.eclipse.jetty.util.component.LifeCycle

      {
        try
        {
          if (oldLoggers[i] instanceof LifeCycle)
          {
            LifeCycle lifeCycle = (LifeCycle) oldLoggers[i];
            if (lifeCycle.isStarted())
              lifeCycle.stop();
          }
        }
        catch (Throwable e)
        {
          mex.add(e);
View Full Code Here

Examples of org.eclipse.jetty.util.component.LifeCycle

      {
        try
        {
          if (oldLoggers[i] instanceof LifeCycle)
          {
            LifeCycle lifeCycle = (LifeCycle) oldLoggers[i];
            if (lifeCycle.isStarted())
              lifeCycle.stop();
          }
        }
        catch (Throwable e)
        {
          mex.add(e);
View Full Code Here

Examples of org.huihoo.willow.Lifecycle

      {
        className = value;
      }
    }
    // Add this LifecycleListener to our associated component
    Lifecycle lifecycle = (Lifecycle) digester.peek();
   
    Class clazz = lifecycle.getClass().getClassLoader().loadClass(className);
    LifecycleListener listener = (LifecycleListener) clazz.newInstance();     
    lifecycle.addLifecycleListener(listener);
  }
View Full Code Here

Examples of org.jbehave.core.model.Lifecycle

                "Scenario:"+ NL +       
                "Given a scenario";
        Story story = parser.parseStory(wholeStory, storyPath);
        List<String> beforeSteps = story.getLifecycle().getBeforeSteps();
        assertThat(beforeSteps.isEmpty(), equalTo(true));
        Lifecycle lifecycle = story.getLifecycle();
    List<String> afterSteps = lifecycle.getAfterSteps();
        assertThat(afterSteps.get(0), equalTo("Given a step after any scenario"));
        assertThat(afterSteps.get(1), equalTo("Given a step after successful scenario"));
        assertThat(afterSteps.get(2), equalTo("Given a step after failed scenario"));
        assertThat(lifecycle.getAfterSteps(Outcome.ANY).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.ANY).get(0), equalTo("Given a step after any scenario"));
        assertThat(lifecycle.getAfterSteps(Outcome.SUCCESS).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.SUCCESS).get(0), equalTo("Given a step after successful scenario"));
        assertThat(lifecycle.getAfterSteps(Outcome.FAILURE).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.FAILURE).get(0), equalTo("Given a step after failed scenario"));
        Scenario scenario = story.getScenarios().get(0);
        List<String> steps = scenario.getSteps();
        assertThat(steps.get(0), equalTo("Given a scenario"));
    }
View Full Code Here

Examples of org.jbehave.core.model.Lifecycle

                "Wenn ein Kunde 20 T-Shirts bestellt";
      parser = new RegexStoryParser(new LocalizedKeywords(Locale.GERMAN));
        Story story = parser.parseStory(wholeStory, storyPath);
        List<String> beforeSteps = story.getLifecycle().getBeforeSteps();
        assertThat(beforeSteps.isEmpty(), equalTo(true));
        Lifecycle lifecycle = story.getLifecycle();
    List<String> afterSteps = lifecycle.getAfterSteps();
        assertThat(afterSteps.get(0), equalTo("Gegeben im Lager sind 200 T-Shirts"));
        assertThat(afterSteps.get(1), equalTo("Gegeben im Lager sind 300 T-Shirts"));
        assertThat(afterSteps.get(2), equalTo("Gegeben im Lager sind 400 T-Shirts"));
        assertThat(lifecycle.getAfterSteps(Outcome.ANY).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.ANY).get(0), equalTo("Gegeben im Lager sind 200 T-Shirts"));
        assertThat(lifecycle.getAfterSteps(Outcome.SUCCESS).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.SUCCESS).get(0), equalTo("Gegeben im Lager sind 300 T-Shirts"));
        assertThat(lifecycle.getAfterSteps(Outcome.FAILURE).size(), equalTo(1));
        assertThat(lifecycle.getAfterSteps(Outcome.FAILURE).get(0), equalTo("Gegeben im Lager sind 400 T-Shirts"));
        Scenario scenario = story.getScenarios().get(0);
        List<String> steps = scenario.getSteps();
        assertThat(steps.get(0), equalTo("Wenn ein Kunde 20 T-Shirts bestellt"));
    }
View Full Code Here

Examples of org.jbehave.core.model.Lifecycle

    public Story parseStory(String storyAsText, String storyPath) {
        Description description = parseDescriptionFrom(storyAsText);
        Meta meta = parseStoryMetaFrom(storyAsText);
        Narrative narrative = parseNarrativeFrom(storyAsText);
        GivenStories givenStories = parseGivenStories(storyAsText);
        Lifecycle lifecycle = parseLifecycle(storyAsText);
        List<Scenario> scenarios = parseScenariosFrom(storyAsText);
        Story story = new Story(storyPath, description, meta, narrative, givenStories, lifecycle, scenarios);
        if (storyPath != null) {
            story.namedAs(new File(storyPath).getName());
        }
View Full Code Here

Examples of org.jbehave.core.model.Lifecycle

        if ( findingBeforeAndAfter.matches() ){
            String beforeLifecycle = findingBeforeAndAfter.group(1).trim();
      Steps beforeSteps = parseBeforeLifecycle(beforeLifecycle);
            String afterLifecycle = findingBeforeAndAfter.group(2).trim();
      Steps[] afterSteps = parseAfterLifecycle(afterLifecycle);
            return new Lifecycle(beforeSteps, afterSteps);
        }
        Matcher findingBefore = compile(".*" + keywords.before() + "(.*)\\s*", DOTALL).matcher(lifecycle);
        if ( findingBefore.matches() ){
            String beforeLifecycle = findingBefore.group(1).trim();
      Steps beforeSteps = parseBeforeLifecycle(beforeLifecycle);
            return new Lifecycle(beforeSteps, new Steps(new ArrayList<String>()));
        }
        Matcher findingAfter = compile(".*" + keywords.after() + "(.*)\\s*", DOTALL).matcher(lifecycle);
        if ( findingAfter.matches() ){
            Steps beforeSteps = Steps.EMPTY;
            String afterLifecycle = findingAfter.group(1).trim();
      Steps[] afterSteps = parseAfterLifecycle(afterLifecycle);
            return new Lifecycle(beforeSteps, afterSteps);
        }
        return Lifecycle.EMPTY;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.