public void testHasPendingLaborLedgerEntryWithAccount() throws Exception {
    String testTarget = "hasPendingLaborLedgerEntryWithAccount";
    int numberOfTestData = Integer.valueOf(properties.getProperty(testTarget + ".numOfData"));
    String accountFieldNames = properties.getProperty(testTarget + ".accountFieldNames");

    // prepare test data -- put the test data into data store
    String prefixForInput = testTarget + ".testData";
    List<LaborLedgerPendingEntry> inputDataList =
        TestDataPreparator.buildTestDataList(
            LaborLedgerPendingEntry.class, properties, prefixForInput, numberOfTestData);
    businessObjectService.save(inputDataList);

    // test primary scenarios -- everything is correct and the expected results can be retrieved
    String prefixForValidAccount = testTarget + ".accountWithResults";
    int numOfValidAccounts =
        Integer.valueOf(properties.getProperty(prefixForValidAccount + ".numOfData"));
    List<Account> validAccounts =
        TestDataPreparator.buildTestDataList(
            Account.class,
            properties,
            prefixForValidAccount,
            accountFieldNames,
            deliminator,
            numOfValidAccounts);
    for (Account account : validAccounts) {
      assertTrue(
          "At least one record can be found.",
          laborLedgerPendingEntryService.hasPendingLaborLedgerEntry(
              account.getChartOfAccountsCode(), account.getAccountNumber()));
    }

    // test secondary scenarios -- the input is not correct and nothing can be returned
    String prefixForInvalidAccount = testTarget + ".accountWithoutResults";
    int numOfInvalidAccounts =
        Integer.valueOf(properties.getProperty(prefixForInvalidAccount + ".numOfData"));
    List<Account> invalidAccounts =
        TestDataPreparator.buildTestDataList(
            Account.class,
            properties,
            prefixForInvalidAccount,
            accountFieldNames,
            deliminator,
            numOfInvalidAccounts);
    for (Account account : invalidAccounts) {
      assertFalse(
          "Must not find anything.",
          laborLedgerPendingEntryService.hasPendingLaborLedgerEntry(
              account.getChartOfAccountsCode(), account.getAccountNumber()));
    }
  }
  @Override
  public void setUp() throws Exception {
    super.setUp();

    String messageFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/message.properties";
    String propertiesFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME
            + "/laborGLLedgerEntryPoster.properties";

    properties = TestDataPreparator.loadPropertiesFromClassPath(propertiesFileName);

    fieldNames = properties.getProperty("fieldNames");
    deliminator = properties.getProperty("deliminator");
    keyFieldList = Arrays.asList(StringUtils.split(fieldNames, deliminator));

    laborGLLedgerEntryPoster =
        SpringContext.getBean(PostTransaction.class, "laborGLLedgerEntryPoster");
    businessObjectService = SpringContext.getBean(BusinessObjectService.class);
    originEntryGroupService = SpringContext.getBean(LaborOriginEntryGroupService.class);
    laborGeneralLedgerEntryService = SpringContext.getBean(LaborGeneralLedgerEntryService.class);
    DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);

    // TODO:- commented out
    // group1 = originEntryGroupService.createGroup(dateTimeService.getCurrentSqlDate(),
    // LABOR_MAIN_POSTER_VALID, false, false, false);
    today = dateTimeService.getCurrentDate();

    LaborGeneralLedgerEntry cleanup = new LaborGeneralLedgerEntry();
    ObjectUtil.populateBusinessObject(cleanup, properties, "dataCleanup", fieldNames, deliminator);
    fieldValues =
        ObjectUtil.buildPropertyMap(
            cleanup, Arrays.asList(StringUtils.split(fieldNames, deliminator)));
    businessObjectService.deleteMatching(LaborGeneralLedgerEntry.class, fieldValues);
  }
  @Override
  public void setUp() throws Exception {
    super.setUp();
    String messageFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/message.properties";
    String propertiesFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME
            + "/laborPosterTransactionValidator.properties";

    properties = TestDataPreparator.loadPropertiesFromClassPath(propertiesFileName);

    fieldNames = properties.getProperty("fieldNames");
    deliminator = properties.getProperty("deliminator");

    laborPosterTransactionValidator =
        SpringContext.getBean(VerifyTransaction.class, "laborPosterTransactionValidator");
    laborOriginEntryService = SpringContext.getBean(LaborOriginEntryService.class);
    originEntryGroupService = SpringContext.getBean(LaborOriginEntryGroupService.class);
    businessObjectService = SpringContext.getBean(BusinessObjectService.class);
    persistenceService = SpringContext.getBean(PersistenceService.class);

    Date today = (SpringContext.getBean(DateTimeService.class)).getCurrentSqlDate();
    // TODO:- commented out
    // group1 = originEntryGroupService.createGroup(today, LABOR_MAIN_POSTER_VALID, true, true,
    // false);
  }
  @Override
  public void setUp() throws Exception {
    super.setUp();

    laborLedgerPendingEntryService = SpringContext.getBean(LaborLedgerPendingEntryService.class);
    businessObjectService = SpringContext.getBean(BusinessObjectService.class);

    fieldValues =
        TestDataPreparator.buildCleanupCriteria(
            LaborLedgerPendingEntry.class, properties, "dataCleanup");
    businessObjectService.deleteMatching(LaborLedgerPendingEntry.class, fieldValues);
  }
  public LaborLedgerPendingEntryServiceTest() {
    super();
    String messageFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/message.properties";
    String propertiesFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME
            + "/laborLedgerPendingEntryService.properties";

    properties = TestDataPreparator.loadPropertiesFromClassPath(propertiesFileName);

    fieldNames = properties.getProperty("fieldNames");
    deliminator = properties.getProperty("deliminator");
    keyFieldList = Arrays.asList(StringUtils.split(fieldNames, deliminator));
  }
示例#6
0
  public TestDataLoader() {
    String messageFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/message.properties";
    String propertiesFileName =
        LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/laborTransaction.properties";

    properties = TestDataPreparator.loadPropertiesFromClassPath(propertiesFileName);

    fieldNames = properties.getProperty("fieldNames");
    fieldLength = properties.getProperty("fieldLength");
    deliminator = properties.getProperty("deliminator");

    Log4jConfigurer.configureLogging(false);

    SpringContextForBatchRunner.initializeKfs();
    keyFieldList = Arrays.asList(StringUtils.split(fieldNames, deliminator));
    fieldLengthList = Arrays.asList(StringUtils.split(fieldLength, deliminator));
    businessObjectService = SpringContext.getBean(BusinessObjectService.class);

    laborOriginEntryService = SpringContext.getBean(LaborOriginEntryService.class);
  }