Examples of TokenContext


Examples of org.openbp.server.context.TokenContext

  public int checkNumberOfContexts(String stepName, int expected)
  {
    int n = 0;
    for (Iterator it = CollectionUtil.iterator(processFacade.getTokens(null, 0)); it.hasNext();)
    {
      TokenContext token = (TokenContext) it.next();
      if (token.getCurrentSocket() == null)
      {
        errOut("Test context check " + stepName + ": Socket of context " + token + " is null.");
      }
      ++n;
    }
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    // Start 3 processes that consist of a signal wait activity only
    // and make them wait for the signal id "Sync".
    ArrayList contextList = new ArrayList();
    for (int i = 0; i < NUM_THREADS; ++i)
    {
      TokenContext tc = startSimpleSignalWaitProcess("Sync" + i, 0);
      contextList.add(tc);
    }

    // Thread pool capacity is 2, so the executor should pick exactly 2 processes for execution.
    int n = getProcessFacade().executePendingContextsInDifferentThread();
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    // Start 3 processes that consist of a signal wait activity only
    // and make them wait for the signal id "Sync".
    final ArrayList contextList = new ArrayList();
    for (int i = 0; i < NUM_THREADS; ++i)
    {
      TokenContext tc = startSimpleSignalWaitProcess("Signal" + i, 0);
      contextList.add(tc);
    }

    // In 3 seconds, we will send the signal to the processes
    new Thread()
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    startSimpleSignalSetProcess("Sync2", "Sig 2", 1);
    startSimpleSignalSetProcess("Sync3", "Sig 3", 3);

    Iterator it = getProcessServer().getTokenContextService().getExecutableContexts(10);

    TokenContext tc;

    tc = (TokenContext) it.next();
    getProcessFacade().executeContextInThisThread(tc);
    assertEquals(TestCaseSyncMgr.getInstance().getSignal(tc, "Sync2"), "Sig 2");
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    String localHost = new DefaultSystemNameProvider().getSystemName();
    TokenContextService tokenContextService = getProcessServer().getTokenContextService();

    // Create all kinds of contexts and simulate several states

    TokenContext tc1 = startSimpleSignalSetProcess("TestSignal1", "Done", 0);
    tc1.setLifecycleState(LifecycleState.SELECTED);
    tc1.setLifecycleRequest(LifecycleRequest.NONE);
    tc1.setNodeId(localHost);
    tokenContextService.saveContext(tc1);

    TokenContext tc2 = startSimpleSignalSetProcess("TestSignal2", "Done", 0);
    tc2.setLifecycleState(LifecycleState.SELECTED);
    tc2.setLifecycleRequest(LifecycleRequest.NONE);
    tc2.setNodeId("DifferentHost");
    tokenContextService.saveContext(tc2);

    TokenContext tc3 = startSimpleSignalSetProcess("TestSignal3", "Done", 0);
    tc3.setLifecycleState(LifecycleState.RUNNING);
    tc3.setLifecycleRequest(LifecycleRequest.NONE);
    tc3.setNodeId(localHost);
    tokenContextService.saveContext(tc3);

    TokenContext tc4 = startSimpleSignalSetProcess("TestSignal4", "Done", 0);
    tc4.setLifecycleState(LifecycleState.ERROR);
    tc4.setLifecycleRequest(LifecycleRequest.NONE);
    tc4.setNodeId(localHost);
    tokenContextService.saveContext(tc4);

    TokenContext tc5 = startSimpleSignalSetProcess("TestSignal5", "Done", 0);
    tokenContextService.saveContext(tc5);

    getProcessServer().getEngine().commit();

    // Execute those that can be executed
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    for (int i = 0; i < historicContextData.length; ++i)
    {
      try
      {
        tokenId = startToken();
        TokenContext token = getProcessFacade().getTokenById(tokenId);

        String base64ContextData = historicContextData[i].getBase64ContextData();
        byte[] contextData = Base64.decode(base64ContextData);
        token.setContextData(contextData);

        ((PersistentTokenContextService) getProcessServer().getTokenContextService()).postProcessContextAfterLoad(token);

        resumeToken(tokenId);
      }
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    }
  }

  private Object startToken()
  {
    TokenContext token = createToken();

    getProcessFacade().startToken(token, "/TestCase/SubProcessTest.Start", null);
    Object tokenId = token.getId();

    getProcessFacade().executePendingContextsInThisThread();

    return tokenId;
  }
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    return tokenId;
  }

  private void resumeToken(Object tokenId)
  {
    TokenContext token = getProcessFacade().getTokenById(tokenId);
    getProcessFacade().resumeToken(token, "Resumption", null);

    getProcessFacade().executePendingContextsInThisThread();
  }
View Full Code Here

Examples of org.openbp.server.context.TokenContext

    getProcessFacade().executePendingContextsInThisThread();
  }

  private void printToken(Object tokenId)
  {
    TokenContext token = getProcessFacade().getTokenById(tokenId);

    byte[] data = token.getContextData();

        String base64Data = Base64.encodeBytes(data, Base64.DONT_BREAK_LINES);

        byte[] encodedData = Base64.decode(base64Data);
View Full Code Here

Examples of org.openbp.server.context.TokenContext

  /**
   * Destroys context, i\.\e. removes it from its parent context.
   */
  public void destroy()
  {
    TokenContext parent = getParentContext();
    if (parent != null)
    {
      parent.removeChildContext(this);
      parentContext = null;
    }
  }
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.