Пример #1
0
  private void createTransactions(AbstractTransactionNeo4jGraph graph) {
    long batches = tranCnt / batchSize;
    long left = tranCnt % batchSize;

    if (left != 0) {
      batches++;
    }

    for (long i = 0; i < batches; i++) {
      List<TransactionEntity> transactions = new ArrayList<TransactionEntity>();
      long realTransInBatch = batchSize;
      if (i == batches - 1 && left != 0) {
        realTransInBatch = left;
      }
      for (int j = 0; j < realTransInBatch; j++) {
        transactions.add(createRandomTransaction());
      }
      graph.addTransactions(transactions);
    }
  }
Пример #2
0
  private void createAccounts(AbstractTransactionNeo4jGraph graph) {
    long acctNum = baseAcctNum;

    long batches = nodeCnt / batchSize;
    long left = nodeCnt % batchSize;
    if (left != 0) {
      batches++;
    }

    for (long i = 0; i < batches; i++) {
      List<Long> batchAccouts = new ArrayList<Long>();
      long realAccountsInBatch = batchSize;
      if (i == batches - 1 && left != 0) {
        realAccountsInBatch = left;
      }
      for (int j = 0; j < realAccountsInBatch; j++) {
        batchAccouts.add(acctNum);
        acctNum++;
      }
      graph.addAccounts(batchAccouts);
    }
  }