Examples of Lifecycle


Examples of org.jbehave.core.model.Lifecycle

        when(successCandidate.isAndStep(myFailureStep)).thenReturn(false);
        when(successCandidate.createMatchedStepUponOutcome(myFailureStep, parameters, Outcome.FAILURE)).thenReturn(failureStep);

        when(steps.listCandidates()).thenReturn(asList(anyCandidate, successCandidate, failureCandidate));

    Lifecycle lifecycle = new Lifecycle(
        org.jbehave.core.model.Lifecycle.Steps.EMPTY,
        new org.jbehave.core.model.Lifecycle.Steps(Outcome.ANY, asList(myAnyStep)),
        new org.jbehave.core.model.Lifecycle.Steps(Outcome.SUCCESS, asList(mySuccessStep)),
        new org.jbehave.core.model.Lifecycle.Steps(Outcome.FAILURE, asList(myFailureStep)));
View Full Code Here

Examples of org.mortbay.component.LifeCycle

            for (int i = 0; i < args.length; i++)
            {
                if (obj[i] instanceof LifeCycle)
                {
                    LifeCycle lc = (LifeCycle)obj[i];
                    if (!lc.isRunning())
                        lc.start();
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.mule.api.lifecycle.Lifecycle

        builder.chain(staticChain);
        builder.chain(postMessageProcessors);
        MessageProcessorChain newChain = builder.build();

        Lifecycle preChainOld = preChain;
        Lifecycle postChainOld = postChain;
        preChain = new SimpleMessageProcessorChain(preMessageProcessors);
        postChain = new SimpleMessageProcessorChain(postMessageProcessors);
        initDynamicChains();

        //hook chain as last step to avoid synchronization
View Full Code Here

Examples of org.qi4j.api.entity.Lifecycle

        if( lifecycleMixins != null )
        {
            InjectionContext injectionContext = new InjectionContext( instance, UsesInstance.EMPTY_USES, state );
            for( Integer lifecycleMixin : lifecycleMixins )
            {
                Lifecycle lifecycle = (Lifecycle) mixins[ lifecycleMixin ];

                if( lifecycle == null )
                {
                    lifecycle = (Lifecycle) mixinModels.get( lifecycleMixin ).newInstance( injectionContext );
                }

                if( create )
                {
                    lifecycle.create();
                }
                else
                {
                    lifecycle.remove();
                }
            }
        }
    }
View Full Code Here

Examples of org.radargun.traits.Lifecycle

    * @param clusterFormationTimeout
    * @param reachable
    */
   public static void start(SlaveState slaveState, boolean validate, Integer expectedSlaves, long clusterFormationTimeout,
                            Set<Integer> reachable) {
      Lifecycle lifecycle = slaveState.getTrait(Lifecycle.class);
      Clustered clustered = slaveState.getTrait(Clustered.class);
      Partitionable partitionable = slaveState.getTrait(Partitionable.class);
      try {
         if (partitionable != null) {
            partitionable.setStartWithReachable(slaveState.getSlaveIndex(), reachable);
         }
         for (ServiceListener listener : slaveState.getServiceListeners()) {
            listener.beforeServiceStart();
         }
         long startingTime = System.currentTimeMillis();
         lifecycle.start();
         long startedTime = System.currentTimeMillis();
         slaveState.getTimeline().addEvent(LifecycleHelper.LIFECYCLE, new Timeline.IntervalEvent(startingTime, "Start", startedTime - startingTime));
         if (validate && clustered != null) {

            int expectedNumberOfSlaves = expectedSlaves != null ? expectedSlaves : slaveState.getGroupSize();

            long clusterFormationDeadline = System.currentTimeMillis() + clusterFormationTimeout;
            for (;;) {
               int numMembers = clustered.getClusteredNodes();
               if (numMembers != expectedNumberOfSlaves) {
                  String msg = "Number of members=" + numMembers + " is not the one expected: " + expectedNumberOfSlaves;
                  log.info(msg);
                  try {
                     Thread.sleep(1000);
                  } catch (InterruptedException ie) {
                     Thread.currentThread().interrupt();
                  }
                  if (System.currentTimeMillis() > clusterFormationDeadline) {
                     throw new ClusterFormationTimeoutException(msg);
                  }
               } else {
                  log.info("Number of members is the one expected: " + clustered.getClusteredNodes());
                  break;
               }
            }
         }
         for (ServiceListener listener : slaveState.getServiceListeners()) {
            try {
               listener.afterServiceStart();
            } catch (Exception e) {
               log.error("Failed to run listener " + listener, e);
            }
         }
      } catch (RuntimeException e) {
         log.trace("Failed to start", e);
         try {
            lifecycle.stop();
         } catch (Exception ignored) {
            log.trace("Failed to stop after start failed", ignored);
         }
         throw e;
      }
View Full Code Here

Examples of org.springframework.context.Lifecycle

        }
    }

    public static void main(String[] args) throws IOException {
        SpringSupport support = new SpringSupport();
        Lifecycle lifecycle = null;

        support.getBean("ConfigurationContext", ConfigurationFactory.class).configure(args);
        lifecycle = support.getBean("LifeCycle", Lifecycle.class);

        lifecycle.start();
        lifecycle.stop();
    }
View Full Code Here

Examples of org.switchyard.deploy.Lifecycle

        getGatewayLifecycle().stop();
    }

    @Override
    public State getState() {
        final Lifecycle lifecycle = getGatewayLifecycle();
        return lifecycle == null ? State.NONE : lifecycle.getState();
    }
View Full Code Here

Examples of org.tmatesoft.hg.internal.Lifecycle

   */
  public void inspectChangelog(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      internalInspectChangelog(da, inspector);
    } catch (IOException ex) {
View Full Code Here

Examples of org.tmatesoft.hg.internal.Lifecycle

   */
  public void inspectManifest(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      if (da.isEmpty()) {
        return;
View Full Code Here

Examples of org.tmatesoft.hg.internal.Lifecycle

   */
  public void inspectFiles(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      if (da.isEmpty()) {
        return;
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.