@Override
  public void newChunk(final Item item) {
    Assert.assertNull("currentAggregatedItem shall be null at this point", currentAggregatedItem);
    Assert.assertNotNull("processorCtx shall be set at this point", processorCtx);
    Assert.assertNotNull(
        "processorCtx transaction shall be set at this point", processorCtx.getTrx());
    assertThreadInheritedTrxSet();

    final String groupKey = item.getGroupKey();
    if (errorOnNewChunkGroupKeys.contains(groupKey)) {
      throw new RuntimeException("Test exception on newChunk for group: " + groupKey);
    }
    currentAggregatedItem = new AggregatedItem(groupKey, processorCtx.getTrx().getTrxName());
  }
Example #2
0
  @Override
  public void process(final I_C_OLCand olCand) throws Exception {
    if (olCand.isProcessed()) {
      result.incSkipped();
      return;
    }

    final IParams params = processorCtx.getParams();
    Check.errorIf(params == null, "Given processorCtx {0} needs to contain params", processorCtx);

    // Partner
    final int bpartnerId = params.getParameterAsInt(I_C_OLCand.COLUMNNAME_C_BPartner_Override_ID);
    olCand.setC_BPartner_Override_ID(bpartnerId);

    // Location
    final int bpartnerLocationId =
        params.getParameterAsInt(I_C_OLCand.COLUMNNAME_C_BP_Location_Override_ID);
    olCand.setC_BP_Location_Override_ID(bpartnerLocationId);

    // DatePrommissed
    final Timestamp datePromissed =
        params.getParameterAsTimestamp(I_C_OLCand.COLUMNNAME_DatePromised_Override);
    olCand.setDatePromised_Override(datePromissed);

    InterfaceWrapperHelper.save(olCand);
    result.incUpdated();
  }
  private void assertThreadInheritedTrxSet() {
    final String trxName = trxManager.getThreadInheritedTrxName();
    Assert.assertTrue(
        "Thread inherited transaction shall be set at this point", !trxManager.isNull(trxName));

    Assert.assertEquals(
        "Thread inherited transaction shall match context transaction",
        processorCtx.getTrxName(),
        trxName);

    if (expectTrxSavepoints != null) {
      final PlainTrx trx = (PlainTrx) processorCtx.getTrx();
      Assert.assertEquals(
          "Active savepoints for " + trx, expectTrxSavepoints, trx.hasActiveSavepoints());
    }
  }