Package org.cyclop.service.importer.model

Examples of org.cyclop.service.importer.model.ImportStats


    LOG.debug("Executing import");
    execImport(scanner, resultWriter, status, config);

    timer.stop();
    ImportStats stats = new ImportStats(timer, status.success.get(), status.error.get());

    LOG.debug("Import done: {}", stats);
    return stats;
  }
View Full Code Here


    LOG.debug("Importing file of {} bytes", fileContentBytes.length);

    ImportResultWriter result = new ImportResultWriter();

    ImportConfig config = createImportConfig(importOptions);
    ImportStats stats = getImporter(importOptions).importScript(new ByteArrayInputStream(fileContentBytes), result,
        config);

    resultModel.setObject(result.getResult());

    String resp = createStatsMessage(stats);
View Full Code Here

  @Test
  public void testBreakAfterError() throws Exception {

    try (InputStream fio = getClass().getResourceAsStream("/cql/testImportOrdered.cql")) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = importer.importScript(fio, rc, new ImportConfig().withContinueWithErrors(false)
          .withUpdateHistory(true));

      assertEquals(rc.toString(), 3, rc.size());
      assertEquals(rc.toString(), 1, rc.error.size());
      assertEquals(rc.toString(), 2, rc.success.size());
View Full Code Here

  @Test
  public void testImportOrdered() throws Exception {
    try (InputStream fio = getClass().getResourceAsStream("/cql/testImportOrdered.cql")) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = importer.importScript(fio, rc, new ImportConfig().withContinueWithErrors(true)
          .withUpdateHistory(true));

      assertTrue(rc.toString(), rc.success.contains(new CqlQuery(CqlQueryType.UNKNOWN, "USE CqlDemo")));
      assertTrue(
          rc.toString(),
View Full Code Here

  @Test
  public void testImportOneQueryPerLine() throws Exception {
    try (InputStream fio = getClass().getResourceAsStream("/cql/createDemoData.cql")) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = getImporter().importScript(fio, rc,
          new ImportConfig().withContinueWithErrors(true).withUpdateHistory(true));
      assertEquals(rc.toString(), 6, rc.size());
      assertEquals(rc.error.toString(), 0, rc.error.size());
      assertEquals(rc.toString(), 6, rc.success.size());
      assertEquals(rc.toString(), 0, stats.errorCount);
View Full Code Here

        "select title from cqldemo.mybooks where id=644556a9-651b-45b3-bd01-cc807c64bd4f");
    assertFalse(queryService.execute(testCql).iterator().hasNext());

    try (InputStream fio = getClass().getResourceAsStream("/cql/testImportLineBreaks.cql")) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = getImporter().importScript(fio, rc,
          new ImportConfig().withContinueWithErrors(true).withUpdateHistory(true));
      assertEquals(7, rc.size());
      assertEquals(rc.error.toString(), 0, rc.error.size());
      assertEquals(7, rc.success.size());
      assertEquals(0, stats.errorCount);
View Full Code Here

  private void execImport(int scrNr, int amountError, long counterValue) throws Exception {
    String script = "/cql/testImportOneCol_" + scrNr + ".cql";
    try (InputStream fio = getClass().getResourceAsStream(script)) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = getImporter().importScript(fio, rc,
          new ImportConfig().withContinueWithErrors(true).withUpdateHistory(true));

      assertEquals(script + "- " + rc, amountError, rc.error.size());
      assertEquals(script + "- " + rc, scrNr - amountError, rc.success.size());
      assertEquals(script + "- " + rc, scrNr, rc.size());
View Full Code Here

  @Test
  public void testBreakAfterError() throws Exception {

    try (InputStream fio = getClass().getResourceAsStream("/cql/testImportOrdered.cql")) {
      ResultConsumer rc = new ResultConsumer();
      ImportStats stats = importer.importScript(fio, rc, new ImportConfig().withContinueWithErrors(false)
          .withUpdateHistory(true));

      assertTrue(rc.toString(), rc.size() < 100);
      assertTrue(rc.toString(), rc.error.size() < 4);
      assertTrue(rc.toString(), rc.success.size() < 100);
View Full Code Here

TOP

Related Classes of org.cyclop.service.importer.model.ImportStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.