private void setPositions() {
    int numOfPositions = rng.nextInt(MAX_NUM_OF_POSITIONS);
    if (numOfPositions == 0) {
      numOfPositions++;
    }

    int secId = rng.nextInt(NUM_OF_SECURITIES);

    for (int i = 0; i < numOfPositions; i++) {
      Properties props = getProps();

      // secId needs to be UNIQUE in one portfolio, keep track MAX_NUM_OF_POSITIONS and
      // NUM_OF_SECURITIES
      secId += i * 7;
      if (secId > NUM_OF_SECURITIES) {
        secId -= NUM_OF_SECURITIES;
      }
      props.setProperty("secId", Integer.toString(secId));

      Position pos = new Position();
      pos.initialize(null, props);
      positions.put(pos.getSecId(), pos);
    }
  }
A version of the Portfolio Object used for query.
geode-junit/src/main/java/parReg/query/unittest/NewPortfolio.java