Пример #1
0
  @Test(
      groups = {"load", "invoice_line"},
      dataProvider = "generalConfigurationLoader",
      dataProviderClass = LoaderDataProvider.class)
  public void shouldFailDueToFileMissing(Map<String, String> gc) {
    Process p;

    try {
      Base.open(getDataSource());

      p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0);

      Parameter param =
          (Parameter)
              Parameter.where(
                      "module = ? and object = ? and pkey = ?",
                      "ARC",
                      "INVOICE_LINE_LOAD_PROCESS",
                      "FILENAME")
                  .get(0);
      param.set("pvalue", "fileNotFound.txt");
      parameterService.updateParameter(param);
    } finally {
      Base.close();
    }

    invoiceLineLoader.load(p, gc);

    Assert.assertEquals(p.get("status"), "FNF");
  }
Пример #2
0
  @Test(groups = {"load", "invoice_line"})
  public void shouldFailDueToIncorrectConfiguration() {
    Process p;

    try {
      Base.open(getDataSource());

      p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0);

      Parameter param =
          (Parameter)
              Parameter.where(
                      "module = ? and object = ? and pkey = ?",
                      "ARC",
                      "INVOICE_LINE_LOAD_PROCESS",
                      "FILENAME")
                  .get(0);
      param.set("pvalue", "");
      parameterService.updateParameter(param);
    } finally {
      Base.close();
    }

    invoiceLineLoader.load(p, null);

    Assert.assertEquals(p.get("status"), "ERROR");
  }
Пример #3
0
  @Test(groups = {"load", "invoice_line"})
  public void shouldFailDueToGeneralConfigurationMissing() {
    Process p = getProcess("INVOICE_LINE_LOAD_PROCESS");

    invoiceLineLoader.load(p, null);

    Assert.assertEquals(p.get("status"), "ERROR");
  }
Пример #4
0
  @Test(
      groups = {"load", "invoice_line"},
      dataProvider = "incorrectGeneralConfigurationLoader",
      dataProviderClass = LoaderDataProvider.class)
  public void shouldFailDueToIncorrectGeneralConfiguration(Map<String, String> gc) {
    Process p = getProcess("INVOICE_LINE_LOAD_PROCESS");

    invoiceLineLoader.load(p, gc);

    Assert.assertEquals(p.get("status"), "ERROR");
  }
Пример #5
0
  @Test(
      groups = {"load", "invoice_line"},
      dataProvider = "generalConfigurationLoader",
      dataProviderClass = LoaderDataProvider.class)
  public void shouldLoadInvoiceLinesFile(Map<String, String> gc) {
    Process p = getProcess("INVOICE_LINE_LOAD_PROCESS");

    invoiceLineLoader.load(p, gc);

    try {
      Base.open(getDataSource());

      Assert.assertEquals(p.get("status"), "SUCCESS");
      Assert.assertEquals(InvoiceLine.count().longValue(), 23L);

    } finally {
      Base.close();
    }
  }
Пример #6
0
  @Test(
      groups = {"load", "invoice_line"},
      dataProvider = "generalConfigurationLoader",
      dataProviderClass = LoaderDataProvider.class)
  public void shouldFailDueToConfigurationMissing(Map<String, String> gc) {
    Process p;

    try {
      Base.open(getDataSource());

      p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0);

      parameterService.deleteParameter(13L);

    } finally {
      Base.close();
    }

    invoiceLineLoader.load(p, gc);

    Assert.assertEquals(p.get("status"), "ERROR");
  }