public WorkflowSummary createWorkflowSummaryFromInstance(WorkflowInstance instance) {
    WorkflowSummary summary = new WorkflowSummary();
    summary.setWorkflowId(instance.getWorkflowId());
    summary.setInternalId(instance.getInternalId());
    summary.setWorkflowVersionId(instance.getWorkflowVersionId());
    summary.setWorkflowName(getWorkflowNameOrDefault(instance.getRuntimeWorkflow()));
    summary.setWorkflowInstanceId(instance.getWorkflowInstanceId());
    summary.setCreationTime(instance.getCreateTime());
    summary.setWorkflowRunId(instance.getWorkflowRunId());
    summary.setCorrelationId(instance.getCorrelationId());
    summary.setWorkflowUuid(instance.getWorkflowUuid());
    if (instance.getRunConfig() != null) {
      summary.setRunPolicy(instance.getRunConfig().getPolicy());
      summary.setRestartConfig(instance.getRunConfig().getRestartConfig());
    }
    summary.setRunProperties(instance.getRunProperties());
    summary.setInitiator(instance.getInitiator());
    summary.setParams(instance.getParams());
    summary.setStepRunParams(instance.getStepRunParams());
    summary.setTags(instance.getRuntimeWorkflow().getTags());
    summary.setRuntimeDag(instance.getRuntimeDag());
    summary.setCriticality(instance.getRuntimeWorkflow().getCriticality());
    summary.setInstanceStepConcurrency(instance.getRuntimeWorkflow().getInstanceStepConcurrency());
    return summary;
  }
@Test
  public void testCreateWorkflowSummaryFromInstanceWithInstanceStepConcurrency() {
    WorkflowSummary summary = workflowHelper.createWorkflowSummaryFromInstance(instance);
    assertEquals(instance.getWorkflowId(), summary.getWorkflowId());
    assertEquals(instance.getWorkflowVersionId(), summary.getWorkflowVersionId());
    assertEquals(instance.getCreateTime(), summary.getCreationTime());
    assertEquals(instance.getInternalId(), summary.getInternalId());
    assertNull(summary.getInstanceStepConcurrency());

    instance.getRunProperties().setStepConcurrency(10L);
    summary = workflowHelper.createWorkflowSummaryFromInstance(instance);
    assertNull(summary.getInstanceStepConcurrency());

    // use runtime workflow instance_step_concurrency
    instance.setRuntimeWorkflow(
        instance.getRuntimeWorkflow().toBuilder().instanceStepConcurrency(20L).build());
    summary = workflowHelper.createWorkflowSummaryFromInstance(instance);
    assertEquals(20L, summary.getInstanceStepConcurrency().longValue());
  }